diff --git a/hideout-core/build.gradle.kts b/hideout-core/build.gradle.kts index eee94aa5..8fa96834 100644 --- a/hideout-core/build.gradle.kts +++ b/hideout-core/build.gradle.kts @@ -31,22 +31,22 @@ version = "0.0.1" sourceSets { create("intTest") { - test { +// test { compileClasspath += sourceSets.main.get().output runtimeClasspath += sourceSets.main.get().output kotlin.srcDirs("src/intTest/kotlin") java.srcDirs("src/intTest/java") resources.srcDirs("src/intTest/resources") - } +// } } create("e2eTest") { - test { +// test { compileClasspath += sourceSets.main.get().output runtimeClasspath += sourceSets.main.get().output kotlin.srcDirs("src/e2eTest/kotlin") java.srcDirs("src/e2eTest/java") resources.srcDirs("src/e2eTest/resources") - } +// } } } @@ -263,7 +263,7 @@ dependencies { detekt { parallel = true - config = files("detekt.yml") + config = files("../detekt.yml") buildUponDefaultConfig = true basePath = "${rootDir.absolutePath}/src/main/kotlin" autoCorrect = true @@ -286,14 +286,6 @@ tasks.withType().configure exclude("**/org/koin/ksp/generated/**", "**/generated/**") } -configurations.matching { it.name == "detekt" }.all { - resolutionStrategy.eachDependency { - if (requested.group == "org.jetbrains.kotlin") { - useVersion("1.9.22") - } - } -} - configurations { all { exclude("org.springframework.boot", "spring-boot-starter-logging") diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/ApSendAcceptService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/ApSendAcceptService.kt index d27016b0..f9487f5d 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/ApSendAcceptService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/ApSendAcceptService.kt @@ -19,9 +19,8 @@ package dev.usbharu.hideout.activitypub.service.activity.accept import dev.usbharu.hideout.activitypub.domain.model.Accept import dev.usbharu.hideout.activitypub.domain.model.Follow import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.external.job.DeliverAcceptJob import dev.usbharu.hideout.core.external.job.DeliverAcceptJobParam -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service interface ApSendAcceptService { @@ -30,8 +29,7 @@ interface ApSendAcceptService { @Service class ApSendAcceptServiceImpl( - private val jobQueueParentService: JobQueueParentService, - private val deliverAcceptJob: DeliverAcceptJob + private val owlProducer: OwlProducer, ) : ApSendAcceptService { override suspend fun sendAcceptFollow(actor: Actor, target: Actor) { val deliverAcceptJobParam = DeliverAcceptJobParam( @@ -46,6 +44,6 @@ class ApSendAcceptServiceImpl( actor.id ) - jobQueueParentService.scheduleTypeSafe(deliverAcceptJob, deliverAcceptJobParam) + owlProducer.publishTask(deliverAcceptJobParam) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/block/APSendBlockService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/block/APSendBlockService.kt index 923770c5..50fac669 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/block/APSendBlockService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/block/APSendBlockService.kt @@ -21,9 +21,8 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow import dev.usbharu.hideout.activitypub.domain.model.Reject import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.external.job.DeliverBlockJob import dev.usbharu.hideout.core.external.job.DeliverBlockJobParam -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service interface APSendBlockService { @@ -33,8 +32,7 @@ interface APSendBlockService { @Service class ApSendBlockServiceImpl( private val applicationConfig: ApplicationConfig, - private val jobQueueParentService: JobQueueParentService, - private val deliverBlockJob: DeliverBlockJob + private val owlProducer: OwlProducer, ) : APSendBlockService { override suspend fun sendBlock(actor: Actor, target: Actor) { val blockJobParam = DeliverBlockJobParam( @@ -54,6 +52,6 @@ class ApSendBlockServiceImpl( ), target.inbox ) - jobQueueParentService.scheduleTypeSafe(deliverBlockJob, blockJobParam) + owlProducer.publishTask(blockJobParam) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/ApSendCreateServiceImpl.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/ApSendCreateServiceImpl.kt index 0d37ea10..76793b91 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/ApSendCreateServiceImpl.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/ApSendCreateServiceImpl.kt @@ -24,9 +24,10 @@ import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.post.Post -import dev.usbharu.hideout.core.external.job.DeliverPostJob +import dev.usbharu.hideout.core.external.job.DeliverPostTask import dev.usbharu.hideout.core.query.FollowerQueryService import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -37,7 +38,8 @@ class ApSendCreateServiceImpl( private val jobQueueParentService: JobQueueParentService, private val noteQueryService: NoteQueryService, private val applicationConfig: ApplicationConfig, - private val actorRepository: ActorRepository + private val actorRepository: ActorRepository, + private val owlProducer: OwlProducer, ) : ApSendCreateService { override suspend fun createNote(post: Post) { logger.info("CREATE Create Local Note ${post.url}") @@ -56,11 +58,7 @@ class ApSendCreateServiceImpl( id = "${applicationConfig.url}/create/note/${post.id}" ) followers.forEach { followerEntity -> - jobQueueParentService.schedule(DeliverPostJob) { - props[DeliverPostJob.actor] = userEntity.url - props[DeliverPostJob.inbox] = followerEntity.inbox - props[DeliverPostJob.create] = objectMapper.writeValueAsString(create) - } + owlProducer.publishTask(DeliverPostTask(create, userEntity.url, followerEntity.inbox)) } logger.debug("SUCCESS Create Local Note ${post.url}") diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/delete/APSendDeleteService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/delete/APSendDeleteService.kt index 55e68c78..a4e8d40c 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/delete/APSendDeleteService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/delete/APSendDeleteService.kt @@ -24,10 +24,9 @@ import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.post.Post -import dev.usbharu.hideout.core.external.job.DeliverDeleteJob import dev.usbharu.hideout.core.external.job.DeliverDeleteJobParam import dev.usbharu.hideout.core.query.FollowerQueryService -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service import java.time.Instant @@ -38,11 +37,10 @@ interface APSendDeleteService { @Service class APSendDeleteServiceImpl( - private val jobQueueParentService: JobQueueParentService, - private val delverDeleteJob: DeliverDeleteJob, private val followerQueryService: FollowerQueryService, private val applicationConfig: ApplicationConfig, - private val actorRepository: ActorRepository + private val actorRepository: ActorRepository, + private val owlProducer: OwlProducer, ) : APSendDeleteService { override suspend fun sendDeleteNote(deletedPost: Post) { val actor = @@ -62,7 +60,8 @@ class APSendDeleteServiceImpl( it.inbox, actor.id ) - jobQueueParentService.scheduleTypeSafe(delverDeleteJob, jobProps) + + owlProducer.publishTask(jobProps) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APFollowProcessor.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APFollowProcessor.kt index da4fbbbb..62f21276 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APFollowProcessor.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APFollowProcessor.kt @@ -22,16 +22,15 @@ import dev.usbharu.hideout.activitypub.service.common.AbstractActivityPubProcess import dev.usbharu.hideout.activitypub.service.common.ActivityPubProcessContext import dev.usbharu.hideout.activitypub.service.common.ActivityType import dev.usbharu.hideout.application.external.Transaction -import dev.usbharu.hideout.core.external.job.ReceiveFollowJob import dev.usbharu.hideout.core.external.job.ReceiveFollowJobParam -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service @Service class APFollowProcessor( transaction: Transaction, - private val jobQueueParentService: JobQueueParentService, - private val objectMapper: ObjectMapper + private val objectMapper: ObjectMapper, + private val owlProducer: OwlProducer, ) : AbstractActivityPubProcessor(transaction) { override suspend fun internalProcess(activity: ActivityPubProcessContext) { @@ -43,7 +42,7 @@ class APFollowProcessor( objectMapper.writeValueAsString(activity.activity), activity.activity.apObject ) - jobQueueParentService.scheduleTypeSafe(ReceiveFollowJob, jobProps) + owlProducer.publishTask(jobProps) } override fun isSupported(activityType: ActivityType): Boolean = activityType == ActivityType.Follow diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt index c9afab20..9d69e7be 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt @@ -16,12 +16,10 @@ package dev.usbharu.hideout.activitypub.service.activity.follow -import com.fasterxml.jackson.databind.ObjectMapper import dev.usbharu.hideout.activitypub.domain.model.Follow -import dev.usbharu.hideout.core.external.job.ReceiveFollowJob -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.external.job.ReceiveFollowTask +import dev.usbharu.owl.producer.api.OwlProducer import org.slf4j.LoggerFactory -import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Service interface APReceiveFollowService { @@ -30,16 +28,11 @@ interface APReceiveFollowService { @Service class APReceiveFollowServiceImpl( - private val jobQueueParentService: JobQueueParentService, - @Qualifier("activitypub") private val objectMapper: ObjectMapper + private val owlProducer: OwlProducer, ) : APReceiveFollowService { override suspend fun receiveFollow(follow: Follow) { logger.info("FOLLOW from: {} to: {}", follow.actor, follow.apObject) - jobQueueParentService.schedule(ReceiveFollowJob) { - props[ReceiveFollowJob.actor] = follow.actor - props[ReceiveFollowJob.follow] = objectMapper.writeValueAsString(follow) - props[ReceiveFollowJob.targetActor] = follow.apObject - } + owlProducer.publishTask(ReceiveFollowTask(follow.actor, follow, follow.apObject)) return } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt index ea218c6e..08d34f33 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt @@ -16,17 +16,15 @@ package dev.usbharu.hideout.activitypub.service.activity.like -import com.fasterxml.jackson.databind.ObjectMapper import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.post.PostRepository import dev.usbharu.hideout.core.domain.model.reaction.Reaction -import dev.usbharu.hideout.core.external.job.DeliverReactionJob -import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob +import dev.usbharu.hideout.core.external.job.DeliverReactionTask +import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionTask import dev.usbharu.hideout.core.query.FollowerQueryService -import dev.usbharu.hideout.core.service.job.JobQueueParentService -import org.springframework.beans.factory.annotation.Qualifier +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service interface APReactionService { @@ -36,11 +34,10 @@ interface APReactionService { @Service class APReactionServiceImpl( - private val jobQueueParentService: JobQueueParentService, private val followerQueryService: FollowerQueryService, private val actorRepository: ActorRepository, - @Qualifier("activitypub") private val objectMapper: ObjectMapper, - private val postRepository: PostRepository + private val postRepository: PostRepository, + private val owlProducer: OwlProducer, ) : APReactionService { override suspend fun reaction(like: Reaction) { val followers = followerQueryService.findFollowersById(like.actorId) @@ -48,13 +45,15 @@ class APReactionServiceImpl( val post = postRepository.findById(like.postId) ?: throw PostNotFoundException.withId(like.postId) followers.forEach { follower -> - jobQueueParentService.schedule(DeliverReactionJob) { - props[DeliverReactionJob.actor] = user.url - props[DeliverReactionJob.reaction] = "❤" - props[DeliverReactionJob.inbox] = follower.inbox - props[DeliverReactionJob.postUrl] = post.url - props[DeliverReactionJob.id] = post.id.toString() - } + owlProducer.publishTask( + DeliverReactionTask( + actor = user.url, + reaction = "❤", + inbox = follower.inbox, + postUrl = post.url, + id = post.id + ) + ) } } @@ -64,12 +63,14 @@ class APReactionServiceImpl( val post = postRepository.findById(like.postId) ?: throw PostNotFoundException.withId(like.postId) followers.forEach { follower -> - jobQueueParentService.schedule(DeliverRemoveReactionJob) { - props[DeliverRemoveReactionJob.actor] = user.url - props[DeliverRemoveReactionJob.inbox] = follower.inbox - props[DeliverRemoveReactionJob.id] = post.id.toString() - props[DeliverRemoveReactionJob.like] = objectMapper.writeValueAsString(like) - } + owlProducer.publishTask( + DeliverRemoveReactionTask( + actor = user.url, + inbox = follower.inbox, + id = post.id, + reaction = like + ) + ) } } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/reject/ApSendRejectServiceImpl.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/reject/ApSendRejectServiceImpl.kt index 9977be3f..eef398ed 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/reject/ApSendRejectServiceImpl.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/reject/ApSendRejectServiceImpl.kt @@ -20,16 +20,14 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow import dev.usbharu.hideout.activitypub.domain.model.Reject import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.external.job.DeliverRejectJob import dev.usbharu.hideout.core.external.job.DeliverRejectJobParam -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service @Service class ApSendRejectServiceImpl( private val applicationConfig: ApplicationConfig, - private val jobQueueParentService: JobQueueParentService, - private val deliverRejectJob: DeliverRejectJob + private val owlProducer: OwlProducer, ) : ApSendRejectService { override suspend fun sendRejectFollow(actor: Actor, target: Actor) { val deliverRejectJobParam = DeliverRejectJobParam( @@ -42,6 +40,6 @@ class ApSendRejectServiceImpl( actor.id ) - jobQueueParentService.scheduleTypeSafe(deliverRejectJob, deliverRejectJobParam) + owlProducer.publishTask(deliverRejectJobParam) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt index 49444259..342951ec 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt @@ -21,17 +21,15 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow import dev.usbharu.hideout.activitypub.domain.model.Undo import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.external.job.DeliverUndoJob import dev.usbharu.hideout.core.external.job.DeliverUndoJobParam -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.owl.producer.api.OwlProducer import org.springframework.stereotype.Service import java.time.Instant @Service class APSendUndoServiceImpl( - private val jobQueueParentService: JobQueueParentService, - private val deliverUndoJob: DeliverUndoJob, - private val applicationConfig: ApplicationConfig + private val applicationConfig: ApplicationConfig, + private val owlProducer: OwlProducer, ) : APSendUndoService { override suspend fun sendUndoFollow(actor: Actor, target: Actor) { val deliverUndoJobParam = DeliverUndoJobParam( @@ -48,7 +46,7 @@ class APSendUndoServiceImpl( actor.id ) - jobQueueParentService.scheduleTypeSafe(deliverUndoJob, deliverUndoJobParam) + owlProducer.publishTask(deliverUndoJobParam) } override suspend fun sendUndoBlock(actor: Actor, target: Actor) { @@ -67,6 +65,6 @@ class APSendUndoServiceImpl( actor.id ) - jobQueueParentService.scheduleTypeSafe(deliverUndoJob, deliverUndoJobParam) + owlProducer.publishTask(deliverUndoJobParam) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt index 257e57b1..64aa581b 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt @@ -19,9 +19,9 @@ package dev.usbharu.hideout.activitypub.service.common import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import dev.usbharu.hideout.activitypub.domain.exception.JsonParseException -import dev.usbharu.hideout.core.external.job.InboxJob -import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.external.job.InboxTask import dev.usbharu.httpsignature.common.HttpRequest +import dev.usbharu.owl.producer.api.OwlProducer import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier @@ -41,7 +41,7 @@ interface APService { @Service class APServiceImpl( @Qualifier("activitypub") private val objectMapper: ObjectMapper, - private val jobQueueParentService: JobQueueParentService + private val owlProducer: OwlProducer, ) : APService { val logger: Logger = LoggerFactory.getLogger(APServiceImpl::class.java) @@ -90,13 +90,14 @@ class APServiceImpl( map: Map> ) { logger.debug("process activity: {}", type) - jobQueueParentService.schedule(InboxJob) { - props[it.json] = json - props[it.type] = type.name - val writeValueAsString = objectMapper.writeValueAsString(httpRequest) - props[it.httpRequest] = writeValueAsString - props[it.headers] = objectMapper.writeValueAsString(map) - } + owlProducer.publishTask( + InboxTask( + json, + type, + httpRequest, + map + ) + ) return } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityType.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityType.kt index acd7e3ae..acd1fcb6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityType.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityType.kt @@ -46,4 +46,4 @@ enum class ActivityType { Update, View, Other -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityVocabulary.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityVocabulary.kt index 569b5f66..4d42dfff 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityVocabulary.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ActivityVocabulary.kt @@ -71,4 +71,4 @@ enum class ActivityVocabulary { Tombstone, Video, Mention, -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedActivityVocabulary.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedActivityVocabulary.kt index 322cb2a3..b8150064 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedActivityVocabulary.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedActivityVocabulary.kt @@ -72,4 +72,4 @@ enum class ExtendedActivityVocabulary { Video, Mention, Emoji -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedVocabulary.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedVocabulary.kt index 9fe0516a..ef1c06c6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedVocabulary.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ExtendedVocabulary.kt @@ -18,4 +18,4 @@ package dev.usbharu.hideout.activitypub.service.common enum class ExtendedVocabulary { Emoji -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverAcceptJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverAcceptJob.kt index 3c8c4b6c..59e10083 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverAcceptJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverAcceptJob.kt @@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.Accept +import dev.usbharu.owl.common.task.Task import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import org.springframework.stereotype.Component @@ -26,8 +27,8 @@ import org.springframework.stereotype.Component data class DeliverAcceptJobParam( val accept: Accept, val inbox: String, - val signer: Long -) + val signer: Long, +) : Task() @Component class DeliverAcceptJob(private val objectMapper: ObjectMapper) : diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverBlockJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverBlockJob.kt index 3d7f8c54..4b02ff73 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverBlockJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverBlockJob.kt @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.Block import dev.usbharu.hideout.activitypub.domain.model.Reject +import dev.usbharu.owl.common.task.Task import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import org.springframework.beans.factory.annotation.Qualifier @@ -37,8 +38,8 @@ data class DeliverBlockJobParam( val signer: Long, val block: Block, val reject: Reject, - val inbox: String -) + val inbox: String, +) : Task() /** * ブロックアクティビティ配送のジョブ diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverDeleteJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverDeleteJob.kt index d5c1576c..5d3ce8b7 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverDeleteJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverDeleteJob.kt @@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.Delete +import dev.usbharu.owl.common.task.Task import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import org.springframework.beans.factory.annotation.Qualifier @@ -27,8 +28,8 @@ import org.springframework.stereotype.Component data class DeliverDeleteJobParam( val delete: Delete, val inbox: String, - val signer: Long -) + val signer: Long, +) : Task() @Component class DeliverDeleteJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) : diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverPostTask.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverPostTask.kt new file mode 100644 index 00000000..3b682831 --- /dev/null +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverPostTask.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.core.external.job + +import dev.usbharu.hideout.activitypub.domain.model.Create +import dev.usbharu.owl.common.task.Task + +data class DeliverPostTask( + val create: Create, + val inbox: String, + val actor: String, +) : Task() diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverReactionTask.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverReactionTask.kt new file mode 100644 index 00000000..3a11d541 --- /dev/null +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverReactionTask.kt @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.core.external.job + +import dev.usbharu.owl.common.task.Task + +data class DeliverReactionTask( + val actor: String, + val reaction: String, + val inbox: String, + val postUrl: String, + val id: Long, +) : Task() diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRejectJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRejectJob.kt index a57b3093..85baa145 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRejectJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRejectJob.kt @@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.Reject +import dev.usbharu.owl.common.task.Task import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import org.springframework.beans.factory.annotation.Qualifier @@ -27,8 +28,8 @@ import org.springframework.stereotype.Component data class DeliverRejectJobParam( val reject: Reject, val inbox: String, - val signer: Long -) + val signer: Long, +) : Task() @Component class DeliverRejectJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) : diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRemoveReactionTask.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRemoveReactionTask.kt new file mode 100644 index 00000000..1f0a5b15 --- /dev/null +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverRemoveReactionTask.kt @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.core.external.job + +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.owl.common.task.Task + +data class DeliverRemoveReactionTask( + val actor: String, + val inbox: String, + val id: Long, + val reaction: Reaction, +) : Task() diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverUndoJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverUndoJob.kt index a2f5c8d7..f89c6d62 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverUndoJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/DeliverUndoJob.kt @@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.Undo +import dev.usbharu.owl.common.task.Task import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import org.springframework.beans.factory.annotation.Qualifier @@ -27,8 +28,8 @@ import org.springframework.stereotype.Component data class DeliverUndoJobParam( val undo: Undo, val inbox: String, - val signer: Long -) + val signer: Long, +) : Task() @Component class DeliverUndoJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) : diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt index 69737d3f..26d8a1cf 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt @@ -17,6 +17,7 @@ package dev.usbharu.hideout.core.external.job import dev.usbharu.hideout.activitypub.service.common.ActivityType +import dev.usbharu.owl.common.task.Task import kjob.core.Job import kjob.core.Prop import kjob.core.dsl.ScheduleContext @@ -32,8 +33,8 @@ abstract class HideoutJob>(name: String) : Job(n data class ReceiveFollowJobParam( val actor: String, val follow: String, - val targetActor: String -) + val targetActor: String, +) : Task() @Component object ReceiveFollowJob : HideoutJob("ReceiveFollowJob") { diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/InboxTask.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/InboxTask.kt new file mode 100644 index 00000000..fc281e2b --- /dev/null +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/InboxTask.kt @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.core.external.job + +import dev.usbharu.hideout.activitypub.service.common.ActivityType +import dev.usbharu.httpsignature.common.HttpRequest +import dev.usbharu.owl.common.task.Task + +data class InboxTask( + val json: String, + val type: ActivityType, + val httpRequest: HttpRequest, + val headers: Map>, +) : Task() diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/ReceiveFollowTask.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/ReceiveFollowTask.kt new file mode 100644 index 00000000..f11b2b60 --- /dev/null +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/job/ReceiveFollowTask.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.core.external.job + +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.owl.common.task.Task + +data class ReceiveFollowTask( + val actor: String, + val follow: Follow, + val targetActor: String, +) : Task() diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessor.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessor.kt index eb6daa17..cd33d1c4 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessor.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessor.kt @@ -18,6 +18,7 @@ package dev.usbharu.hideout.core.service.job import dev.usbharu.hideout.core.external.job.HideoutJob +@Deprecated("use owl") interface JobProcessor> { suspend fun process(param: @UnsafeVariance T) fun job(): R diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt index c93c6b61..a302a44b 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt @@ -22,6 +22,7 @@ import kjob.core.dsl.ScheduleContext import org.springframework.stereotype.Service @Service +@Deprecated("use owl producer") interface JobQueueParentService { fun init(jobDefines: List) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt index 2fbfceda..d5577ee5 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt @@ -22,6 +22,7 @@ import dev.usbharu.hideout.core.external.job.HideoutJob as HJ import kjob.core.dsl.JobContextWithProps as JCWP import kjob.core.dsl.JobRegisterContext as JRC +@Deprecated("use owl") @Service interface JobQueueWorkerService { fun > init( diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/AccountNotFoundException.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/AccountNotFoundException.kt index d8bbd1cb..8f6d5b79 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/AccountNotFoundException.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/AccountNotFoundException.kt @@ -38,7 +38,7 @@ class AccountNotFoundException : ClientException { ) : super(message, cause, enableSuppression, writableStackTrace, response) fun getTypedResponse(): MastodonApiErrorResponse = - response + response as MastodonApiErrorResponse companion object { fun ofId(id: Long): AccountNotFoundException = AccountNotFoundException( diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt index 667375b5..934403ec 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt @@ -40,7 +40,7 @@ class StatusNotFoundException : ClientException { ) : super(message, cause, enableSuppression, writableStackTrace, response) fun getTypedResponse(): MastodonApiErrorResponse = - response + response as MastodonApiErrorResponse companion object { fun ofId(id: Long): StatusNotFoundException = StatusNotFoundException( diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt index 8e49e8b7..1005680d 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt @@ -16,9 +16,9 @@ package dev.usbharu.hideout.mastodon.interfaces.api.status -import Status import com.fasterxml.jackson.annotation.JsonProperty import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.domain.mastodon.model.generated.Status import dev.usbharu.hideout.domain.mastodon.model.generated.StatusesRequestPoll import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest.Visibility.* diff --git a/hideout-core/src/test/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionServiceImplTest.kt b/hideout-core/src/test/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionServiceImplTest.kt index 5bed662e..fa1cd43e 100644 --- a/hideout-core/src/test/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionServiceImplTest.kt +++ b/hideout-core/src/test/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionServiceImplTest.kt @@ -55,11 +55,9 @@ class APReactionServiceImplTest { onBlocking { findById(eq(user.id)) }.doReturn(user) } val apReactionServiceImpl = APReactionServiceImpl( - jobQueueParentService = jobQueueParentService, actorRepository = actorRepository, followerQueryService = followerQueryService, postRepository = postQueryService, - objectMapper = objectMapper ) apReactionServiceImpl.reaction( diff --git a/hideout-worker/settings.gradle.kts b/hideout-worker/settings.gradle.kts index 97244032..861c039e 100644 --- a/hideout-worker/settings.gradle.kts +++ b/hideout-worker/settings.gradle.kts @@ -13,4 +13,6 @@ dependencyResolutionManagement { from(files("../libs.versions.toml")) } } -} \ No newline at end of file +} + +includeBuild("../hideout-core") \ No newline at end of file diff --git a/libs.versions.toml b/libs.versions.toml index acd49b5c..90bf96b5 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -4,7 +4,7 @@ kotlin = "1.9.23" ktor = "2.3.9" exposed = "0.49.0" javacv-ffmpeg = "6.1.1-1.5.10" -detekt = "1.23.5" +detekt = "1.23.6" coroutines = "1.8.0" swagger = "2.2.6" serialization = "1.6.3"