mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
4f084a375b
commit
dc323f7d25
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.springframework.security.web.SecurityFilterChain
|
|||
class MastodonApiSecurityConfig {
|
||||
@Bean
|
||||
@Order(4)
|
||||
@Suppress("LongMethod")
|
||||
fun mastodonApiSecurityFilterChain(
|
||||
http: HttpSecurity,
|
||||
rf: RoleHierarchyAuthorizationManagerFactory,
|
||||
|
|
Loading…
Reference in New Issue