diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/instance/InstanceService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/instance/InstanceService.kt index c41a6d8c..a9a84f3d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/service/instance/InstanceService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/instance/InstanceService.kt @@ -50,36 +50,17 @@ class InstanceServiceImpl( } logger.info("Instance not found. try fetch instance info. url: {}", resolveInstanceUrl) - + @Suppress("TooGenericExceptionCaught") try { - - val nodeinfoJson = resourceResolveService.resolve("$resolveInstanceUrl/.well-known/nodeinfo").bodyAsText() val nodeinfo = objectMapper.readValue(nodeinfoJson, Nodeinfo::class.java) val nodeinfoPathMap = nodeinfo.links.associate { it.rel to it.href } for ((key, value) in nodeinfoPathMap) { when (key) { - "http://nodeinfo.diaspora.software/ns/schema/2.0" -> { - val nodeinfo20 = objectMapper.readValue( - resourceResolveService.resolve(value!!).bodyAsText(), - Nodeinfo2_0::class.java - ) - - val instanceCreateDto = InstanceCreateDto( - name = nodeinfo20.metadata?.nodeName, - description = nodeinfo20.metadata?.nodeDescription, - url = resolveInstanceUrl, - iconUrl = "$resolveInstanceUrl/favicon.ico", - sharedInbox = sharedInbox, - software = nodeinfo20.software?.name, - version = nodeinfo20.software?.version - ) - return createNewInstance(instanceCreateDto) - } - - // TODO: 多分2.0と2.1で互換性有るのでそのまま使うけどなおす - "http://nodeinfo.diaspora.software/ns/schema/2.1" -> { + "http://nodeinfo.diaspora.software/ns/schema/2.0", + "http://nodeinfo.diaspora.software/ns/schema/2.1", + -> { val nodeinfo20 = objectMapper.readValue( resourceResolveService.resolve(value!!).bodyAsText(), Nodeinfo2_0::class.java @@ -102,8 +83,6 @@ class InstanceServiceImpl( } } } - - } catch (e: Exception) { logger.warn("FAILED Fetch Instance", e) } diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/config/MastodonApiSecurityConfig.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/config/MastodonApiSecurityConfig.kt index ffb8d734..39ec70fb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/config/MastodonApiSecurityConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/config/MastodonApiSecurityConfig.kt @@ -31,6 +31,7 @@ import org.springframework.security.web.SecurityFilterChain class MastodonApiSecurityConfig { @Bean @Order(4) + @Suppress("LongMethod") fun mastodonApiSecurityFilterChain( http: HttpSecurity, rf: RoleHierarchyAuthorizationManagerFactory,