mirror of https://github.com/usbharu/Hideout.git
feat: 動的に生成できるように
This commit is contained in:
parent
253e25e51d
commit
124dcd6050
|
@ -0,0 +1,18 @@
|
|||
package dev.usbharu.hideout.activitypub.config
|
||||
|
||||
import dev.usbharu.hideout.activitypub.application.hostmeta.Link
|
||||
import dev.usbharu.hideout.core.config.ApplicationConfig
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@Configuration
|
||||
class WebFingerHostMetaLinkConfiguration(private val applicationConfig: ApplicationConfig) {
|
||||
@Bean
|
||||
fun webFingerHostMetaLink(): Link {
|
||||
return Link(
|
||||
rel = "lrdd",
|
||||
type = "application/jrd+json",
|
||||
template = applicationConfig.url.resolve(".well-known/webfinger").toString() + "?resource={uri}"
|
||||
)
|
||||
}
|
||||
}
|
|
@ -11,22 +11,22 @@ import org.springframework.web.bind.annotation.RestController
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/.well-known")
|
||||
class HostmetaController {
|
||||
class HostmetaController(private val linkList: List<Link> = emptyList()) {
|
||||
@Order(1)
|
||||
@GetMapping("/host-meta")
|
||||
fun hostmeta(): ResponseEntity<WebHostMetadata> {
|
||||
return ResponseEntity.ok().contentType(MediaType("application", "xrd+xml"))
|
||||
.body(WebHostMetadata(listOf(Link("a", "b", "c"))))
|
||||
.body(WebHostMetadata(linkList))
|
||||
}
|
||||
|
||||
@Order(2)
|
||||
@GetMapping("/host-meta", produces = ["application/json"])
|
||||
fun hostmetaJson(): WebHostMetadata {
|
||||
return WebHostMetadata(listOf(Link("a", "b", "c")))
|
||||
return WebHostMetadata(linkList)
|
||||
}
|
||||
|
||||
@GetMapping("/host-meta.json", produces = ["application/json"])
|
||||
fun hostmetaJson2(): WebHostMetadata {
|
||||
return WebHostMetadata(listOf(Link("a", "b", "c")))
|
||||
return WebHostMetadata(linkList)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue