mirror of https://github.com/usbharu/Hideout.git
style: fix lint (CI)
This commit is contained in:
parent
27cf8227ea
commit
5e5bbe756b
|
@ -8,7 +8,6 @@ import org.springframework.http.HttpMethod.POST
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||||
import org.springframework.security.config.annotation.web.invoke
|
import org.springframework.security.config.annotation.web.invoke
|
||||||
import org.springframework.security.web.SecurityFilterChain
|
import org.springframework.security.web.SecurityFilterChain
|
||||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher
|
|
||||||
import org.springframework.security.web.util.matcher.RequestMatcher
|
import org.springframework.security.web.util.matcher.RequestMatcher
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ -17,10 +16,12 @@ class ActivityPubSecurityConfig {
|
||||||
@Order(4)
|
@Order(4)
|
||||||
fun activityPubSecurityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
fun activityPubSecurityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
||||||
http {
|
http {
|
||||||
securityMatcher(RequestMatcher {
|
securityMatcher(
|
||||||
|
RequestMatcher {
|
||||||
val accept = it.getHeader("Accept") ?: ""
|
val accept = it.getHeader("Accept") ?: ""
|
||||||
return@RequestMatcher accept == "application/json" || accept == "application/activity+json"
|
return@RequestMatcher accept == "application/json" || accept == "application/activity+json"
|
||||||
})
|
}
|
||||||
|
)
|
||||||
authorizeHttpRequests {
|
authorizeHttpRequests {
|
||||||
authorize(POST, "/inbox", permitAll)
|
authorize(POST, "/inbox", permitAll)
|
||||||
authorize(POST, "/users/{username}/inbox", permitAll)
|
authorize(POST, "/users/{username}/inbox", permitAll)
|
||||||
|
|
|
@ -10,6 +10,4 @@ class Task<out T : TaskBody>(
|
||||||
val publishedOn: Instant,
|
val publishedOn: Instant,
|
||||||
val body: T,
|
val body: T,
|
||||||
val domain: Domain
|
val domain: Domain
|
||||||
) : Task() {
|
) : Task()
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,17 +29,19 @@ class ActivityStreamHttpMessageConverter : HttpMessageConverter<JsonLd> {
|
||||||
outputMessage.headers.contentType = MediaType.APPLICATION_JSON
|
outputMessage.headers.contentType = MediaType.APPLICATION_JSON
|
||||||
outputMessage.body.bufferedWriter()
|
outputMessage.body.bufferedWriter()
|
||||||
.use {
|
.use {
|
||||||
it.write(JsonUtils.toString(
|
it.write(
|
||||||
|
JsonUtils.toString(
|
||||||
JsonLdProcessor.compact(
|
JsonLdProcessor.compact(
|
||||||
JsonUtils.fromString(JacksonSerializationConverter.convert(t.json).toString()), "https://www.w3.org/ns/activitystreams",
|
JsonUtils.fromString(JacksonSerializationConverter.convert(t.json).toString()),
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
JsonLdOptions()
|
JsonLdOptions()
|
||||||
)
|
)
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun read(clazz: Class<out JsonLd>, inputMessage: HttpInputMessage): JsonLd {
|
override fun read(clazz: Class<out JsonLd>, inputMessage: HttpInputMessage): JsonLd {
|
||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package dev.usbharu.hideout.activitypub.external.activitystreams
|
package dev.usbharu.hideout.activitypub.external.activitystreams
|
||||||
|
|
||||||
|
|
||||||
import dev.usbharu.activitystreamsserialization.dsl.ActivityBuilder
|
import dev.usbharu.activitystreamsserialization.dsl.ActivityBuilder
|
||||||
import dev.usbharu.activitystreamsserialization.other.JsonLd
|
import dev.usbharu.activitystreamsserialization.other.JsonLd
|
||||||
import dev.usbharu.hideout.core.domain.model.actor.Actor
|
import dev.usbharu.hideout.core.domain.model.actor.Actor
|
||||||
|
@ -25,16 +24,16 @@ class ActorTranslator {
|
||||||
owner(actor.url)
|
owner(actor.url)
|
||||||
publicKeyPem(actor.publicKey.publicKey)
|
publicKeyPem(actor.publicKey.publicKey)
|
||||||
id(actor.keyId.keyId)
|
id(actor.keyId.keyId)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
iconMedia?.let {
|
iconMedia?.let {
|
||||||
icon {
|
icon {
|
||||||
listOf(
|
listOf(
|
||||||
Image {
|
Image {
|
||||||
url(iconMedia.url)
|
url(iconMedia.url)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bannerMedia?.let {
|
bannerMedia?.let {
|
||||||
|
@ -42,7 +41,8 @@ class ActorTranslator {
|
||||||
listOf(
|
listOf(
|
||||||
Image {
|
Image {
|
||||||
url(bannerMedia.url)
|
url(bannerMedia.url)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue