From 36a0e48e49d0c1adc58a22fe51cf885b5f6b99c8 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sat, 1 Oct 2022 14:40:30 +0200 Subject: [PATCH] bacakend: prefer absolute over relative imports There are still many places where import paths with `..` are used and maybe should use absolute paths also. --- packages/backend/src/boot/index.ts | 2 +- packages/backend/src/daemons/queue-stats.ts | 2 +- packages/backend/src/queue/index.ts | 2 +- .../src/queue/processors/db/delete-drive-files.ts | 2 +- .../backend/src/queue/processors/db/export-blocking.ts | 2 +- .../src/queue/processors/db/export-custom-emojis.ts | 2 +- .../src/queue/processors/db/export-following.ts | 2 +- .../backend/src/queue/processors/db/export-mute.ts | 2 +- .../backend/src/queue/processors/db/export-notes.ts | 2 +- .../src/queue/processors/db/export-user-lists.ts | 2 +- .../backend/src/queue/processors/db/import-blocking.ts | 2 +- .../src/queue/processors/db/import-custom-emojis.ts | 2 +- .../src/queue/processors/db/import-following.ts | 2 +- .../backend/src/queue/processors/db/import-muting.ts | 2 +- .../src/queue/processors/db/import-user-lists.ts | 2 +- packages/backend/src/queue/processors/deliver.ts | 2 +- packages/backend/src/queue/processors/inbox.ts | 2 +- .../processors/object-storage/clean-remote-files.ts | 2 +- .../queue/processors/system/check-expired-mutings.ts | 2 +- .../src/queue/processors/system/clean-charts.ts | 2 +- .../src/queue/processors/system/resync-charts.ts | 2 +- .../backend/src/queue/processors/system/tick-charts.ts | 2 +- .../backend/src/queue/processors/webhook-deliver.ts | 2 +- .../src/remote/activitypub/kernel/accept/follow.ts | 4 ++-- .../src/remote/activitypub/kernel/accept/index.ts | 6 +++--- .../backend/src/remote/activitypub/kernel/add/index.ts | 4 ++-- .../src/remote/activitypub/kernel/announce/index.ts | 6 +++--- .../src/remote/activitypub/kernel/announce/note.ts | 10 +++++----- .../src/remote/activitypub/kernel/block/index.ts | 4 ++-- .../src/remote/activitypub/kernel/create/note.ts | 6 +++--- .../src/remote/activitypub/kernel/delete/actor.ts | 2 +- .../src/remote/activitypub/kernel/delete/index.ts | 2 +- .../src/remote/activitypub/kernel/delete/note.ts | 4 ++-- .../src/remote/activitypub/kernel/flag/index.ts | 2 +- .../src/remote/activitypub/kernel/undo/accept.ts | 4 ++-- .../src/remote/activitypub/kernel/undo/announce.ts | 2 +- .../src/remote/activitypub/kernel/undo/block.ts | 4 ++-- .../src/remote/activitypub/kernel/undo/follow.ts | 4 ++-- .../src/remote/activitypub/kernel/undo/index.ts | 6 +++--- .../backend/src/remote/activitypub/kernel/undo/like.ts | 4 ++-- .../src/remote/activitypub/kernel/update/index.ts | 10 +++++----- .../backend/src/remote/activitypub/misc/html-to-mfm.ts | 2 +- .../backend/src/remote/activitypub/models/person.ts | 2 +- packages/backend/src/remote/activitypub/request.ts | 2 +- packages/backend/src/server/index.ts | 2 +- packages/backend/src/services/create-system-user.ts | 2 +- .../backend/src/services/following/requests/create.ts | 2 +- packages/backend/src/services/logger.ts | 2 +- packages/backend/src/services/note/polls/update.ts | 2 +- packages/backend/src/services/note/polls/vote.ts | 2 +- packages/backend/src/services/note/reaction/create.ts | 2 +- 51 files changed, 75 insertions(+), 75 deletions(-) diff --git a/packages/backend/src/boot/index.ts b/packages/backend/src/boot/index.ts index 91d987908..f88d89d0c 100644 --- a/packages/backend/src/boot/index.ts +++ b/packages/backend/src/boot/index.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import Xev from 'xev'; import Logger from '@/services/logger.js'; -import { envOption } from '../env.js'; +import { envOption } from '@/env.js'; // for typeorm import 'reflect-metadata'; diff --git a/packages/backend/src/daemons/queue-stats.ts b/packages/backend/src/daemons/queue-stats.ts index baabadfff..34fceaed5 100644 --- a/packages/backend/src/daemons/queue-stats.ts +++ b/packages/backend/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ import Xev from 'xev'; -import { deliverQueue, inboxQueue } from '../queue/queues.js'; +import { deliverQueue, inboxQueue } from '@/queue/queues.js'; const ev = new Xev(); diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index 1603865b9..b3a5862f0 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -5,7 +5,7 @@ import config from '@/config/index.js'; import { DriveFile } from '@/models/entities/drive-file.js'; import { Webhook, webhookEventTypes } from '@/models/entities/webhook.js'; import { IActivity } from '@/remote/activitypub/type.js'; -import { envOption } from '../env.js'; +import { envOption } from '@/env.js'; import processDeliver from './processors/deliver.js'; import processInbox from './processors/inbox.js'; diff --git a/packages/backend/src/queue/processors/db/delete-drive-files.ts b/packages/backend/src/queue/processors/db/delete-drive-files.ts index 0c59ea716..503490657 100644 --- a/packages/backend/src/queue/processors/db/delete-drive-files.ts +++ b/packages/backend/src/queue/processors/db/delete-drive-files.ts @@ -3,7 +3,7 @@ import { MoreThan } from 'typeorm'; import { Users, DriveFiles } from '@/models/index.js'; import { deleteFileSync } from '@/services/drive/delete-file.js'; import { DbUserJobData } from '@/queue/types.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('delete-drive-files'); diff --git a/packages/backend/src/queue/processors/db/export-blocking.ts b/packages/backend/src/queue/processors/db/export-blocking.ts index be4f9b96b..29374e26f 100644 --- a/packages/backend/src/queue/processors/db/export-blocking.ts +++ b/packages/backend/src/queue/processors/db/export-blocking.ts @@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js'; import { createTemp } from '@/misc/create-temp.js'; import { Users, Blockings } from '@/models/index.js'; import { DbUserJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('export-blocking'); diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index e2bb0c6f1..ed12e0e7b 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -9,7 +9,7 @@ import { createTemp, createTempDir } from '@/misc/create-temp.js'; import { downloadUrl } from '@/misc/download-url.js'; import { Users, Emojis } from '@/models/index.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('export-custom-emojis'); diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index 9f7647876..0b7e170e6 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -8,8 +8,8 @@ import { createTemp } from '@/misc/create-temp.js'; import { Following } from '@/models/entities/following.js'; import { Users, Followings, Mutings } from '@/models/index.js'; import { DbUserJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('export-following'); diff --git a/packages/backend/src/queue/processors/db/export-mute.ts b/packages/backend/src/queue/processors/db/export-mute.ts index 14103ba78..8ff8851ce 100644 --- a/packages/backend/src/queue/processors/db/export-mute.ts +++ b/packages/backend/src/queue/processors/db/export-mute.ts @@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js'; import { createTemp } from '@/misc/create-temp.js'; import { Users, Mutings } from '@/models/index.js'; import { DbUserJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('export-mute'); diff --git a/packages/backend/src/queue/processors/db/export-notes.ts b/packages/backend/src/queue/processors/db/export-notes.ts index dc8434ff8..b04aed9fa 100644 --- a/packages/backend/src/queue/processors/db/export-notes.ts +++ b/packages/backend/src/queue/processors/db/export-notes.ts @@ -9,7 +9,7 @@ import { Poll } from '@/models/entities/poll.js'; import { Users, Notes, Polls } from '@/models/index.js'; import { DbUserJobData } from '@/queue/types.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('export-notes'); diff --git a/packages/backend/src/queue/processors/db/export-user-lists.ts b/packages/backend/src/queue/processors/db/export-user-lists.ts index 41849227a..22521ca03 100644 --- a/packages/backend/src/queue/processors/db/export-user-lists.ts +++ b/packages/backend/src/queue/processors/db/export-user-lists.ts @@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js'; import { createTemp } from '@/misc/create-temp.js'; import { Users, UserLists, UserListJoinings } from '@/models/index.js'; import { DbUserJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('export-user-lists'); diff --git a/packages/backend/src/queue/processors/db/import-blocking.ts b/packages/backend/src/queue/processors/db/import-blocking.ts index 33bf45730..cc2ccc8e3 100644 --- a/packages/backend/src/queue/processors/db/import-blocking.ts +++ b/packages/backend/src/queue/processors/db/import-blocking.ts @@ -6,9 +6,9 @@ import { isSelfHost, toPuny } from '@/misc/convert-host.js'; import { downloadTextFile } from '@/misc/download-text-file.js'; import { Users, DriveFiles } from '@/models/index.js'; import { DbUserImportJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { resolveUser } from '@/remote/resolve-user.js'; import block from '@/services/blocking/create.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('import-blocking'); diff --git a/packages/backend/src/queue/processors/db/import-custom-emojis.ts b/packages/backend/src/queue/processors/db/import-custom-emojis.ts index 2ad208b0d..04d32d230 100644 --- a/packages/backend/src/queue/processors/db/import-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/import-custom-emojis.ts @@ -8,8 +8,8 @@ import { downloadUrl } from '@/misc/download-url.js'; import { genId } from '@/misc/gen-id.js'; import { DriveFiles, Emojis } from '@/models/index.js'; import { DbUserImportJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { addFile } from '@/services/drive/add-file.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('import-custom-emojis'); diff --git a/packages/backend/src/queue/processors/db/import-following.ts b/packages/backend/src/queue/processors/db/import-following.ts index e01ffe517..a63491d1d 100644 --- a/packages/backend/src/queue/processors/db/import-following.ts +++ b/packages/backend/src/queue/processors/db/import-following.ts @@ -6,9 +6,9 @@ import { isSelfHost, toPuny } from '@/misc/convert-host.js'; import { downloadTextFile } from '@/misc/download-text-file.js'; import { Users, DriveFiles } from '@/models/index.js'; import { DbUserImportJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { resolveUser } from '@/remote/resolve-user.js'; import follow from '@/services/following/create.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('import-following'); diff --git a/packages/backend/src/queue/processors/db/import-muting.ts b/packages/backend/src/queue/processors/db/import-muting.ts index ec7c6a8d7..4dcd50397 100644 --- a/packages/backend/src/queue/processors/db/import-muting.ts +++ b/packages/backend/src/queue/processors/db/import-muting.ts @@ -8,8 +8,8 @@ import { genId } from '@/misc/gen-id.js'; import { Users, DriveFiles, Mutings } from '@/models/index.js'; import { User } from '@/models/entities/user.js'; import { DbUserImportJobData } from '@/queue/types.js'; +import { queueLogger } from '@/queue/logger.js'; import { resolveUser } from '@/remote/resolve-user.js'; -import { queueLogger } from '../../logger.js'; const logger = queueLogger.createSubLogger('import-muting'); diff --git a/packages/backend/src/queue/processors/db/import-user-lists.ts b/packages/backend/src/queue/processors/db/import-user-lists.ts index f291ab6d7..69fe823d2 100644 --- a/packages/backend/src/queue/processors/db/import-user-lists.ts +++ b/packages/backend/src/queue/processors/db/import-user-lists.ts @@ -9,7 +9,7 @@ import { DriveFiles, Users, UserLists, UserListJoinings } from '@/models/index.j import { DbUserImportJobData } from '@/queue/types.js'; import { resolveUser } from '@/remote/resolve-user.js'; import { pushUserToUserList } from '@/services/user-list/push.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('import-user-lists'); diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index a7a0e4be9..108379aa8 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -11,7 +11,7 @@ import { toPuny } from '@/misc/convert-host.js'; import { Cache } from '@/misc/cache.js'; import { Instance } from '@/models/entities/instance.js'; import { StatusError } from '@/misc/fetch.js'; -import { DeliverJobData } from '../types.js'; +import { DeliverJobData } from '@/queue/types.js'; const logger = new Logger('deliver'); diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index 167e5bc6b..426713358 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -16,7 +16,7 @@ import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js'; import { StatusError } from '@/misc/fetch.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { UserPublickey } from '@/models/entities/user-publickey.js'; -import { InboxJobData } from '../types.js'; +import { InboxJobData } from '@/queue/types.js'; const logger = new Logger('inbox'); diff --git a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts index 918337d09..17d165bf2 100644 --- a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts +++ b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts @@ -3,7 +3,7 @@ import { MoreThan, Not, IsNull } from 'typeorm'; import { DriveFiles } from '@/models/index.js'; import { deleteFileSync } from '@/services/drive/delete-file.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('clean-remote-files'); diff --git a/packages/backend/src/queue/processors/system/check-expired-mutings.ts b/packages/backend/src/queue/processors/system/check-expired-mutings.ts index 60dd83a48..93840403f 100644 --- a/packages/backend/src/queue/processors/system/check-expired-mutings.ts +++ b/packages/backend/src/queue/processors/system/check-expired-mutings.ts @@ -2,7 +2,7 @@ import Bull from 'bull'; import { In } from 'typeorm'; import { Mutings } from '@/models/index.js'; import { publishUserEvent } from '@/services/stream.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('check-expired-mutings'); diff --git a/packages/backend/src/queue/processors/system/clean-charts.ts b/packages/backend/src/queue/processors/system/clean-charts.ts index 0b4c7f0ea..b5e8ec09f 100644 --- a/packages/backend/src/queue/processors/system/clean-charts.ts +++ b/packages/backend/src/queue/processors/system/clean-charts.ts @@ -1,7 +1,7 @@ import Bull from 'bull'; import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('clean-charts'); diff --git a/packages/backend/src/queue/processors/system/resync-charts.ts b/packages/backend/src/queue/processors/system/resync-charts.ts index 292ba9f81..b0a0e933b 100644 --- a/packages/backend/src/queue/processors/system/resync-charts.ts +++ b/packages/backend/src/queue/processors/system/resync-charts.ts @@ -1,7 +1,7 @@ import Bull from 'bull'; import { driveChart, notesChart, usersChart } from '@/services/chart/index.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('resync-charts'); diff --git a/packages/backend/src/queue/processors/system/tick-charts.ts b/packages/backend/src/queue/processors/system/tick-charts.ts index 27b048a61..451ec1079 100644 --- a/packages/backend/src/queue/processors/system/tick-charts.ts +++ b/packages/backend/src/queue/processors/system/tick-charts.ts @@ -1,7 +1,7 @@ import Bull from 'bull'; import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js'; -import { queueLogger } from '../../logger.js'; +import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('tick-charts'); diff --git a/packages/backend/src/queue/processors/webhook-deliver.ts b/packages/backend/src/queue/processors/webhook-deliver.ts index 07dfb61c6..00ba9ded2 100644 --- a/packages/backend/src/queue/processors/webhook-deliver.ts +++ b/packages/backend/src/queue/processors/webhook-deliver.ts @@ -3,7 +3,7 @@ import config from '@/config/index.js'; import { getResponse, StatusError } from '@/misc/fetch.js'; import { Webhooks } from '@/models/index.js'; import Logger from '@/services/logger.js'; -import { WebhookDeliverJobData } from '../types.js'; +import { WebhookDeliverJobData } from '@/queue/types.js'; const logger = new Logger('webhook'); diff --git a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts index d2d4bc964..21e7c29ce 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts @@ -1,8 +1,8 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import accept from '@/services/following/requests/accept.js'; import { relayAccepted } from '@/services/relay.js'; -import { IFollow } from '../../type.js'; -import DbResolver from '../../db-resolver.js'; +import { IFollow } from '@/remote/activitypub/type.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; export default async (actor: CacheableRemoteUser, activity: IFollow): Promise => { // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある diff --git a/packages/backend/src/remote/activitypub/kernel/accept/index.ts b/packages/backend/src/remote/activitypub/kernel/accept/index.ts index 0965e76df..b5102da9b 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; -import { apLogger } from '../../logger.js'; -import Resolver from '../../resolver.js'; -import { IAccept, isFollow, getApType } from '../../type.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { IAccept, isFollow, getApType } from '@/remote/activitypub/type.js'; import acceptFollow from './follow.js'; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/add/index.ts b/packages/backend/src/remote/activitypub/kernel/add/index.ts index a705cfede..e3ae01ef2 100644 --- a/packages/backend/src/remote/activitypub/kernel/add/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/add/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { addPinned } from '@/services/i/pin.js'; -import { resolveNote } from '../../models/note.js'; -import { IAdd } from '../../type.js'; +import { resolveNote } from '@/remote/activitypub/models/note.js'; +import { IAdd } from '@/remote/activitypub/type.js'; export default async (actor: CacheableRemoteUser, activity: IAdd): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/packages/backend/src/remote/activitypub/kernel/announce/index.ts b/packages/backend/src/remote/activitypub/kernel/announce/index.ts index d26d7b02b..7a7e3b428 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; -import { apLogger } from '../../logger.js'; -import Resolver from '../../resolver.js'; -import { IAnnounce, getApId } from '../../type.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { IAnnounce, getApId } from '@/remote/activitypub/type.js'; import announceNote from './note.js'; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index 8a6e50a91..0783d1ea0 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -5,11 +5,11 @@ import { fetchMeta } from '@/misc/fetch-meta.js'; import { getApLock } from '@/misc/app-lock.js'; import { StatusError } from '@/misc/fetch.js'; import { Notes } from '@/models/index.js'; -import { parseAudience } from '../../audience.js'; -import { apLogger } from '../../logger.js'; -import { fetchNote, resolveNote } from '../../models/note.js'; -import Resolver from '../../resolver.js'; -import { IAnnounce, getApId } from '../../type.js'; +import { parseAudience } from '@/remote/activitypub/audience.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; +import { fetchNote, resolveNote } from '@/remote/activitypub/models/note.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { IAnnounce, getApId } from '@/remote/activitypub/type.js'; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/block/index.ts b/packages/backend/src/remote/activitypub/kernel/block/index.ts index dc7e648cf..e66ed2799 100644 --- a/packages/backend/src/remote/activitypub/kernel/block/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/block/index.ts @@ -1,8 +1,8 @@ import block from '@/services/blocking/create.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { Users } from '@/models/index.js'; -import DbResolver from '../../db-resolver.js'; -import { IBlock } from '../../type.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; +import { IBlock } from '@/remote/activitypub/type.js'; export default async (actor: CacheableRemoteUser, activity: IBlock): Promise => { // ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index 52ece6b96..12b07c18e 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -2,9 +2,9 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { getApLock } from '@/misc/app-lock.js'; import { extractDbHost } from '@/misc/convert-host.js'; import { StatusError } from '@/misc/fetch.js'; -import Resolver from '../../resolver.js'; -import { createNote, fetchNote } from '../../models/note.js'; -import { getApId, IObject, ICreate } from '../../type.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { createNote, fetchNote } from '@/remote/activitypub/models/note.js'; +import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js'; /** * 投稿作成アクティビティを捌きます diff --git a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts index ebc4a2eab..ca347beb0 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts @@ -1,7 +1,7 @@ import { createDeleteAccountJob } from '@/queue/index.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { Users } from '@/models/index.js'; -import { apLogger } from '../../logger.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/delete/index.ts b/packages/backend/src/remote/activitypub/kernel/delete/index.ts index 3d51e0545..ee05e5327 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/index.ts @@ -1,6 +1,6 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { toSingle } from '@/prelude/array.js'; -import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type.js'; +import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '@/remote/activitypub/type.js'; import { deleteActor } from './actor.js'; import deleteNote from './note.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/delete/note.ts b/packages/backend/src/remote/activitypub/kernel/delete/note.ts index 1867cc535..6f64b66e2 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/note.ts @@ -2,8 +2,8 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import deleteNode from '@/services/note/delete.js'; import { getApLock } from '@/misc/app-lock.js'; import { deleteMessage } from '@/services/messages/delete.js'; -import DbResolver from '../../db-resolver.js'; -import { apLogger } from '../../logger.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/flag/index.ts b/packages/backend/src/remote/activitypub/kernel/flag/index.ts index 4ec8e36f6..e50bcc2bd 100644 --- a/packages/backend/src/remote/activitypub/kernel/flag/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/flag/index.ts @@ -3,7 +3,7 @@ import config from '@/config/index.js'; import { genId } from '@/misc/gen-id.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { AbuseUserReports, Users } from '@/models/index.js'; -import { IFlag, getApIds } from '../../type.js'; +import { IFlag, getApIds } from '@/remote/activitypub/type.js'; export default async (actor: CacheableRemoteUser, activity: IFlag): Promise => { // objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので diff --git a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts index ac90a5d17..b3f227012 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts @@ -1,8 +1,8 @@ import unfollow from '@/services/following/delete.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { Followings } from '@/models/index.js'; -import DbResolver from '../../db-resolver.js'; -import { IAccept } from '../../type.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; +import { IAccept } from '@/remote/activitypub/type.js'; export default async (actor: CacheableRemoteUser, activity: IAccept): Promise => { const dbResolver = new DbResolver(); diff --git a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts index 3752e178b..c06b21db3 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts @@ -1,7 +1,7 @@ import { Notes } from '@/models/index.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import deleteNote from '@/services/note/delete.js'; -import { IAnnounce, getApId } from '../../type.js'; +import { IAnnounce, getApId } from '@/remote/activitypub/type.js'; export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise => { const uri = getApId(activity); diff --git a/packages/backend/src/remote/activitypub/kernel/undo/block.ts b/packages/backend/src/remote/activitypub/kernel/undo/block.ts index 6bb426fec..fc6763673 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/block.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/block.ts @@ -1,8 +1,8 @@ import unblock from '@/services/blocking/delete.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { Users } from '@/models/index.js'; -import { IBlock } from '../../type.js'; -import DbResolver from '../../db-resolver.js'; +import { IBlock } from '@/remote/activitypub/type.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; export default async (actor: CacheableRemoteUser, activity: IBlock): Promise => { const dbResolver = new DbResolver(); diff --git a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts index 3989b5708..a0bdf0d0b 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts @@ -2,8 +2,8 @@ import unfollow from '@/services/following/delete.js'; import cancelRequest from '@/services/following/requests/cancel.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; import { FollowRequests, Followings } from '@/models/index.js'; -import { IFollow } from '../../type.js'; -import DbResolver from '../../db-resolver.js'; +import { IFollow } from '@/remote/activitypub/type.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; export default async (actor: CacheableRemoteUser, activity: IFollow): Promise => { const dbResolver = new DbResolver(); diff --git a/packages/backend/src/remote/activitypub/kernel/undo/index.ts b/packages/backend/src/remote/activitypub/kernel/undo/index.ts index 80f69ec63..d69dd0f47 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; -import { apLogger } from '../../logger.js'; -import Resolver from '../../resolver.js'; -import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '../../type.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '@/remote/activitypub/type.js'; import unfollow from './follow.js'; import unblock from './block.js'; import undoLike from './like.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/undo/like.ts b/packages/backend/src/remote/activitypub/kernel/undo/like.ts index d00d9c3f3..a7f7e6bc6 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/like.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/like.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import deleteReaction from '@/services/note/reaction/delete.js'; -import { ILike, getApId } from '../../type.js'; -import { fetchNote } from '../../models/note.js'; +import { ILike, getApId } from '@/remote/activitypub/type.js'; +import { fetchNote } from '@/remote/activitypub/models/note.js'; /** * Process Undo.Like activity diff --git a/packages/backend/src/remote/activitypub/kernel/update/index.ts b/packages/backend/src/remote/activitypub/kernel/update/index.ts index 1a700f275..153c86233 100644 --- a/packages/backend/src/remote/activitypub/kernel/update/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/update/index.ts @@ -1,9 +1,9 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; -import { getApType, IUpdate, isActor } from '../../type.js'; -import { apLogger } from '../../logger.js'; -import { updateQuestion } from '../../models/question.js'; -import Resolver from '../../resolver.js'; -import { updatePerson } from '../../models/person.js'; +import { getApType, IUpdate, isActor } from '@/remote/activitypub/type.js'; +import { apLogger } from '@/remote/activitypub/logger.js'; +import { updateQuestion } from '@/remote/activitypub/models/question.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { updatePerson } from '@/remote/activitypub/models/person.js'; /** * Updateアクティビティを捌きます diff --git a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts index bb1ba7925..c9c7f389a 100644 --- a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts +++ b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts @@ -1,6 +1,6 @@ import { IObject } from '../type.js'; import { extractApHashtagObjects } from '../models/tag.js'; -import { fromHtml } from '../../../mfm/from-html.js'; +import { fromHtml } from '@/mfm/from-html.js'; export function htmlToMfm(html: string, tag?: IObject | IObject[]) { const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null); diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index b546aedc2..d512c1870 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -25,7 +25,7 @@ import { publishInternalEvent } from '@/services/stream.js'; import { db } from '@/db/postgre.js'; import { apLogger } from '../logger.js'; import { htmlToMfm } from '../misc/html-to-mfm.js'; -import { fromHtml } from '../../../mfm/from-html.js'; +import { fromHtml } from '@/mfm/from-html.js'; import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type.js'; import Resolver from '../resolver.js'; import { extractApHashtags } from './tag.js'; diff --git a/packages/backend/src/remote/activitypub/request.ts b/packages/backend/src/remote/activitypub/request.ts index 5cbfd8c25..2cc2a146c 100644 --- a/packages/backend/src/remote/activitypub/request.ts +++ b/packages/backend/src/remote/activitypub/request.ts @@ -1,7 +1,7 @@ import config from '@/config/index.js'; import { getUserKeypair } from '@/misc/keypair-store.js'; import { User } from '@/models/entities/user.js'; -import { getResponse } from '../../misc/fetch.js'; +import { getResponse } from '@/misc/fetch.js'; import { createSignedPost, createSignedGet } from './ap-request.js'; export default async (user: { id: User['id'] }, url: string, object: any) => { diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index f31de2b7f..4d3ae0043 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -19,7 +19,7 @@ import { genIdenticon } from '@/misc/gen-identicon.js'; import { createTemp } from '@/misc/create-temp.js'; import { publishMainStream } from '@/services/stream.js'; import * as Acct from '@/misc/acct.js'; -import { envOption } from '../env.js'; +import { envOption } from '@/env.js'; import activityPub from './activitypub.js'; import nodeinfo from './nodeinfo.js'; import wellKnown from './well-known.js'; diff --git a/packages/backend/src/services/create-system-user.ts b/packages/backend/src/services/create-system-user.ts index 4f3a3bc01..2285f1586 100644 --- a/packages/backend/src/services/create-system-user.ts +++ b/packages/backend/src/services/create-system-user.ts @@ -8,7 +8,7 @@ import { genId } from '@/misc/gen-id.js'; import { UserKeypair } from '@/models/entities/user-keypair.js'; import { UsedUsername } from '@/models/entities/used-username.js'; import { db } from '@/db/postgre.js'; -import generateNativeUserToken from '../server/api/common/generate-native-user-token.js'; +import generateNativeUserToken from '@/server/api/common/generate-native-user-token.js'; export async function createSystemUser(username: string): Promise { const password = uuid(); diff --git a/packages/backend/src/services/following/requests/create.ts b/packages/backend/src/services/following/requests/create.ts index bda2f8f92..e8971ba57 100644 --- a/packages/backend/src/services/following/requests/create.ts +++ b/packages/backend/src/services/following/requests/create.ts @@ -5,7 +5,7 @@ import { deliver } from '@/queue/index.js'; import { User } from '@/models/entities/user.js'; import { Blockings, FollowRequests, Users } from '@/models/index.js'; import { genId } from '@/misc/gen-id.js'; -import { createNotification } from '../../create-notification.js'; +import { createNotification } from '@/services/create-notification.js'; export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, requestId?: string) { if (follower.id === followee.id) return; diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 8aee58154..9bdae345a 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -4,7 +4,7 @@ import { default as convertColor } from 'color-convert'; import { format as dateFormat } from 'date-fns'; import * as SyslogPro from 'syslog-pro'; import config from '@/config/index.js'; -import { envOption } from '../env.js'; +import { envOption } from '@/env.js'; type Domain = { name: string; diff --git a/packages/backend/src/services/note/polls/update.ts b/packages/backend/src/services/note/polls/update.ts index a0ce5f92f..2d8050b68 100644 --- a/packages/backend/src/services/note/polls/update.ts +++ b/packages/backend/src/services/note/polls/update.ts @@ -4,7 +4,7 @@ import renderNote from '@/remote/activitypub/renderer/note.js'; import { Users, Notes } from '@/models/index.js'; import { Note } from '@/models/entities/note.js'; import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; -import { deliverToRelays } from '../../relay.js'; +import { deliverToRelays } from '@/services/relay.js'; export async function deliverQuestionUpdate(noteId: Note['id']): Promise { const note = await Notes.findOneBy({ id: noteId }); diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index 90be1c844..3382e10bd 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -4,7 +4,7 @@ import { CacheableUser } from '@/models/entities/user.js'; import { Note } from '@/models/entities/note.js'; import { PollVotes, NoteWatchings, Polls, Blockings, NoteThreadMutings } from '@/models/index.js'; import { genId } from '@/misc/gen-id.js'; -import { createNotification } from '../../create-notification.js'; +import { createNotification } from '@/services/create-notification.js'; export default async function(user: CacheableUser, note: Note, choice: number) { const poll = await Polls.findOneBy({ noteId: note.id }); diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 2bd19b685..5cc4f331c 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -12,7 +12,7 @@ import { genId } from '@/misc/gen-id.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { NoteReaction } from '@/models/entities/note-reaction.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import { createNotification } from '../../create-notification.js'; +import { createNotification } from '@/services/create-notification.js'; import deleteReaction from './delete.js'; export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => {