mirror of https://github.com/usbharu/Hideout.git
feat: /.well-known/nodeinfoを作成
This commit is contained in:
parent
ac5dee2551
commit
4be93fea86
|
@ -0,0 +1,3 @@
|
|||
package dev.usbharu.hideout.activitypub.application.nodeinfo
|
||||
|
||||
data class Nodeinfo2_0()
|
|
@ -24,6 +24,7 @@ class ActivityPubSecurityConfig {
|
|||
)
|
||||
authorizeHttpRequests {
|
||||
authorize(GET, "/.well-known/**", permitAll)
|
||||
authorize(GET, "/nodeinfo/**", permitAll)
|
||||
authorize(GET, "/error", permitAll)
|
||||
authorize(POST, "/inbox", permitAll)
|
||||
authorize(POST, "/users/{username}/inbox", permitAll)
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package dev.usbharu.hideout.activitypub.interfaces.wellknown
|
||||
|
||||
import dev.usbharu.hideout.core.config.ApplicationConfig
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/.well-known")
|
||||
class NodeinfoController(private val applicationConfig: ApplicationConfig) {
|
||||
@GetMapping("/nodeinfo", produces = ["application/json"])
|
||||
suspend fun nodeinfo(): XRD = XRD(
|
||||
listOf(
|
||||
Link(
|
||||
"http://nodeinfo.diaspora.software/ns/schema/2.1",
|
||||
href = applicationConfig.url.resolve("/nodeinfo/2.1").toString()
|
||||
), Link(
|
||||
"http://nodeinfo.diaspora.software/ns/schema/2.0",
|
||||
href = applicationConfig.url.resolve("/nodeinfo/2.0").toString()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
|
@ -24,8 +24,9 @@ data class XRD(
|
|||
data class Link(
|
||||
@JacksonXmlProperty(localName = "rel", isAttribute = true) val rel: String,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JacksonXmlProperty(localName = "template", isAttribute = true) val template: String?,
|
||||
@JacksonXmlProperty(localName = "type", isAttribute = true) val type: String,
|
||||
@JacksonXmlProperty(localName = "template", isAttribute = true) val template: String? = null,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JacksonXmlProperty(localName = "href", isAttribute = true) val href: String?,
|
||||
@JacksonXmlProperty(localName = "type", isAttribute = true) val type: String? = null,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JacksonXmlProperty(localName = "href", isAttribute = true) val href: String? = null,
|
||||
)
|
||||
|
|
|
@ -90,7 +90,7 @@ class SecurityConfig {
|
|||
authorize("/error", permitAll)
|
||||
authorize("/auth/sign_in", permitAll)
|
||||
authorize(GET, "/.well-known/**", permitAll)
|
||||
authorize(GET, "/nodeinfo/2.0", permitAll)
|
||||
authorize(GET, "/nodeinfo/**", permitAll)
|
||||
|
||||
authorize(GET, "/auth/sign_up", hasRole("ANONYMOUS"))
|
||||
authorize(POST, "/auth/sign_up", permitAll)
|
||||
|
|
Loading…
Reference in New Issue