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)
|
logger.info("Instance not found. try fetch instance info. url: {}", resolveInstanceUrl)
|
||||||
|
@Suppress("TooGenericExceptionCaught")
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
val nodeinfoJson = resourceResolveService.resolve("$resolveInstanceUrl/.well-known/nodeinfo").bodyAsText()
|
val nodeinfoJson = resourceResolveService.resolve("$resolveInstanceUrl/.well-known/nodeinfo").bodyAsText()
|
||||||
val nodeinfo = objectMapper.readValue(nodeinfoJson, Nodeinfo::class.java)
|
val nodeinfo = objectMapper.readValue(nodeinfoJson, Nodeinfo::class.java)
|
||||||
val nodeinfoPathMap = nodeinfo.links.associate { it.rel to it.href }
|
val nodeinfoPathMap = nodeinfo.links.associate { it.rel to it.href }
|
||||||
|
|
||||||
for ((key, value) in nodeinfoPathMap) {
|
for ((key, value) in nodeinfoPathMap) {
|
||||||
when (key) {
|
when (key) {
|
||||||
"http://nodeinfo.diaspora.software/ns/schema/2.0" -> {
|
"http://nodeinfo.diaspora.software/ns/schema/2.0",
|
||||||
val nodeinfo20 = objectMapper.readValue(
|
"http://nodeinfo.diaspora.software/ns/schema/2.1",
|
||||||
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" -> {
|
|
||||||
val nodeinfo20 = objectMapper.readValue(
|
val nodeinfo20 = objectMapper.readValue(
|
||||||
resourceResolveService.resolve(value!!).bodyAsText(),
|
resourceResolveService.resolve(value!!).bodyAsText(),
|
||||||
Nodeinfo2_0::class.java
|
Nodeinfo2_0::class.java
|
||||||
|
@ -102,8 +83,6 @@ class InstanceServiceImpl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn("FAILED Fetch Instance", e)
|
logger.warn("FAILED Fetch Instance", e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.springframework.security.web.SecurityFilterChain
|
||||||
class MastodonApiSecurityConfig {
|
class MastodonApiSecurityConfig {
|
||||||
@Bean
|
@Bean
|
||||||
@Order(4)
|
@Order(4)
|
||||||
|
@Suppress("LongMethod")
|
||||||
fun mastodonApiSecurityFilterChain(
|
fun mastodonApiSecurityFilterChain(
|
||||||
http: HttpSecurity,
|
http: HttpSecurity,
|
||||||
rf: RoleHierarchyAuthorizationManagerFactory,
|
rf: RoleHierarchyAuthorizationManagerFactory,
|
||||||
|
|
Loading…
Reference in New Issue