mirror of https://github.com/usbharu/Hideout.git
Compare commits
3 Commits
b1c2b554b0
...
f767da23f3
| Author | SHA1 | Date |
|---|---|---|
|
|
f767da23f3 | |
|
|
d63503daef | |
|
|
9c96595758 |
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (8, 'test-user8', 'example.com', 'Im test-user8.', 'THis account is test-user8.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user8/inbox',
|
||||
|
|
@ -7,10 +7,10 @@ VALUES (8, 'test-user8', 'example.com', 'Im test-user8.', 'THis account is test-
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user8#pubkey', 'https://example.com/users/test-user8/following',
|
||||
'https://example.com/users/test-user8/followers');
|
||||
'https://example.com/users/test-user8/followers', null);
|
||||
|
||||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (9, 'test-user9', 'follower.example.com', 'Im test-user9.', 'THis account is test-user9.',
|
||||
null,
|
||||
'https://follower.example.com/users/test-user9/inbox',
|
||||
|
|
@ -19,7 +19,7 @@ VALUES (9, 'test-user9', 'follower.example.com', 'Im test-user9.', 'THis account
|
|||
null, 12345678,
|
||||
'https://follower.example.com/users/test-user9#pubkey',
|
||||
'https://follower.example.com/users/test-user9/following',
|
||||
'https://follower.example.com/users/test-user9/followers');
|
||||
'https://follower.example.com/users/test-user9/followers', null);
|
||||
|
||||
insert into USERS_FOLLOWERS (USER_ID, FOLLOWER_ID)
|
||||
VALUES (8, 9);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (4, 'test-user4', 'example.com', 'Im test user4.', 'THis account is test user4.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user4/inbox',
|
||||
|
|
@ -7,10 +7,10 @@ VALUES (4, 'test-user4', 'example.com', 'Im test user4.', 'THis account is test
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user4#pubkey', 'https://example.com/users/test-user4/following',
|
||||
'https://example.com/users/test-user4/followers');
|
||||
'https://example.com/users/test-user4/followers', null);
|
||||
|
||||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (5, 'test-user5', 'follower.example.com', 'Im test user5.', 'THis account is test user5.',
|
||||
null,
|
||||
'https://follower.example.com/users/test-user5/inbox',
|
||||
|
|
@ -19,7 +19,7 @@ VALUES (5, 'test-user5', 'follower.example.com', 'Im test user5.', 'THis account
|
|||
null, 12345678,
|
||||
'https://follower.example.com/users/test-user5#pubkey',
|
||||
'https://follower.example.com/users/test-user5/following',
|
||||
'https://follower.example.com/users/test-user5/followers');
|
||||
'https://follower.example.com/users/test-user5/followers', null);
|
||||
|
||||
insert into USERS_FOLLOWERS (USER_ID, FOLLOWER_ID)
|
||||
VALUES (4, 5);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (6, 'test-user6', 'example.com', 'Im test-user6.', 'THis account is test-user6.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user6/inbox',
|
||||
|
|
@ -7,10 +7,10 @@ VALUES (6, 'test-user6', 'example.com', 'Im test-user6.', 'THis account is test-
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user6#pubkey', 'https://example.com/users/test-user6/following',
|
||||
'https://example.com/users/test-user6/followers');
|
||||
'https://example.com/users/test-user6/followers', null);
|
||||
|
||||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (7, 'test-user7', 'follower.example.com', 'Im test-user7.', 'THis account is test-user7.',
|
||||
null,
|
||||
'https://follower.example.com/users/test-user7/inbox',
|
||||
|
|
@ -19,7 +19,7 @@ VALUES (7, 'test-user7', 'follower.example.com', 'Im test-user7.', 'THis account
|
|||
null, 12345678,
|
||||
'https://follower.example.com/users/test-user7#pubkey',
|
||||
'https://follower.example.com/users/test-user7/following',
|
||||
'https://follower.example.com/users/test-user7/followers');
|
||||
'https://follower.example.com/users/test-user7/followers', null);
|
||||
|
||||
insert into USERS_FOLLOWERS (USER_ID, FOLLOWER_ID)
|
||||
VALUES (6, 7);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (11, 'test-user11', 'example.com', 'Im test-user11.', 'THis account is test-user11.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user11/inbox',
|
||||
|
|
@ -7,7 +7,7 @@ VALUES (11, 'test-user11', 'example.com', 'Im test-user11.', 'THis account is te
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user11#pubkey', 'https://example.com/users/test-user11/following',
|
||||
'https://example.com/users/test-user11/followers');
|
||||
'https://example.com/users/test-user11/followers', null);
|
||||
|
||||
insert into POSTS (ID, "userId", OVERVIEW, TEXT, "createdAt", VISIBILITY, URL, "repostId", "replyId", SENSITIVE, AP_ID)
|
||||
VALUES (1242, 11, null, 'test post', 12345680, 0, 'https://example.com/users/test-user11/posts/1242', null, null, false,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (10, 'test-user10', 'example.com', 'Im test-user10.', 'THis account is test-user10.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user10/inbox',
|
||||
|
|
@ -7,7 +7,7 @@ VALUES (10, 'test-user10', 'example.com', 'Im test-user10.', 'THis account is te
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user10#pubkey', 'https://example.com/users/test-user10/following',
|
||||
'https://example.com/users/test-user10/followers');
|
||||
'https://example.com/users/test-user10/followers', null);
|
||||
|
||||
insert into POSTS (ID, "userId", OVERVIEW, TEXT, "createdAt", VISIBILITY, URL, "repostId", "replyId", SENSITIVE, AP_ID)
|
||||
VALUES (1240, 10, null, 'test post', 12345680, 0, 'https://example.com/users/test-user10/posts/1240', null, null, false,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (3, 'test-user3', 'example.com', 'Im test user3.', 'THis account is test user3.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user3/inbox',
|
||||
|
|
@ -7,7 +7,7 @@ VALUES (3, 'test-user3', 'example.com', 'Im test user3.', 'THis account is test
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user3#pubkey', 'https://example.com/users/test-user3/following',
|
||||
'https://example.com/users/test-user3/followers');
|
||||
'https://example.com/users/test-user3/followers', null);
|
||||
|
||||
insert into POSTS (ID, "userId", OVERVIEW, TEXT, "createdAt", VISIBILITY, URL, "repostId", "replyId", SENSITIVE, AP_ID)
|
||||
VALUES (1236, 3, null, 'test post', 12345680, 2, 'https://example.com/users/test-user3/posts/1236', null, null, false,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (1, 'test-user', 'example.com', 'Im test user.', 'THis account is test user.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8', 'https://example.com/users/test-user/inbox',
|
||||
'https://example.com/users/test-user/outbox', 'https://example.com/users/test-user',
|
||||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user#pubkey', 'https://example.com/users/test-user/following',
|
||||
'https://example.com/users/test-users/followers');
|
||||
'https://example.com/users/test-users/followers', null);
|
||||
|
||||
insert into POSTS (ID, "userId", OVERVIEW, TEXT, "createdAt", VISIBILITY, URL, "repostId", "replyId", SENSITIVE, AP_ID)
|
||||
VALUES (1234, 1, null, 'test post', 12345680, 0, 'https://example.com/users/test-user/posts/1234', null, null, false,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (2, 'test-user2', 'example.com', 'Im test user2.', 'THis account is test user2.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
|
||||
'https://example.com/users/test-user2/inbox',
|
||||
|
|
@ -7,7 +7,7 @@ VALUES (2, 'test-user2', 'example.com', 'Im test user2.', 'THis account is test
|
|||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user2#pubkey', 'https://example.com/users/test-user2/following',
|
||||
'https://example.com/users/test-user2/followers');
|
||||
'https://example.com/users/test-user2/followers', null);
|
||||
|
||||
insert into POSTS (ID, "userId", OVERVIEW, TEXT, "createdAt", VISIBILITY, URL, "repostId", "replyId", SENSITIVE, AP_ID)
|
||||
VALUES (1235, 2, null, 'test post', 12345680, 1, 'https://example.com/users/test-user2/posts/1235', null, null, false,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
insert into "USERS" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, PASSWORD, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS)
|
||||
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
|
||||
VALUES (1, 'test-user', 'example.com', 'Im test user.', 'THis account is test user.',
|
||||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8', 'https://example.com/users/test-user/inbox',
|
||||
'https://example.com/users/test-user/outbox', 'https://example.com/users/test-user',
|
||||
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
|
||||
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
|
||||
'https://example.com/users/test-user#pubkey', 'https://example.com/users/test-user/following',
|
||||
'https://example.com/users/test-users/followers');
|
||||
'https://example.com/users/test-users/followers', null);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package dev.usbharu.hideout.activitypub.domain.model.objects
|
||||
|
||||
@Suppress("VariableNaming")
|
||||
open class ObjectValue : Object {
|
||||
|
||||
var `object`: String? = null
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ class Nodeinfo {
|
|||
|
||||
var links: List<Links> = emptyList()
|
||||
|
||||
protected constructor()
|
||||
private constructor()
|
||||
}
|
||||
|
||||
class Links {
|
||||
var rel: String? = null
|
||||
var href: String? = null
|
||||
|
||||
protected constructor()
|
||||
private constructor()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
package dev.usbharu.hideout.core.domain.model.instance
|
||||
|
||||
@Suppress("ClassNaming")
|
||||
class Nodeinfo2_0 {
|
||||
var metadata: Metadata? = null
|
||||
var software: Software? = null
|
||||
|
||||
protected constructor()
|
||||
constructor()
|
||||
}
|
||||
|
||||
class Metadata {
|
||||
var nodeName: String? = null
|
||||
var nodeDescription: String? = null
|
||||
|
||||
protected constructor()
|
||||
constructor()
|
||||
}
|
||||
|
||||
class Software {
|
||||
var name: String? = null
|
||||
var version: String? = null
|
||||
|
||||
protected constructor()
|
||||
constructor()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ data class User private constructor(
|
|||
val instance: Long? = null
|
||||
) {
|
||||
override fun toString(): String =
|
||||
"User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description', password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers, following=$following, instance=$instance)"
|
||||
"User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description'," +
|
||||
" password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', " +
|
||||
"privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers," +
|
||||
" following=$following, instance=$instance)"
|
||||
|
||||
@Component
|
||||
class UserBuilder(private val characterLimit: CharacterLimit, private val applicationConfig: ApplicationConfig) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) :
|
|||
override suspend fun generateId(): Long = idGenerateService.generateId()
|
||||
|
||||
override suspend fun save(instance: InstanceEntity): InstanceEntity {
|
||||
if (Instance.select { Instance.id.eq(instance.id) }.firstOrNull() == null) {
|
||||
if (Instance.select { Instance.id.eq(instance.id) }.empty()) {
|
||||
Instance.insert {
|
||||
it[id] = instance.id
|
||||
it[name] = instance.name
|
||||
|
|
@ -88,4 +88,6 @@ object Instance : Table("instance") {
|
|||
val isMuted = bool("is_muted")
|
||||
val moderationNote = varchar("moderation_note", 10000)
|
||||
val createdAt = timestamp("created_at")
|
||||
|
||||
override val primaryKey: PrimaryKey = PrimaryKey(id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ class InstanceServiceImpl(
|
|||
)
|
||||
|
||||
val instanceCreateDto = InstanceCreateDto(
|
||||
nodeinfo20.metadata?.nodeName,
|
||||
nodeinfo20.metadata?.nodeDescription,
|
||||
resolveInstanceUrl,
|
||||
resolveInstanceUrl + "/favicon.ico",
|
||||
sharedInbox,
|
||||
nodeinfo20.software?.name,
|
||||
nodeinfo20.software?.version
|
||||
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)
|
||||
}
|
||||
|
|
@ -69,13 +69,13 @@ class InstanceServiceImpl(
|
|||
)
|
||||
|
||||
val instanceCreateDto = InstanceCreateDto(
|
||||
nodeinfo20.metadata?.nodeName,
|
||||
nodeinfo20.metadata?.nodeDescription,
|
||||
resolveInstanceUrl,
|
||||
resolveInstanceUrl + "/favicon.ico",
|
||||
sharedInbox,
|
||||
nodeinfo20.software?.name,
|
||||
nodeinfo20.software?.version
|
||||
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)
|
||||
}
|
||||
|
|
@ -91,18 +91,18 @@ class InstanceServiceImpl(
|
|||
|
||||
override suspend fun createNewInstance(instanceCreateDto: InstanceCreateDto): Instance {
|
||||
val instance = Instance(
|
||||
instanceRepository.generateId(),
|
||||
instanceCreateDto.name ?: instanceCreateDto.url,
|
||||
instanceCreateDto.description ?: "",
|
||||
instanceCreateDto.url,
|
||||
instanceCreateDto.iconUrl,
|
||||
instanceCreateDto.sharedInbox,
|
||||
instanceCreateDto.software ?: "unknown",
|
||||
instanceCreateDto.version ?: "unknown",
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
Instant.now()
|
||||
id = instanceRepository.generateId(),
|
||||
name = instanceCreateDto.name ?: instanceCreateDto.url,
|
||||
description = instanceCreateDto.description.orEmpty(),
|
||||
url = instanceCreateDto.url,
|
||||
iconUrl = instanceCreateDto.iconUrl,
|
||||
sharedInbox = instanceCreateDto.sharedInbox,
|
||||
software = instanceCreateDto.software ?: "unknown",
|
||||
version = instanceCreateDto.version ?: "unknown",
|
||||
isBlocked = false,
|
||||
isMuted = false,
|
||||
moderationNote = "",
|
||||
createdAt = Instant.now()
|
||||
)
|
||||
instanceRepository.save(instance)
|
||||
return instance
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ open class MediaServiceImpl(
|
|||
private val remoteMediaDownloadService: RemoteMediaDownloadService,
|
||||
private val renameService: MediaFileRenameService
|
||||
) : MediaService {
|
||||
@Suppress("LongMethod")
|
||||
@Suppress("LongMethod", "NestedBlockDepth")
|
||||
override suspend fun uploadLocalMedia(mediaRequest: MediaRequest): EntityMedia {
|
||||
val fileName = mediaRequest.file.name
|
||||
logger.info(
|
||||
|
|
@ -95,6 +95,7 @@ open class MediaServiceImpl(
|
|||
}
|
||||
|
||||
// TODO: 仮の処理として保存したように動かす
|
||||
@Suppress("LongMethod", "NestedBlockDepth")
|
||||
override suspend fun uploadRemoteMedia(remoteMedia: RemoteMedia): Media {
|
||||
logger.info("MEDIA Remote media. filename:${remoteMedia.name} url:${remoteMedia.url}")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package dev.usbharu.hideout.activitypub.service.common
|
||||
|
||||
import dev.usbharu.hideout.core.domain.model.user.UserRepository
|
||||
import dev.usbharu.hideout.core.service.resource.InMemoryCacheManager
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.test.runTest
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class UserServiceTest {
|
|||
mock(),
|
||||
userBuilder,
|
||||
testApplicationConfig,
|
||||
mock()
|
||||
)
|
||||
userService.createLocalUser(UserCreateDto("test", "testUser", "XXXXXXXXXXXXX", "test"))
|
||||
verify(userRepository, times(1)).save(any())
|
||||
|
|
@ -67,7 +68,7 @@ class UserServiceTest {
|
|||
onBlocking { nextId() } doReturn 113345L
|
||||
}
|
||||
val userService =
|
||||
UserServiceImpl(userRepository, mock(), mock(), mock(), mock(), userBuilder, testApplicationConfig)
|
||||
UserServiceImpl(userRepository, mock(), mock(), mock(), mock(), userBuilder, testApplicationConfig, mock())
|
||||
val user = RemoteUserCreateDto(
|
||||
name = "test",
|
||||
domain = "remote.example.com",
|
||||
|
|
@ -79,7 +80,8 @@ class UserServiceTest {
|
|||
publicKey = "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----",
|
||||
keyId = "a",
|
||||
following = "",
|
||||
followers = ""
|
||||
followers = "",
|
||||
sharedInbox = null
|
||||
)
|
||||
userService.createRemoteUser(user)
|
||||
verify(userRepository, times(1)).save(any())
|
||||
|
|
|
|||
Loading…
Reference in New Issue