bacakend: prefer absolute over relative imports

There are still many places where import paths with `..` are used and
maybe should use absolute paths also.
This commit is contained in:
Johann150 2022-10-01 14:40:30 +02:00
parent cb72d45672
commit 36a0e48e49
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
51 changed files with 75 additions and 75 deletions

View file

@ -3,7 +3,7 @@ import chalk from 'chalk';
import Xev from 'xev'; import Xev from 'xev';
import Logger from '@/services/logger.js'; import Logger from '@/services/logger.js';
import { envOption } from '../env.js'; import { envOption } from '@/env.js';
// for typeorm // for typeorm
import 'reflect-metadata'; import 'reflect-metadata';

View file

@ -1,5 +1,5 @@
import Xev from 'xev'; import Xev from 'xev';
import { deliverQueue, inboxQueue } from '../queue/queues.js'; import { deliverQueue, inboxQueue } from '@/queue/queues.js';
const ev = new Xev(); const ev = new Xev();

View file

@ -5,7 +5,7 @@ import config from '@/config/index.js';
import { DriveFile } from '@/models/entities/drive-file.js'; import { DriveFile } from '@/models/entities/drive-file.js';
import { Webhook, webhookEventTypes } from '@/models/entities/webhook.js'; import { Webhook, webhookEventTypes } from '@/models/entities/webhook.js';
import { IActivity } from '@/remote/activitypub/type.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 processDeliver from './processors/deliver.js';
import processInbox from './processors/inbox.js'; import processInbox from './processors/inbox.js';

View file

@ -3,7 +3,7 @@ import { MoreThan } from 'typeorm';
import { Users, DriveFiles } from '@/models/index.js'; import { Users, DriveFiles } from '@/models/index.js';
import { deleteFileSync } from '@/services/drive/delete-file.js'; import { deleteFileSync } from '@/services/drive/delete-file.js';
import { DbUserJobData } from '@/queue/types.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'); const logger = queueLogger.createSubLogger('delete-drive-files');

View file

@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js';
import { createTemp } from '@/misc/create-temp.js'; import { createTemp } from '@/misc/create-temp.js';
import { Users, Blockings } from '@/models/index.js'; import { Users, Blockings } from '@/models/index.js';
import { DbUserJobData } from '@/queue/types.js'; import { DbUserJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { addFile } from '@/services/drive/add-file.js'; import { addFile } from '@/services/drive/add-file.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('export-blocking'); const logger = queueLogger.createSubLogger('export-blocking');

View file

@ -9,7 +9,7 @@ import { createTemp, createTempDir } from '@/misc/create-temp.js';
import { downloadUrl } from '@/misc/download-url.js'; import { downloadUrl } from '@/misc/download-url.js';
import { Users, Emojis } from '@/models/index.js'; import { Users, Emojis } from '@/models/index.js';
import { addFile } from '@/services/drive/add-file.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'); const logger = queueLogger.createSubLogger('export-custom-emojis');

View file

@ -8,8 +8,8 @@ import { createTemp } from '@/misc/create-temp.js';
import { Following } from '@/models/entities/following.js'; import { Following } from '@/models/entities/following.js';
import { Users, Followings, Mutings } from '@/models/index.js'; import { Users, Followings, Mutings } from '@/models/index.js';
import { DbUserJobData } from '@/queue/types.js'; import { DbUserJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { addFile } from '@/services/drive/add-file.js'; import { addFile } from '@/services/drive/add-file.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('export-following'); const logger = queueLogger.createSubLogger('export-following');

View file

@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js';
import { createTemp } from '@/misc/create-temp.js'; import { createTemp } from '@/misc/create-temp.js';
import { Users, Mutings } from '@/models/index.js'; import { Users, Mutings } from '@/models/index.js';
import { DbUserJobData } from '@/queue/types.js'; import { DbUserJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { addFile } from '@/services/drive/add-file.js'; import { addFile } from '@/services/drive/add-file.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('export-mute'); const logger = queueLogger.createSubLogger('export-mute');

View file

@ -9,7 +9,7 @@ import { Poll } from '@/models/entities/poll.js';
import { Users, Notes, Polls } from '@/models/index.js'; import { Users, Notes, Polls } from '@/models/index.js';
import { DbUserJobData } from '@/queue/types.js'; import { DbUserJobData } from '@/queue/types.js';
import { addFile } from '@/services/drive/add-file.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'); const logger = queueLogger.createSubLogger('export-notes');

View file

@ -7,8 +7,8 @@ import { getFullApAccount } from '@/misc/convert-host.js';
import { createTemp } from '@/misc/create-temp.js'; import { createTemp } from '@/misc/create-temp.js';
import { Users, UserLists, UserListJoinings } from '@/models/index.js'; import { Users, UserLists, UserListJoinings } from '@/models/index.js';
import { DbUserJobData } from '@/queue/types.js'; import { DbUserJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { addFile } from '@/services/drive/add-file.js'; import { addFile } from '@/services/drive/add-file.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('export-user-lists'); const logger = queueLogger.createSubLogger('export-user-lists');

View file

@ -6,9 +6,9 @@ import { isSelfHost, toPuny } from '@/misc/convert-host.js';
import { downloadTextFile } from '@/misc/download-text-file.js'; import { downloadTextFile } from '@/misc/download-text-file.js';
import { Users, DriveFiles } from '@/models/index.js'; import { Users, DriveFiles } from '@/models/index.js';
import { DbUserImportJobData } from '@/queue/types.js'; import { DbUserImportJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { resolveUser } from '@/remote/resolve-user.js'; import { resolveUser } from '@/remote/resolve-user.js';
import block from '@/services/blocking/create.js'; import block from '@/services/blocking/create.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('import-blocking'); const logger = queueLogger.createSubLogger('import-blocking');

View file

@ -8,8 +8,8 @@ import { downloadUrl } from '@/misc/download-url.js';
import { genId } from '@/misc/gen-id.js'; import { genId } from '@/misc/gen-id.js';
import { DriveFiles, Emojis } from '@/models/index.js'; import { DriveFiles, Emojis } from '@/models/index.js';
import { DbUserImportJobData } from '@/queue/types.js'; import { DbUserImportJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { addFile } from '@/services/drive/add-file.js'; import { addFile } from '@/services/drive/add-file.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('import-custom-emojis'); const logger = queueLogger.createSubLogger('import-custom-emojis');

View file

@ -6,9 +6,9 @@ import { isSelfHost, toPuny } from '@/misc/convert-host.js';
import { downloadTextFile } from '@/misc/download-text-file.js'; import { downloadTextFile } from '@/misc/download-text-file.js';
import { Users, DriveFiles } from '@/models/index.js'; import { Users, DriveFiles } from '@/models/index.js';
import { DbUserImportJobData } from '@/queue/types.js'; import { DbUserImportJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { resolveUser } from '@/remote/resolve-user.js'; import { resolveUser } from '@/remote/resolve-user.js';
import follow from '@/services/following/create.js'; import follow from '@/services/following/create.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('import-following'); const logger = queueLogger.createSubLogger('import-following');

View file

@ -8,8 +8,8 @@ import { genId } from '@/misc/gen-id.js';
import { Users, DriveFiles, Mutings } from '@/models/index.js'; import { Users, DriveFiles, Mutings } from '@/models/index.js';
import { User } from '@/models/entities/user.js'; import { User } from '@/models/entities/user.js';
import { DbUserImportJobData } from '@/queue/types.js'; import { DbUserImportJobData } from '@/queue/types.js';
import { queueLogger } from '@/queue/logger.js';
import { resolveUser } from '@/remote/resolve-user.js'; import { resolveUser } from '@/remote/resolve-user.js';
import { queueLogger } from '../../logger.js';
const logger = queueLogger.createSubLogger('import-muting'); const logger = queueLogger.createSubLogger('import-muting');

View file

@ -9,7 +9,7 @@ import { DriveFiles, Users, UserLists, UserListJoinings } from '@/models/index.j
import { DbUserImportJobData } from '@/queue/types.js'; import { DbUserImportJobData } from '@/queue/types.js';
import { resolveUser } from '@/remote/resolve-user.js'; import { resolveUser } from '@/remote/resolve-user.js';
import { pushUserToUserList } from '@/services/user-list/push.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'); const logger = queueLogger.createSubLogger('import-user-lists');

View file

@ -11,7 +11,7 @@ import { toPuny } from '@/misc/convert-host.js';
import { Cache } from '@/misc/cache.js'; import { Cache } from '@/misc/cache.js';
import { Instance } from '@/models/entities/instance.js'; import { Instance } from '@/models/entities/instance.js';
import { StatusError } from '@/misc/fetch.js'; import { StatusError } from '@/misc/fetch.js';
import { DeliverJobData } from '../types.js'; import { DeliverJobData } from '@/queue/types.js';
const logger = new Logger('deliver'); const logger = new Logger('deliver');

View file

@ -16,7 +16,7 @@ import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js';
import { StatusError } from '@/misc/fetch.js'; import { StatusError } from '@/misc/fetch.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { UserPublickey } from '@/models/entities/user-publickey.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'); const logger = new Logger('inbox');

View file

@ -3,7 +3,7 @@ import { MoreThan, Not, IsNull } from 'typeorm';
import { DriveFiles } from '@/models/index.js'; import { DriveFiles } from '@/models/index.js';
import { deleteFileSync } from '@/services/drive/delete-file.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'); const logger = queueLogger.createSubLogger('clean-remote-files');

View file

@ -2,7 +2,7 @@ import Bull from 'bull';
import { In } from 'typeorm'; import { In } from 'typeorm';
import { Mutings } from '@/models/index.js'; import { Mutings } from '@/models/index.js';
import { publishUserEvent } from '@/services/stream.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'); const logger = queueLogger.createSubLogger('check-expired-mutings');

View file

@ -1,7 +1,7 @@
import Bull from 'bull'; import Bull from 'bull';
import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js'; 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'); const logger = queueLogger.createSubLogger('clean-charts');

View file

@ -1,7 +1,7 @@
import Bull from 'bull'; import Bull from 'bull';
import { driveChart, notesChart, usersChart } from '@/services/chart/index.js'; 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'); const logger = queueLogger.createSubLogger('resync-charts');

View file

@ -1,7 +1,7 @@
import Bull from 'bull'; import Bull from 'bull';
import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js'; 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'); const logger = queueLogger.createSubLogger('tick-charts');

View file

@ -3,7 +3,7 @@ import config from '@/config/index.js';
import { getResponse, StatusError } from '@/misc/fetch.js'; import { getResponse, StatusError } from '@/misc/fetch.js';
import { Webhooks } from '@/models/index.js'; import { Webhooks } from '@/models/index.js';
import Logger from '@/services/logger.js'; import Logger from '@/services/logger.js';
import { WebhookDeliverJobData } from '../types.js'; import { WebhookDeliverJobData } from '@/queue/types.js';
const logger = new Logger('webhook'); const logger = new Logger('webhook');

View file

@ -1,8 +1,8 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import accept from '@/services/following/requests/accept.js'; import accept from '@/services/following/requests/accept.js';
import { relayAccepted } from '@/services/relay.js'; import { relayAccepted } from '@/services/relay.js';
import { IFollow } from '../../type.js'; import { IFollow } from '@/remote/activitypub/type.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<string> => { export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<string> => {
// ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある

View file

@ -1,7 +1,7 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { IAccept, isFollow, getApType } from '../../type.js'; import { IAccept, isFollow, getApType } from '@/remote/activitypub/type.js';
import acceptFollow from './follow.js'; import acceptFollow from './follow.js';
const logger = apLogger; const logger = apLogger;

View file

@ -1,7 +1,7 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { addPinned } from '@/services/i/pin.js'; import { addPinned } from '@/services/i/pin.js';
import { resolveNote } from '../../models/note.js'; import { resolveNote } from '@/remote/activitypub/models/note.js';
import { IAdd } from '../../type.js'; import { IAdd } from '@/remote/activitypub/type.js';
export default async (actor: CacheableRemoteUser, activity: IAdd): Promise<void> => { export default async (actor: CacheableRemoteUser, activity: IAdd): Promise<void> => {
if ('actor' in activity && actor.uri !== activity.actor) { if ('actor' in activity && actor.uri !== activity.actor) {

View file

@ -1,7 +1,7 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { IAnnounce, getApId } from '../../type.js'; import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
import announceNote from './note.js'; import announceNote from './note.js';
const logger = apLogger; const logger = apLogger;

View file

@ -5,11 +5,11 @@ import { fetchMeta } from '@/misc/fetch-meta.js';
import { getApLock } from '@/misc/app-lock.js'; import { getApLock } from '@/misc/app-lock.js';
import { StatusError } from '@/misc/fetch.js'; import { StatusError } from '@/misc/fetch.js';
import { Notes } from '@/models/index.js'; import { Notes } from '@/models/index.js';
import { parseAudience } from '../../audience.js'; import { parseAudience } from '@/remote/activitypub/audience.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
import { fetchNote, resolveNote } from '../../models/note.js'; import { fetchNote, resolveNote } from '@/remote/activitypub/models/note.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { IAnnounce, getApId } from '../../type.js'; import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
const logger = apLogger; const logger = apLogger;

View file

@ -1,8 +1,8 @@
import block from '@/services/blocking/create.js'; import block from '@/services/blocking/create.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { Users } from '@/models/index.js'; import { Users } from '@/models/index.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
import { IBlock } from '../../type.js'; import { IBlock } from '@/remote/activitypub/type.js';
export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<string> => { export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<string> => {
// ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず // ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず

View file

@ -2,9 +2,9 @@ import { CacheableRemoteUser } from '@/models/entities/user.js';
import { getApLock } from '@/misc/app-lock.js'; import { getApLock } from '@/misc/app-lock.js';
import { extractDbHost } from '@/misc/convert-host.js'; import { extractDbHost } from '@/misc/convert-host.js';
import { StatusError } from '@/misc/fetch.js'; import { StatusError } from '@/misc/fetch.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { createNote, fetchNote } from '../../models/note.js'; import { createNote, fetchNote } from '@/remote/activitypub/models/note.js';
import { getApId, IObject, ICreate } from '../../type.js'; import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js';
/** /**
* 稿 * 稿

View file

@ -1,7 +1,7 @@
import { createDeleteAccountJob } from '@/queue/index.js'; import { createDeleteAccountJob } from '@/queue/index.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { Users } from '@/models/index.js'; import { Users } from '@/models/index.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
const logger = apLogger; const logger = apLogger;

View file

@ -1,6 +1,6 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { toSingle } from '@/prelude/array.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 { deleteActor } from './actor.js';
import deleteNote from './note.js'; import deleteNote from './note.js';

View file

@ -2,8 +2,8 @@ import { CacheableRemoteUser } from '@/models/entities/user.js';
import deleteNode from '@/services/note/delete.js'; import deleteNode from '@/services/note/delete.js';
import { getApLock } from '@/misc/app-lock.js'; import { getApLock } from '@/misc/app-lock.js';
import { deleteMessage } from '@/services/messages/delete.js'; import { deleteMessage } from '@/services/messages/delete.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
const logger = apLogger; const logger = apLogger;

View file

@ -3,7 +3,7 @@ import config from '@/config/index.js';
import { genId } from '@/misc/gen-id.js'; import { genId } from '@/misc/gen-id.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { AbuseUserReports, Users } from '@/models/index.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<string> => { export default async (actor: CacheableRemoteUser, activity: IFlag): Promise<string> => {
// objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので // objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので

View file

@ -1,8 +1,8 @@
import unfollow from '@/services/following/delete.js'; import unfollow from '@/services/following/delete.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { Followings } from '@/models/index.js'; import { Followings } from '@/models/index.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
import { IAccept } from '../../type.js'; import { IAccept } from '@/remote/activitypub/type.js';
export default async (actor: CacheableRemoteUser, activity: IAccept): Promise<string> => { export default async (actor: CacheableRemoteUser, activity: IAccept): Promise<string> => {
const dbResolver = new DbResolver(); const dbResolver = new DbResolver();

View file

@ -1,7 +1,7 @@
import { Notes } from '@/models/index.js'; import { Notes } from '@/models/index.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import deleteNote from '@/services/note/delete.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<string> => { export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise<string> => {
const uri = getApId(activity); const uri = getApId(activity);

View file

@ -1,8 +1,8 @@
import unblock from '@/services/blocking/delete.js'; import unblock from '@/services/blocking/delete.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { Users } from '@/models/index.js'; import { Users } from '@/models/index.js';
import { IBlock } from '../../type.js'; import { IBlock } from '@/remote/activitypub/type.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<string> => { export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<string> => {
const dbResolver = new DbResolver(); const dbResolver = new DbResolver();

View file

@ -2,8 +2,8 @@ import unfollow from '@/services/following/delete.js';
import cancelRequest from '@/services/following/requests/cancel.js'; import cancelRequest from '@/services/following/requests/cancel.js';
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { FollowRequests, Followings } from '@/models/index.js'; import { FollowRequests, Followings } from '@/models/index.js';
import { IFollow } from '../../type.js'; import { IFollow } from '@/remote/activitypub/type.js';
import DbResolver from '../../db-resolver.js'; import DbResolver from '@/remote/activitypub/db-resolver.js';
export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<string> => { export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<string> => {
const dbResolver = new DbResolver(); const dbResolver = new DbResolver();

View file

@ -1,7 +1,7 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '../../type.js'; import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '@/remote/activitypub/type.js';
import unfollow from './follow.js'; import unfollow from './follow.js';
import unblock from './block.js'; import unblock from './block.js';
import undoLike from './like.js'; import undoLike from './like.js';

View file

@ -1,7 +1,7 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import deleteReaction from '@/services/note/reaction/delete.js'; import deleteReaction from '@/services/note/reaction/delete.js';
import { ILike, getApId } from '../../type.js'; import { ILike, getApId } from '@/remote/activitypub/type.js';
import { fetchNote } from '../../models/note.js'; import { fetchNote } from '@/remote/activitypub/models/note.js';
/** /**
* Process Undo.Like activity * Process Undo.Like activity

View file

@ -1,9 +1,9 @@
import { CacheableRemoteUser } from '@/models/entities/user.js'; import { CacheableRemoteUser } from '@/models/entities/user.js';
import { getApType, IUpdate, isActor } from '../../type.js'; import { getApType, IUpdate, isActor } from '@/remote/activitypub/type.js';
import { apLogger } from '../../logger.js'; import { apLogger } from '@/remote/activitypub/logger.js';
import { updateQuestion } from '../../models/question.js'; import { updateQuestion } from '@/remote/activitypub/models/question.js';
import Resolver from '../../resolver.js'; import Resolver from '@/remote/activitypub/resolver.js';
import { updatePerson } from '../../models/person.js'; import { updatePerson } from '@/remote/activitypub/models/person.js';
/** /**
* Updateアクティビティを捌きます * Updateアクティビティを捌きます

View file

@ -1,6 +1,6 @@
import { IObject } from '../type.js'; import { IObject } from '../type.js';
import { extractApHashtagObjects } from '../models/tag.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[]) { export function htmlToMfm(html: string, tag?: IObject | IObject[]) {
const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null); const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null);

View file

@ -25,7 +25,7 @@ import { publishInternalEvent } from '@/services/stream.js';
import { db } from '@/db/postgre.js'; import { db } from '@/db/postgre.js';
import { apLogger } from '../logger.js'; import { apLogger } from '../logger.js';
import { htmlToMfm } from '../misc/html-to-mfm.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 { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type.js';
import Resolver from '../resolver.js'; import Resolver from '../resolver.js';
import { extractApHashtags } from './tag.js'; import { extractApHashtags } from './tag.js';

View file

@ -1,7 +1,7 @@
import config from '@/config/index.js'; import config from '@/config/index.js';
import { getUserKeypair } from '@/misc/keypair-store.js'; import { getUserKeypair } from '@/misc/keypair-store.js';
import { User } from '@/models/entities/user.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'; import { createSignedPost, createSignedGet } from './ap-request.js';
export default async (user: { id: User['id'] }, url: string, object: any) => { export default async (user: { id: User['id'] }, url: string, object: any) => {

View file

@ -19,7 +19,7 @@ import { genIdenticon } from '@/misc/gen-identicon.js';
import { createTemp } from '@/misc/create-temp.js'; import { createTemp } from '@/misc/create-temp.js';
import { publishMainStream } from '@/services/stream.js'; import { publishMainStream } from '@/services/stream.js';
import * as Acct from '@/misc/acct.js'; import * as Acct from '@/misc/acct.js';
import { envOption } from '../env.js'; import { envOption } from '@/env.js';
import activityPub from './activitypub.js'; import activityPub from './activitypub.js';
import nodeinfo from './nodeinfo.js'; import nodeinfo from './nodeinfo.js';
import wellKnown from './well-known.js'; import wellKnown from './well-known.js';

View file

@ -8,7 +8,7 @@ import { genId } from '@/misc/gen-id.js';
import { UserKeypair } from '@/models/entities/user-keypair.js'; import { UserKeypair } from '@/models/entities/user-keypair.js';
import { UsedUsername } from '@/models/entities/used-username.js'; import { UsedUsername } from '@/models/entities/used-username.js';
import { db } from '@/db/postgre.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<User> { export async function createSystemUser(username: string): Promise<User> {
const password = uuid(); const password = uuid();

View file

@ -5,7 +5,7 @@ import { deliver } from '@/queue/index.js';
import { User } from '@/models/entities/user.js'; import { User } from '@/models/entities/user.js';
import { Blockings, FollowRequests, Users } from '@/models/index.js'; import { Blockings, FollowRequests, Users } from '@/models/index.js';
import { genId } from '@/misc/gen-id.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) { 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; if (follower.id === followee.id) return;

View file

@ -4,7 +4,7 @@ import { default as convertColor } from 'color-convert';
import { format as dateFormat } from 'date-fns'; import { format as dateFormat } from 'date-fns';
import * as SyslogPro from 'syslog-pro'; import * as SyslogPro from 'syslog-pro';
import config from '@/config/index.js'; import config from '@/config/index.js';
import { envOption } from '../env.js'; import { envOption } from '@/env.js';
type Domain = { type Domain = {
name: string; name: string;

View file

@ -4,7 +4,7 @@ import renderNote from '@/remote/activitypub/renderer/note.js';
import { Users, Notes } from '@/models/index.js'; import { Users, Notes } from '@/models/index.js';
import { Note } from '@/models/entities/note.js'; import { Note } from '@/models/entities/note.js';
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.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<void> { export async function deliverQuestionUpdate(noteId: Note['id']): Promise<void> {
const note = await Notes.findOneBy({ id: noteId }); const note = await Notes.findOneBy({ id: noteId });

View file

@ -4,7 +4,7 @@ import { CacheableUser } from '@/models/entities/user.js';
import { Note } from '@/models/entities/note.js'; import { Note } from '@/models/entities/note.js';
import { PollVotes, NoteWatchings, Polls, Blockings, NoteThreadMutings } from '@/models/index.js'; import { PollVotes, NoteWatchings, Polls, Blockings, NoteThreadMutings } from '@/models/index.js';
import { genId } from '@/misc/gen-id.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) { export default async function(user: CacheableUser, note: Note, choice: number) {
const poll = await Polls.findOneBy({ noteId: note.id }); const poll = await Polls.findOneBy({ noteId: note.id });

View file

@ -12,7 +12,7 @@ import { genId } from '@/misc/gen-id.js';
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
import { NoteReaction } from '@/models/entities/note-reaction.js'; import { NoteReaction } from '@/models/entities/note-reaction.js';
import { IdentifiableError } from '@/misc/identifiable-error.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'; import deleteReaction from './delete.js';
export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => { export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => {