mirror of https://github.com/usbharu/Hideout.git
refactor: 利用しない予定のクラスを移動
This commit is contained in:
parent
07500651ae
commit
dd408f86db
|
@ -12,6 +12,7 @@ import dev.usbharu.hideout.repository.UserAuthRepository
|
|||
import dev.usbharu.hideout.repository.UserRepository
|
||||
import dev.usbharu.hideout.routing.*
|
||||
import dev.usbharu.hideout.service.*
|
||||
import dev.usbharu.hideout.service.impl.*
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
import io.ktor.client.plugins.contentnegotiation.*
|
||||
|
|
|
@ -3,7 +3,7 @@ package dev.usbharu.hideout.plugins
|
|||
import dev.usbharu.hideout.ap.JsonLd
|
||||
import dev.usbharu.hideout.config.Config
|
||||
import dev.usbharu.hideout.service.IUserAuthService
|
||||
import dev.usbharu.hideout.service.UserAuthService
|
||||
import dev.usbharu.hideout.service.impl.UserAuthService
|
||||
import dev.usbharu.hideout.util.HttpUtil.Activity
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.plugins.api.*
|
||||
|
@ -12,7 +12,6 @@ import io.ktor.client.statement.*
|
|||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.util.*
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import tech.barbero.http.message.signing.HttpMessage
|
||||
import tech.barbero.http.message.signing.HttpMessageSigner
|
||||
|
|
|
@ -4,8 +4,8 @@ import dev.usbharu.hideout.domain.model.User
|
|||
import dev.usbharu.hideout.plugins.UserSession
|
||||
import dev.usbharu.hideout.plugins.respondAp
|
||||
import dev.usbharu.hideout.plugins.tokenAuth
|
||||
import dev.usbharu.hideout.service.ActivityPubUserService
|
||||
import dev.usbharu.hideout.service.UserService
|
||||
import dev.usbharu.hideout.service.impl.ActivityPubUserService
|
||||
import dev.usbharu.hideout.service.impl.UserService
|
||||
import dev.usbharu.hideout.util.HttpUtil
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
|
@ -13,7 +13,6 @@ import io.ktor.server.auth.*
|
|||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
import io.ktor.server.sessions.*
|
||||
|
||||
@Suppress("unused")
|
||||
fun Application.user(userService: UserService, activityPubUserService: ActivityPubUserService) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package dev.usbharu.hideout.routing
|
||||
|
||||
import dev.usbharu.hideout.config.Config
|
||||
import dev.usbharu.hideout.service.UserService
|
||||
import dev.usbharu.hideout.service.impl.UserService
|
||||
import dev.usbharu.hideout.util.HttpUtil.Activity
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
|
|
|
@ -3,8 +3,8 @@ package dev.usbharu.hideout.routing
|
|||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import dev.usbharu.hideout.ap.Follow
|
||||
import dev.usbharu.hideout.config.Config
|
||||
import dev.usbharu.hideout.service.ActivityPubService
|
||||
import dev.usbharu.hideout.service.ActivityPubUserService
|
||||
import dev.usbharu.hideout.service.impl.ActivityPubService
|
||||
import dev.usbharu.hideout.service.impl.ActivityPubUserService
|
||||
import dev.usbharu.hideout.util.HttpUtil
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package dev.usbharu.hideout.service.activitypub
|
||||
|
||||
interface ActivityPubService {
|
||||
fun parseActivity(json:String): ActivityType
|
||||
|
||||
fun processActivity(json:String, type: ActivityType)
|
||||
}
|
||||
|
||||
enum class ActivityType {
|
||||
Accept,
|
||||
Add,
|
||||
Announce,
|
||||
Arrive,
|
||||
Block,
|
||||
Create,
|
||||
Delete,
|
||||
Dislike,
|
||||
Flag,
|
||||
Follow,
|
||||
Ignore,
|
||||
Invite,
|
||||
Join,
|
||||
Leave,
|
||||
Like,
|
||||
Listen,
|
||||
Move,
|
||||
Offer,
|
||||
Question,
|
||||
Reject,
|
||||
Read,
|
||||
Remove,
|
||||
TentativeReject,
|
||||
TentativeAccept,
|
||||
Travel,
|
||||
Undo,
|
||||
Update,
|
||||
View,
|
||||
Other
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import dev.usbharu.hideout.config.Config
|
||||
|
||||
class ActivityPubService() {
|
||||
|
@ -10,7 +9,7 @@ class ActivityPubService() {
|
|||
Undo
|
||||
}
|
||||
|
||||
fun switchApType(json:String):ActivityType{
|
||||
fun switchApType(json:String): ActivityType {
|
||||
val typeAsText = Config.configData.objectMapper.readTree(json).get("type").asText()
|
||||
return when(typeAsText){
|
||||
"Follow" -> ActivityType.Follow
|
|
@ -1,8 +1,10 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import dev.usbharu.hideout.ap.*
|
||||
import dev.usbharu.hideout.config.Config
|
||||
import dev.usbharu.hideout.plugins.postAp
|
||||
import dev.usbharu.hideout.service.IUserAuthService
|
||||
import dev.usbharu.hideout.service.IWebFingerService
|
||||
import io.ktor.client.*
|
||||
|
||||
class ActivityPubUserService(
|
|
@ -1,4 +1,4 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import java.security.PrivateKey
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import dev.usbharu.hideout.config.Config
|
||||
import dev.usbharu.hideout.domain.model.User
|
||||
import dev.usbharu.hideout.domain.model.UserAuthentication
|
||||
import dev.usbharu.hideout.domain.model.UserAuthenticationEntity
|
||||
import dev.usbharu.hideout.domain.model.Users.screenName
|
||||
import dev.usbharu.hideout.exception.UserNotFoundException
|
||||
import dev.usbharu.hideout.repository.IUserAuthRepository
|
||||
import dev.usbharu.hideout.repository.IUserRepository
|
||||
import dev.usbharu.hideout.service.IUserAuthService
|
||||
import io.ktor.util.*
|
||||
import java.security.KeyPair
|
||||
import java.security.KeyPairGenerator
|
|
@ -1,4 +1,4 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import dev.usbharu.hideout.domain.model.User
|
||||
import dev.usbharu.hideout.domain.model.UserEntity
|
|
@ -1,8 +1,9 @@
|
|||
package dev.usbharu.hideout.service
|
||||
package dev.usbharu.hideout.service.impl
|
||||
|
||||
import dev.usbharu.hideout.ap.Person
|
||||
import dev.usbharu.hideout.domain.model.User
|
||||
import dev.usbharu.hideout.domain.model.UserEntity
|
||||
import dev.usbharu.hideout.service.IWebFingerService
|
||||
import dev.usbharu.hideout.util.HttpUtil
|
||||
import dev.usbharu.hideout.webfinger.WebFinger
|
||||
import io.ktor.client.*
|
|
@ -7,8 +7,8 @@ import dev.usbharu.hideout.domain.model.UserAuthenticationEntity
|
|||
import dev.usbharu.hideout.domain.model.UserEntity
|
||||
import dev.usbharu.hideout.repository.IUserAuthRepository
|
||||
import dev.usbharu.hideout.repository.IUserRepository
|
||||
import dev.usbharu.hideout.service.UserAuthService
|
||||
import dev.usbharu.hideout.service.toPem
|
||||
import dev.usbharu.hideout.service.impl.UserAuthService
|
||||
import dev.usbharu.hideout.service.impl.toPem
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.mock.*
|
||||
import io.ktor.client.plugins.logging.*
|
||||
|
@ -17,7 +17,6 @@ import org.junit.jupiter.api.Test
|
|||
import java.security.KeyPairGenerator
|
||||
import java.security.interfaces.RSAPrivateKey
|
||||
import java.security.interfaces.RSAPublicKey
|
||||
import java.util.*
|
||||
|
||||
class ActivityPubKtTest {
|
||||
@Test
|
||||
|
|
|
@ -6,13 +6,12 @@ import dev.usbharu.hideout.domain.model.UserAuthenticationEntity
|
|||
import dev.usbharu.hideout.domain.model.UserEntity
|
||||
import dev.usbharu.hideout.repository.IUserAuthRepository
|
||||
import dev.usbharu.hideout.repository.IUserRepository
|
||||
import dev.usbharu.hideout.service.UserAuthService
|
||||
import dev.usbharu.hideout.service.toPem
|
||||
import dev.usbharu.hideout.service.impl.UserAuthService
|
||||
import dev.usbharu.hideout.service.impl.toPem
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.security.KeyPairGenerator
|
||||
import java.security.interfaces.RSAPrivateKey
|
||||
import java.security.interfaces.RSAPublicKey
|
||||
import java.util.*
|
||||
|
||||
class KtorKeyMapTest {
|
||||
|
||||
|
|
Loading…
Reference in New Issue