mirror of https://github.com/usbharu/Hideout.git
style: コードを整形
This commit is contained in:
parent
5e11b70d22
commit
cabecd4fce
|
@ -6,6 +6,7 @@ import org.jetbrains.exposed.dao.id.LongIdTable
|
|||
object UsersFollowers : LongIdTable("users_followers") {
|
||||
val userId = long("user_id").references(Users.id).index()
|
||||
val followerId = long("follower_id").references(Users.id)
|
||||
|
||||
init {
|
||||
uniqueIndex(userId, followerId)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package dev.usbharu.hideout.domain.model.ap
|
||||
|
||||
open class Accept : Object {
|
||||
public var `object`: Object? = null
|
||||
public var actor:String? = null
|
||||
var `object`: Object? = null
|
||||
var actor: String? = null
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package dev.usbharu.hideout.domain.model.ap
|
||||
|
||||
open class Follow : Object {
|
||||
public var `object`:String? = null
|
||||
public var actor:String? = null
|
||||
var `object`: String? = null
|
||||
var actor: String? = null
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
|
|
|
@ -43,8 +43,11 @@ open class JsonLd {
|
|||
|
||||
}
|
||||
|
||||
public class ContextDeserializer : JsonDeserializer<String>() {
|
||||
override fun deserialize(p0: com.fasterxml.jackson.core.JsonParser?, p1: com.fasterxml.jackson.databind.DeserializationContext?): String {
|
||||
class ContextDeserializer : JsonDeserializer<String>() {
|
||||
override fun deserialize(
|
||||
p0: com.fasterxml.jackson.core.JsonParser?,
|
||||
p1: com.fasterxml.jackson.databind.DeserializationContext?
|
||||
): String {
|
||||
val readTree: JsonNode = p0?.codec?.readTree(p0) ?: return ""
|
||||
if (readTree.isObject) {
|
||||
return ""
|
||||
|
@ -53,17 +56,17 @@ public class ContextDeserializer : JsonDeserializer<String>() {
|
|||
}
|
||||
}
|
||||
|
||||
public class ContextSerializer : JsonSerializer<List<String>>() {
|
||||
class ContextSerializer : JsonSerializer<List<String>>() {
|
||||
override fun serialize(value: List<String>?, gen: JsonGenerator?, serializers: SerializerProvider?) {
|
||||
if (value.isNullOrEmpty()) {
|
||||
gen?.writeNull()
|
||||
return
|
||||
}
|
||||
if (value?.size == 1) {
|
||||
if (value.size == 1) {
|
||||
gen?.writeString(value[0])
|
||||
} else {
|
||||
gen?.writeStartArray()
|
||||
value?.forEach {
|
||||
value.forEach {
|
||||
gen?.writeString(it)
|
||||
}
|
||||
gen?.writeEndArray()
|
||||
|
|
|
@ -4,6 +4,7 @@ open class Key : Object {
|
|||
var id: String? = null
|
||||
var owner: String? = null
|
||||
var publicKeyPem: String? = null
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(
|
||||
type: List<String>,
|
||||
|
|
|
@ -6,6 +6,7 @@ open class Note : Object {
|
|||
var content: String? = null
|
||||
var published: String? = null
|
||||
var to: List<String> = emptyList()
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
|
|
|
@ -46,7 +46,7 @@ open class Object : JsonLd {
|
|||
|
||||
}
|
||||
|
||||
public class TypeSerializer : JsonSerializer<List<String>>() {
|
||||
class TypeSerializer : JsonSerializer<List<String>>() {
|
||||
override fun serialize(value: List<String>?, gen: JsonGenerator?, serializers: SerializerProvider?) {
|
||||
println(value)
|
||||
if (value?.size == 1) {
|
||||
|
|
|
@ -9,6 +9,7 @@ open class Person : Object {
|
|||
private var url: String? = null
|
||||
private var icon: Image? = null
|
||||
var publicKey: Key? = null
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package dev.usbharu.hideout.plugins
|
||||
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.plugins.cors.routing.*
|
||||
import io.ktor.server.plugins.defaultheaders.*
|
||||
import io.ktor.server.plugins.forwardedheaders.*
|
||||
import io.ktor.server.application.*
|
||||
|
||||
fun Application.configureHTTP() {
|
||||
install(CORS) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package dev.usbharu.hideout.plugins
|
||||
|
||||
import io.ktor.server.plugins.callloging.*
|
||||
import org.slf4j.event.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.plugins.callloging.*
|
||||
import org.slf4j.event.Level
|
||||
|
||||
fun Application.configureMonitoring() {
|
||||
install(CallLogging) {
|
||||
|
|
|
@ -3,8 +3,6 @@ package dev.usbharu.hideout.plugins
|
|||
import dev.usbharu.hideout.service.IUserAuthService
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.auth.*
|
||||
import io.ktor.server.sessions.*
|
||||
import kotlin.collections.set
|
||||
|
||||
data class UserSession(val username: String) : Principal
|
||||
|
||||
|
|
|
@ -4,13 +4,9 @@ import com.fasterxml.jackson.annotation.JsonInclude
|
|||
import com.fasterxml.jackson.annotation.JsonSetter
|
||||
import com.fasterxml.jackson.annotation.Nulls
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
||||
import dev.usbharu.hideout.util.HttpUtil.Activity
|
||||
import io.ktor.http.*
|
||||
import io.ktor.serialization.jackson.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.plugins.contentnegotiation.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Application.configureSerialization() {
|
||||
install(ContentNegotiation) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class ActivityPubServiceImpl(
|
|||
return ActivityType.values().first { it.name.equals(type.asText(), true) }
|
||||
}
|
||||
|
||||
override suspend fun processActivity(json: String, type: ActivityType): ActivityPubResponse? {
|
||||
override suspend fun processActivity(json: String, type: ActivityType): ActivityPubResponse {
|
||||
return when (type) {
|
||||
ActivityType.Accept -> TODO()
|
||||
ActivityType.Add -> TODO()
|
||||
|
|
|
@ -10,7 +10,7 @@ import tech.barbero.http.message.signing.SignatureHeaderVerifier
|
|||
class HttpSignatureVerifyServiceImpl(private val userAuthService: IUserRepository) : HttpSignatureVerifyService {
|
||||
override fun verify(headers: Headers): Boolean {
|
||||
val build = SignatureHeaderVerifier.builder().keyMap(KtorKeyMap(userAuthService)).build()
|
||||
return true;
|
||||
return true
|
||||
build.verify(object : HttpMessage {
|
||||
override fun headerValues(name: String?): MutableList<String> {
|
||||
return name?.let { headers.getAll(it) }?.toMutableList() ?: mutableListOf()
|
||||
|
|
|
@ -30,6 +30,10 @@ object HttpUtil {
|
|||
get() = ContentType("application", "activity+json")
|
||||
|
||||
val ContentType.Application.JsonLd: ContentType
|
||||
get() = ContentType("application", "ld+json", listOf(HeaderValueParam("profile", "https://www.w3.org/ns/activitystreams")))
|
||||
get() = ContentType(
|
||||
"application",
|
||||
"ld+json",
|
||||
listOf(HeaderValueParam("profile", "https://www.w3.org/ns/activitystreams"))
|
||||
)
|
||||
// fun
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.jetbrains.exposed.dao.id.LongIdTable
|
|||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.isNull
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.plus
|
||||
import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport"/>
|
||||
<meta content="#000000" name="theme-color"/>
|
||||
<title>Solid App</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue