diff --git a/index.js b/index.js index 9b91b0a03e..aa103e667e 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,13 @@ +/* +import * as fs from 'fs'; + +if (fs.existsSync('./built')) { + import('./built/index.js').then(built => built()); +} else { + console.log('Built code is not found. Probably an error occurred during a build or you just forgot to build.'); +} +*/ + const fs = require('fs'); if (fs.existsSync('./built')) { diff --git a/package.json b/package.json index 1f7d570f56..a871012a6c 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "main": "./index.js", "private": true, "scripts": { - "start": "node ./index.js", - "start:test": "cross-env NODE_ENV=test node ./index.js", + "start": "node --experimental-json-modules ./index.js", + "start:test": "cross-env NODE_ENV=test node --experimental-json-modules ./index.js", "init": "npm run migrate", "ormconfig": "node ./built/ormconfig.js", "migrate": "ts-node ./node_modules/typeorm/cli.js migration:run", diff --git a/src/argv.ts b/src/argv.ts index 8e00bcf47d..5d1aeb70a0 100644 --- a/src/argv.ts +++ b/src/argv.ts @@ -1,20 +1,19 @@ import { Command } from 'commander'; -import config from '@/config'; +import config from '@/config/index.js'; const program = new Command(); -program - .version(config.version) - .option('--no-daemons', 'Disable daemon processes (for debbuging)') - .option('--disable-clustering', 'Disable clustering') - .option('--only-server', 'Run server only (without job queue processing)') - .option('--only-queue', 'Pocessing job queue only (without server)') - .option('--quiet', 'Suppress all logs') - .option('--verbose', 'Enable all logs') - .option('--with-log-time', 'Include timestamp for each logs') - .option('--slow', 'Delay all requests (for debbuging)') - .option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.') - .parse(process.argv); +program.version(config.version); +program.option('--no-daemons', 'Disable daemon processes (for debbuging)'); +program.option('--disable-clustering', 'Disable clustering'); +program.option('--only-server', 'Run server only (without job queue processing)'); +program.option('--only-queue', 'Pocessing job queue only (without server)'); +program.option('--quiet', 'Suppress all logs'); +program.option('--verbose', 'Enable all logs'); +program.option('--with-log-time', 'Include timestamp for each logs'); +program.option('--slow', 'Delay all requests (for debbuging)'); +program.option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.'); +program.parse(process.argv); if (process.env.MK_ONLY_QUEUE) program.onlyQueue = true; if (process.env.NODE_ENV === 'test') program.disableClustering = true; diff --git a/src/boot/index.ts b/src/boot/index.ts index 602f6b0e48..091793e530 100644 --- a/src/boot/index.ts +++ b/src/boot/index.ts @@ -2,13 +2,13 @@ import * as cluster from 'cluster'; import * as chalk from 'chalk'; import Xev from 'xev'; -import Logger from '../services/logger'; -import { program } from '../argv'; +import Logger from '@/services/logger.js'; +import { program } from '../argv.js'; // for typeorm import 'reflect-metadata'; -import { masterMain } from './master'; -import { workerMain } from './worker'; +import { masterMain } from './master.js'; +import { workerMain } from './worker.js'; const logger = new Logger('core', 'cyan'); const clusterLogger = logger.createSubLogger('cluster', 'orange', false); diff --git a/src/boot/master.ts b/src/boot/master.ts index 473e215bac..93ef9a458b 100644 --- a/src/boot/master.ts +++ b/src/boot/master.ts @@ -5,14 +5,14 @@ import * as portscanner from 'portscanner'; import * as isRoot from 'is-root'; import { getConnection } from 'typeorm'; -import Logger from '../services/logger'; -import loadConfig from '@/config/load'; -import { Config } from '@/config/types'; -import { lessThan } from '../prelude/array'; -import { program } from '../argv'; -import { showMachineInfo } from '@/misc/show-machine-info'; -import { initDb } from '../db/postgre'; -const meta = require('../meta.json'); +import Logger from '@/services/logger.js'; +import loadConfig from '@/config/load.js'; +import { Config } from '@/config/types.js'; +import { lessThan } from '../prelude/array.js'; +import { program } from '../argv.js'; +import { showMachineInfo } from '@/misc/show-machine-info.js'; +import { initDb } from '../db/postgre.js'; +import * as meta from '../meta.json'; const logger = new Logger('core', 'cyan'); const bootLogger = logger.createSubLogger('boot', 'magenta', false); diff --git a/src/boot/worker.ts b/src/boot/worker.ts index 362fa3f26b..881e6c723d 100644 --- a/src/boot/worker.ts +++ b/src/boot/worker.ts @@ -1,5 +1,5 @@ import * as cluster from 'cluster'; -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; /** * Init worker process diff --git a/src/config/index.ts b/src/config/index.ts index 7bfdca4612..3e53b00036 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,3 +1,3 @@ -import load from './load'; +import load from './load.js'; export default load(); diff --git a/src/config/load.ts b/src/config/load.ts index 0929e80414..920efad4d6 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -3,14 +3,20 @@ */ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as yaml from 'js-yaml'; -import { Source, Mixin } from './types'; -const meta = require('../meta.json'); +import { Source, Mixin } from './types.js'; +import * as meta from '../meta.json'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); /** * Path of configuration directory */ -const dir = `${__dirname}/../../.config`; +const dir = `${_dirname}/../../.config`; /** * Path of configuration file diff --git a/src/daemons/janitor.ts b/src/daemons/janitor.ts index c079086427..2bffbc55d1 100644 --- a/src/daemons/janitor.ts +++ b/src/daemons/janitor.ts @@ -1,7 +1,7 @@ // TODO: 消したい const interval = 30 * 60 * 1000; -import { AttestationChallenges } from '../models'; +import { AttestationChallenges } from '@/models/index.js'; import { LessThan } from 'typeorm'; /** diff --git a/src/daemons/queue-stats.ts b/src/daemons/queue-stats.ts index 77f09b18d6..945bb1bd02 100644 --- a/src/daemons/queue-stats.ts +++ b/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ import Xev from 'xev'; -import { deliverQueue, inboxQueue } from '../queue/queues'; +import { deliverQueue, inboxQueue } from '../queue/queues.js'; const ev = new Xev(); diff --git a/src/db/elasticsearch.ts b/src/db/elasticsearch.ts index 58455b510d..b21685069c 100644 --- a/src/db/elasticsearch.ts +++ b/src/db/elasticsearch.ts @@ -1,5 +1,5 @@ import * as elasticsearch from '@elastic/elasticsearch'; -import config from '@/config'; +import config from '@/config/index.js'; const index = { settings: { diff --git a/src/db/logger.ts b/src/db/logger.ts index 1f702c18e2..22f4c6b1b0 100644 --- a/src/db/logger.ts +++ b/src/db/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const dbLogger = new Logger('db'); diff --git a/src/db/postgre.ts b/src/db/postgre.ts index bc691319cf..881f1e4da3 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -3,75 +3,75 @@ const types = require('pg').types; types.setTypeParser(20, Number); import { createConnection, Logger, getConnection } from 'typeorm'; -import config from '@/config'; -import { entities as charts } from '../services/chart/entities'; -import { dbLogger } from './logger'; +import config from '@/config/index.js'; +import { entities as charts } from '@/services/chart/entities.js'; +import { dbLogger } from './logger.js'; import * as highlight from 'cli-highlight'; -import { Log } from '../models/entities/log'; -import { User } from '../models/entities/user'; -import { DriveFile } from '../models/entities/drive-file'; -import { DriveFolder } from '../models/entities/drive-folder'; -import { AccessToken } from '../models/entities/access-token'; -import { App } from '../models/entities/app'; -import { PollVote } from '../models/entities/poll-vote'; -import { Note } from '../models/entities/note'; -import { NoteReaction } from '../models/entities/note-reaction'; -import { NoteWatching } from '../models/entities/note-watching'; -import { NoteUnread } from '../models/entities/note-unread'; -import { Notification } from '../models/entities/notification'; -import { Meta } from '../models/entities/meta'; -import { Following } from '../models/entities/following'; -import { Instance } from '../models/entities/instance'; -import { Muting } from '../models/entities/muting'; -import { SwSubscription } from '../models/entities/sw-subscription'; -import { Blocking } from '../models/entities/blocking'; -import { UserList } from '../models/entities/user-list'; -import { UserListJoining } from '../models/entities/user-list-joining'; -import { UserGroup } from '../models/entities/user-group'; -import { UserGroupJoining } from '../models/entities/user-group-joining'; -import { UserGroupInvitation } from '../models/entities/user-group-invitation'; -import { Hashtag } from '../models/entities/hashtag'; -import { NoteFavorite } from '../models/entities/note-favorite'; -import { AbuseUserReport } from '../models/entities/abuse-user-report'; -import { RegistrationTicket } from '../models/entities/registration-tickets'; -import { MessagingMessage } from '../models/entities/messaging-message'; -import { Signin } from '../models/entities/signin'; -import { AuthSession } from '../models/entities/auth-session'; -import { FollowRequest } from '../models/entities/follow-request'; -import { Emoji } from '../models/entities/emoji'; -import { ReversiGame } from '../models/entities/games/reversi/game'; -import { ReversiMatching } from '../models/entities/games/reversi/matching'; -import { UserNotePining } from '../models/entities/user-note-pining'; -import { Poll } from '../models/entities/poll'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { UserPublickey } from '../models/entities/user-publickey'; -import { UserProfile } from '../models/entities/user-profile'; -import { UserSecurityKey } from '../models/entities/user-security-key'; -import { AttestationChallenge } from '../models/entities/attestation-challenge'; -import { Page } from '../models/entities/page'; -import { PageLike } from '../models/entities/page-like'; -import { GalleryPost } from '../models/entities/gallery-post'; -import { GalleryLike } from '../models/entities/gallery-like'; -import { ModerationLog } from '../models/entities/moderation-log'; -import { UsedUsername } from '../models/entities/used-username'; -import { Announcement } from '../models/entities/announcement'; -import { AnnouncementRead } from '../models/entities/announcement-read'; -import { Clip } from '../models/entities/clip'; -import { ClipNote } from '../models/entities/clip-note'; -import { Antenna } from '../models/entities/antenna'; -import { AntennaNote } from '../models/entities/antenna-note'; -import { PromoNote } from '../models/entities/promo-note'; -import { PromoRead } from '../models/entities/promo-read'; -import { program } from '../argv'; -import { Relay } from '../models/entities/relay'; -import { MutedNote } from '../models/entities/muted-note'; -import { Channel } from '../models/entities/channel'; -import { ChannelFollowing } from '../models/entities/channel-following'; -import { ChannelNotePining } from '../models/entities/channel-note-pining'; -import { RegistryItem } from '../models/entities/registry-item'; -import { Ad } from '../models/entities/ad'; -import { PasswordResetRequest } from '@/models/entities/password-reset-request'; +import { Log } from '@/models/entities/log.js'; +import { User } from '@/models/entities/user.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFolder } from '@/models/entities/drive-folder.js'; +import { AccessToken } from '@/models/entities/access-token.js'; +import { App } from '@/models/entities/app.js'; +import { PollVote } from '@/models/entities/poll-vote.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; +import { NoteWatching } from '@/models/entities/note-watching.js'; +import { NoteUnread } from '@/models/entities/note-unread.js'; +import { Notification } from '@/models/entities/notification.js'; +import { Meta } from '@/models/entities/meta.js'; +import { Following } from '@/models/entities/following.js'; +import { Instance } from '@/models/entities/instance.js'; +import { Muting } from '@/models/entities/muting.js'; +import { SwSubscription } from '@/models/entities/sw-subscription.js'; +import { Blocking } from '@/models/entities/blocking.js'; +import { UserList } from '@/models/entities/user-list.js'; +import { UserListJoining } from '@/models/entities/user-list-joining.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { UserGroupJoining } from '@/models/entities/user-group-joining.js'; +import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js'; +import { Hashtag } from '@/models/entities/hashtag.js'; +import { NoteFavorite } from '@/models/entities/note-favorite.js'; +import { AbuseUserReport } from '@/models/entities/abuse-user-report.js'; +import { RegistrationTicket } from '@/models/entities/registration-tickets.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { Signin } from '@/models/entities/signin.js'; +import { AuthSession } from '@/models/entities/auth-session.js'; +import { FollowRequest } from '@/models/entities/follow-request.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiMatching } from '@/models/entities/games/reversi/matching.js'; +import { UserNotePining } from '@/models/entities/user-note-pining.js'; +import { Poll } from '@/models/entities/poll.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { UserPublickey } from '@/models/entities/user-publickey.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; +import { UserSecurityKey } from '@/models/entities/user-security-key.js'; +import { AttestationChallenge } from '@/models/entities/attestation-challenge.js'; +import { Page } from '@/models/entities/page.js'; +import { PageLike } from '@/models/entities/page-like.js'; +import { GalleryPost } from '@/models/entities/gallery-post.js'; +import { GalleryLike } from '@/models/entities/gallery-like.js'; +import { ModerationLog } from '@/models/entities/moderation-log.js'; +import { UsedUsername } from '@/models/entities/used-username.js'; +import { Announcement } from '@/models/entities/announcement.js'; +import { AnnouncementRead } from '@/models/entities/announcement-read.js'; +import { Clip } from '@/models/entities/clip.js'; +import { ClipNote } from '@/models/entities/clip-note.js'; +import { Antenna } from '@/models/entities/antenna.js'; +import { AntennaNote } from '@/models/entities/antenna-note.js'; +import { PromoNote } from '@/models/entities/promo-note.js'; +import { PromoRead } from '@/models/entities/promo-read.js'; +import { program } from '../argv.js'; +import { Relay } from '@/models/entities/relay.js'; +import { MutedNote } from '@/models/entities/muted-note.js'; +import { Channel } from '@/models/entities/channel.js'; +import { ChannelFollowing } from '@/models/entities/channel-following.js'; +import { ChannelNotePining } from '@/models/entities/channel-note-pining.js'; +import { RegistryItem } from '@/models/entities/registry-item.js'; +import { Ad } from '@/models/entities/ad.js'; +import { PasswordResetRequest } from '@/models/entities/password-reset-request.js'; const sqlLogger = dbLogger.createSubLogger('sql', 'white', false); diff --git a/src/db/redis.ts b/src/db/redis.ts index a10422846f..97500e02b3 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -1,5 +1,5 @@ import * as redis from 'redis'; -import config from '@/config'; +import config from '@/config/index.js'; export function createConnection() { return redis.createClient( diff --git a/src/index.ts b/src/index.ts index c4a1088c2e..7c131b2618 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ Error.stackTraceLimit = Infinity; require('events').EventEmitter.defaultMaxListeners = 128; -import boot from './boot'; +import boot from './boot/index.js'; export default function() { return boot(); diff --git a/src/mfm/to-html.ts b/src/mfm/to-html.ts index aa39443c64..6ce7d35efa 100644 --- a/src/mfm/to-html.ts +++ b/src/mfm/to-html.ts @@ -1,9 +1,9 @@ import { JSDOM } from 'jsdom'; import * as mfm from 'mfm-js'; -import config from '@/config'; -import { intersperse } from '../prelude/array'; -import { IMentionedRemoteUsers } from '../models/entities/note'; -import { wellKnownServices } from '../well-known-services'; +import config from '@/config/index.js'; +import { intersperse } from '../prelude/array.js'; +import { IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { wellKnownServices } from '../well-known-services.js'; export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) { if (nodes == null) { diff --git a/src/misc/antenna-cache.ts b/src/misc/antenna-cache.ts index 6be1c18db5..dcf96c1610 100644 --- a/src/misc/antenna-cache.ts +++ b/src/misc/antenna-cache.ts @@ -1,6 +1,6 @@ -import { Antennas } from '../models'; -import { Antenna } from '../models/entities/antenna'; -import { subsdcriber } from '../db/redis'; +import { Antennas } from '@/models/index.js'; +import { Antenna } from '@/models/entities/antenna.js'; +import { subsdcriber } from '../db/redis.js'; let antennasFetched = false; let antennas: Antenna[] = []; diff --git a/src/misc/app-lock.ts b/src/misc/app-lock.ts index 9ae2cba478..52ac680715 100644 --- a/src/misc/app-lock.ts +++ b/src/misc/app-lock.ts @@ -1,5 +1,6 @@ -import { redisClient } from '../db/redis'; +import { redisClient } from '../db/redis.js'; import { promisify } from 'util'; +import * as redisLock from 'redis-lock'; /** * Retry delay (ms) for lock acquisition @@ -8,7 +9,7 @@ const retryDelay = 100; const lock: (key: string, timeout?: number) => Promise<() => void> = redisClient - ? promisify(require('redis-lock')(redisClient, retryDelay)) + ? promisify(redisLock(redisClient, retryDelay)) : async () => () => { }; /** diff --git a/src/misc/captcha.ts b/src/misc/captcha.ts index 727c86af0f..4623565c3c 100644 --- a/src/misc/captcha.ts +++ b/src/misc/captcha.ts @@ -1,7 +1,7 @@ import fetch from 'node-fetch'; import { URLSearchParams } from 'url'; -import { getAgentByUrl } from './fetch'; -import config from '@/config'; +import { getAgentByUrl } from './fetch.js'; +import config from '@/config/index.js'; export async function verifyRecaptcha(secret: string, response: string) { const result = await getCaptchaResponse('https://www.recaptcha.net/recaptcha/api/siteverify', secret, response).catch(e => { diff --git a/src/misc/check-hit-antenna.ts b/src/misc/check-hit-antenna.ts index 3dfcb54c49..fdba66b640 100644 --- a/src/misc/check-hit-antenna.ts +++ b/src/misc/check-hit-antenna.ts @@ -1,10 +1,10 @@ -import { Antenna } from '../models/entities/antenna'; -import { Note } from '../models/entities/note'; -import { User } from '../models/entities/user'; -import { UserListJoinings, UserGroupJoinings } from '../models'; -import { getFullApAccount } from './convert-host'; -import { PackedNote } from '../models/repositories/note'; -import { parseAcct } from '@/misc/acct'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { UserListJoinings, UserGroupJoinings } from '@/models/index.js'; +import { getFullApAccount } from './convert-host.js'; +import { PackedNote } from '../models/repositories/note.js'; +import { parseAcct } from '@/misc/acct.js'; /** * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい diff --git a/src/misc/check-word-mute.ts b/src/misc/check-word-mute.ts index 5af267d75d..f12e552ebd 100644 --- a/src/misc/check-word-mute.ts +++ b/src/misc/check-word-mute.ts @@ -1,6 +1,6 @@ const RE2 = require('re2'); -import { Note } from '../models/entities/note'; -import { User } from '../models/entities/user'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; type NoteLike = { userId: Note['userId']; diff --git a/src/misc/convert-host.ts b/src/misc/convert-host.ts index 7b0b0acf10..2e705cb6b1 100644 --- a/src/misc/convert-host.ts +++ b/src/misc/convert-host.ts @@ -1,5 +1,5 @@ import { URL } from 'url'; -import config from '@/config'; +import config from '@/config/index.js'; import { toASCII } from 'punycode/'; export function getFullApAccount(username: string, host: string | null) { diff --git a/src/misc/count-same-renotes.ts b/src/misc/count-same-renotes.ts index bc1072080a..b7f8ce90c8 100644 --- a/src/misc/count-same-renotes.ts +++ b/src/misc/count-same-renotes.ts @@ -1,4 +1,4 @@ -import { Notes } from '../models'; +import { Notes } from '@/models/index.js'; export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise { // 指定したユーザーの指定したノートのリノートがいくつあるか数える diff --git a/src/misc/detect-url-mime.ts b/src/misc/detect-url-mime.ts index 274c291737..cd143cf2fb 100644 --- a/src/misc/detect-url-mime.ts +++ b/src/misc/detect-url-mime.ts @@ -1,6 +1,6 @@ -import { createTemp } from './create-temp'; -import { downloadUrl } from './download-url'; -import { detectType } from './get-file-info'; +import { createTemp } from './create-temp.js'; +import { downloadUrl } from './download-url.js'; +import { detectType } from './get-file-info.js'; export async function detectUrlMime(url: string) { const [path, cleanup] = await createTemp(); diff --git a/src/misc/download-text-file.ts b/src/misc/download-text-file.ts index d6fd17fc13..745604c19c 100644 --- a/src/misc/download-text-file.ts +++ b/src/misc/download-text-file.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as util from 'util'; -import Logger from '../services/logger'; -import { createTemp } from './create-temp'; -import { downloadUrl } from './download-url'; +import Logger from '@/services/logger.js'; +import { createTemp } from './create-temp.js'; +import { downloadUrl } from './download-url.js'; const logger = new Logger('download-text-file'); diff --git a/src/misc/download-url.ts b/src/misc/download-url.ts index dafeff6fc8..f01f34e6db 100644 --- a/src/misc/download-url.ts +++ b/src/misc/download-url.ts @@ -3,11 +3,11 @@ import * as stream from 'stream'; import * as util from 'util'; import { URL } from 'url'; import fetch from 'node-fetch'; -import { getAgentByUrl } from './fetch'; +import { getAgentByUrl } from './fetch.js'; import { AbortController } from 'abort-controller'; -import config from '@/config'; +import config from '@/config/index.js'; import * as chalk from 'chalk'; -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; const pipeline = util.promisify(stream.pipeline); diff --git a/src/misc/extract-custom-emojis-from-mfm.ts b/src/misc/extract-custom-emojis-from-mfm.ts index b29ce281b3..a0319d8dd5 100644 --- a/src/misc/extract-custom-emojis-from-mfm.ts +++ b/src/misc/extract-custom-emojis-from-mfm.ts @@ -1,5 +1,5 @@ import * as mfm from 'mfm-js'; -import { unique } from '@/prelude/array'; +import { unique } from '@/prelude/array.js'; export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { const emojiNodes = mfm.extract(nodes, (node) => { diff --git a/src/misc/extract-hashtags.ts b/src/misc/extract-hashtags.ts index b0a74df219..0b0418eefd 100644 --- a/src/misc/extract-hashtags.ts +++ b/src/misc/extract-hashtags.ts @@ -1,5 +1,5 @@ import * as mfm from 'mfm-js'; -import { unique } from '@/prelude/array'; +import { unique } from '@/prelude/array.js'; export function extractHashtags(nodes: mfm.MfmNode[]): string[] { const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag'); diff --git a/src/misc/fetch-meta.ts b/src/misc/fetch-meta.ts index e7a945dc9e..3d7e69f2da 100644 --- a/src/misc/fetch-meta.ts +++ b/src/misc/fetch-meta.ts @@ -1,4 +1,4 @@ -import { Meta } from '../models/entities/meta'; +import { Meta } from '@/models/entities/meta.js'; import { getConnection } from 'typeorm'; let cache: Meta; diff --git a/src/misc/fetch-proxy-account.ts b/src/misc/fetch-proxy-account.ts index 537edf2891..ed8a4c794d 100644 --- a/src/misc/fetch-proxy-account.ts +++ b/src/misc/fetch-proxy-account.ts @@ -1,6 +1,6 @@ -import { fetchMeta } from './fetch-meta'; -import { ILocalUser } from '../models/entities/user'; -import { Users } from '../models'; +import { fetchMeta } from './fetch-meta.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export async function fetchProxyAccount(): Promise { const meta = await fetchMeta(); diff --git a/src/misc/fetch.ts b/src/misc/fetch.ts index f7756f9256..11e8a69205 100644 --- a/src/misc/fetch.ts +++ b/src/misc/fetch.ts @@ -3,7 +3,7 @@ import * as https from 'https'; import CacheableLookup from 'cacheable-lookup'; import fetch, { HeadersInit } from 'node-fetch'; import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'; -import config from '@/config'; +import config from '@/config/index.js'; import { URL } from 'url'; export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: HeadersInit) { diff --git a/src/misc/gen-avatar.ts b/src/misc/gen-avatar.ts index 7ff28b2e88..f03ca9f96d 100644 --- a/src/misc/gen-avatar.ts +++ b/src/misc/gen-avatar.ts @@ -2,7 +2,7 @@ * Random avatar generator */ -const p = require('pureimage'); +import * as p from 'pureimage'; import * as gen from 'random-seed'; import { WriteStream } from 'fs'; diff --git a/src/misc/gen-id.ts b/src/misc/gen-id.ts index 8e7e0b6113..fcf476857f 100644 --- a/src/misc/gen-id.ts +++ b/src/misc/gen-id.ts @@ -1,9 +1,9 @@ import { ulid } from 'ulid'; -import { genAid } from './id/aid'; -import { genMeid } from './id/meid'; -import { genMeidg } from './id/meidg'; -import { genObjectId } from './id/object-id'; -import config from '@/config'; +import { genAid } from './id/aid.js'; +import { genMeid } from './id/meid.js'; +import { genMeidg } from './id/meidg.js'; +import { genObjectId } from './id/object-id.js'; +import config from '@/config/index.js'; const metohd = config.id.toLowerCase(); diff --git a/src/misc/get-user-name.ts b/src/misc/get-user-name.ts index b6b45118b0..805dbba529 100644 --- a/src/misc/get-user-name.ts +++ b/src/misc/get-user-name.ts @@ -1,4 +1,4 @@ -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; export default function(user: User): string { return user.name || user.username; diff --git a/src/misc/is-quote.ts b/src/misc/is-quote.ts index 0a2a72f4a0..779f548b03 100644 --- a/src/misc/is-quote.ts +++ b/src/misc/is-quote.ts @@ -1,4 +1,4 @@ -import { Note } from '../models/entities/note'; +import { Note } from '@/models/entities/note.js'; export default function(note: Note): boolean { return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0)); diff --git a/src/misc/keypair-store.ts b/src/misc/keypair-store.ts index c78fdd7555..3d505c0abb 100644 --- a/src/misc/keypair-store.ts +++ b/src/misc/keypair-store.ts @@ -1,7 +1,7 @@ -import { UserKeypairs } from '../models'; -import { User } from '../models/entities/user'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { Cache } from './cache'; +import { UserKeypairs } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { Cache } from './cache.js'; const cache = new Cache(Infinity); diff --git a/src/misc/license.ts b/src/misc/license.ts index d36af665cd..8b12923ca1 100644 --- a/src/misc/license.ts +++ b/src/misc/license.ts @@ -1,6 +1,12 @@ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; -const license = fs.readFileSync(__dirname + '/../../LICENSE', 'utf-8'); +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); + +const license = fs.readFileSync(_dirname + '/../../LICENSE', 'utf-8'); const licenseHtml = license .replace(/\r\n/g, '\n') diff --git a/src/misc/populate-emojis.ts b/src/misc/populate-emojis.ts index 42aaaf0705..e1ec87a95b 100644 --- a/src/misc/populate-emojis.ts +++ b/src/misc/populate-emojis.ts @@ -1,12 +1,12 @@ import { In } from 'typeorm'; -import { Emojis } from '../models'; -import { Emoji } from '../models/entities/emoji'; -import { Note } from '../models/entities/note'; -import { Cache } from './cache'; -import { isSelfHost, toPunyNullable } from './convert-host'; -import { decodeReaction } from './reaction-lib'; -import config from '@/config'; -import { query } from '@/prelude/url'; +import { Emojis } from '@/models/index.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { Note } from '@/models/entities/note.js'; +import { Cache } from './cache.js'; +import { isSelfHost, toPunyNullable } from './convert-host.js'; +import { decodeReaction } from './reaction-lib.js'; +import config from '@/config/index.js'; +import { query } from '@/prelude/url.js'; const cache = new Cache(1000 * 60 * 60 * 12); diff --git a/src/misc/reaction-lib.ts b/src/misc/reaction-lib.ts index b393154d9c..beff1b32bc 100644 --- a/src/misc/reaction-lib.ts +++ b/src/misc/reaction-lib.ts @@ -1,7 +1,7 @@ -import { emojiRegex } from './emoji-regex'; -import { fetchMeta } from './fetch-meta'; -import { Emojis } from '../models'; -import { toPunyNullable } from './convert-host'; +import { emojiRegex } from './emoji-regex.js'; +import { fetchMeta } from './fetch-meta.js'; +import { Emojis } from '@/models/index.js'; +import { toPunyNullable } from './convert-host.js'; const legacies: Record = { 'like': '👍', diff --git a/src/misc/show-machine-info.ts b/src/misc/show-machine-info.ts index 2aae019be2..5ce466af26 100644 --- a/src/misc/show-machine-info.ts +++ b/src/misc/show-machine-info.ts @@ -1,6 +1,6 @@ import * as os from 'os'; import * as sysUtils from 'systeminformation'; -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export async function showMachineInfo(parentLogger: Logger) { const logger = parentLogger.createSubLogger('machine'); diff --git a/src/models/entities/abuse-user-report.ts b/src/models/entities/abuse-user-report.ts index c0cff139f6..cb13921222 100644 --- a/src/models/entities/abuse-user-report.ts +++ b/src/models/entities/abuse-user-report.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class AbuseUserReport { diff --git a/src/models/entities/access-token.ts b/src/models/entities/access-token.ts index 5f41b3c1fc..c2d034af87 100644 --- a/src/models/entities/access-token.ts +++ b/src/models/entities/access-token.ts @@ -1,7 +1,7 @@ import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { App } from './app'; -import { id } from '../id'; +import { User } from './user.js'; +import { App } from './app.js'; +import { id } from '../id.js'; @Entity() export class AccessToken { diff --git a/src/models/entities/ad.ts b/src/models/entities/ad.ts index b2fc04c4f0..1b0cfa06d3 100644 --- a/src/models/entities/ad.ts +++ b/src/models/entities/ad.ts @@ -1,5 +1,5 @@ import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Ad { diff --git a/src/models/entities/announcement-read.ts b/src/models/entities/announcement-read.ts index 892beb826f..56ee2e6905 100644 --- a/src/models/entities/announcement-read.ts +++ b/src/models/entities/announcement-read.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Announcement } from './announcement'; -import { id } from '../id'; +import { User } from './user.js'; +import { Announcement } from './announcement.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'announcementId'], { unique: true }) diff --git a/src/models/entities/announcement.ts b/src/models/entities/announcement.ts index 06d379c229..1569ca89c7 100644 --- a/src/models/entities/announcement.ts +++ b/src/models/entities/announcement.ts @@ -1,5 +1,5 @@ import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Announcement { diff --git a/src/models/entities/antenna-note.ts b/src/models/entities/antenna-note.ts index 9b911524ef..ecf2973919 100644 --- a/src/models/entities/antenna-note.ts +++ b/src/models/entities/antenna-note.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { Antenna } from './antenna'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Antenna } from './antenna.js'; +import { id } from '../id.js'; @Entity() @Index(['noteId', 'antennaId'], { unique: true }) diff --git a/src/models/entities/antenna.ts b/src/models/entities/antenna.ts index bcfe09a829..5dc814e1d5 100644 --- a/src/models/entities/antenna.ts +++ b/src/models/entities/antenna.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { UserList } from './user-list'; -import { UserGroupJoining } from './user-group-joining'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { UserList } from './user-list.js'; +import { UserGroupJoining } from './user-group-joining.js'; @Entity() export class Antenna { diff --git a/src/models/entities/app.ts b/src/models/entities/app.ts index ea87546311..c3a6a0a107 100644 --- a/src/models/entities/app.ts +++ b/src/models/entities/app.ts @@ -1,6 +1,6 @@ import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class App { diff --git a/src/models/entities/attestation-challenge.ts b/src/models/entities/attestation-challenge.ts index 942747c02f..26a212e0c6 100644 --- a/src/models/entities/attestation-challenge.ts +++ b/src/models/entities/attestation-challenge.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class AttestationChallenge { diff --git a/src/models/entities/auth-session.ts b/src/models/entities/auth-session.ts index 4eec27e3f6..f0480abcc6 100644 --- a/src/models/entities/auth-session.ts +++ b/src/models/entities/auth-session.ts @@ -1,7 +1,7 @@ import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { App } from './app'; -import { id } from '../id'; +import { User } from './user.js'; +import { App } from './app.js'; +import { id } from '../id.js'; @Entity() export class AuthSession { diff --git a/src/models/entities/blocking.ts b/src/models/entities/blocking.ts index 48487cb086..2fff80cfc1 100644 --- a/src/models/entities/blocking.ts +++ b/src/models/entities/blocking.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['blockerId', 'blockeeId'], { unique: true }) diff --git a/src/models/entities/channel-following.ts b/src/models/entities/channel-following.ts index fca801e5ab..6e5c9cba04 100644 --- a/src/models/entities/channel-following.ts +++ b/src/models/entities/channel-following.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Channel } from './channel.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/channel-note-pining.ts b/src/models/entities/channel-note-pining.ts index 26a7eb501f..751af4a183 100644 --- a/src/models/entities/channel-note-pining.ts +++ b/src/models/entities/channel-note-pining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { Channel } from './channel'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Channel } from './channel.js'; +import { id } from '../id.js'; @Entity() @Index(['channelId', 'noteId'], { unique: true }) diff --git a/src/models/entities/channel.ts b/src/models/entities/channel.ts index f2d713612d..adf937c0b4 100644 --- a/src/models/entities/channel.ts +++ b/src/models/entities/channel.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() export class Channel { diff --git a/src/models/entities/clip-note.ts b/src/models/entities/clip-note.ts index 7d96b2ef7a..41d92b0c74 100644 --- a/src/models/entities/clip-note.ts +++ b/src/models/entities/clip-note.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { Clip } from './clip'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Clip } from './clip.js'; +import { id } from '../id.js'; @Entity() @Index(['noteId', 'clipId'], { unique: true }) diff --git a/src/models/entities/clip.ts b/src/models/entities/clip.ts index 66b5b8847e..1cdf4c52eb 100644 --- a/src/models/entities/clip.ts +++ b/src/models/entities/clip.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Clip { diff --git a/src/models/entities/drive-file.ts b/src/models/entities/drive-file.ts index 698dfac222..41d68a1334 100644 --- a/src/models/entities/drive-file.ts +++ b/src/models/entities/drive-file.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFolder } from './drive-folder'; -import { id } from '../id'; +import { User } from './user.js'; +import { DriveFolder } from './drive-folder.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'folderId', 'id']) diff --git a/src/models/entities/drive-folder.ts b/src/models/entities/drive-folder.ts index a80d075855..f137dd5c6a 100644 --- a/src/models/entities/drive-folder.ts +++ b/src/models/entities/drive-folder.ts @@ -1,6 +1,6 @@ import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class DriveFolder { diff --git a/src/models/entities/emoji.ts b/src/models/entities/emoji.ts index d6080ae099..3da4c6b416 100644 --- a/src/models/entities/emoji.ts +++ b/src/models/entities/emoji.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() @Index(['name', 'host'], { unique: true }) diff --git a/src/models/entities/follow-request.ts b/src/models/entities/follow-request.ts index 22ec263962..e661c9933a 100644 --- a/src/models/entities/follow-request.ts +++ b/src/models/entities/follow-request.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/following.ts b/src/models/entities/following.ts index ee3286a1a1..5f9b548dab 100644 --- a/src/models/entities/following.ts +++ b/src/models/entities/following.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/gallery-like.ts b/src/models/entities/gallery-like.ts index 7d084a2275..f1610b8aae 100644 --- a/src/models/entities/gallery-like.ts +++ b/src/models/entities/gallery-like.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { GalleryPost } from './gallery-post'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { GalleryPost } from './gallery-post.js'; @Entity() @Index(['userId', 'postId'], { unique: true }) diff --git a/src/models/entities/gallery-post.ts b/src/models/entities/gallery-post.ts index f59cd671f3..cc4ed640a4 100644 --- a/src/models/entities/gallery-post.ts +++ b/src/models/entities/gallery-post.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() export class GalleryPost { diff --git a/src/models/entities/games/reversi/game.ts b/src/models/entities/games/reversi/game.ts index 9deacaf5c6..b63c72e9fb 100644 --- a/src/models/entities/games/reversi/game.ts +++ b/src/models/entities/games/reversi/game.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from '../../user'; -import { id } from '../../../id'; +import { User } from '../../user.js'; +import { id } from '../../../id.js'; @Entity() export class ReversiGame { diff --git a/src/models/entities/games/reversi/matching.ts b/src/models/entities/games/reversi/matching.ts index 477a29316e..690a080b2b 100644 --- a/src/models/entities/games/reversi/matching.ts +++ b/src/models/entities/games/reversi/matching.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from '../../user'; -import { id } from '../../../id'; +import { User } from '../../user.js'; +import { id } from '../../../id.js'; @Entity() export class ReversiMatching { diff --git a/src/models/entities/hashtag.ts b/src/models/entities/hashtag.ts index 842cdaa562..b99ac80b58 100644 --- a/src/models/entities/hashtag.ts +++ b/src/models/entities/hashtag.ts @@ -1,6 +1,6 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Hashtag { diff --git a/src/models/entities/instance.ts b/src/models/entities/instance.ts index 7c8719e06a..f4637096fa 100644 --- a/src/models/entities/instance.ts +++ b/src/models/entities/instance.ts @@ -1,5 +1,5 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Instance { diff --git a/src/models/entities/log.ts b/src/models/entities/log.ts index 182a9fbed8..17c5cba7d6 100644 --- a/src/models/entities/log.ts +++ b/src/models/entities/log.ts @@ -1,5 +1,5 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Log { diff --git a/src/models/entities/messaging-message.ts b/src/models/entities/messaging-message.ts index ac0764674c..04a1637f44 100644 --- a/src/models/entities/messaging-message.ts +++ b/src/models/entities/messaging-message.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; -import { UserGroup } from './user-group'; +import { User } from './user.js'; +import { DriveFile } from './drive-file.js'; +import { id } from '../id.js'; +import { UserGroup } from './user-group.js'; @Entity() export class MessagingMessage { diff --git a/src/models/entities/meta.ts b/src/models/entities/meta.ts index 2a0632c87c..a03891622d 100644 --- a/src/models/entities/meta.ts +++ b/src/models/entities/meta.ts @@ -1,7 +1,7 @@ import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Clip } from './clip'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Clip } from './clip.js'; @Entity() export class Meta { diff --git a/src/models/entities/moderation-log.ts b/src/models/entities/moderation-log.ts index 33d3d683ae..d96b63f523 100644 --- a/src/models/entities/moderation-log.ts +++ b/src/models/entities/moderation-log.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class ModerationLog { diff --git a/src/models/entities/muted-note.ts b/src/models/entities/muted-note.ts index 521876688c..07763b2dbf 100644 --- a/src/models/entities/muted-note.ts +++ b/src/models/entities/muted-note.ts @@ -1,8 +1,8 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; -import { mutedNoteReasons } from '../../types'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { mutedNoteReasons } from '../../types.js'; @Entity() @Index(['noteId', 'userId'], { unique: true }) diff --git a/src/models/entities/muting.ts b/src/models/entities/muting.ts index 0084213bcc..9c9134949f 100644 --- a/src/models/entities/muting.ts +++ b/src/models/entities/muting.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['muterId', 'muteeId'], { unique: true }) diff --git a/src/models/entities/note-favorite.ts b/src/models/entities/note-favorite.ts index 0713c3ae56..54792d225b 100644 --- a/src/models/entities/note-favorite.ts +++ b/src/models/entities/note-favorite.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-reaction.ts b/src/models/entities/note-reaction.ts index 674dc3639e..5bca5c3d36 100644 --- a/src/models/entities/note-reaction.ts +++ b/src/models/entities/note-reaction.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-unread.ts b/src/models/entities/note-unread.ts index 57dda4fafd..5a88c7f7d5 100644 --- a/src/models/entities/note-unread.ts +++ b/src/models/entities/note-unread.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; +import { Channel } from './channel.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-watching.ts b/src/models/entities/note-watching.ts index 741a1c0c8b..458fac3a40 100644 --- a/src/models/entities/note-watching.ts +++ b/src/models/entities/note-watching.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts index 9a85532637..74d69de13c 100644 --- a/src/models/entities/note.ts +++ b/src/models/entities/note.ts @@ -1,9 +1,9 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; -import { noteVisibilities } from '../../types'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { DriveFile } from './drive-file.js'; +import { id } from '../id.js'; +import { noteVisibilities } from '../../types.js'; +import { Channel } from './channel.js'; @Entity() @Index('IDX_NOTE_TAGS', { synchronize: false }) diff --git a/src/models/entities/notification.ts b/src/models/entities/notification.ts index 988fdb341f..1114910a80 100644 --- a/src/models/entities/notification.ts +++ b/src/models/entities/notification.ts @@ -1,11 +1,11 @@ import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Note } from './note'; -import { FollowRequest } from './follow-request'; -import { UserGroupInvitation } from './user-group-invitation'; -import { AccessToken } from './access-token'; -import { notificationTypes } from '../../types'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Note } from './note.js'; +import { FollowRequest } from './follow-request.js'; +import { UserGroupInvitation } from './user-group-invitation.js'; +import { AccessToken } from './access-token.js'; +import { notificationTypes } from '../../types.js'; @Entity() export class Notification { diff --git a/src/models/entities/page-like.ts b/src/models/entities/page-like.ts index ca84ece8fd..49f3f0ef52 100644 --- a/src/models/entities/page-like.ts +++ b/src/models/entities/page-like.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Page } from './page'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Page } from './page.js'; @Entity() @Index(['userId', 'pageId'], { unique: true }) diff --git a/src/models/entities/page.ts b/src/models/entities/page.ts index ed0411a3d0..7bc35aa69a 100644 --- a/src/models/entities/page.ts +++ b/src/models/entities/page.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() @Index(['userId', 'name'], { unique: true }) diff --git a/src/models/entities/password-reset-request.ts b/src/models/entities/password-reset-request.ts index 6d41d38a93..95ba14db18 100644 --- a/src/models/entities/password-reset-request.ts +++ b/src/models/entities/password-reset-request.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id'; -import { User } from './user'; +import { id } from '../id.js'; +import { User } from './user.js'; @Entity() export class PasswordResetRequest { diff --git a/src/models/entities/poll-vote.ts b/src/models/entities/poll-vote.ts index 709376f909..f8b5ad7d81 100644 --- a/src/models/entities/poll-vote.ts +++ b/src/models/entities/poll-vote.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId', 'choice'], { unique: true }) diff --git a/src/models/entities/poll.ts b/src/models/entities/poll.ts index e3bbb1c3f2..a201b1198b 100644 --- a/src/models/entities/poll.ts +++ b/src/models/entities/poll.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id'; -import { Note } from './note'; -import { User } from './user'; -import { noteVisibilities } from '../../types'; +import { id } from '../id.js'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { noteVisibilities } from '../../types.js'; @Entity() export class Poll { diff --git a/src/models/entities/promo-note.ts b/src/models/entities/promo-note.ts index 474f1cb235..d21b2adac3 100644 --- a/src/models/entities/promo-note.ts +++ b/src/models/entities/promo-note.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class PromoNote { diff --git a/src/models/entities/promo-read.ts b/src/models/entities/promo-read.ts index 2e0977b6b5..d949061b99 100644 --- a/src/models/entities/promo-read.ts +++ b/src/models/entities/promo-read.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/registration-tickets.ts b/src/models/entities/registration-tickets.ts index d962f78a78..139e40f85e 100644 --- a/src/models/entities/registration-tickets.ts +++ b/src/models/entities/registration-tickets.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class RegistrationTicket { diff --git a/src/models/entities/registry-item.ts b/src/models/entities/registry-item.ts index 54d2ef2082..f1904e6120 100644 --- a/src/models/entities/registry-item.ts +++ b/src/models/entities/registry-item.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; // TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい @Entity() diff --git a/src/models/entities/relay.ts b/src/models/entities/relay.ts index 4c82ccb125..94d1929574 100644 --- a/src/models/entities/relay.ts +++ b/src/models/entities/relay.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Relay { diff --git a/src/models/entities/signin.ts b/src/models/entities/signin.ts index 7e047084b1..1db5c48ca1 100644 --- a/src/models/entities/signin.ts +++ b/src/models/entities/signin.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Signin { diff --git a/src/models/entities/sw-subscription.ts b/src/models/entities/sw-subscription.ts index 7c3f6f0a6c..254dd70b4f 100644 --- a/src/models/entities/sw-subscription.ts +++ b/src/models/entities/sw-subscription.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class SwSubscription { diff --git a/src/models/entities/user-group-invitation.ts b/src/models/entities/user-group-invitation.ts index 6fe8f20134..9e71c78e1d 100644 --- a/src/models/entities/user-group-invitation.ts +++ b/src/models/entities/user-group-invitation.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserGroup } from './user-group'; -import { id } from '../id'; +import { User } from './user.js'; +import { UserGroup } from './user-group.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'userGroupId'], { unique: true }) diff --git a/src/models/entities/user-group-joining.ts b/src/models/entities/user-group-joining.ts index e09c3230f1..fbed44c79f 100644 --- a/src/models/entities/user-group-joining.ts +++ b/src/models/entities/user-group-joining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserGroup } from './user-group'; -import { id } from '../id'; +import { User } from './user.js'; +import { UserGroup } from './user-group.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'userGroupId'], { unique: true }) diff --git a/src/models/entities/user-group.ts b/src/models/entities/user-group.ts index f4bac03223..ae4cd5485f 100644 --- a/src/models/entities/user-group.ts +++ b/src/models/entities/user-group.ts @@ -1,6 +1,6 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserGroup { diff --git a/src/models/entities/user-keypair.ts b/src/models/entities/user-keypair.ts index 603321d758..026f823f7b 100644 --- a/src/models/entities/user-keypair.ts +++ b/src/models/entities/user-keypair.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserKeypair { diff --git a/src/models/entities/user-list-joining.ts b/src/models/entities/user-list-joining.ts index bb7dc40b95..91cff3cd54 100644 --- a/src/models/entities/user-list-joining.ts +++ b/src/models/entities/user-list-joining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserList } from './user-list'; -import { id } from '../id'; +import { User } from './user.js'; +import { UserList } from './user-list.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'userListId'], { unique: true }) diff --git a/src/models/entities/user-list.ts b/src/models/entities/user-list.ts index 35a83ef8c3..51031e3c1f 100644 --- a/src/models/entities/user-list.ts +++ b/src/models/entities/user-list.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserList { diff --git a/src/models/entities/user-note-pining.ts b/src/models/entities/user-note-pining.ts index 04a6f8f645..0495c4b2f5 100644 --- a/src/models/entities/user-note-pining.ts +++ b/src/models/entities/user-note-pining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 3a9043fac6..fd05522797 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -1,8 +1,8 @@ import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; -import { User } from './user'; -import { Page } from './page'; -import { notificationTypes } from '../../types'; +import { id } from '../id.js'; +import { User } from './user.js'; +import { Page } from './page.js'; +import { notificationTypes } from '../../types.js'; // TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも // ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン diff --git a/src/models/entities/user-publickey.ts b/src/models/entities/user-publickey.ts index 21edc3e9e2..adfff74f8a 100644 --- a/src/models/entities/user-publickey.ts +++ b/src/models/entities/user-publickey.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserPublickey { diff --git a/src/models/entities/user-security-key.ts b/src/models/entities/user-security-key.ts index d54c728e53..ec8ac81c47 100644 --- a/src/models/entities/user-security-key.ts +++ b/src/models/entities/user-security-key.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserSecurityKey { diff --git a/src/models/entities/user.ts b/src/models/entities/user.ts index 060ec06b9a..36c5068205 100644 --- a/src/models/entities/user.ts +++ b/src/models/entities/user.ts @@ -1,6 +1,6 @@ import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; +import { DriveFile } from './drive-file.js'; +import { id } from '../id.js'; @Entity() @Index(['usernameLower', 'host'], { unique: true }) diff --git a/src/models/index.ts b/src/models/index.ts index 9f8bd104e9..51ee88bb7f 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,67 +1,67 @@ import { getRepository, getCustomRepository } from 'typeorm'; -import { Announcement } from './entities/announcement'; -import { AnnouncementRead } from './entities/announcement-read'; -import { Instance } from './entities/instance'; -import { Poll } from './entities/poll'; -import { PollVote } from './entities/poll-vote'; -import { Meta } from './entities/meta'; -import { SwSubscription } from './entities/sw-subscription'; -import { NoteWatching } from './entities/note-watching'; -import { NoteUnread } from './entities/note-unread'; -import { RegistrationTicket } from './entities/registration-tickets'; -import { UserRepository } from './repositories/user'; -import { NoteRepository } from './repositories/note'; -import { DriveFileRepository } from './repositories/drive-file'; -import { DriveFolderRepository } from './repositories/drive-folder'; -import { Log } from './entities/log'; -import { AccessToken } from './entities/access-token'; -import { UserNotePining } from './entities/user-note-pining'; -import { SigninRepository } from './repositories/signin'; -import { MessagingMessageRepository } from './repositories/messaging-message'; -import { ReversiGameRepository } from './repositories/games/reversi/game'; -import { UserListRepository } from './repositories/user-list'; -import { UserListJoining } from './entities/user-list-joining'; -import { UserGroupRepository } from './repositories/user-group'; -import { UserGroupJoining } from './entities/user-group-joining'; -import { UserGroupInvitationRepository } from './repositories/user-group-invitation'; -import { FollowRequestRepository } from './repositories/follow-request'; -import { MutingRepository } from './repositories/muting'; -import { BlockingRepository } from './repositories/blocking'; -import { NoteReactionRepository } from './repositories/note-reaction'; -import { NotificationRepository } from './repositories/notification'; -import { NoteFavoriteRepository } from './repositories/note-favorite'; -import { ReversiMatchingRepository } from './repositories/games/reversi/matching'; -import { UserPublickey } from './entities/user-publickey'; -import { UserKeypair } from './entities/user-keypair'; -import { AppRepository } from './repositories/app'; -import { FollowingRepository } from './repositories/following'; -import { AbuseUserReportRepository } from './repositories/abuse-user-report'; -import { AuthSessionRepository } from './repositories/auth-session'; -import { UserProfile } from './entities/user-profile'; -import { AttestationChallenge } from './entities/attestation-challenge'; -import { UserSecurityKey } from './entities/user-security-key'; -import { HashtagRepository } from './repositories/hashtag'; -import { PageRepository } from './repositories/page'; -import { PageLikeRepository } from './repositories/page-like'; -import { GalleryPostRepository } from './repositories/gallery-post'; -import { GalleryLikeRepository } from './repositories/gallery-like'; -import { ModerationLogRepository } from './repositories/moderation-logs'; -import { UsedUsername } from './entities/used-username'; -import { ClipRepository } from './repositories/clip'; -import { ClipNote } from './entities/clip-note'; -import { AntennaRepository } from './repositories/antenna'; -import { AntennaNote } from './entities/antenna-note'; -import { PromoNote } from './entities/promo-note'; -import { PromoRead } from './entities/promo-read'; -import { EmojiRepository } from './repositories/emoji'; -import { RelayRepository } from './repositories/relay'; -import { ChannelRepository } from './repositories/channel'; -import { MutedNote } from './entities/muted-note'; -import { ChannelFollowing } from './entities/channel-following'; -import { ChannelNotePining } from './entities/channel-note-pining'; -import { RegistryItem } from './entities/registry-item'; -import { Ad } from './entities/ad'; -import { PasswordResetRequest } from './entities/password-reset-request'; +import { Announcement } from './entities/announcement.js'; +import { AnnouncementRead } from './entities/announcement-read.js'; +import { Instance } from './entities/instance.js'; +import { Poll } from './entities/poll.js'; +import { PollVote } from './entities/poll-vote.js'; +import { Meta } from './entities/meta.js'; +import { SwSubscription } from './entities/sw-subscription.js'; +import { NoteWatching } from './entities/note-watching.js'; +import { NoteUnread } from './entities/note-unread.js'; +import { RegistrationTicket } from './entities/registration-tickets.js'; +import { UserRepository } from './repositories/user.js'; +import { NoteRepository } from './repositories/note.js'; +import { DriveFileRepository } from './repositories/drive-file.js'; +import { DriveFolderRepository } from './repositories/drive-folder.js'; +import { Log } from './entities/log.js'; +import { AccessToken } from './entities/access-token.js'; +import { UserNotePining } from './entities/user-note-pining.js'; +import { SigninRepository } from './repositories/signin.js'; +import { MessagingMessageRepository } from './repositories/messaging-message.js'; +import { ReversiGameRepository } from './repositories/games/reversi/game.js'; +import { UserListRepository } from './repositories/user-list.js'; +import { UserListJoining } from './entities/user-list-joining.js'; +import { UserGroupRepository } from './repositories/user-group.js'; +import { UserGroupJoining } from './entities/user-group-joining.js'; +import { UserGroupInvitationRepository } from './repositories/user-group-invitation.js'; +import { FollowRequestRepository } from './repositories/follow-request.js'; +import { MutingRepository } from './repositories/muting.js'; +import { BlockingRepository } from './repositories/blocking.js'; +import { NoteReactionRepository } from './repositories/note-reaction.js'; +import { NotificationRepository } from './repositories/notification.js'; +import { NoteFavoriteRepository } from './repositories/note-favorite.js'; +import { ReversiMatchingRepository } from './repositories/games/reversi/matching.js'; +import { UserPublickey } from './entities/user-publickey.js'; +import { UserKeypair } from './entities/user-keypair.js'; +import { AppRepository } from './repositories/app.js'; +import { FollowingRepository } from './repositories/following.js'; +import { AbuseUserReportRepository } from './repositories/abuse-user-report.js'; +import { AuthSessionRepository } from './repositories/auth-session.js'; +import { UserProfile } from './entities/user-profile.js'; +import { AttestationChallenge } from './entities/attestation-challenge.js'; +import { UserSecurityKey } from './entities/user-security-key.js'; +import { HashtagRepository } from './repositories/hashtag.js'; +import { PageRepository } from './repositories/page.js'; +import { PageLikeRepository } from './repositories/page-like.js'; +import { GalleryPostRepository } from './repositories/gallery-post.js'; +import { GalleryLikeRepository } from './repositories/gallery-like.js'; +import { ModerationLogRepository } from './repositories/moderation-logs.js'; +import { UsedUsername } from './entities/used-username.js'; +import { ClipRepository } from './repositories/clip.js'; +import { ClipNote } from './entities/clip-note.js'; +import { AntennaRepository } from './repositories/antenna.js'; +import { AntennaNote } from './entities/antenna-note.js'; +import { PromoNote } from './entities/promo-note.js'; +import { PromoRead } from './entities/promo-read.js'; +import { EmojiRepository } from './repositories/emoji.js'; +import { RelayRepository } from './repositories/relay.js'; +import { ChannelRepository } from './repositories/channel.js'; +import { MutedNote } from './entities/muted-note.js'; +import { ChannelFollowing } from './entities/channel-following.js'; +import { ChannelNotePining } from './entities/channel-note-pining.js'; +import { RegistryItem } from './entities/registry-item.js'; +import { Ad } from './entities/ad.js'; +import { PasswordResetRequest } from './entities/password-reset-request.js'; export const Announcements = getRepository(Announcement); export const AnnouncementReads = getRepository(AnnouncementRead); diff --git a/src/models/repositories/abuse-user-report.ts b/src/models/repositories/abuse-user-report.ts index cb33d2506e..16a121576f 100644 --- a/src/models/repositories/abuse-user-report.ts +++ b/src/models/repositories/abuse-user-report.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { AbuseUserReport } from '../entities/abuse-user-report'; -import { awaitAll } from '../../prelude/await-all'; +import { Users } from '../index.js'; +import { AbuseUserReport } from '../entities/abuse-user-report.js'; +import { awaitAll } from '../../prelude/await-all.js'; @EntityRepository(AbuseUserReport) export class AbuseUserReportRepository extends Repository { diff --git a/src/models/repositories/antenna.ts b/src/models/repositories/antenna.ts index 787e5c8e2b..5117bcb033 100644 --- a/src/models/repositories/antenna.ts +++ b/src/models/repositories/antenna.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Antenna } from '../entities/antenna'; -import { SchemaType } from '@/misc/schema'; -import { AntennaNotes, UserGroupJoinings } from '..'; +import { Antenna } from '../entities/antenna.js'; +import { SchemaType } from '@/misc/schema.js'; +import { AntennaNotes, UserGroupJoinings } from '../index.js'; export type PackedAntenna = SchemaType; diff --git a/src/models/repositories/app.ts b/src/models/repositories/app.ts index c919a9bdb1..3c96909ddd 100644 --- a/src/models/repositories/app.ts +++ b/src/models/repositories/app.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { App } from '../entities/app'; -import { AccessTokens } from '..'; -import { SchemaType } from '@/misc/schema'; +import { App } from '../entities/app.js'; +import { AccessTokens } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedApp = SchemaType; diff --git a/src/models/repositories/auth-session.ts b/src/models/repositories/auth-session.ts index f513357e1b..0eac1348c7 100644 --- a/src/models/repositories/auth-session.ts +++ b/src/models/repositories/auth-session.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Apps } from '..'; -import { AuthSession } from '../entities/auth-session'; -import { awaitAll } from '../../prelude/await-all'; -import { User } from '../entities/user'; +import { Apps } from '../index.js'; +import { AuthSession } from '../entities/auth-session.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { User } from '../entities/user.js'; @EntityRepository(AuthSession) export class AuthSessionRepository extends Repository { diff --git a/src/models/repositories/blocking.ts b/src/models/repositories/blocking.ts index 9a4f3f6c68..41b9ed5ab9 100644 --- a/src/models/repositories/blocking.ts +++ b/src/models/repositories/blocking.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Blocking } from '../entities/blocking'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Blocking } from '../entities/blocking.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedBlocking = SchemaType; diff --git a/src/models/repositories/channel.ts b/src/models/repositories/channel.ts index 007b110015..c889fc164b 100644 --- a/src/models/repositories/channel.ts +++ b/src/models/repositories/channel.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Channel } from '../entities/channel'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles, ChannelFollowings, NoteUnreads } from '..'; -import { User } from '../entities/user'; +import { Channel } from '../entities/channel.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles, ChannelFollowings, NoteUnreads } from '../index.js'; +import { User } from '../entities/user.js'; export type PackedChannel = SchemaType; diff --git a/src/models/repositories/clip.ts b/src/models/repositories/clip.ts index 293807b125..3fae8a7aee 100644 --- a/src/models/repositories/clip.ts +++ b/src/models/repositories/clip.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Clip } from '../entities/clip'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '..'; -import { awaitAll } from '../../prelude/await-all'; +import { Clip } from '../entities/clip.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; export type PackedClip = SchemaType; diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts index 675faca8e3..3edd9dd66a 100644 --- a/src/models/repositories/drive-file.ts +++ b/src/models/repositories/drive-file.ts @@ -1,14 +1,14 @@ import { EntityRepository, Repository } from 'typeorm'; -import { DriveFile } from '../entities/drive-file'; -import { Users, DriveFolders } from '..'; -import { User } from '../entities/user'; -import { toPuny } from '@/misc/convert-host'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import config from '@/config'; -import { query, appendQuery } from '../../prelude/url'; -import { Meta } from '../entities/meta'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { DriveFile } from '../entities/drive-file.js'; +import { Users, DriveFolders } from '../index.js'; +import { User } from '../entities/user.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import config from '@/config/index.js'; +import { query, appendQuery } from '../../prelude/url.js'; +import { Meta } from '../entities/meta.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export type PackedDriveFile = SchemaType; diff --git a/src/models/repositories/drive-folder.ts b/src/models/repositories/drive-folder.ts index d1922c96f8..e78c50149c 100644 --- a/src/models/repositories/drive-folder.ts +++ b/src/models/repositories/drive-folder.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { DriveFolders, DriveFiles } from '..'; -import { DriveFolder } from '../entities/drive-folder'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; +import { DriveFolders, DriveFiles } from '../index.js'; +import { DriveFolder } from '../entities/drive-folder.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedDriveFolder = SchemaType; diff --git a/src/models/repositories/emoji.ts b/src/models/repositories/emoji.ts index 3490a6ac86..ecef68325a 100644 --- a/src/models/repositories/emoji.ts +++ b/src/models/repositories/emoji.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Emoji } from '../entities/emoji'; +import { Emoji } from '../entities/emoji.js'; @EntityRepository(Emoji) export class EmojiRepository extends Repository { diff --git a/src/models/repositories/federation-instance.ts b/src/models/repositories/federation-instance.ts index 15e8023ee9..ad14cfc962 100644 --- a/src/models/repositories/federation-instance.ts +++ b/src/models/repositories/federation-instance.ts @@ -1,4 +1,4 @@ -import config from '@/config'; +import config from '@/config/index.js'; export const packedFederationInstanceSchema = { type: 'object' as const, diff --git a/src/models/repositories/follow-request.ts b/src/models/repositories/follow-request.ts index 31e5fb2d90..6fe86972e5 100644 --- a/src/models/repositories/follow-request.ts +++ b/src/models/repositories/follow-request.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { FollowRequest } from '../entities/follow-request'; -import { Users } from '..'; -import { User } from '../entities/user'; +import { FollowRequest } from '../entities/follow-request.js'; +import { Users } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(FollowRequest) export class FollowRequestRepository extends Repository { diff --git a/src/models/repositories/following.ts b/src/models/repositories/following.ts index 3aed83f320..0cc3626c26 100644 --- a/src/models/repositories/following.ts +++ b/src/models/repositories/following.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Following } from '../entities/following'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Following } from '../entities/following.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; type LocalFollowerFollowing = Following & { followerHost: null; diff --git a/src/models/repositories/gallery-like.ts b/src/models/repositories/gallery-like.ts index e01c17cff5..550405d659 100644 --- a/src/models/repositories/gallery-like.ts +++ b/src/models/repositories/gallery-like.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { GalleryLike } from '../entities/gallery-like'; -import { GalleryPosts } from '..'; +import { GalleryLike } from '../entities/gallery-like.js'; +import { GalleryPosts } from '../index.js'; @EntityRepository(GalleryLike) export class GalleryLikeRepository extends Repository { diff --git a/src/models/repositories/gallery-post.ts b/src/models/repositories/gallery-post.ts index f1d6fe6326..b2c989481a 100644 --- a/src/models/repositories/gallery-post.ts +++ b/src/models/repositories/gallery-post.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { GalleryPost } from '../entities/gallery-post'; -import { SchemaType } from '../../misc/schema'; -import { Users, DriveFiles, GalleryLikes } from '..'; -import { awaitAll } from '../../prelude/await-all'; -import { User } from '../entities/user'; +import { GalleryPost } from '../entities/gallery-post.js'; +import { SchemaType } from '../../misc/schema.js'; +import { Users, DriveFiles, GalleryLikes } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { User } from '../entities/user.js'; export type PackedGalleryPost = SchemaType; diff --git a/src/models/repositories/games/reversi/game.ts b/src/models/repositories/games/reversi/game.ts index 344cf7b20e..0a1d67f960 100644 --- a/src/models/repositories/games/reversi/game.ts +++ b/src/models/repositories/games/reversi/game.ts @@ -1,7 +1,7 @@ -import { User } from '@/models/entities/user'; +import { User } from '@/models/entities/user.js'; import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '../../..'; -import { ReversiGame } from '../../../entities/games/reversi/game'; +import { Users } from '../../../index.js'; +import { ReversiGame } from '../../../entities/games/reversi/game.js'; @EntityRepository(ReversiGame) export class ReversiGameRepository extends Repository { diff --git a/src/models/repositories/games/reversi/matching.ts b/src/models/repositories/games/reversi/matching.ts index 013021eb90..942194410b 100644 --- a/src/models/repositories/games/reversi/matching.ts +++ b/src/models/repositories/games/reversi/matching.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { ReversiMatching } from '../../../entities/games/reversi/matching'; -import { Users } from '../../..'; -import { awaitAll } from '../../../../prelude/await-all'; -import { User } from '@/models/entities/user'; +import { ReversiMatching } from '../../../entities/games/reversi/matching.js'; +import { Users } from '../../../index.js'; +import { awaitAll } from '../../../../prelude/await-all.js'; +import { User } from '@/models/entities/user.js'; @EntityRepository(ReversiMatching) export class ReversiMatchingRepository extends Repository { diff --git a/src/models/repositories/hashtag.ts b/src/models/repositories/hashtag.ts index 3fee2f771d..f16e2dcd86 100644 --- a/src/models/repositories/hashtag.ts +++ b/src/models/repositories/hashtag.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Hashtag } from '../entities/hashtag'; -import { SchemaType } from '@/misc/schema'; +import { Hashtag } from '../entities/hashtag.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedHashtag = SchemaType; diff --git a/src/models/repositories/messaging-message.ts b/src/models/repositories/messaging-message.ts index c77b14ca7f..1413105c55 100644 --- a/src/models/repositories/messaging-message.ts +++ b/src/models/repositories/messaging-message.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { MessagingMessage } from '../entities/messaging-message'; -import { Users, DriveFiles, UserGroups } from '..'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { MessagingMessage } from '../entities/messaging-message.js'; +import { Users, DriveFiles, UserGroups } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedMessagingMessage = SchemaType; diff --git a/src/models/repositories/moderation-logs.ts b/src/models/repositories/moderation-logs.ts index 3d4c075701..ea074a4532 100644 --- a/src/models/repositories/moderation-logs.ts +++ b/src/models/repositories/moderation-logs.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { ModerationLog } from '../entities/moderation-log'; -import { awaitAll } from '../../prelude/await-all'; +import { Users } from '../index.js'; +import { ModerationLog } from '../entities/moderation-log.js'; +import { awaitAll } from '../../prelude/await-all.js'; @EntityRepository(ModerationLog) export class ModerationLogRepository extends Repository { diff --git a/src/models/repositories/muting.ts b/src/models/repositories/muting.ts index 32e681bf0b..78dfa29215 100644 --- a/src/models/repositories/muting.ts +++ b/src/models/repositories/muting.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Muting } from '../entities/muting'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Muting } from '../entities/muting.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedMuting = SchemaType; diff --git a/src/models/repositories/note-favorite.ts b/src/models/repositories/note-favorite.ts index e58b258fcb..a192bbbc07 100644 --- a/src/models/repositories/note-favorite.ts +++ b/src/models/repositories/note-favorite.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { NoteFavorite } from '../entities/note-favorite'; -import { Notes } from '..'; -import { User } from '../entities/user'; +import { NoteFavorite } from '../entities/note-favorite.js'; +import { Notes } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(NoteFavorite) export class NoteFavoriteRepository extends Repository { diff --git a/src/models/repositories/note-reaction.ts b/src/models/repositories/note-reaction.ts index 5de9e1be65..6c72008d24 100644 --- a/src/models/repositories/note-reaction.ts +++ b/src/models/repositories/note-reaction.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { NoteReaction } from '../entities/note-reaction'; -import { Users } from '..'; -import { SchemaType } from '@/misc/schema'; -import { convertLegacyReaction } from '@/misc/reaction-lib'; -import { User } from '../entities/user'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { Users } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { convertLegacyReaction } from '@/misc/reaction-lib.js'; +import { User } from '../entities/user.js'; export type PackedNoteReaction = SchemaType; diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts index df0ca8c6ad..60a5e1ab3d 100644 --- a/src/models/repositories/note.ts +++ b/src/models/repositories/note.ts @@ -1,14 +1,14 @@ import { EntityRepository, Repository, In } from 'typeorm'; import * as mfm from 'mfm-js'; -import { Note } from '../entities/note'; -import { User } from '../entities/user'; -import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '..'; -import { SchemaType } from '@/misc/schema'; -import { nyaize } from '@/misc/nyaize'; -import { awaitAll } from '../../prelude/await-all'; -import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib'; -import { NoteReaction } from '../entities/note-reaction'; -import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis'; +import { Note } from '../entities/note.js'; +import { User } from '../entities/user.js'; +import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { nyaize } from '@/misc/nyaize.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib.js'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis.js'; export type PackedNote = SchemaType; diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index 94a2c3c91a..8199534e34 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -1,12 +1,12 @@ import { EntityRepository, In, Repository } from 'typeorm'; -import { Users, Notes, UserGroupInvitations, AccessTokens, NoteReactions } from '..'; -import { Notification } from '../entities/notification'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { Note } from '../entities/note'; -import { NoteReaction } from '../entities/note-reaction'; -import { User } from '../entities/user'; -import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis'; +import { Users, Notes, UserGroupInvitations, AccessTokens, NoteReactions } from '../index.js'; +import { Notification } from '../entities/notification.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Note } from '../entities/note.js'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { User } from '../entities/user.js'; +import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis.js'; export type PackedNotification = SchemaType; diff --git a/src/models/repositories/page-like.ts b/src/models/repositories/page-like.ts index cfef950f3b..81147a9ee0 100644 --- a/src/models/repositories/page-like.ts +++ b/src/models/repositories/page-like.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { PageLike } from '../entities/page-like'; -import { Pages } from '..'; -import { User } from '../entities/user'; +import { PageLike } from '../entities/page-like.js'; +import { Pages } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(PageLike) export class PageLikeRepository extends Repository { diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index a162a50321..45f8c81786 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -1,10 +1,10 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Page } from '../entities/page'; -import { SchemaType } from '@/misc/schema'; -import { Users, DriveFiles, PageLikes } from '..'; -import { awaitAll } from '../../prelude/await-all'; -import { DriveFile } from '../entities/drive-file'; -import { User } from '../entities/user'; +import { Page } from '../entities/page.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users, DriveFiles, PageLikes } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { DriveFile } from '../entities/drive-file.js'; +import { User } from '../entities/user.js'; export type PackedPage = SchemaType; diff --git a/src/models/repositories/relay.ts b/src/models/repositories/relay.ts index 601bb5eb39..c1b04a8ea0 100644 --- a/src/models/repositories/relay.ts +++ b/src/models/repositories/relay.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Relay } from '../entities/relay'; +import { Relay } from '../entities/relay.js'; @EntityRepository(Relay) export class RelayRepository extends Repository { diff --git a/src/models/repositories/signin.ts b/src/models/repositories/signin.ts index f5b90c0e9e..8490ac6a59 100644 --- a/src/models/repositories/signin.ts +++ b/src/models/repositories/signin.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Signin } from '../entities/signin'; +import { Signin } from '../entities/signin.js'; @EntityRepository(Signin) export class SigninRepository extends Repository { diff --git a/src/models/repositories/user-group-invitation.ts b/src/models/repositories/user-group-invitation.ts index 2aa890361c..6552f23d96 100644 --- a/src/models/repositories/user-group-invitation.ts +++ b/src/models/repositories/user-group-invitation.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserGroupInvitation } from '../entities/user-group-invitation'; -import { UserGroups } from '..'; +import { UserGroupInvitation } from '../entities/user-group-invitation.js'; +import { UserGroups } from '../index.js'; @EntityRepository(UserGroupInvitation) export class UserGroupInvitationRepository extends Repository { diff --git a/src/models/repositories/user-group.ts b/src/models/repositories/user-group.ts index c7d73ebe26..6a2cd2caa2 100644 --- a/src/models/repositories/user-group.ts +++ b/src/models/repositories/user-group.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserGroup } from '../entities/user-group'; -import { UserGroupJoinings } from '..'; -import { SchemaType } from '@/misc/schema'; +import { UserGroup } from '../entities/user-group.js'; +import { UserGroupJoinings } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedUserGroup = SchemaType; diff --git a/src/models/repositories/user-list.ts b/src/models/repositories/user-list.ts index 7710bebfcc..6027e346a2 100644 --- a/src/models/repositories/user-list.ts +++ b/src/models/repositories/user-list.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserList } from '../entities/user-list'; -import { UserListJoinings } from '..'; -import { SchemaType } from '@/misc/schema'; +import { UserList } from '../entities/user-list.js'; +import { UserListJoinings } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedUserList = SchemaType; diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 1a191fe864..494ab3c979 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; import { EntityRepository, Repository, In, Not } from 'typeorm'; -import { User, ILocalUser, IRemoteUser } from '../entities/user'; -import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '..'; -import config from '@/config'; -import { SchemaType } from '@/misc/schema'; -import { awaitAll } from '../../prelude/await-all'; -import { populateEmojis } from '@/misc/populate-emojis'; -import { getAntennas } from '@/misc/antenna-cache'; -import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const'; +import { User, ILocalUser, IRemoteUser } from '../entities/user.js'; +import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '../index.js'; +import config from '@/config/index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { populateEmojis } from '@/misc/populate-emojis.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; +import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js'; export type PackedUser = SchemaType; diff --git a/src/prelude/array.ts b/src/prelude/array.ts index d63f0475d0..3846c31af2 100644 --- a/src/prelude/array.ts +++ b/src/prelude/array.ts @@ -1,4 +1,4 @@ -import { EndoRelation, Predicate } from './relation'; +import { EndoRelation, Predicate } from './relation.js'; /** * Count the number of elements that satisfy the predicate diff --git a/src/queue/index.ts b/src/queue/index.ts index c7b7f0392c..7b6824f803 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -1,18 +1,18 @@ import * as httpSignature from 'http-signature'; -import config from '@/config'; -import { program } from '../argv'; +import config from '@/config/index.js'; +import { program } from '../argv.js'; -import processDeliver from './processors/deliver'; -import processInbox from './processors/inbox'; -import processDb from './processors/db'; -import procesObjectStorage from './processors/object-storage'; -import { queueLogger } from './logger'; -import { DriveFile } from '../models/entities/drive-file'; -import { getJobInfo } from './get-job-info'; -import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues'; -import { ThinUser } from './types'; -import { IActivity } from '@/remote/activitypub/type'; +import processDeliver from './processors/deliver.js'; +import processInbox from './processors/inbox.js'; +import processDb from './processors/db/index.js'; +import procesObjectStorage from './processors/object-storage/index.js'; +import { queueLogger } from './logger.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { getJobInfo } from './get-job-info.js'; +import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues.js'; +import { ThinUser } from './types.js'; +import { IActivity } from '@/remote/activitypub/type.js'; function renderError(e: Error): any { return { diff --git a/src/queue/initialize.ts b/src/queue/initialize.ts index 4c0e5f9d87..bed368967b 100644 --- a/src/queue/initialize.ts +++ b/src/queue/initialize.ts @@ -1,5 +1,5 @@ import * as Bull from 'bull'; -import config from '@/config'; +import config from '@/config/index.js'; export function initialize(name: string, limitPerSec = -1) { return new Bull(name, { diff --git a/src/queue/logger.ts b/src/queue/logger.ts index d6d0774680..2843a3c263 100644 --- a/src/queue/logger.ts +++ b/src/queue/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const queueLogger = new Logger('queue', 'orange'); diff --git a/src/queue/processors/db/delete-drive-files.ts b/src/queue/processors/db/delete-drive-files.ts index 874623204b..1d3876ac15 100644 --- a/src/queue/processors/db/delete-drive-files.ts +++ b/src/queue/processors/db/delete-drive-files.ts @@ -1,10 +1,10 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { deleteFileSync } from '../../../services/drive/delete-file'; -import { Users, DriveFiles } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import { deleteFileSync } from '@/services/drive/delete-file.js'; +import { Users, DriveFiles } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('delete-drive-files'); diff --git a/src/queue/processors/db/export-blocking.ts b/src/queue/processors/db/export-blocking.ts index 001b50a22c..41344826e8 100644 --- a/src/queue/processors/db/export-blocking.ts +++ b/src/queue/processors/db/export-blocking.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Blockings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Blockings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-blocking'); diff --git a/src/queue/processors/db/export-following.ts b/src/queue/processors/db/export-following.ts index c1ccb7af4c..c299479afd 100644 --- a/src/queue/processors/db/export-following.ts +++ b/src/queue/processors/db/export-following.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Followings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Followings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-following'); diff --git a/src/queue/processors/db/export-mute.ts b/src/queue/processors/db/export-mute.ts index 55d45cc29c..8a16ab0b1e 100644 --- a/src/queue/processors/db/export-mute.ts +++ b/src/queue/processors/db/export-mute.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Mutings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Mutings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-mute'); diff --git a/src/queue/processors/db/export-notes.ts b/src/queue/processors/db/export-notes.ts index 2d09c0d201..9a2f71b9cc 100644 --- a/src/queue/processors/db/export-notes.ts +++ b/src/queue/processors/db/export-notes.ts @@ -2,14 +2,14 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { Users, Notes, Polls } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { Users, Notes, Polls } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { Note } from '../../../models/entities/note'; -import { Poll } from '../../../models/entities/poll'; -import { DbUserJobData } from '@/queue/types'; +import { Note } from '@/models/entities/note.js'; +import { Poll } from '@/models/entities/poll.js'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-notes'); diff --git a/src/queue/processors/db/export-user-lists.ts b/src/queue/processors/db/export-user-lists.ts index 3f793e064f..6b54638f08 100644 --- a/src/queue/processors/db/export-user-lists.ts +++ b/src/queue/processors/db/export-user-lists.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, UserLists, UserListJoinings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, UserLists, UserListJoinings } from '@/models/index.js'; import { In } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-user-lists'); diff --git a/src/queue/processors/db/import-following.ts b/src/queue/processors/db/import-following.ts index 1156b5cafa..bc8166c72c 100644 --- a/src/queue/processors/db/import-following.ts +++ b/src/queue/processors/db/import-following.ts @@ -1,13 +1,13 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import follow from '../../../services/following/create'; -import { parseAcct } from '@/misc/acct'; -import { resolveUser } from '../../../remote/resolve-user'; -import { downloadTextFile } from '@/misc/download-text-file'; -import { isSelfHost, toPuny } from '@/misc/convert-host'; -import { Users, DriveFiles } from '../../../models'; -import { DbUserImportJobData } from '@/queue/types'; +import { queueLogger } from '../../logger.js'; +import follow from '@/services/following/create.js'; +import { parseAcct } from '@/misc/acct.js'; +import { resolveUser } from '@/remote/resolve-user.js'; +import { downloadTextFile } from '@/misc/download-text-file.js'; +import { isSelfHost, toPuny } from '@/misc/convert-host.js'; +import { Users, DriveFiles } from '@/models/index.js'; +import { DbUserImportJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('import-following'); diff --git a/src/queue/processors/db/import-user-lists.ts b/src/queue/processors/db/import-user-lists.ts index d04ead869a..6748e748ec 100644 --- a/src/queue/processors/db/import-user-lists.ts +++ b/src/queue/processors/db/import-user-lists.ts @@ -1,14 +1,14 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { parseAcct } from '@/misc/acct'; -import { resolveUser } from '../../../remote/resolve-user'; -import { pushUserToUserList } from '../../../services/user-list/push'; -import { downloadTextFile } from '@/misc/download-text-file'; -import { isSelfHost, toPuny } from '@/misc/convert-host'; -import { DriveFiles, Users, UserLists, UserListJoinings } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { DbUserImportJobData } from '@/queue/types'; +import { queueLogger } from '../../logger.js'; +import { parseAcct } from '@/misc/acct.js'; +import { resolveUser } from '@/remote/resolve-user.js'; +import { pushUserToUserList } from '@/services/user-list/push.js'; +import { downloadTextFile } from '@/misc/download-text-file.js'; +import { isSelfHost, toPuny } from '@/misc/convert-host.js'; +import { DriveFiles, Users, UserLists, UserListJoinings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { DbUserImportJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('import-user-lists'); diff --git a/src/queue/processors/db/index.ts b/src/queue/processors/db/index.ts index b56b7bfa2c..0936daf7aa 100644 --- a/src/queue/processors/db/index.ts +++ b/src/queue/processors/db/index.ts @@ -1,13 +1,13 @@ import * as Bull from 'bull'; -import { DbJobData } from '@/queue/types'; -import { deleteDriveFiles } from './delete-drive-files'; -import { exportNotes } from './export-notes'; -import { exportFollowing } from './export-following'; -import { exportMute } from './export-mute'; -import { exportBlocking } from './export-blocking'; -import { exportUserLists } from './export-user-lists'; -import { importFollowing } from './import-following'; -import { importUserLists } from './import-user-lists'; +import { DbJobData } from '@/queue/types.js'; +import { deleteDriveFiles } from './delete-drive-files.js'; +import { exportNotes } from './export-notes.js'; +import { exportFollowing } from './export-following.js'; +import { exportMute } from './export-mute.js'; +import { exportBlocking } from './export-blocking.js'; +import { exportUserLists } from './export-user-lists.js'; +import { importFollowing } from './import-following.js'; +import { importUserLists } from './import-user-lists.js'; const jobs = { deleteDriveFiles, diff --git a/src/queue/processors/deliver.ts b/src/queue/processors/deliver.ts index f9c53fc8f1..aeb7fc5f92 100644 --- a/src/queue/processors/deliver.ts +++ b/src/queue/processors/deliver.ts @@ -1,16 +1,16 @@ import { URL } from 'url'; import * as Bull from 'bull'; -import request from '../../remote/activitypub/request'; -import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-instance-doc'; -import Logger from '../../services/logger'; -import { Instances } from '../../models'; -import { instanceChart } from '../../services/chart'; -import { fetchInstanceMetadata } from '../../services/fetch-instance-metadata'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { toPuny } from '@/misc/convert-host'; -import { Cache } from '@/misc/cache'; -import { Instance } from '../../models/entities/instance'; -import { DeliverJobData } from '../types'; +import request from '@/remote/activitypub/request.js'; +import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; +import Logger from '@/services/logger.js'; +import { Instances } from '@/models/index.js'; +import { instanceChart } from '@/services/chart/index.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { Cache } from '@/misc/cache.js'; +import { Instance } from '@/models/entities/instance.js'; +import { DeliverJobData } from '../types.js'; const logger = new Logger('deliver'); diff --git a/src/queue/processors/inbox.ts b/src/queue/processors/inbox.ts index 5922c4c560..b13828096d 100644 --- a/src/queue/processors/inbox.ts +++ b/src/queue/processors/inbox.ts @@ -1,19 +1,19 @@ import { URL } from 'url'; import * as Bull from 'bull'; import * as httpSignature from 'http-signature'; -import perform from '../../remote/activitypub/perform'; -import Logger from '../../services/logger'; -import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-instance-doc'; -import { Instances } from '../../models'; -import { instanceChart } from '../../services/chart'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { toPuny, extractDbHost } from '@/misc/convert-host'; -import { getApId } from '../../remote/activitypub/type'; -import { fetchInstanceMetadata } from '../../services/fetch-instance-metadata'; -import { InboxJobData } from '../types'; -import DbResolver from '../../remote/activitypub/db-resolver'; -import { resolvePerson } from '../../remote/activitypub/models/person'; -import { LdSignature } from '../../remote/activitypub/misc/ld-signature'; +import perform from '@/remote/activitypub/perform.js'; +import Logger from '@/services/logger.js'; +import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; +import { Instances } from '@/models/index.js'; +import { instanceChart } from '@/services/chart/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { toPuny, extractDbHost } from '@/misc/convert-host.js'; +import { getApId } from '@/remote/activitypub/type.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; +import { InboxJobData } from '../types.js'; +import DbResolver from '@/remote/activitypub/db-resolver.js'; +import { resolvePerson } from '@/remote/activitypub/models/person.js'; +import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js'; const logger = new Logger('inbox'); diff --git a/src/queue/processors/object-storage/clean-remote-files.ts b/src/queue/processors/object-storage/clean-remote-files.ts index a922755f4d..96cb912c1c 100644 --- a/src/queue/processors/object-storage/clean-remote-files.ts +++ b/src/queue/processors/object-storage/clean-remote-files.ts @@ -1,8 +1,8 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { deleteFileSync } from '../../../services/drive/delete-file'; -import { DriveFiles } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import { deleteFileSync } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; import { MoreThan, Not, IsNull } from 'typeorm'; const logger = queueLogger.createSubLogger('clean-remote-files'); diff --git a/src/queue/processors/object-storage/delete-file.ts b/src/queue/processors/object-storage/delete-file.ts index 31050998af..08f2977816 100644 --- a/src/queue/processors/object-storage/delete-file.ts +++ b/src/queue/processors/object-storage/delete-file.ts @@ -1,6 +1,6 @@ -import { ObjectStorageFileJobData } from '@/queue/types'; +import { ObjectStorageFileJobData } from '@/queue/types.js'; import * as Bull from 'bull'; -import { deleteObjectStorageFile } from '../../../services/drive/delete-file'; +import { deleteObjectStorageFile } from '@/services/drive/delete-file.js'; export default async (job: Bull.Job) => { const key: string = job.data.key; diff --git a/src/queue/processors/object-storage/index.ts b/src/queue/processors/object-storage/index.ts index 0d9570e179..b00d493719 100644 --- a/src/queue/processors/object-storage/index.ts +++ b/src/queue/processors/object-storage/index.ts @@ -1,7 +1,7 @@ import * as Bull from 'bull'; -import { ObjectStorageJobData } from '@/queue/types'; -import deleteFile from './delete-file'; -import cleanRemoteFiles from './clean-remote-files'; +import { ObjectStorageJobData } from '@/queue/types.js'; +import deleteFile from './delete-file.js'; +import cleanRemoteFiles from './clean-remote-files.js'; const jobs = { deleteFile, diff --git a/src/queue/queues.ts b/src/queue/queues.ts index 5e2754b83f..a3084ae4f6 100644 --- a/src/queue/queues.ts +++ b/src/queue/queues.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { initialize as initializeQueue } from './initialize'; -import { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData } from './types'; +import config from '@/config/index.js'; +import { initialize as initializeQueue } from './initialize.js'; +import { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData } from './types.js'; export const deliverQueue = initializeQueue('deliver', config.deliverJobPerSec || 128); export const inboxQueue = initializeQueue('inbox', config.inboxJobPerSec || 16); diff --git a/src/queue/types.ts b/src/queue/types.ts index a782fc6b97..79067ca05f 100644 --- a/src/queue/types.ts +++ b/src/queue/types.ts @@ -1,6 +1,6 @@ -import { DriveFile } from '@/models/entities/drive-file'; -import { User } from '@/models/entities/user'; -import { IActivity } from '@/remote/activitypub/type'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { User } from '@/models/entities/user.js'; +import { IActivity } from '@/remote/activitypub/type.js'; import * as httpSignature from 'http-signature'; export type DeliverJobData = { diff --git a/src/remote/activitypub/audience.ts b/src/remote/activitypub/audience.ts index 85a70f8286..1ced62e50a 100644 --- a/src/remote/activitypub/audience.ts +++ b/src/remote/activitypub/audience.ts @@ -1,9 +1,9 @@ -import { ApObject, getApIds } from './type'; -import Resolver from './resolver'; -import { resolvePerson } from './models/person'; -import { unique, concat } from '../../prelude/array'; +import { ApObject, getApIds } from './type.js'; +import Resolver from './resolver.js'; +import { resolvePerson } from './models/person.js'; +import { unique, concat } from '../../prelude/array.js'; import * as promiseLimit from 'promise-limit'; -import { User, IRemoteUser } from '../../models/entities/user'; +import { User, IRemoteUser } from '@/models/entities/user.js'; type Visibility = 'public' | 'home' | 'followers' | 'specified'; diff --git a/src/remote/activitypub/db-resolver.ts b/src/remote/activitypub/db-resolver.ts index 9fc6f0c3b7..b73ac1e52a 100644 --- a/src/remote/activitypub/db-resolver.ts +++ b/src/remote/activitypub/db-resolver.ts @@ -1,11 +1,11 @@ -import config from '@/config'; -import { Note } from '../../models/entities/note'; -import { User, IRemoteUser } from '../../models/entities/user'; -import { UserPublickey } from '../../models/entities/user-publickey'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { Notes, Users, UserPublickeys, MessagingMessages } from '../../models'; -import { IObject, getApId } from './type'; -import { resolvePerson } from './models/person'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { UserPublickey } from '@/models/entities/user-publickey.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { Notes, Users, UserPublickeys, MessagingMessages } from '@/models/index.js'; +import { IObject, getApId } from './type.js'; +import { resolvePerson } from './models/person.js'; import escapeRegexp = require('escape-regexp'); export default class DbResolver { diff --git a/src/remote/activitypub/deliver-manager.ts b/src/remote/activitypub/deliver-manager.ts index f112b02b4f..b4b2df6ee4 100644 --- a/src/remote/activitypub/deliver-manager.ts +++ b/src/remote/activitypub/deliver-manager.ts @@ -1,6 +1,6 @@ -import { Users, Followings } from '../../models'; -import { ILocalUser, IRemoteUser, User } from '../../models/entities/user'; -import { deliver } from '../../queue'; +import { Users, Followings } from '@/models/index.js'; +import { ILocalUser, IRemoteUser, User } from '@/models/entities/user.js'; +import { deliver } from '@/queue/index.js'; //#region types interface IRecipe { diff --git a/src/remote/activitypub/kernel/accept/follow.ts b/src/remote/activitypub/kernel/accept/follow.ts index 71c1bed9de..393516addf 100644 --- a/src/remote/activitypub/kernel/accept/follow.ts +++ b/src/remote/activitypub/kernel/accept/follow.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import accept from '../../../../services/following/requests/accept'; -import { IFollow } from '../../type'; -import DbResolver from '../../db-resolver'; -import { relayAccepted } from '../../../../services/relay'; +import { IRemoteUser } from '@/models/entities/user.js'; +import accept from '@/services/following/requests/accept.js'; +import { IFollow } from '../../type.js'; +import DbResolver from '../../db-resolver.js'; +import { relayAccepted } from '@/services/relay.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある diff --git a/src/remote/activitypub/kernel/accept/index.ts b/src/remote/activitypub/kernel/accept/index.ts index 79cdbb2ef7..354bd4f6e1 100644 --- a/src/remote/activitypub/kernel/accept/index.ts +++ b/src/remote/activitypub/kernel/accept/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import acceptFollow from './follow'; -import { IAccept, isFollow, getApType } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import acceptFollow from './follow.js'; +import { IAccept, isFollow, getApType } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/add/index.ts b/src/remote/activitypub/kernel/add/index.ts index a5b2687416..9a2fac1e74 100644 --- a/src/remote/activitypub/kernel/add/index.ts +++ b/src/remote/activitypub/kernel/add/index.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAdd } from '../../type'; -import { resolveNote } from '../../models/note'; -import { addPinned } from '../../../../services/i/pin'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAdd } from '../../type.js'; +import { resolveNote } from '../../models/note.js'; +import { addPinned } from '@/services/i/pin.js'; export default async (actor: IRemoteUser, activity: IAdd): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/src/remote/activitypub/kernel/announce/index.ts b/src/remote/activitypub/kernel/announce/index.ts index 28ad2fbcc1..7e2e73bdd5 100644 --- a/src/remote/activitypub/kernel/announce/index.ts +++ b/src/remote/activitypub/kernel/announce/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import announceNote from './note'; -import { IAnnounce, getApId } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import announceNote from './note.js'; +import { IAnnounce, getApId } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/announce/note.ts b/src/remote/activitypub/kernel/announce/note.ts index d5176897bc..9a6402e3b8 100644 --- a/src/remote/activitypub/kernel/announce/note.ts +++ b/src/remote/activitypub/kernel/announce/note.ts @@ -1,13 +1,13 @@ -import Resolver from '../../resolver'; -import post from '../../../../services/note/create'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAnnounce, getApId } from '../../type'; -import { fetchNote, resolveNote } from '../../models/note'; -import { apLogger } from '../../logger'; -import { extractDbHost } from '@/misc/convert-host'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getApLock } from '@/misc/app-lock'; -import { parseAudience } from '../../audience'; +import Resolver from '../../resolver.js'; +import post from '@/services/note/create.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAnnounce, getApId } from '../../type.js'; +import { fetchNote, resolveNote } from '../../models/note.js'; +import { apLogger } from '../../logger.js'; +import { extractDbHost } from '@/misc/convert-host.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { parseAudience } from '../../audience.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/block/index.ts b/src/remote/activitypub/kernel/block/index.ts index 6c794e1250..9e4f1b316e 100644 --- a/src/remote/activitypub/kernel/block/index.ts +++ b/src/remote/activitypub/kernel/block/index.ts @@ -1,7 +1,7 @@ -import { IBlock } from '../../type'; -import block from '../../../../services/blocking/create'; -import { IRemoteUser } from '../../../../models/entities/user'; -import DbResolver from '../../db-resolver'; +import { IBlock } from '../../type.js'; +import block from '@/services/blocking/create.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IBlock): Promise => { // ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず diff --git a/src/remote/activitypub/kernel/create/index.ts b/src/remote/activitypub/kernel/create/index.ts index f1a3ebff43..4aa10d85df 100644 --- a/src/remote/activitypub/kernel/create/index.ts +++ b/src/remote/activitypub/kernel/create/index.ts @@ -1,9 +1,9 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import createNote from './note'; -import { ICreate, getApId, isPost, getApType } from '../../type'; -import { apLogger } from '../../logger'; -import { toArray, concat, unique } from '../../../../prelude/array'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import createNote from './note.js'; +import { ICreate, getApId, isPost, getApType } from '../../type.js'; +import { apLogger } from '../../logger.js'; +import { toArray, concat, unique } from '../../../../prelude/array.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/create/note.ts b/src/remote/activitypub/kernel/create/note.ts index 69499d303e..b0a7be5ea5 100644 --- a/src/remote/activitypub/kernel/create/note.ts +++ b/src/remote/activitypub/kernel/create/note.ts @@ -1,9 +1,9 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { createNote, fetchNote } from '../../models/note'; -import { getApId, IObject, ICreate } from '../../type'; -import { getApLock } from '@/misc/app-lock'; -import { extractDbHost } from '@/misc/convert-host'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { createNote, fetchNote } from '../../models/note.js'; +import { getApId, IObject, ICreate } from '../../type.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { extractDbHost } from '@/misc/convert-host.js'; /** * 投稿作成アクティビティを捌きます diff --git a/src/remote/activitypub/kernel/delete/index.ts b/src/remote/activitypub/kernel/delete/index.ts index 4fb3d40577..130b0aeec9 100644 --- a/src/remote/activitypub/kernel/delete/index.ts +++ b/src/remote/activitypub/kernel/delete/index.ts @@ -1,7 +1,7 @@ -import deleteNote from './note'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type'; -import { toSingle } from '../../../../prelude/array'; +import deleteNote from './note.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type.js'; +import { toSingle } from '../../../../prelude/array.js'; /** * 削除アクティビティを捌きます diff --git a/src/remote/activitypub/kernel/delete/note.ts b/src/remote/activitypub/kernel/delete/note.ts index 1a7844f68b..ad5e1a2edc 100644 --- a/src/remote/activitypub/kernel/delete/note.ts +++ b/src/remote/activitypub/kernel/delete/note.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import deleteNode from '../../../../services/note/delete'; -import { apLogger } from '../../logger'; -import DbResolver from '../../db-resolver'; -import { getApLock } from '@/misc/app-lock'; -import { deleteMessage } from '../../../../services/messages/delete'; +import { IRemoteUser } from '@/models/entities/user.js'; +import deleteNode from '@/services/note/delete.js'; +import { apLogger } from '../../logger.js'; +import DbResolver from '../../db-resolver.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { deleteMessage } from '@/services/messages/delete.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/flag/index.ts b/src/remote/activitypub/kernel/flag/index.ts index 5f5357a3ed..62f3ac5ed5 100644 --- a/src/remote/activitypub/kernel/flag/index.ts +++ b/src/remote/activitypub/kernel/flag/index.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import config from '@/config'; -import { IFlag, getApIds } from '../../type'; -import { AbuseUserReports, Users } from '../../../../models'; +import { IRemoteUser } from '@/models/entities/user.js'; +import config from '@/config/index.js'; +import { IFlag, getApIds } from '../../type.js'; +import { AbuseUserReports, Users } from '@/models/index.js'; import { In } from 'typeorm'; -import { genId } from '@/misc/gen-id'; +import { genId } from '@/misc/gen-id.js'; export default async (actor: IRemoteUser, activity: IFlag): Promise => { // objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので diff --git a/src/remote/activitypub/kernel/follow.ts b/src/remote/activitypub/kernel/follow.ts index 3e2063302a..49c1a7ee01 100644 --- a/src/remote/activitypub/kernel/follow.ts +++ b/src/remote/activitypub/kernel/follow.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import follow from '../../../services/following/create'; -import { IFollow } from '../type'; -import DbResolver from '../db-resolver'; +import { IRemoteUser } from '@/models/entities/user.js'; +import follow from '@/services/following/create.js'; +import { IFollow } from '../type.js'; +import DbResolver from '../db-resolver.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/index.ts b/src/remote/activitypub/kernel/index.ts index ff75f80299..fa0df9753f 100644 --- a/src/remote/activitypub/kernel/index.ts +++ b/src/remote/activitypub/kernel/index.ts @@ -1,22 +1,22 @@ -import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type'; -import { IRemoteUser } from '../../../models/entities/user'; -import create from './create'; -import performDeleteActivity from './delete'; -import performUpdateActivity from './update'; -import { performReadActivity } from './read'; -import follow from './follow'; -import undo from './undo'; -import like from './like'; -import announce from './announce'; -import accept from './accept'; -import reject from './reject'; -import add from './add'; -import remove from './remove'; -import block from './block'; -import flag from './flag'; -import { apLogger } from '../logger'; -import Resolver from '../resolver'; -import { toArray } from '../../../prelude/array'; +import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import create from './create/index.js'; +import performDeleteActivity from './delete/index.js'; +import performUpdateActivity from './update/index.js'; +import { performReadActivity } from './read.js'; +import follow from './follow.js'; +import undo from './undo/index.js'; +import like from './like.js'; +import announce from './announce/index.js'; +import accept from './accept/index.js'; +import reject from './reject/index.js'; +import add from './add/index.js'; +import remove from './remove/index.js'; +import block from './block/index.js'; +import flag from './flag/index.js'; +import { apLogger } from '../logger.js'; +import Resolver from '../resolver.js'; +import { toArray } from '../../../prelude/array.js'; export async function performActivity(actor: IRemoteUser, activity: IObject) { if (isCollectionOrOrderedCollection(activity)) { diff --git a/src/remote/activitypub/kernel/like.ts b/src/remote/activitypub/kernel/like.ts index 6ba03e4a48..715cc379b9 100644 --- a/src/remote/activitypub/kernel/like.ts +++ b/src/remote/activitypub/kernel/like.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import { ILike, getApId } from '../type'; -import create from '../../../services/note/reaction/create'; -import { fetchNote, extractEmojis } from '../models/note'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { ILike, getApId } from '../type.js'; +import create from '@/services/note/reaction/create.js'; +import { fetchNote, extractEmojis } from '../models/note.js'; export default async (actor: IRemoteUser, activity: ILike) => { const targetUri = getApId(activity.object); diff --git a/src/remote/activitypub/kernel/read.ts b/src/remote/activitypub/kernel/read.ts index edbc8e68ed..93cc36ec46 100644 --- a/src/remote/activitypub/kernel/read.ts +++ b/src/remote/activitypub/kernel/read.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import { IRead, getApId } from '../type'; -import { isSelfHost, extractDbHost } from '@/misc/convert-host'; -import { MessagingMessages } from '../../../models'; -import { readUserMessagingMessage } from '../../../server/api/common/read-messaging-message'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IRead, getApId } from '../type.js'; +import { isSelfHost, extractDbHost } from '@/misc/convert-host.js'; +import { MessagingMessages } from '@/models/index.js'; +import { readUserMessagingMessage } from '../../../server/api/common/read-messaging-message.js'; export const performReadActivity = async (actor: IRemoteUser, activity: IRead): Promise => { const id = await getApId(activity.object); diff --git a/src/remote/activitypub/kernel/reject/follow.ts b/src/remote/activitypub/kernel/reject/follow.ts index d97ced46b3..7099864e76 100644 --- a/src/remote/activitypub/kernel/reject/follow.ts +++ b/src/remote/activitypub/kernel/reject/follow.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import reject from '../../../../services/following/requests/reject'; -import { IFollow } from '../../type'; -import DbResolver from '../../db-resolver'; -import { relayRejected } from '../../../../services/relay'; +import { IRemoteUser } from '@/models/entities/user.js'; +import reject from '@/services/following/requests/reject.js'; +import { IFollow } from '../../type.js'; +import DbResolver from '../../db-resolver.js'; +import { relayRejected } from '@/services/relay.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある diff --git a/src/remote/activitypub/kernel/reject/index.ts b/src/remote/activitypub/kernel/reject/index.ts index d7a80fce7b..ed86a4aa2f 100644 --- a/src/remote/activitypub/kernel/reject/index.ts +++ b/src/remote/activitypub/kernel/reject/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import rejectFollow from './follow'; -import { IReject, isFollow, getApType } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import rejectFollow from './follow.js'; +import { IReject, isFollow, getApType } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/remove/index.ts b/src/remote/activitypub/kernel/remove/index.ts index 32b8d66471..7d7b3386c0 100644 --- a/src/remote/activitypub/kernel/remove/index.ts +++ b/src/remote/activitypub/kernel/remove/index.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IRemove } from '../../type'; -import { resolveNote } from '../../models/note'; -import { removePinned } from '../../../../services/i/pin'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IRemove } from '../../type.js'; +import { resolveNote } from '../../models/note.js'; +import { removePinned } from '@/services/i/pin.js'; export default async (actor: IRemoteUser, activity: IRemove): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/src/remote/activitypub/kernel/undo/announce.ts b/src/remote/activitypub/kernel/undo/announce.ts index e08fea188d..d0c8c7cb66 100644 --- a/src/remote/activitypub/kernel/undo/announce.ts +++ b/src/remote/activitypub/kernel/undo/announce.ts @@ -1,7 +1,7 @@ -import { Notes } from '../../../../models'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAnnounce, getApId } from '../../type'; -import deleteNote from '../../../../services/note/delete'; +import { Notes } from '@/models/index.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAnnounce, getApId } from '../../type.js'; +import deleteNote from '@/services/note/delete.js'; export const undoAnnounce = async (actor: IRemoteUser, activity: IAnnounce): Promise => { const uri = getApId(activity); diff --git a/src/remote/activitypub/kernel/undo/block.ts b/src/remote/activitypub/kernel/undo/block.ts index 73000fc3f1..844b067e2b 100644 --- a/src/remote/activitypub/kernel/undo/block.ts +++ b/src/remote/activitypub/kernel/undo/block.ts @@ -1,7 +1,7 @@ -import { IBlock } from '../../type'; -import unblock from '../../../../services/blocking/delete'; -import { IRemoteUser } from '../../../../models/entities/user'; -import DbResolver from '../../db-resolver'; +import { IBlock } from '../../type.js'; +import unblock from '@/services/blocking/delete.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IBlock): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts index 73a164030b..cbf9b2e800 100644 --- a/src/remote/activitypub/kernel/undo/follow.ts +++ b/src/remote/activitypub/kernel/undo/follow.ts @@ -1,9 +1,9 @@ -import unfollow from '../../../../services/following/delete'; -import cancelRequest from '../../../../services/following/requests/cancel'; -import { IFollow } from '../../type'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { FollowRequests, Followings } from '../../../../models'; -import DbResolver from '../../db-resolver'; +import unfollow from '@/services/following/delete.js'; +import cancelRequest from '@/services/following/requests/cancel.js'; +import { IFollow } from '../../type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { FollowRequests, Followings } from '@/models/index.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/undo/index.ts b/src/remote/activitypub/kernel/undo/index.ts index 0bab3c9666..a03a785c0b 100644 --- a/src/remote/activitypub/kernel/undo/index.ts +++ b/src/remote/activitypub/kernel/undo/index.ts @@ -1,11 +1,11 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType } from '../../type'; -import unfollow from './follow'; -import unblock from './block'; -import undoLike from './like'; -import { undoAnnounce } from './announce'; -import Resolver from '../../resolver'; -import { apLogger } from '../../logger'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType } from '../../type.js'; +import unfollow from './follow.js'; +import unblock from './block.js'; +import undoLike from './like.js'; +import { undoAnnounce } from './announce.js'; +import Resolver from '../../resolver.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/undo/like.ts b/src/remote/activitypub/kernel/undo/like.ts index bd6930c66b..283e556b35 100644 --- a/src/remote/activitypub/kernel/undo/like.ts +++ b/src/remote/activitypub/kernel/undo/like.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { ILike, getApId } from '../../type'; -import deleteReaction from '../../../../services/note/reaction/delete'; -import { fetchNote } from '../../models/note'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { ILike, getApId } from '../../type.js'; +import deleteReaction from '@/services/note/reaction/delete.js'; +import { fetchNote } from '../../models/note.js'; /** * Process Undo.Like activity diff --git a/src/remote/activitypub/kernel/update/index.ts b/src/remote/activitypub/kernel/update/index.ts index 6dd3e5f296..7888c698e3 100644 --- a/src/remote/activitypub/kernel/update/index.ts +++ b/src/remote/activitypub/kernel/update/index.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { getApType, IUpdate, isActor } from '../../type'; -import { apLogger } from '../../logger'; -import { updateQuestion } from '../../models/question'; -import Resolver from '../../resolver'; -import { updatePerson } from '../../models/person'; +import { IRemoteUser } 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'; /** * Updateアクティビティを捌きます diff --git a/src/remote/activitypub/logger.ts b/src/remote/activitypub/logger.ts index e13add01db..cab51b3bf5 100644 --- a/src/remote/activitypub/logger.ts +++ b/src/remote/activitypub/logger.ts @@ -1,3 +1,3 @@ -import { remoteLogger } from '../logger'; +import { remoteLogger } from '../logger.js'; export const apLogger = remoteLogger.createSubLogger('ap', 'magenta'); diff --git a/src/remote/activitypub/misc/get-note-html.ts b/src/remote/activitypub/misc/get-note-html.ts index 683860d9cc..3800b40608 100644 --- a/src/remote/activitypub/misc/get-note-html.ts +++ b/src/remote/activitypub/misc/get-note-html.ts @@ -1,6 +1,6 @@ import * as mfm from 'mfm-js'; -import { Note } from '../../../models/entities/note'; -import { toHtml } from '../../../mfm/to-html'; +import { Note } from '@/models/entities/note.js'; +import { toHtml } from '../../../mfm/to-html.js'; export default function(note: Note) { let html = note.text ? toHtml(mfm.parse(note.text), JSON.parse(note.mentionedRemoteUsers)) : null; diff --git a/src/remote/activitypub/misc/html-to-mfm.ts b/src/remote/activitypub/misc/html-to-mfm.ts index 5cca04df21..bb1ba7925c 100644 --- a/src/remote/activitypub/misc/html-to-mfm.ts +++ b/src/remote/activitypub/misc/html-to-mfm.ts @@ -1,6 +1,6 @@ -import { IObject } from '../type'; -import { extractApHashtagObjects } from '../models/tag'; -import { fromHtml } from '../../../mfm/from-html'; +import { IObject } from '../type.js'; +import { extractApHashtagObjects } from '../models/tag.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/src/remote/activitypub/misc/ld-signature.ts b/src/remote/activitypub/misc/ld-signature.ts index dec07ea81b..c73cef81e1 100644 --- a/src/remote/activitypub/misc/ld-signature.ts +++ b/src/remote/activitypub/misc/ld-signature.ts @@ -1,8 +1,8 @@ import * as crypto from 'crypto'; import * as jsonld from 'jsonld'; -import { CONTEXTS } from './contexts'; +import { CONTEXTS } from './contexts.js'; import fetch from 'node-fetch'; -import { httpAgent, httpsAgent } from '@/misc/fetch'; +import { httpAgent, httpsAgent } from '@/misc/fetch.js'; // RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017 diff --git a/src/remote/activitypub/models/image.ts b/src/remote/activitypub/models/image.ts index 7bec1d6030..ea2584407a 100644 --- a/src/remote/activitypub/models/image.ts +++ b/src/remote/activitypub/models/image.ts @@ -1,10 +1,10 @@ -import uploadFromUrl from '../../../services/drive/upload-from-url'; -import { IRemoteUser } from '../../../models/entities/user'; -import Resolver from '../resolver'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { apLogger } from '../logger'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import Resolver from '../resolver.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { apLogger } from '../logger.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/mention.ts b/src/remote/activitypub/models/mention.ts index 5d10328ef4..e84429815d 100644 --- a/src/remote/activitypub/models/mention.ts +++ b/src/remote/activitypub/models/mention.ts @@ -1,9 +1,9 @@ -import { toArray, unique } from '../../../prelude/array'; -import { IObject, isMention, IApMention } from '../type'; -import { resolvePerson } from './person'; +import { toArray, unique } from '../../../prelude/array.js'; +import { IObject, isMention, IApMention } from '../type.js'; +import { resolvePerson } from './person.js'; import * as promiseLimit from 'promise-limit'; -import Resolver from '../resolver'; -import { User } from '../../../models/entities/user'; +import Resolver from '../resolver.js'; +import { User } from '@/models/entities/user.js'; export async function extractApMentions(tags: IObject | IObject[] | null | undefined) { const hrefs = unique(extractApMentionObjects(tags).map(x => x.href as string)); diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 6621ae3492..2a4f51bb3b 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -1,31 +1,31 @@ import * as promiseLimit from 'promise-limit'; -import config from '@/config'; -import Resolver from '../resolver'; -import post from '../../../services/note/create'; -import { resolvePerson, updatePerson } from './person'; -import { resolveImage } from './image'; -import { IRemoteUser } from '../../../models/entities/user'; -import { htmlToMfm } from '../misc/html-to-mfm'; -import { extractApHashtags } from './tag'; -import { unique, toArray, toSingle } from '../../../prelude/array'; -import { extractPollFromQuestion } from './question'; -import vote from '../../../services/note/polls/vote'; -import { apLogger } from '../logger'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { deliverQuestionUpdate } from '../../../services/note/polls/update'; -import { extractDbHost, toPuny } from '@/misc/convert-host'; -import { Emojis, Polls, MessagingMessages } from '../../../models'; -import { Note } from '../../../models/entities/note'; -import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type'; -import { Emoji } from '../../../models/entities/emoji'; -import { genId } from '@/misc/gen-id'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getApLock } from '@/misc/app-lock'; -import { createMessage } from '../../../services/messages/create'; -import { parseAudience } from '../audience'; -import { extractApMentions } from './mention'; -import DbResolver from '../db-resolver'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import post from '@/services/note/create.js'; +import { resolvePerson, updatePerson } from './person.js'; +import { resolveImage } from './image.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { htmlToMfm } from '../misc/html-to-mfm.js'; +import { extractApHashtags } from './tag.js'; +import { unique, toArray, toSingle } from '../../../prelude/array.js'; +import { extractPollFromQuestion } from './question.js'; +import vote from '@/services/note/polls/vote.js'; +import { apLogger } from '../logger.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { deliverQuestionUpdate } from '@/services/note/polls/update.js'; +import { extractDbHost, toPuny } from '@/misc/convert-host.js'; +import { Emojis, Polls, MessagingMessages } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { genId } from '@/misc/gen-id.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { createMessage } from '@/services/messages/create.js'; +import { parseAudience } from '../audience.js'; +import { extractApMentions } from './mention.js'; +import DbResolver from '../db-resolver.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 1b2d0bbdcf..2b7d707ac8 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -2,32 +2,32 @@ import { URL } from 'url'; import * as promiseLimit from 'promise-limit'; import $, { Context } from 'cafy'; -import config from '@/config'; -import Resolver from '../resolver'; -import { resolveImage } from './image'; -import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type'; -import { fromHtml } from '../../../mfm/from-html'; -import { htmlToMfm } from '../misc/html-to-mfm'; -import { resolveNote, extractEmojis } from './note'; -import { registerOrFetchInstanceDoc } from '../../../services/register-or-fetch-instance-doc'; -import { extractApHashtags } from './tag'; -import { apLogger } from '../logger'; -import { Note } from '../../../models/entities/note'; -import { updateUsertags } from '../../../services/update-hashtag'; -import { Users, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '../../../models'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Emoji } from '../../../models/entities/emoji'; -import { UserNotePining } from '../../../models/entities/user-note-pining'; -import { genId } from '@/misc/gen-id'; -import { instanceChart, usersChart } from '../../../services/chart'; -import { UserPublickey } from '../../../models/entities/user-publickey'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { toPuny } from '@/misc/convert-host'; -import { UserProfile } from '../../../models/entities/user-profile'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import { resolveImage } from './image.js'; +import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type.js'; +import { fromHtml } from '../../../mfm/from-html.js'; +import { htmlToMfm } from '../misc/html-to-mfm.js'; +import { resolveNote, extractEmojis } from './note.js'; +import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; +import { extractApHashtags } from './tag.js'; +import { apLogger } from '../logger.js'; +import { Note } from '@/models/entities/note.js'; +import { updateUsertags } from '@/services/update-hashtag.js'; +import { Users, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '@/models/index.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { UserNotePining } from '@/models/entities/user-note-pining.js'; +import { genId } from '@/misc/gen-id.js'; +import { instanceChart, usersChart } from '@/services/chart/index.js'; +import { UserPublickey } from '@/models/entities/user-publickey.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; import { getConnection } from 'typeorm'; -import { toArray } from '../../../prelude/array'; -import { fetchInstanceMetadata } from '../../../services/fetch-instance-metadata'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { toArray } from '../../../prelude/array.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/question.ts b/src/remote/activitypub/models/question.ts index 966b15af11..f954a38e8b 100644 --- a/src/remote/activitypub/models/question.ts +++ b/src/remote/activitypub/models/question.ts @@ -1,9 +1,9 @@ -import config from '@/config'; -import Resolver from '../resolver'; -import { IObject, IQuestion, isQuestion, } from '../type'; -import { apLogger } from '../logger'; -import { Notes, Polls } from '../../../models'; -import { IPoll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import { IObject, IQuestion, isQuestion, } from '../type.js'; +import { apLogger } from '../logger.js'; +import { Notes, Polls } from '@/models/index.js'; +import { IPoll } from '@/models/entities/poll.js'; export async function extractPollFromQuestion(source: string | IObject, resolver?: Resolver): Promise { if (resolver == null) resolver = new Resolver(); diff --git a/src/remote/activitypub/models/tag.ts b/src/remote/activitypub/models/tag.ts index d25cb463fe..cb8c753365 100644 --- a/src/remote/activitypub/models/tag.ts +++ b/src/remote/activitypub/models/tag.ts @@ -1,5 +1,5 @@ -import { toArray } from '../../../prelude/array'; -import { IObject, isHashtag, IApHashtag } from '../type'; +import { toArray } from '../../../prelude/array.js'; +import { IObject, isHashtag, IApHashtag } from '../type.js'; export function extractApHashtags(tags: IObject | IObject[] | null | undefined) { if (tags == null) return []; diff --git a/src/remote/activitypub/perform.ts b/src/remote/activitypub/perform.ts index 12e72fdea5..3e18815586 100644 --- a/src/remote/activitypub/perform.ts +++ b/src/remote/activitypub/perform.ts @@ -1,6 +1,6 @@ -import { IObject } from './type'; -import { IRemoteUser } from '../../models/entities/user'; -import { performActivity } from './kernel'; +import { IObject } from './type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { performActivity } from './kernel/index.js'; export default async (actor: IRemoteUser, activity: IObject): Promise => { await performActivity(actor, activity); diff --git a/src/remote/activitypub/renderer/accept.ts b/src/remote/activitypub/renderer/accept.ts index 8725a30e7c..f1037e95f2 100644 --- a/src/remote/activitypub/renderer/accept.ts +++ b/src/remote/activitypub/renderer/accept.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Accept', diff --git a/src/remote/activitypub/renderer/add.ts b/src/remote/activitypub/renderer/add.ts index 18f9ccacf5..fce541bcdc 100644 --- a/src/remote/activitypub/renderer/add.ts +++ b/src/remote/activitypub/renderer/add.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; export default (user: ILocalUser, target: any, object: any) => ({ type: 'Add', diff --git a/src/remote/activitypub/renderer/announce.ts b/src/remote/activitypub/renderer/announce.ts index f577dbbc89..dfbe4714c9 100644 --- a/src/remote/activitypub/renderer/announce.ts +++ b/src/remote/activitypub/renderer/announce.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; export default (object: any, note: Note) => { const attributedTo = `${config.url}/users/${note.userId}`; diff --git a/src/remote/activitypub/renderer/block.ts b/src/remote/activitypub/renderer/block.ts index 26b7dd580a..4e9102e6f0 100644 --- a/src/remote/activitypub/renderer/block.ts +++ b/src/remote/activitypub/renderer/block.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser, IRemoteUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser, IRemoteUser } from '@/models/entities/user.js'; export default (blocker: ILocalUser, blockee: IRemoteUser) => ({ type: 'Block', diff --git a/src/remote/activitypub/renderer/create.ts b/src/remote/activitypub/renderer/create.ts index ff0840b9e6..103ce4bfd5 100644 --- a/src/remote/activitypub/renderer/create.ts +++ b/src/remote/activitypub/renderer/create.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; export default (object: any, note: Note) => { const activity = { diff --git a/src/remote/activitypub/renderer/delete.ts b/src/remote/activitypub/renderer/delete.ts index 710f0482a6..159a486e08 100644 --- a/src/remote/activitypub/renderer/delete.ts +++ b/src/remote/activitypub/renderer/delete.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Delete', diff --git a/src/remote/activitypub/renderer/document.ts b/src/remote/activitypub/renderer/document.ts index f6e9dca45d..c973de4c4c 100644 --- a/src/remote/activitypub/renderer/document.ts +++ b/src/remote/activitypub/renderer/document.ts @@ -1,5 +1,5 @@ -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export default (file: DriveFile) => ({ type: 'Document', diff --git a/src/remote/activitypub/renderer/emoji.ts b/src/remote/activitypub/renderer/emoji.ts index b62259c32e..a58c0c1ad9 100644 --- a/src/remote/activitypub/renderer/emoji.ts +++ b/src/remote/activitypub/renderer/emoji.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Emoji } from '../../../models/entities/emoji'; +import config from '@/config/index.js'; +import { Emoji } from '@/models/entities/emoji.js'; export default (emoji: Emoji) => ({ id: `${config.url}/emojis/${emoji.name}`, diff --git a/src/remote/activitypub/renderer/follow-relay.ts b/src/remote/activitypub/renderer/follow-relay.ts index d53bd05825..4340b70537 100644 --- a/src/remote/activitypub/renderer/follow-relay.ts +++ b/src/remote/activitypub/renderer/follow-relay.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { Relay } from '../../../models/entities/relay'; -import { ILocalUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { Relay } from '@/models/entities/relay.js'; +import { ILocalUser } from '@/models/entities/user.js'; export function renderFollowRelay(relay: Relay, relayActor: ILocalUser) { const follow = { diff --git a/src/remote/activitypub/renderer/follow-user.ts b/src/remote/activitypub/renderer/follow-user.ts index 744361a24f..ad1d63b933 100644 --- a/src/remote/activitypub/renderer/follow-user.ts +++ b/src/remote/activitypub/renderer/follow-user.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { Users } from '../../../models'; -import { User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; /** * Convert (local|remote)(Follower|Followee)ID to URL diff --git a/src/remote/activitypub/renderer/follow.ts b/src/remote/activitypub/renderer/follow.ts index 252b0b2838..9f80bf829b 100644 --- a/src/remote/activitypub/renderer/follow.ts +++ b/src/remote/activitypub/renderer/follow.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User } from '../../../models/entities/user'; -import { Users } from '../../../models'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export default (follower: { id: User['id']; host: User['host']; uri: User['host'] }, followee: { id: User['id']; host: User['host']; uri: User['host'] }, requestId?: string) => { const follow = { diff --git a/src/remote/activitypub/renderer/hashtag.ts b/src/remote/activitypub/renderer/hashtag.ts index a739a4b0b6..faa0efe924 100644 --- a/src/remote/activitypub/renderer/hashtag.ts +++ b/src/remote/activitypub/renderer/hashtag.ts @@ -1,4 +1,4 @@ -import config from '@/config'; +import config from '@/config/index.js'; export default (tag: string) => ({ type: 'Hashtag', diff --git a/src/remote/activitypub/renderer/image.ts b/src/remote/activitypub/renderer/image.ts index cbd4fbbe68..6440248a4a 100644 --- a/src/remote/activitypub/renderer/image.ts +++ b/src/remote/activitypub/renderer/image.ts @@ -1,5 +1,5 @@ -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export default (file: DriveFile) => ({ type: 'Image', diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts index 84500e9491..5ab5b1cdbe 100644 --- a/src/remote/activitypub/renderer/index.ts +++ b/src/remote/activitypub/renderer/index.ts @@ -1,9 +1,9 @@ -import config from '@/config'; +import config from '@/config/index.js'; import { v4 as uuid } from 'uuid'; -import { IActivity } from '../type'; -import { LdSignature } from '../misc/ld-signature'; -import { getUserKeypair } from '@/misc/keypair-store'; -import { User } from '@/models/entities/user'; +import { IActivity } from '../type.js'; +import { LdSignature } from '../misc/ld-signature.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; +import { User } from '@/models/entities/user.js'; export const renderActivity = (x: any): IActivity | null => { if (x == null) return null; diff --git a/src/remote/activitypub/renderer/key.ts b/src/remote/activitypub/renderer/key.ts index 547059dd3c..4db1d83262 100644 --- a/src/remote/activitypub/renderer/key.ts +++ b/src/remote/activitypub/renderer/key.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { UserKeypair } from '../../../models/entities/user-keypair'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; import { createPublicKey } from 'crypto'; export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({ diff --git a/src/remote/activitypub/renderer/like.ts b/src/remote/activitypub/renderer/like.ts index 5967836846..6ec0bfb034 100644 --- a/src/remote/activitypub/renderer/like.ts +++ b/src/remote/activitypub/renderer/like.ts @@ -1,8 +1,8 @@ -import config from '@/config'; -import { NoteReaction } from '../../../models/entities/note-reaction'; -import { Note } from '../../../models/entities/note'; -import { Emojis } from '../../../models'; -import renderEmoji from './emoji'; +import config from '@/config/index.js'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; +import { Note } from '@/models/entities/note.js'; +import { Emojis } from '@/models/index.js'; +import renderEmoji from './emoji.js'; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; diff --git a/src/remote/activitypub/renderer/mention.ts b/src/remote/activitypub/renderer/mention.ts index 14c4c40d47..c7e62e8840 100644 --- a/src/remote/activitypub/renderer/mention.ts +++ b/src/remote/activitypub/renderer/mention.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users } from '../../../models'; +import config from '@/config/index.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export default (mention: User) => ({ type: 'Mention', diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index 54dee07892..0f4513fca7 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -1,15 +1,15 @@ -import renderDocument from './document'; -import renderHashtag from './hashtag'; -import renderMention from './mention'; -import renderEmoji from './emoji'; -import config from '@/config'; -import toHtml from '../misc/get-note-html'; -import { Note, IMentionedRemoteUsers } from '../../../models/entities/note'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles, Notes, Users, Emojis, Polls } from '../../../models'; +import renderDocument from './document.js'; +import renderHashtag from './hashtag.js'; +import renderMention from './mention.js'; +import renderEmoji from './emoji.js'; +import config from '@/config/index.js'; +import toHtml from '../misc/get-note-html.js'; +import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles, Notes, Users, Emojis, Polls } from '@/models/index.js'; import { In } from 'typeorm'; -import { Emoji } from '../../../models/entities/emoji'; -import { Poll } from '../../../models/entities/poll'; +import { Emoji } from '@/models/entities/emoji.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderNote(note: Note, dive = true, isTalk = false): Promise { const getPromisedFiles = async (ids: string[]) => { diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts index 91b91bff92..edcb68ef6a 100644 --- a/src/remote/activitypub/renderer/person.ts +++ b/src/remote/activitypub/renderer/person.ts @@ -1,16 +1,16 @@ import { URL } from 'url'; import * as mfm from 'mfm-js'; -import renderImage from './image'; -import renderKey from './key'; -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { toHtml } from '../../../mfm/to-html'; -import { getEmojis } from './note'; -import renderEmoji from './emoji'; -import { IIdentifier } from '../models/identifier'; -import renderHashtag from './hashtag'; -import { DriveFiles, UserProfiles } from '../../../models'; -import { getUserKeypair } from '@/misc/keypair-store'; +import renderImage from './image.js'; +import renderKey from './key.js'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { toHtml } from '../../../mfm/to-html.js'; +import { getEmojis } from './note.js'; +import renderEmoji from './emoji.js'; +import { IIdentifier } from '../models/identifier.js'; +import renderHashtag from './hashtag.js'; +import { DriveFiles, UserProfiles } from '@/models/index.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; export async function renderPerson(user: ILocalUser) { const id = `${config.url}/users/${user.id}`; diff --git a/src/remote/activitypub/renderer/question.ts b/src/remote/activitypub/renderer/question.ts index 99670f80a1..388398a7d8 100644 --- a/src/remote/activitypub/renderer/question.ts +++ b/src/remote/activitypub/renderer/question.ts @@ -1,7 +1,7 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { Poll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderQuestion(user: { id: User['id'] }, note: Note, poll: Poll) { const question = { diff --git a/src/remote/activitypub/renderer/read.ts b/src/remote/activitypub/renderer/read.ts index 1287f4ccb0..39a852fcb5 100644 --- a/src/remote/activitypub/renderer/read.ts +++ b/src/remote/activitypub/renderer/read.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { MessagingMessage } from '../../../models/entities/messaging-message'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; export const renderReadActivity = (user: { id: User['id'] }, message: MessagingMessage) => ({ type: 'Read', diff --git a/src/remote/activitypub/renderer/reject.ts b/src/remote/activitypub/renderer/reject.ts index e1eb5b004e..474b67d680 100644 --- a/src/remote/activitypub/renderer/reject.ts +++ b/src/remote/activitypub/renderer/reject.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => ({ type: 'Reject', diff --git a/src/remote/activitypub/renderer/remove.ts b/src/remote/activitypub/renderer/remove.ts index ff1fab8e57..1f6bc19404 100644 --- a/src/remote/activitypub/renderer/remove.ts +++ b/src/remote/activitypub/renderer/remove.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (user: { id: User['id'] }, target: any, object: any) => ({ type: 'Remove', diff --git a/src/remote/activitypub/renderer/undo.ts b/src/remote/activitypub/renderer/undo.ts index 627a6533ab..968d59fae6 100644 --- a/src/remote/activitypub/renderer/undo.ts +++ b/src/remote/activitypub/renderer/undo.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser, User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => { if (object == null) return null; diff --git a/src/remote/activitypub/renderer/update.ts b/src/remote/activitypub/renderer/update.ts index 4295fc64f3..c696a9c34b 100644 --- a/src/remote/activitypub/renderer/update.ts +++ b/src/remote/activitypub/renderer/update.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => { const activity = { diff --git a/src/remote/activitypub/renderer/vote.ts b/src/remote/activitypub/renderer/vote.ts index 529fdaafcd..201845a189 100644 --- a/src/remote/activitypub/renderer/vote.ts +++ b/src/remote/activitypub/renderer/vote.ts @@ -1,8 +1,8 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; -import { IRemoteUser, User } from '../../../models/entities/user'; -import { PollVote } from '../../../models/entities/poll-vote'; -import { Poll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; +import { IRemoteUser, User } from '@/models/entities/user.js'; +import { PollVote } from '@/models/entities/poll-vote.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderVote(user: { id: User['id'] }, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise { return { diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index e4dca32329..2711c85874 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -3,13 +3,13 @@ import * as https from 'https'; import { sign } from 'http-signature'; import * as crypto from 'crypto'; -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { getAgentByUrl } from '@/misc/fetch'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; import { URL } from 'url'; import got from 'got'; import * as Got from 'got'; -import { getUserKeypair } from '@/misc/keypair-store'; +import { getUserKeypair } from '@/misc/keypair-store.js'; export default async (user: { id: User['id'] }, url: string, object: any) => { const timeout = 10 * 1000; diff --git a/src/remote/activitypub/resolver.ts b/src/remote/activitypub/resolver.ts index 066bde0883..8351058312 100644 --- a/src/remote/activitypub/resolver.ts +++ b/src/remote/activitypub/resolver.ts @@ -1,9 +1,9 @@ -import config from '@/config'; -import { getJson } from '@/misc/fetch'; -import { ILocalUser } from '../../models/entities/user'; -import { getInstanceActor } from '../../services/instance-actor'; -import { signedGet } from './request'; -import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type'; +import config from '@/config/index.js'; +import { getJson } from '@/misc/fetch.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { getInstanceActor } from '@/services/instance-actor.js'; +import { signedGet } from './request.js'; +import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type.js'; export default class Resolver { private history: Set; diff --git a/src/remote/logger.ts b/src/remote/logger.ts index d7464e7fde..4921f53bd8 100644 --- a/src/remote/logger.ts +++ b/src/remote/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const remoteLogger = new Logger('remote', 'cyan'); diff --git a/src/remote/resolve-user.ts b/src/remote/resolve-user.ts index 1bcecee3c1..1869204399 100644 --- a/src/remote/resolve-user.ts +++ b/src/remote/resolve-user.ts @@ -1,12 +1,12 @@ import { URL } from 'url'; -import webFinger from './webfinger'; -import config from '@/config'; -import { createPerson, updatePerson } from './activitypub/models/person'; -import { remoteLogger } from './logger'; +import webFinger from './webfinger.js'; +import config from '@/config/index.js'; +import { createPerson, updatePerson } from './activitypub/models/person.js'; +import { remoteLogger } from './logger.js'; import * as chalk from 'chalk'; -import { User, IRemoteUser } from '../models/entities/user'; -import { Users } from '../models'; -import { toPuny } from '@/misc/convert-host'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; const logger = remoteLogger.createSubLogger('resolve-user'); diff --git a/src/remote/webfinger.ts b/src/remote/webfinger.ts index 744ab3639a..e885e9d7cb 100644 --- a/src/remote/webfinger.ts +++ b/src/remote/webfinger.ts @@ -1,6 +1,6 @@ import { URL } from 'url'; -import { getJson } from '@/misc/fetch'; -import { query as urlQuery } from '../prelude/url'; +import { getJson } from '@/misc/fetch.js'; +import { query as urlQuery } from '../prelude/url.js'; type ILink = { href: string; diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 0ddc4683fe..834293a5a7 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -2,22 +2,22 @@ import * as Router from '@koa/router'; import * as json from 'koa-json-body'; import * as httpSignature from 'http-signature'; -import { renderActivity } from '../remote/activitypub/renderer'; -import renderNote from '../remote/activitypub/renderer/note'; -import renderKey from '../remote/activitypub/renderer/key'; -import { renderPerson } from '../remote/activitypub/renderer/person'; -import renderEmoji from '../remote/activitypub/renderer/emoji'; -import Outbox, { packActivity } from './activitypub/outbox'; -import Followers from './activitypub/followers'; -import Following from './activitypub/following'; -import Featured from './activitypub/featured'; -import { inbox as processInbox } from '../queue'; -import { isSelfHost } from '@/misc/convert-host'; -import { Notes, Users, Emojis, NoteReactions } from '../models'; -import { ILocalUser, User } from '../models/entities/user'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import renderKey from '@/remote/activitypub/renderer/key.js'; +import { renderPerson } from '@/remote/activitypub/renderer/person.js'; +import renderEmoji from '@/remote/activitypub/renderer/emoji.js'; +import Outbox, { packActivity } from './activitypub/outbox.js'; +import Followers from './activitypub/followers.js'; +import Following from './activitypub/following.js'; +import Featured from './activitypub/featured.js'; +import { inbox as processInbox } from '@/queue/index.js'; +import { isSelfHost } from '@/misc/convert-host.js'; +import { Notes, Users, Emojis, NoteReactions } from '@/models/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; import { In } from 'typeorm'; -import { renderLike } from '../remote/activitypub/renderer/like'; -import { getUserKeypair } from '@/misc/keypair-store'; +import { renderLike } from '@/remote/activitypub/renderer/like.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; // Init router const router = new Router(); diff --git a/src/server/activitypub/featured.ts b/src/server/activitypub/featured.ts index 02d4a30a5d..69de201137 100644 --- a/src/server/activitypub/featured.ts +++ b/src/server/activitypub/featured.ts @@ -1,10 +1,10 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import { setResponseType } from '../activitypub'; -import renderNote from '../../remote/activitypub/renderer/note'; -import { Users, Notes, UserNotePinings } from '../../models'; +import config from '@/config/index.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; +import { setResponseType } from '../activitypub.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import { Users, Notes, UserNotePinings } from '@/models/index.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/activitypub/followers.ts b/src/server/activitypub/followers.ts index a4f2e666d0..13a3ae91ad 100644 --- a/src/server/activitypub/followers.ts +++ b/src/server/activitypub/followers.ts @@ -1,14 +1,14 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import * as url from '../../prelude/url'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import renderFollowUser from '../../remote/activitypub/renderer/follow-user'; -import { setResponseType } from '../activitypub'; -import { Users, Followings } from '../../models'; +import { ID } from '@/misc/cafy-id.js'; +import * as url from '../../prelude/url.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; +import renderOrderedCollectionPage from '@/remote/activitypub/renderer/ordered-collection-page.js'; +import renderFollowUser from '@/remote/activitypub/renderer/follow-user.js'; +import { setResponseType } from '../activitypub.js'; +import { Users, Followings } from '@/models/index.js'; import { LessThan } from 'typeorm'; export default async (ctx: Router.RouterContext) => { diff --git a/src/server/activitypub/following.ts b/src/server/activitypub/following.ts index f5e5c62364..1f7938bec4 100644 --- a/src/server/activitypub/following.ts +++ b/src/server/activitypub/following.ts @@ -1,16 +1,16 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import * as url from '../../prelude/url'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import renderFollowUser from '../../remote/activitypub/renderer/follow-user'; -import { setResponseType } from '../activitypub'; -import { Users, Followings } from '../../models'; +import { ID } from '@/misc/cafy-id.js'; +import * as url from '../../prelude/url.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; +import renderOrderedCollectionPage from '@/remote/activitypub/renderer/ordered-collection-page.js'; +import renderFollowUser from '@/remote/activitypub/renderer/follow-user.js'; +import { setResponseType } from '../activitypub.js'; +import { Users, Followings } from '@/models/index.js'; import { LessThan, FindConditions } from 'typeorm'; -import { Following } from '../../models/entities/following'; +import { Following } from '@/models/entities/following.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/activitypub/outbox.ts b/src/server/activitypub/outbox.ts index 338e177370..eed489e59d 100644 --- a/src/server/activitypub/outbox.ts +++ b/src/server/activitypub/outbox.ts @@ -1,20 +1,20 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import { setResponseType } from '../activitypub'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import { countIf } from '../../prelude/array'; -import * as url from '../../prelude/url'; -import { Users, Notes } from '../../models'; -import { makePaginationQuery } from '../api/common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; +import renderOrderedCollectionPage from '@/remote/activitypub/renderer/ordered-collection-page.js'; +import { setResponseType } from '../activitypub.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import renderCreate from '@/remote/activitypub/renderer/create.js'; +import renderAnnounce from '@/remote/activitypub/renderer/announce.js'; +import { countIf } from '../../prelude/array.js'; +import * as url from '../../prelude/url.js'; +import { Users, Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../api/common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { Note } from '../../models/entities/note'; +import { Note } from '@/models/entities/note.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/api/2fa.ts b/src/server/api/2fa.ts index 77f0f8cd04..ee92caf55a 100644 --- a/src/server/api/2fa.ts +++ b/src/server/api/2fa.ts @@ -1,5 +1,5 @@ import * as crypto from 'crypto'; -import config from '@/config'; +import config from '@/config/index.js'; import * as jsrsasign from 'jsrsasign'; const ECC_PRELUDE = Buffer.from([0x04]); diff --git a/src/server/api/api-handler.ts b/src/server/api/api-handler.ts index cbace8917e..e2660d7b6f 100644 --- a/src/server/api/api-handler.ts +++ b/src/server/api/api-handler.ts @@ -1,9 +1,9 @@ import * as Koa from 'koa'; -import { IEndpoint } from './endpoints'; -import authenticate, { AuthenticationError } from './authenticate'; -import call from './call'; -import { ApiError } from './error'; +import { IEndpoint } from './endpoints.js'; +import authenticate, { AuthenticationError } from './authenticate.js'; +import call from './call.js'; +import { ApiError } from './error.js'; export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { const body = ctx.request.body; diff --git a/src/server/api/authenticate.ts b/src/server/api/authenticate.ts index 6148ad33c5..cd5b01cd51 100644 --- a/src/server/api/authenticate.ts +++ b/src/server/api/authenticate.ts @@ -1,7 +1,7 @@ -import isNativeToken from './common/is-native-token'; -import { User } from '../../models/entities/user'; -import { Users, AccessTokens, Apps } from '../../models'; -import { AccessToken } from '../../models/entities/access-token'; +import isNativeToken from './common/is-native-token.js'; +import { User } from '@/models/entities/user.js'; +import { Users, AccessTokens, Apps } from '@/models/index.js'; +import { AccessToken } from '@/models/entities/access-token.js'; export class AuthenticationError extends Error { constructor(message: string) { diff --git a/src/server/api/call.ts b/src/server/api/call.ts index d50b6a1222..899a5a6c72 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -1,10 +1,10 @@ import { performance } from 'perf_hooks'; -import limiter from './limiter'; -import { User } from '../../models/entities/user'; -import endpoints from './endpoints'; -import { ApiError } from './error'; -import { apiLogger } from './logger'; -import { AccessToken } from '../../models/entities/access-token'; +import limiter from './limiter.js'; +import { User } from '@/models/entities/user.js'; +import endpoints from './endpoints.js'; +import { ApiError } from './error.js'; +import { apiLogger } from './logger.js'; +import { AccessToken } from '@/models/entities/access-token.js'; const accessDenied = { message: 'Access denied.', diff --git a/src/server/api/common/generate-block-query.ts b/src/server/api/common/generate-block-query.ts index 016da57aac..60db1e731b 100644 --- a/src/server/api/common/generate-block-query.ts +++ b/src/server/api/common/generate-block-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Blockings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Blockings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; // ここでいうBlockedは被Blockedの意 diff --git a/src/server/api/common/generate-channel-query.ts b/src/server/api/common/generate-channel-query.ts index 74a6d68c40..333bb73b86 100644 --- a/src/server/api/common/generate-channel-query.ts +++ b/src/server/api/common/generate-channel-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { ChannelFollowings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { ChannelFollowings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateChannelQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/generate-muted-note-query.ts b/src/server/api/common/generate-muted-note-query.ts index c7f9f7c5a3..f544e334d3 100644 --- a/src/server/api/common/generate-muted-note-query.ts +++ b/src/server/api/common/generate-muted-note-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { MutedNotes } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { MutedNotes } from '@/models/index.js'; import { SelectQueryBuilder } from 'typeorm'; export function generateMutedNoteQuery(q: SelectQueryBuilder, me: { id: User['id'] }) { diff --git a/src/server/api/common/generate-muted-user-query.ts b/src/server/api/common/generate-muted-user-query.ts index f5e072ba93..79cb3ff894 100644 --- a/src/server/api/common/generate-muted-user-query.ts +++ b/src/server/api/common/generate-muted-user-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Mutings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Mutings } from '@/models/index.js'; import { SelectQueryBuilder, Brackets } from 'typeorm'; export function generateMutedUserQuery(q: SelectQueryBuilder, me: { id: User['id'] }, exclude?: User) { diff --git a/src/server/api/common/generate-native-user-token.ts b/src/server/api/common/generate-native-user-token.ts index 1f791c57ce..5d8a4c5378 100644 --- a/src/server/api/common/generate-native-user-token.ts +++ b/src/server/api/common/generate-native-user-token.ts @@ -1,3 +1,3 @@ -import { secureRndstr } from '@/misc/secure-rndstr'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; export default () => secureRndstr(16, true); diff --git a/src/server/api/common/generate-replies-query.ts b/src/server/api/common/generate-replies-query.ts index 29b1e17c2e..e59a3334ef 100644 --- a/src/server/api/common/generate-replies-query.ts +++ b/src/server/api/common/generate-replies-query.ts @@ -1,4 +1,4 @@ -import { User } from '../../../models/entities/user'; +import { User } from '@/models/entities/user.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateRepliesQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/generate-visibility-query.ts b/src/server/api/common/generate-visibility-query.ts index 00a50f8211..715982934c 100644 --- a/src/server/api/common/generate-visibility-query.ts +++ b/src/server/api/common/generate-visibility-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Followings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Followings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateVisibilityQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/getters.ts b/src/server/api/common/getters.ts index 73fbadfee6..c5a47876d0 100644 --- a/src/server/api/common/getters.ts +++ b/src/server/api/common/getters.ts @@ -1,7 +1,7 @@ -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { Notes, Users } from '../../../models'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes, Users } from '@/models/index.js'; /** * Get note for API processing diff --git a/src/server/api/common/inject-featured.ts b/src/server/api/common/inject-featured.ts index 3659b7f2b2..b7dd8028b5 100644 --- a/src/server/api/common/inject-featured.ts +++ b/src/server/api/common/inject-featured.ts @@ -1,9 +1,9 @@ import rndstr from 'rndstr'; -import { Note } from '../../../models/entities/note'; -import { User } from '../../../models/entities/user'; -import { Notes, UserProfiles, NoteReactions } from '../../../models'; -import { generateMutedUserQuery } from './generate-muted-user-query'; -import { generateBlockedUserQuery } from './generate-block-query'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { Notes, UserProfiles, NoteReactions } from '@/models/index.js'; +import { generateMutedUserQuery } from './generate-muted-user-query.js'; +import { generateBlockedUserQuery } from './generate-block-query.js'; // TODO: リアクション、Renote、返信などをしたノートは除外する diff --git a/src/server/api/common/inject-promo.ts b/src/server/api/common/inject-promo.ts index 2c16ca4cf7..971770f32a 100644 --- a/src/server/api/common/inject-promo.ts +++ b/src/server/api/common/inject-promo.ts @@ -1,7 +1,7 @@ import rndstr from 'rndstr'; -import { Note } from '../../../models/entities/note'; -import { User } from '../../../models/entities/user'; -import { PromoReads, PromoNotes, Notes, Users } from '../../../models'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { PromoReads, PromoNotes, Notes, Users } from '@/models/index.js'; export async function injectPromo(timeline: Note[], user?: User | null) { if (timeline.length < 5) return; diff --git a/src/server/api/common/read-messaging-message.ts b/src/server/api/common/read-messaging-message.ts index 6c9fcf973f..638aff3d58 100644 --- a/src/server/api/common/read-messaging-message.ts +++ b/src/server/api/common/read-messaging-message.ts @@ -1,17 +1,17 @@ -import { publishMainStream, publishGroupMessagingStream } from '../../../services/stream'; -import { publishMessagingStream } from '../../../services/stream'; -import { publishMessagingIndexStream } from '../../../services/stream'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { MessagingMessage } from '../../../models/entities/messaging-message'; -import { MessagingMessages, UserGroupJoinings, Users } from '../../../models'; +import { publishMainStream, publishGroupMessagingStream } from '@/services/stream.js'; +import { publishMessagingStream } from '@/services/stream.js'; +import { publishMessagingIndexStream } from '@/services/stream.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { MessagingMessages, UserGroupJoinings, Users } from '@/models/index.js'; import { In } from 'typeorm'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { UserGroup } from '../../../models/entities/user-group'; -import { toArray } from '../../../prelude/array'; -import { renderReadActivity } from '../../../remote/activitypub/renderer/read'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import { deliver } from '../../../queue'; -import orderedCollection from '../../../remote/activitypub/renderer/ordered-collection'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { toArray } from '../../../prelude/array.js'; +import { renderReadActivity } from '@/remote/activitypub/renderer/read.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { deliver } from '@/queue/index.js'; +import orderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; /** * Mark messages as read diff --git a/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts index effa61e8b5..ce958c479f 100644 --- a/src/server/api/common/read-notification.ts +++ b/src/server/api/common/read-notification.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from '../../../services/stream'; -import { User } from '../../../models/entities/user'; -import { Notification } from '../../../models/entities/notification'; -import { Notifications, Users } from '../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { Notification } from '@/models/entities/notification.js'; +import { Notifications, Users } from '@/models/index.js'; import { In } from 'typeorm'; export async function readNotification( diff --git a/src/server/api/common/signin.ts b/src/server/api/common/signin.ts index af09a70340..adc5aafe85 100644 --- a/src/server/api/common/signin.ts +++ b/src/server/api/common/signin.ts @@ -1,10 +1,10 @@ import * as Koa from 'koa'; -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { Signins } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { publishMainStream } from '../../../services/stream'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { Signins } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { publishMainStream } from '@/services/stream.js'; export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { if (redirect) { diff --git a/src/server/api/common/signup.ts b/src/server/api/common/signup.ts index b8d197317a..c5605e2b8f 100644 --- a/src/server/api/common/signup.ts +++ b/src/server/api/common/signup.ts @@ -1,15 +1,15 @@ import * as bcrypt from 'bcryptjs'; import { generateKeyPair } from 'crypto'; -import generateUserToken from './generate-native-user-token'; -import { User } from '../../../models/entities/user'; -import { Users, UsedUsernames } from '../../../models'; -import { UserProfile } from '../../../models/entities/user-profile'; +import generateUserToken from './generate-native-user-token.js'; +import { User } from '@/models/entities/user.js'; +import { Users, UsedUsernames } from '@/models/index.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; import { getConnection } from 'typeorm'; -import { genId } from '@/misc/gen-id'; -import { toPunyNullable } from '@/misc/convert-host'; -import { UserKeypair } from '../../../models/entities/user-keypair'; -import { usersChart } from '../../../services/chart'; -import { UsedUsername } from '../../../models/entities/used-username'; +import { genId } from '@/misc/gen-id.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { usersChart } from '@/services/chart/index.js'; +import { UsedUsername } from '@/models/entities/used-username.js'; export async function signup(username: User['username'], password: UserProfile['password'], host: string | null = null) { // Validate username diff --git a/src/server/api/define.ts b/src/server/api/define.ts index cba69cfdc4..18e8f62016 100644 --- a/src/server/api/define.ts +++ b/src/server/api/define.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; -import { ILocalUser } from '../../models/entities/user'; -import { IEndpointMeta } from './endpoints'; -import { ApiError } from './error'; -import { SchemaType } from '@/misc/schema'; -import { AccessToken } from '../../models/entities/access-token'; +import { ILocalUser } from '@/models/entities/user.js'; +import { IEndpointMeta } from './endpoints.js'; +import { ApiError } from './error.js'; +import { SchemaType } from '@/misc/schema.js'; +import { AccessToken } from '@/models/entities/access-token.js'; type NonOptional = T extends undefined ? never : T; diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 24b58b873c..4c0baf2242 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -1,7 +1,13 @@ +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import { Context } from 'cafy'; import * as path from 'path'; import * as glob from 'glob'; -import { Schema } from '@/misc/schema'; +import { Schema } from '@/misc/schema.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export type Param = { validator: Context; @@ -102,7 +108,7 @@ export interface IEndpoint { } const files = glob.sync('**/*.js', { - cwd: path.resolve(__dirname + '/endpoints/') + cwd: path.resolve(_dirname + '/endpoints/') }); const endpoints: IEndpoint[] = files.map(f => { diff --git a/src/server/api/endpoints/admin/abuse-user-reports.ts b/src/server/api/endpoints/admin/abuse-user-reports.ts index 02291a3edd..5bc5618ab3 100644 --- a/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { AbuseUserReports } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { AbuseUserReports } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/accounts/create.ts b/src/server/api/endpoints/admin/accounts/create.ts index bceb210a82..f9a6c10b87 100644 --- a/src/server/api/endpoints/admin/accounts/create.ts +++ b/src/server/api/endpoints/admin/accounts/create.ts @@ -1,6 +1,6 @@ -import define from '../../../define'; -import { Users } from '../../../../../models'; -import { signup } from '../../../common/signup'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; +import { signup } from '../../../common/signup.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/create.ts b/src/server/api/endpoints/admin/ad/create.ts index 337114a3fa..55cc037182 100644 --- a/src/server/api/endpoints/admin/ad/create.ts +++ b/src/server/api/endpoints/admin/ad/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Ads } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Ads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/delete.ts b/src/server/api/endpoints/admin/ad/delete.ts index 6a5f92193e..9f11f968ee 100644 --- a/src/server/api/endpoints/admin/ad/delete.ts +++ b/src/server/api/endpoints/admin/ad/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Ads } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Ads } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/list.ts b/src/server/api/endpoints/admin/ad/list.ts index a323f2a9ed..a2d843ec16 100644 --- a/src/server/api/endpoints/admin/ad/list.ts +++ b/src/server/api/endpoints/admin/ad/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Ads } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Ads } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/update.ts b/src/server/api/endpoints/admin/ad/update.ts index 71e6054a88..2d7a32585d 100644 --- a/src/server/api/endpoints/admin/ad/update.ts +++ b/src/server/api/endpoints/admin/ad/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Ads } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Ads } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/create.ts b/src/server/api/endpoints/admin/announcements/create.ts index 794c35023b..ab1b9a3c20 100644 --- a/src/server/api/endpoints/admin/announcements/create.ts +++ b/src/server/api/endpoints/admin/announcements/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Announcements } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Announcements } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/delete.ts b/src/server/api/endpoints/admin/announcements/delete.ts index 6c28054da8..52d7cb26c5 100644 --- a/src/server/api/endpoints/admin/announcements/delete.ts +++ b/src/server/api/endpoints/admin/announcements/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Announcements } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Announcements } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/list.ts b/src/server/api/endpoints/admin/announcements/list.ts index a14f0c0bdc..ff62b7806a 100644 --- a/src/server/api/endpoints/admin/announcements/list.ts +++ b/src/server/api/endpoints/admin/announcements/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Announcements, AnnouncementReads } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Announcements, AnnouncementReads } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/update.ts b/src/server/api/endpoints/admin/announcements/update.ts index 6e9a43d346..e45a185ad6 100644 --- a/src/server/api/endpoints/admin/announcements/update.ts +++ b/src/server/api/endpoints/admin/announcements/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Announcements } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Announcements } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 3d49689cd7..9001e01a1a 100644 --- a/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { deleteFile } from '../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/delete-logs.ts b/src/server/api/endpoints/admin/delete-logs.ts index 410588bc01..be3f58d738 100644 --- a/src/server/api/endpoints/admin/delete-logs.ts +++ b/src/server/api/endpoints/admin/delete-logs.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Logs } from '../../../../models'; +import define from '../../define.js'; +import { Logs } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 5a5adb8a8b..f945f0f049 100644 --- a/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { createCleanRemoteFilesJob } from '../../../../../queue'; +import define from '../../../define.js'; +import { createCleanRemoteFilesJob } from '@/queue/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/cleanup.ts b/src/server/api/endpoints/admin/drive/cleanup.ts index b76236a7f0..d5ad221a62 100644 --- a/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/src/server/api/endpoints/admin/drive/cleanup.ts @@ -1,7 +1,7 @@ import { IsNull } from 'typeorm'; -import define from '../../../define'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/files.ts b/src/server/api/endpoints/admin/drive/files.ts index efeef83ca3..65980bfea2 100644 --- a/src/server/api/endpoints/admin/drive/files.ts +++ b/src/server/api/endpoints/admin/drive/files.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/show-file.ts b/src/server/api/endpoints/admin/drive/show-file.ts index 3489e5c816..9dfa0cacf9 100644 --- a/src/server/api/endpoints/admin/drive/show-file.ts +++ b/src/server/api/endpoints/admin/drive/show-file.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/add.ts b/src/server/api/endpoints/admin/emoji/add.ts index 0d4550bf3c..b797fb30a3 100644 --- a/src/server/api/endpoints/admin/emoji/add.ts +++ b/src/server/api/endpoints/admin/emoji/add.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis, DriveFiles } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Emojis, DriveFiles } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; -import { ApiError } from '../../../error'; -import { ID } from '@/misc/cafy-id'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { ApiError } from '../../../error.js'; +import { ID } from '@/misc/cafy-id.js'; import rndstr from 'rndstr'; -import { publishBroadcastStream } from '../../../../../services/stream'; +import { publishBroadcastStream } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/copy.ts b/src/server/api/endpoints/admin/emoji/copy.ts index 72c2b014a4..4c5f7bf36c 100644 --- a/src/server/api/endpoints/admin/emoji/copy.ts +++ b/src/server/api/endpoints/admin/emoji/copy.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; import { getConnection } from 'typeorm'; -import { ApiError } from '../../../error'; -import { DriveFile } from '../../../../../models/entities/drive-file'; -import { ID } from '@/misc/cafy-id'; -import uploadFromUrl from '../../../../../services/drive/upload-from-url'; -import { publishBroadcastStream } from '@/services/stream'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { ID } from '@/misc/cafy-id.js'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import { publishBroadcastStream } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/list-remote.ts b/src/server/api/endpoints/admin/emoji/list-remote.ts index 570db064ec..cc284123b5 100644 --- a/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/list.ts b/src/server/api/endpoints/admin/emoji/list.ts index b864fed4b0..da72ac13e7 100644 --- a/src/server/api/endpoints/admin/emoji/list.ts +++ b/src/server/api/endpoints/admin/emoji/list.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; -import { Emoji } from '../../../../../models/entities/emoji'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emoji } from '@/models/entities/emoji.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/remove.ts b/src/server/api/endpoints/admin/emoji/remove.ts index 22bbc76e78..d81c0b9bbd 100644 --- a/src/server/api/endpoints/admin/emoji/remove.ts +++ b/src/server/api/endpoints/admin/emoji/remove.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Emojis } from '../../../../../models'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emojis } from '@/models/index.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; -import { ApiError } from '../../../error'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/update.ts b/src/server/api/endpoints/admin/emoji/update.ts index 70589d5cf7..912c96c7dc 100644 --- a/src/server/api/endpoints/admin/emoji/update.ts +++ b/src/server/api/endpoints/admin/emoji/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Emojis } from '../../../../../models'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emojis } from '@/models/index.js'; import { getConnection } from 'typeorm'; -import { ApiError } from '../../../error'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/delete-all-files.ts b/src/server/api/endpoints/admin/federation/delete-all-files.ts index eef53cd92c..f32c6b9776 100644 --- a/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 65b3b6e260..125be42e80 100644 --- a/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Instances } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; -import { fetchInstanceMetadata } from '../../../../../services/fetch-instance-metadata'; +import define from '../../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/remove-all-following.ts b/src/server/api/endpoints/admin/federation/remove-all-following.ts index e593193552..6b3d621c8b 100644 --- a/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import deleteFollowing from '../../../../../services/following/delete'; -import { Followings, Users } from '../../../../../models'; +import define from '../../../define.js'; +import deleteFollowing from '@/services/following/delete.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/update-instance.ts b/src/server/api/endpoints/admin/federation/update-instance.ts index 2d559e43e8..b5f13027a3 100644 --- a/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/src/server/api/endpoints/admin/federation/update-instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Instances } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/get-index-stats.ts b/src/server/api/endpoints/admin/get-index-stats.ts index f2b06d0ef2..e7e8d0b219 100644 --- a/src/server/api/endpoints/admin/get-index-stats.ts +++ b/src/server/api/endpoints/admin/get-index-stats.ts @@ -1,4 +1,4 @@ -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/get-table-stats.ts b/src/server/api/endpoints/admin/get-table-stats.ts index bce813232b..c7f2a614b0 100644 --- a/src/server/api/endpoints/admin/get-table-stats.ts +++ b/src/server/api/endpoints/admin/get-table-stats.ts @@ -1,4 +1,4 @@ -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/invite.ts b/src/server/api/endpoints/admin/invite.ts index 141f27d95e..0a63b69ee9 100644 --- a/src/server/api/endpoints/admin/invite.ts +++ b/src/server/api/endpoints/admin/invite.ts @@ -1,7 +1,7 @@ import rndstr from 'rndstr'; -import define from '../../define'; -import { RegistrationTickets } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../define.js'; +import { RegistrationTickets } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/logs.ts b/src/server/api/endpoints/admin/logs.ts index 1ec7320399..e0d97b4abe 100644 --- a/src/server/api/endpoints/admin/logs.ts +++ b/src/server/api/endpoints/admin/logs.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Logs } from '../../../../models'; +import define from '../../define.js'; +import { Logs } from '@/models/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/moderators/add.ts b/src/server/api/endpoints/admin/moderators/add.ts index 2b4e8a8014..bff9b63359 100644 --- a/src/server/api/endpoints/admin/moderators/add.ts +++ b/src/server/api/endpoints/admin/moderators/add.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/moderators/remove.ts b/src/server/api/endpoints/admin/moderators/remove.ts index fd6e29df54..cacb788b4d 100644 --- a/src/server/api/endpoints/admin/moderators/remove.ts +++ b/src/server/api/endpoints/admin/moderators/remove.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/promo/create.ts b/src/server/api/endpoints/admin/promo/create.ts index 8468ab6545..faba458fed 100644 --- a/src/server/api/endpoints/admin/promo/create.ts +++ b/src/server/api/endpoints/admin/promo/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { PromoNotes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { PromoNotes } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/clear.ts b/src/server/api/endpoints/admin/queue/clear.ts index 0375f55f01..4bab2f20cd 100644 --- a/src/server/api/endpoints/admin/queue/clear.ts +++ b/src/server/api/endpoints/admin/queue/clear.ts @@ -1,6 +1,6 @@ -import define from '../../../define'; -import { destroy } from '../../../../../queue'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; +import define from '../../../define.js'; +import { destroy } from '@/queue/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/src/server/api/endpoints/admin/queue/deliver-delayed.ts index cd7b640983..ed34228108 100644 --- a/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -1,6 +1,6 @@ -import { deliverQueue } from '@/queue/queues'; +import { deliverQueue } from '@/queue/queues.js'; import { URL } from 'url'; -import define from '../../../define'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 119976c680..8870722f23 100644 --- a/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -1,6 +1,6 @@ import { URL } from 'url'; -import define from '../../../define'; -import { inboxQueue } from '../../../../../queue'; +import define from '../../../define.js'; +import { inboxQueue } from '@/queue/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/jobs.ts b/src/server/api/endpoints/admin/queue/jobs.ts index c426e5f39b..164379f721 100644 --- a/src/server/api/endpoints/admin/queue/jobs.ts +++ b/src/server/api/endpoints/admin/queue/jobs.ts @@ -1,6 +1,6 @@ -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues.js'; import $ from 'cafy'; -import define from '../../../define'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/stats.ts b/src/server/api/endpoints/admin/queue/stats.ts index 38f18459dd..60a3416c39 100644 --- a/src/server/api/endpoints/admin/queue/stats.ts +++ b/src/server/api/endpoints/admin/queue/stats.ts @@ -1,5 +1,5 @@ -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; -import define from '../../../define'; +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues.js'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/add.ts b/src/server/api/endpoints/admin/relays/add.ts index 54d292ad55..e3b9a8afcb 100644 --- a/src/server/api/endpoints/admin/relays/add.ts +++ b/src/server/api/endpoints/admin/relays/add.ts @@ -1,8 +1,8 @@ import { URL } from 'url'; import $ from 'cafy'; -import define from '../../../define'; -import { addRelay } from '../../../../../services/relay'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { addRelay } from '@/services/relay.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/list.ts b/src/server/api/endpoints/admin/relays/list.ts index 9f2474f10c..1707b8cd34 100644 --- a/src/server/api/endpoints/admin/relays/list.ts +++ b/src/server/api/endpoints/admin/relays/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { listRelay } from '../../../../../services/relay'; +import define from '../../../define.js'; +import { listRelay } from '@/services/relay.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/remove.ts b/src/server/api/endpoints/admin/relays/remove.ts index 220efab406..406257fdf2 100644 --- a/src/server/api/endpoints/admin/relays/remove.ts +++ b/src/server/api/endpoints/admin/relays/remove.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { removeRelay } from '../../../../../services/relay'; +import define from '../../../define.js'; +import { removeRelay } from '@/services/relay.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/reset-password.ts b/src/server/api/endpoints/admin/reset-password.ts index 6ff49d83d5..0bc32e07a1 100644 --- a/src/server/api/endpoints/admin/reset-password.ts +++ b/src/server/api/endpoints/admin/reset-password.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; import * as bcrypt from 'bcryptjs'; import rndstr from 'rndstr'; -import { Users, UserProfiles } from '../../../../models'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index 38a5e81375..4c7ef37923 100644 --- a/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { AbuseUserReports } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { AbuseUserReports } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/resync-chart.ts b/src/server/api/endpoints/admin/resync-chart.ts index 84e19d37e6..613cdbdfad 100644 --- a/src/server/api/endpoints/admin/resync-chart.ts +++ b/src/server/api/endpoints/admin/resync-chart.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { driveChart, notesChart, usersChart, instanceChart } from '../../../../services/chart'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import define from '../../define.js'; +import { driveChart, notesChart, usersChart, instanceChart } from '@/services/chart/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/send-email.ts b/src/server/api/endpoints/admin/send-email.ts index c0e77e1621..353add59ba 100644 --- a/src/server/api/endpoints/admin/send-email.ts +++ b/src/server/api/endpoints/admin/send-email.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { sendEmail } from '../../../../services/send-email'; +import define from '../../define.js'; +import { sendEmail } from '@/services/send-email.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/server-info.ts b/src/server/api/endpoints/admin/server-info.ts index bb2d35e397..daac6395ea 100644 --- a/src/server/api/endpoints/admin/server-info.ts +++ b/src/server/api/endpoints/admin/server-info.ts @@ -1,8 +1,8 @@ import * as os from 'os'; import * as si from 'systeminformation'; import { getConnection } from 'typeorm'; -import define from '../../define'; -import { redisClient } from '../../../../db/redis'; +import define from '../../define.js'; +import { redisClient } from '../../../../db/redis.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/admin/show-moderation-logs.ts b/src/server/api/endpoints/admin/show-moderation-logs.ts index cfceab9463..833c49ee64 100644 --- a/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ModerationLogs } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ModerationLogs } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/show-user.ts b/src/server/api/endpoints/admin/show-user.ts index b1132ac207..e4935fe90f 100644 --- a/src/server/api/endpoints/admin/show-user.ts +++ b/src/server/api/endpoints/admin/show-user.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/show-users.ts b/src/server/api/endpoints/admin/show-users.ts index 7ea0e0e864..0ac2112f4b 100644 --- a/src/server/api/endpoints/admin/show-users.ts +++ b/src/server/api/endpoints/admin/show-users.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/silence-user.ts b/src/server/api/endpoints/admin/silence-user.ts index 73f9d03b70..0a2b080aa4 100644 --- a/src/server/api/endpoints/admin/silence-user.ts +++ b/src/server/api/endpoints/admin/silence-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/suspend-user.ts b/src/server/api/endpoints/admin/suspend-user.ts index 912d6a5162..8026b9ec83 100644 --- a/src/server/api/endpoints/admin/suspend-user.ts +++ b/src/server/api/endpoints/admin/suspend-user.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import deleteFollowing from '../../../../services/following/delete'; -import { Users, Followings, Notifications } from '../../../../models'; -import { User } from '../../../../models/entities/user'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { doPostSuspend } from '../../../../services/suspend-user'; -import { publishUserEvent } from '@/services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import deleteFollowing from '@/services/following/delete.js'; +import { Users, Followings, Notifications } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { doPostSuspend } from '@/services/suspend-user.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/unsilence-user.ts b/src/server/api/endpoints/admin/unsilence-user.ts index 6083d87afc..1e581df494 100644 --- a/src/server/api/endpoints/admin/unsilence-user.ts +++ b/src/server/api/endpoints/admin/unsilence-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/unsuspend-user.ts b/src/server/api/endpoints/admin/unsuspend-user.ts index 6d015b51ab..e839377435 100644 --- a/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/src/server/api/endpoints/admin/unsuspend-user.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { doPostUnsuspend } from '../../../../services/unsuspend-user'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { doPostUnsuspend } from '@/services/unsuspend-user.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index 573f22822c..2d34b5a219 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; -import { Meta } from '../../../../models/entities/meta'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; -import { ID } from '@/misc/cafy-id'; +import { Meta } from '@/models/entities/meta.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/vacuum.ts b/src/server/api/endpoints/admin/vacuum.ts index e041e65431..9ff9711a00 100644 --- a/src/server/api/endpoints/admin/vacuum.ts +++ b/src/server/api/endpoints/admin/vacuum.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/announcements.ts b/src/server/api/endpoints/announcements.ts index 124682909c..83a8b3a71c 100644 --- a/src/server/api/endpoints/announcements.ts +++ b/src/server/api/endpoints/announcements.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../define'; -import { Announcements, AnnouncementReads } from '../../../models'; -import { makePaginationQuery } from '../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../define.js'; +import { Announcements, AnnouncementReads } from '@/models/index.js'; +import { makePaginationQuery } from '../common/make-pagination-query.js'; export const meta = { tags: ['meta'], diff --git a/src/server/api/endpoints/antennas/create.ts b/src/server/api/endpoints/antennas/create.ts index bff3c09f1c..2310ee6d51 100644 --- a/src/server/api/endpoints/antennas/create.ts +++ b/src/server/api/endpoints/antennas/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; -import { genId } from '@/misc/gen-id'; -import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { ApiError } from '../../error'; -import { publishInternalEvent } from '../../../../services/stream'; +import define from '../../define.js'; +import { genId } from '@/misc/gen-id.js'; +import { Antennas, UserLists, UserGroupJoinings } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { ApiError } from '../../error.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/antennas/delete.ts b/src/server/api/endpoints/antennas/delete.ts index 10a212897b..59a29a9511 100644 --- a/src/server/api/endpoints/antennas/delete.ts +++ b/src/server/api/endpoints/antennas/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas } from '../../../../models'; -import { publishInternalEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas } from '@/models/index.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/antennas/list.ts b/src/server/api/endpoints/antennas/list.ts index 6ae3c0cbb2..eceec945aa 100644 --- a/src/server/api/endpoints/antennas/list.ts +++ b/src/server/api/endpoints/antennas/list.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Antennas } from '../../../../models'; +import define from '../../define.js'; +import { Antennas } from '@/models/index.js'; export const meta = { tags: ['antennas', 'account'], diff --git a/src/server/api/endpoints/antennas/notes.ts b/src/server/api/endpoints/antennas/notes.ts index aadb4261e3..11f69f354b 100644 --- a/src/server/api/endpoints/antennas/notes.ts +++ b/src/server/api/endpoints/antennas/notes.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Antennas, Notes, AntennaNotes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { ApiError } from '../../error'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Antennas, Notes, AntennaNotes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { ApiError } from '../../error.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['antennas', 'account', 'notes'], diff --git a/src/server/api/endpoints/antennas/show.ts b/src/server/api/endpoints/antennas/show.ts index 36045e47a4..0d9a716bf4 100644 --- a/src/server/api/endpoints/antennas/show.ts +++ b/src/server/api/endpoints/antennas/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas } from '@/models/index.js'; export const meta = { tags: ['antennas', 'account'], diff --git a/src/server/api/endpoints/antennas/update.ts b/src/server/api/endpoints/antennas/update.ts index 9194c14795..37f3b01641 100644 --- a/src/server/api/endpoints/antennas/update.ts +++ b/src/server/api/endpoints/antennas/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; -import { publishInternalEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas, UserLists, UserGroupJoinings } from '@/models/index.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/ap/get.ts b/src/server/api/endpoints/ap/get.ts index f2b4c2408f..33734b7cbd 100644 --- a/src/server/api/endpoints/ap/get.ts +++ b/src/server/api/endpoints/ap/get.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import Resolver from '../../../../remote/activitypub/resolver'; -import { ApiError } from '../../error'; +import define from '../../define.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/ap/show.ts b/src/server/api/endpoints/ap/show.ts index 7f61055bfa..0472d28a65 100644 --- a/src/server/api/endpoints/ap/show.ts +++ b/src/server/api/endpoints/ap/show.ts @@ -1,16 +1,16 @@ import $ from 'cafy'; -import define from '../../define'; -import config from '@/config'; -import { createPerson } from '../../../../remote/activitypub/models/person'; -import { createNote } from '../../../../remote/activitypub/models/note'; -import Resolver from '../../../../remote/activitypub/resolver'; -import { ApiError } from '../../error'; -import { extractDbHost } from '@/misc/convert-host'; -import { Users, Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { User } from '../../../../models/entities/user'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { isActor, isPost, getApId } from '../../../../remote/activitypub/type'; +import define from '../../define.js'; +import config from '@/config/index.js'; +import { createPerson } from '@/remote/activitypub/models/person.js'; +import { createNote } from '@/remote/activitypub/models/note.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { ApiError } from '../../error.js'; +import { extractDbHost } from '@/misc/convert-host.js'; +import { Users, Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { isActor, isPost, getApId } from '@/remote/activitypub/type.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts index 500567bf29..f013fa91ca 100644 --- a/src/server/api/endpoints/app/create.ts +++ b/src/server/api/endpoints/app/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { Apps } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { unique } from '../../../../prelude/array'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../define.js'; +import { Apps } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { unique } from '../../../../prelude/array.js'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; export const meta = { tags: ['app'], diff --git a/src/server/api/endpoints/app/show.ts b/src/server/api/endpoints/app/show.ts index 65f8c77981..919d65b12f 100644 --- a/src/server/api/endpoints/app/show.ts +++ b/src/server/api/endpoints/app/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Apps } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Apps } from '@/models/index.js'; export const meta = { tags: ['app'], diff --git a/src/server/api/endpoints/auth/accept.ts b/src/server/api/endpoints/auth/accept.ts index ee0d0421c9..e4fcb6dc42 100644 --- a/src/server/api/endpoints/auth/accept.ts +++ b/src/server/api/endpoints/auth/accept.ts @@ -1,10 +1,10 @@ import * as crypto from 'crypto'; import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { AuthSessions, AccessTokens, Apps } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { AuthSessions, AccessTokens, Apps } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/auth/session/generate.ts b/src/server/api/endpoints/auth/session/generate.ts index 42f9e25c78..4ea5967b08 100644 --- a/src/server/api/endpoints/auth/session/generate.ts +++ b/src/server/api/endpoints/auth/session/generate.ts @@ -1,10 +1,10 @@ import { v4 as uuid } from 'uuid'; import $ from 'cafy'; -import config from '@/config'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { Apps, AuthSessions } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import config from '@/config/index.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { Apps, AuthSessions } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/auth/session/show.ts b/src/server/api/endpoints/auth/session/show.ts index fd20884c02..420facb8fb 100644 --- a/src/server/api/endpoints/auth/session/show.ts +++ b/src/server/api/endpoints/auth/session/show.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { AuthSessions } from '../../../../../models'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { AuthSessions } from '@/models/index.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/auth/session/userkey.ts b/src/server/api/endpoints/auth/session/userkey.ts index 7059aacbea..240ff57f1e 100644 --- a/src/server/api/endpoints/auth/session/userkey.ts +++ b/src/server/api/endpoints/auth/session/userkey.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { Apps, AuthSessions, AccessTokens, Users } from '../../../../../models'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { Apps, AuthSessions, AccessTokens, Users } from '@/models/index.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/blocking/create.ts b/src/server/api/endpoints/blocking/create.ts index dd976a7bf1..c82b6eb920 100644 --- a/src/server/api/endpoints/blocking/create.ts +++ b/src/server/api/endpoints/blocking/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import create from '../../../../services/blocking/create'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Blockings, NoteWatchings, Users } from '../../../../models'; +import create from '@/services/blocking/create.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Blockings, NoteWatchings, Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/blocking/delete.ts b/src/server/api/endpoints/blocking/delete.ts index c69c8b14a7..9d075f272c 100644 --- a/src/server/api/endpoints/blocking/delete.ts +++ b/src/server/api/endpoints/blocking/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import deleteBlocking from '../../../../services/blocking/delete'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Blockings, Users } from '../../../../models'; +import deleteBlocking from '@/services/blocking/delete.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Blockings, Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/blocking/list.ts b/src/server/api/endpoints/blocking/list.ts index db849338ac..a616d0b7c1 100644 --- a/src/server/api/endpoints/blocking/list.ts +++ b/src/server/api/endpoints/blocking/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Blockings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Blockings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/channels/create.ts b/src/server/api/endpoints/channels/create.ts index c6dc68faf8..48348cf35a 100644 --- a/src/server/api/endpoints/channels/create.ts +++ b/src/server/api/endpoints/channels/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, DriveFiles } from '../../../../models'; -import { Channel } from '../../../../models/entities/channel'; -import { genId } from '@/misc/gen-id'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, DriveFiles } from '@/models/index.js'; +import { Channel } from '@/models/entities/channel.js'; +import { genId } from '@/misc/gen-id.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/featured.ts b/src/server/api/endpoints/channels/featured.ts index abb0a19e2d..7cfc33e639 100644 --- a/src/server/api/endpoints/channels/featured.ts +++ b/src/server/api/endpoints/channels/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Channels } from '../../../../models'; +import define from '../../define.js'; +import { Channels } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/follow.ts b/src/server/api/endpoints/channels/follow.ts index b264f7451a..37fb8ff1b4 100644 --- a/src/server/api/endpoints/channels/follow.ts +++ b/src/server/api/endpoints/channels/follow.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, ChannelFollowings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/followed.ts b/src/server/api/endpoints/channels/followed.ts index 7f0cfe4941..7fc83c933d 100644 --- a/src/server/api/endpoints/channels/followed.ts +++ b/src/server/api/endpoints/channels/followed.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Channels, ChannelFollowings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['channels', 'account'], diff --git a/src/server/api/endpoints/channels/owned.ts b/src/server/api/endpoints/channels/owned.ts index 4f538f651e..2f08e52615 100644 --- a/src/server/api/endpoints/channels/owned.ts +++ b/src/server/api/endpoints/channels/owned.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Channels } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Channels } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['channels', 'account'], diff --git a/src/server/api/endpoints/channels/show.ts b/src/server/api/endpoints/channels/show.ts index d5f182da11..f2c351f557 100644 --- a/src/server/api/endpoints/channels/show.ts +++ b/src/server/api/endpoints/channels/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/timeline.ts b/src/server/api/endpoints/channels/timeline.ts index 9e5ecdeeb3..3032e7ee6f 100644 --- a/src/server/api/endpoints/channels/timeline.ts +++ b/src/server/api/endpoints/channels/timeline.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Notes, Channels } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Notes, Channels } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; export const meta = { tags: ['notes', 'channels'], diff --git a/src/server/api/endpoints/channels/unfollow.ts b/src/server/api/endpoints/channels/unfollow.ts index 116af50337..1c2ab307af 100644 --- a/src/server/api/endpoints/channels/unfollow.ts +++ b/src/server/api/endpoints/channels/unfollow.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, ChannelFollowings } from '@/models/index.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/update.ts b/src/server/api/endpoints/channels/update.ts index 1495297ee5..255c664307 100644 --- a/src/server/api/endpoints/channels/update.ts +++ b/src/server/api/endpoints/channels/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, DriveFiles } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/charts/active-users.ts b/src/server/api/endpoints/charts/active-users.ts index fb177e5c94..dc080d3bc6 100644 --- a/src/server/api/endpoints/charts/active-users.ts +++ b/src/server/api/endpoints/charts/active-users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { activeUsersChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { activeUsersChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users'], diff --git a/src/server/api/endpoints/charts/drive.ts b/src/server/api/endpoints/charts/drive.ts index ba6556c597..5bad71a9fa 100644 --- a/src/server/api/endpoints/charts/drive.ts +++ b/src/server/api/endpoints/charts/drive.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { driveChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { driveChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'drive'], diff --git a/src/server/api/endpoints/charts/federation.ts b/src/server/api/endpoints/charts/federation.ts index 46eb87ac02..83ec290023 100644 --- a/src/server/api/endpoints/charts/federation.ts +++ b/src/server/api/endpoints/charts/federation.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { federationChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { federationChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/hashtag.ts b/src/server/api/endpoints/charts/hashtag.ts index 5c2875ddd2..12d3c2ba4c 100644 --- a/src/server/api/endpoints/charts/hashtag.ts +++ b/src/server/api/endpoints/charts/hashtag.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { hashtagChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { hashtagChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'hashtags'], diff --git a/src/server/api/endpoints/charts/instance.ts b/src/server/api/endpoints/charts/instance.ts index 9375992d21..ed3f8bbe93 100644 --- a/src/server/api/endpoints/charts/instance.ts +++ b/src/server/api/endpoints/charts/instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { instanceChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { instanceChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/network.ts b/src/server/api/endpoints/charts/network.ts index d1fd404239..a4700f045a 100644 --- a/src/server/api/endpoints/charts/network.ts +++ b/src/server/api/endpoints/charts/network.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { networkChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { networkChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/notes.ts b/src/server/api/endpoints/charts/notes.ts index 7141fe3b0a..7c92a11882 100644 --- a/src/server/api/endpoints/charts/notes.ts +++ b/src/server/api/endpoints/charts/notes.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { notesChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { notesChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'notes'], diff --git a/src/server/api/endpoints/charts/user/drive.ts b/src/server/api/endpoints/charts/user/drive.ts index bacb022c81..8649ac69c7 100644 --- a/src/server/api/endpoints/charts/user/drive.ts +++ b/src/server/api/endpoints/charts/user/drive.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserDriveChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserDriveChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'drive', 'users'], diff --git a/src/server/api/endpoints/charts/user/following.ts b/src/server/api/endpoints/charts/user/following.ts index ce41c231ba..8905be2d9b 100644 --- a/src/server/api/endpoints/charts/user/following.ts +++ b/src/server/api/endpoints/charts/user/following.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserFollowingChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserFollowingChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'following'], diff --git a/src/server/api/endpoints/charts/user/notes.ts b/src/server/api/endpoints/charts/user/notes.ts index 470b7274bd..9c6152fa9e 100644 --- a/src/server/api/endpoints/charts/user/notes.ts +++ b/src/server/api/endpoints/charts/user/notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserNotesChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserNotesChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'notes'], diff --git a/src/server/api/endpoints/charts/user/reactions.ts b/src/server/api/endpoints/charts/user/reactions.ts index 4ebe4623c0..28629a0259 100644 --- a/src/server/api/endpoints/charts/user/reactions.ts +++ b/src/server/api/endpoints/charts/user/reactions.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserReactionsChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserReactionsChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'reactions'], diff --git a/src/server/api/endpoints/charts/users.ts b/src/server/api/endpoints/charts/users.ts index 4246a18e59..8d312e1a14 100644 --- a/src/server/api/endpoints/charts/users.ts +++ b/src/server/api/endpoints/charts/users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { usersChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { usersChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users'], diff --git a/src/server/api/endpoints/clips/add-note.ts b/src/server/api/endpoints/clips/add-note.ts index 3d72def4f5..909d05bc82 100644 --- a/src/server/api/endpoints/clips/add-note.ts +++ b/src/server/api/endpoints/clips/add-note.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips } from '../../../../models'; -import { ApiError } from '../../error'; -import { genId } from '@/misc/gen-id'; -import { getNote } from '../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips } from '@/models/index.js'; +import { ApiError } from '../../error.js'; +import { genId } from '@/misc/gen-id.js'; +import { getNote } from '../../common/getters.js'; export const meta = { tags: ['account', 'notes', 'clips'], diff --git a/src/server/api/endpoints/clips/create.ts b/src/server/api/endpoints/clips/create.ts index fb2a77fe5b..06286ed8ec 100644 --- a/src/server/api/endpoints/clips/create.ts +++ b/src/server/api/endpoints/clips/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { genId } from '@/misc/gen-id'; -import { Clips } from '../../../../models'; +import define from '../../define.js'; +import { genId } from '@/misc/gen-id.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/clips/delete.ts b/src/server/api/endpoints/clips/delete.ts index 20b2addb76..93e69dae34 100644 --- a/src/server/api/endpoints/clips/delete.ts +++ b/src/server/api/endpoints/clips/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/clips/list.ts b/src/server/api/endpoints/clips/list.ts index 6b90b114df..1eeac8b45b 100644 --- a/src/server/api/endpoints/clips/list.ts +++ b/src/server/api/endpoints/clips/list.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Clips } from '../../../../models'; +import define from '../../define.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips', 'account'], diff --git a/src/server/api/endpoints/clips/notes.ts b/src/server/api/endpoints/clips/notes.ts index 4bece5a2c8..41fa2b2bcc 100644 --- a/src/server/api/endpoints/clips/notes.ts +++ b/src/server/api/endpoints/clips/notes.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips, Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { ApiError } from '../../error'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips, Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { ApiError } from '../../error.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['account', 'notes', 'clips'], diff --git a/src/server/api/endpoints/clips/show.ts b/src/server/api/endpoints/clips/show.ts index 43d2719129..ab368e6a09 100644 --- a/src/server/api/endpoints/clips/show.ts +++ b/src/server/api/endpoints/clips/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips', 'account'], diff --git a/src/server/api/endpoints/clips/update.ts b/src/server/api/endpoints/clips/update.ts index a368174e76..07a9d585c7 100644 --- a/src/server/api/endpoints/clips/update.ts +++ b/src/server/api/endpoints/clips/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/drive.ts b/src/server/api/endpoints/drive.ts index 2feb72ae12..6a99cd1246 100644 --- a/src/server/api/endpoints/drive.ts +++ b/src/server/api/endpoints/drive.ts @@ -1,6 +1,6 @@ -import define from '../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { DriveFiles } from '../../../models'; +import define from '../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive', 'account'], diff --git a/src/server/api/endpoints/drive/files.ts b/src/server/api/endpoints/drive/files.ts index 1e821b0085..60cf3eb948 100644 --- a/src/server/api/endpoints/drive/files.ts +++ b/src/server/api/endpoints/drive/files.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFiles } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/attached-notes.ts b/src/server/api/endpoints/drive/files/attached-notes.ts index dafbf30fbb..5aafe0ea1f 100644 --- a/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/src/server/api/endpoints/drive/files/attached-notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles, Notes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles, Notes } from '@/models/index.js'; export const meta = { tags: ['drive', 'notes'], diff --git a/src/server/api/endpoints/drive/files/check-existence.ts b/src/server/api/endpoints/drive/files/check-existence.ts index b20be44072..a53a4f7f91 100644 --- a/src/server/api/endpoints/drive/files/check-existence.ts +++ b/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index a8f6b92014..1f7b712439 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -1,11 +1,11 @@ import * as ms from 'ms'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import create from '../../../../../services/drive/add-file'; -import define from '../../../define'; -import { apiLogger } from '../../../logger'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import create from '@/services/drive/add-file.js'; +import define from '../../../define.js'; +import { apiLogger } from '../../../logger.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/delete.ts b/src/server/api/endpoints/drive/files/delete.ts index 520078948c..ae1381ee13 100644 --- a/src/server/api/endpoints/drive/files/delete.ts +++ b/src/server/api/endpoints/drive/files/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/find-by-hash.ts b/src/server/api/endpoints/drive/files/find-by-hash.ts index ef0077392e..492a7ee593 100644 --- a/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/find.ts b/src/server/api/endpoints/drive/files/find.ts index b7f2571453..724424500d 100644 --- a/src/server/api/endpoints/drive/files/find.ts +++ b/src/server/api/endpoints/drive/files/find.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/drive/files/show.ts b/src/server/api/endpoints/drive/files/show.ts index 33e88fa817..7a2ea1b76f 100644 --- a/src/server/api/endpoints/drive/files/show.ts +++ b/src/server/api/endpoints/drive/files/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFile } from '../../../../../models/entities/drive-file'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/update.ts b/src/server/api/endpoints/drive/files/update.ts index 29b4ba7a45..d75da00119 100644 --- a/src/server/api/endpoints/drive/files/update.ts +++ b/src/server/api/endpoints/drive/files/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles, DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles, DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/upload-from-url.ts b/src/server/api/endpoints/drive/files/upload-from-url.ts index 8dfc86e660..5f0c461dc3 100644 --- a/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import uploadFromUrl from '../../../../../services/drive/upload-from-url'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; -import { publishMainStream } from '../../../../../services/stream'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { publishMainStream } from '@/services/stream.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders.ts b/src/server/api/endpoints/drive/folders.ts index c446d546cc..5e0561d579 100644 --- a/src/server/api/endpoints/drive/folders.ts +++ b/src/server/api/endpoints/drive/folders.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFolders } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFolders } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/create.ts b/src/server/api/endpoints/drive/folders/create.ts index e39f8f2cee..5167ac0d19 100644 --- a/src/server/api/endpoints/drive/folders/create.ts +++ b/src/server/api/endpoints/drive/folders/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/delete.ts b/src/server/api/endpoints/drive/folders/delete.ts index 253563a3ef..3f2ef8f2c0 100644 --- a/src/server/api/endpoints/drive/folders/delete.ts +++ b/src/server/api/endpoints/drive/folders/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { publishDriveStream } from '../../../../../services/stream'; -import { ApiError } from '../../../error'; -import { DriveFolders, DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { publishDriveStream } from '@/services/stream.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders, DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/find.ts b/src/server/api/endpoints/drive/folders/find.ts index c8e7639e63..7299dceccf 100644 --- a/src/server/api/endpoints/drive/folders/find.ts +++ b/src/server/api/endpoints/drive/folders/find.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/show.ts b/src/server/api/endpoints/drive/folders/show.ts index fe1326da75..7d46e853ba 100644 --- a/src/server/api/endpoints/drive/folders/show.ts +++ b/src/server/api/endpoints/drive/folders/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/update.ts b/src/server/api/endpoints/drive/folders/update.ts index 9dfe33517e..6598b6a8a4 100644 --- a/src/server/api/endpoints/drive/folders/update.ts +++ b/src/server/api/endpoints/drive/folders/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/stream.ts b/src/server/api/endpoints/drive/stream.ts index ca88acf5fe..da70b7b36c 100644 --- a/src/server/api/endpoints/drive/stream.ts +++ b/src/server/api/endpoints/drive/stream.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFiles } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/endpoint.ts b/src/server/api/endpoints/endpoint.ts index 1a04d8bee8..c8fb0f5f34 100644 --- a/src/server/api/endpoints/endpoint.ts +++ b/src/server/api/endpoints/endpoint.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../define'; -import endpoints from '../endpoints'; +import define from '../define.js'; +import endpoints from '../endpoints.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/endpoints.ts b/src/server/api/endpoints/endpoints.ts index f7b9757d8d..cd7bf45c4f 100644 --- a/src/server/api/endpoints/endpoints.ts +++ b/src/server/api/endpoints/endpoints.ts @@ -1,5 +1,5 @@ -import define from '../define'; -import endpoints from '../endpoints'; +import define from '../define.js'; +import endpoints from '../endpoints.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/federation/dns.ts b/src/server/api/endpoints/federation/dns.ts index a188f46ac1..4605cd5576 100644 --- a/src/server/api/endpoints/federation/dns.ts +++ b/src/server/api/endpoints/federation/dns.ts @@ -1,8 +1,8 @@ import { promises as dns } from 'dns'; import $ from 'cafy'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; const resolver = new dns.Resolver(); resolver.setServers(['1.1.1.1']); diff --git a/src/server/api/endpoints/federation/followers.ts b/src/server/api/endpoints/federation/followers.ts index 727eada682..1c74f45030 100644 --- a/src/server/api/endpoints/federation/followers.ts +++ b/src/server/api/endpoints/federation/followers.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/following.ts b/src/server/api/endpoints/federation/following.ts index c6bc71a982..b30f67af39 100644 --- a/src/server/api/endpoints/federation/following.ts +++ b/src/server/api/endpoints/federation/following.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/instances.ts b/src/server/api/endpoints/federation/instances.ts index 29515f0eb4..f16c04f5d5 100644 --- a/src/server/api/endpoints/federation/instances.ts +++ b/src/server/api/endpoints/federation/instances.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import config from '@/config'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { fetchMeta } from '@/misc/fetch-meta'; +import config from '@/config/index.js'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/show-instance.ts b/src/server/api/endpoints/federation/show-instance.ts index 549d7340fb..d613a940ab 100644 --- a/src/server/api/endpoints/federation/show-instance.ts +++ b/src/server/api/endpoints/federation/show-instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/update-remote-user.ts b/src/server/api/endpoints/federation/update-remote-user.ts index c4a6db0dd2..b8a383410d 100644 --- a/src/server/api/endpoints/federation/update-remote-user.ts +++ b/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getRemoteUser } from '../../common/getters'; -import { updatePerson } from '../../../../remote/activitypub/models/person'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getRemoteUser } from '../../common/getters.js'; +import { updatePerson } from '@/remote/activitypub/models/person.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/users.ts b/src/server/api/endpoints/federation/users.ts index 77d9e2e076..9c7390b68e 100644 --- a/src/server/api/endpoints/federation/users.ts +++ b/src/server/api/endpoints/federation/users.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/following/create.ts b/src/server/api/endpoints/following/create.ts index e4f9a86d99..91b49b481d 100644 --- a/src/server/api/endpoints/following/create.ts +++ b/src/server/api/endpoints/following/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import create from '../../../../services/following/create'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Followings, Users } from '../../../../models'; +import create from '@/services/following/create.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['following', 'users'], diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts index e164cb25c9..7b2d006f4f 100644 --- a/src/server/api/endpoints/following/delete.ts +++ b/src/server/api/endpoints/following/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import deleteFollowing from '../../../../services/following/delete'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Followings, Users } from '../../../../models'; +import deleteFollowing from '@/services/following/delete.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['following', 'users'], diff --git a/src/server/api/endpoints/following/requests/accept.ts b/src/server/api/endpoints/following/requests/accept.ts index aa7085c53f..bf3c315c3c 100644 --- a/src/server/api/endpoints/following/requests/accept.ts +++ b/src/server/api/endpoints/following/requests/accept.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import acceptFollowRequest from '../../../../../services/following/requests/accept'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import acceptFollowRequest from '@/services/following/requests/accept.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/cancel.ts b/src/server/api/endpoints/following/requests/cancel.ts index 09056f2620..37e4c73096 100644 --- a/src/server/api/endpoints/following/requests/cancel.ts +++ b/src/server/api/endpoints/following/requests/cancel.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import cancelFollowRequest from '../../../../../services/following/requests/cancel'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import cancelFollowRequest from '@/services/following/requests/cancel.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/list.ts b/src/server/api/endpoints/following/requests/list.ts index bf3bfc68fa..1d6880d35d 100644 --- a/src/server/api/endpoints/following/requests/list.ts +++ b/src/server/api/endpoints/following/requests/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { FollowRequests } from '../../../../../models'; +import define from '../../../define.js'; +import { FollowRequests } from '@/models/index.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/reject.ts b/src/server/api/endpoints/following/requests/reject.ts index 1685a86137..5e41473545 100644 --- a/src/server/api/endpoints/following/requests/reject.ts +++ b/src/server/api/endpoints/following/requests/reject.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import rejectFollowRequest from '../../../../../services/following/requests/reject'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import rejectFollowRequest from '@/services/following/requests/reject.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/gallery/featured.ts b/src/server/api/endpoints/gallery/featured.ts index d09000cc71..6e8118850c 100644 --- a/src/server/api/endpoints/gallery/featured.ts +++ b/src/server/api/endpoints/gallery/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { GalleryPosts } from '../../../../models'; +import define from '../../define.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/popular.ts b/src/server/api/endpoints/gallery/popular.ts index e240b14d27..6c3db479c3 100644 --- a/src/server/api/endpoints/gallery/popular.ts +++ b/src/server/api/endpoints/gallery/popular.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { GalleryPosts } from '../../../../models'; +import define from '../../define.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts.ts b/src/server/api/endpoints/gallery/posts.ts index 656765d80a..625070ca29 100644 --- a/src/server/api/endpoints/gallery/posts.ts +++ b/src/server/api/endpoints/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { GalleryPosts } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/create.ts b/src/server/api/endpoints/gallery/posts/create.ts index ed24a45f88..e1c7345171 100644 --- a/src/server/api/endpoints/gallery/posts/create.ts +++ b/src/server/api/endpoints/gallery/posts/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; -import { DriveFiles, GalleryPosts } from '../../../../../models'; -import { genId } from '../../../../../misc/gen-id'; -import { GalleryPost } from '../../../../../models/entities/gallery-post'; -import { ApiError } from '../../../error'; -import { DriveFile } from '@/models/entities/drive-file'; +import define from '../../../define.js'; +import { ID } from '../../../../../misc/cafy-id.js'; +import { DriveFiles, GalleryPosts } from '@/models/index.js'; +import { genId } from '../../../../../misc/gen-id.js'; +import { GalleryPost } from '@/models/entities/gallery-post.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/delete.ts b/src/server/api/endpoints/gallery/posts/delete.ts index 8b54828b20..65819206c8 100644 --- a/src/server/api/endpoints/gallery/posts/delete.ts +++ b/src/server/api/endpoints/gallery/posts/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts } from '../../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/like.ts b/src/server/api/endpoints/gallery/posts/like.ts index 3bf37c13e3..80ec1b8745 100644 --- a/src/server/api/endpoints/gallery/posts/like.ts +++ b/src/server/api/endpoints/gallery/posts/like.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts, GalleryLikes } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts, GalleryLikes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/show.ts b/src/server/api/endpoints/gallery/posts/show.ts index 17628544b7..777fb76e3a 100644 --- a/src/server/api/endpoints/gallery/posts/show.ts +++ b/src/server/api/endpoints/gallery/posts/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts } from '@/models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/unlike.ts b/src/server/api/endpoints/gallery/posts/unlike.ts index 155949ae3d..1ddafcec90 100644 --- a/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/src/server/api/endpoints/gallery/posts/unlike.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts, GalleryLikes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts, GalleryLikes } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/update.ts b/src/server/api/endpoints/gallery/posts/update.ts index d9176ea407..5906f29e86 100644 --- a/src/server/api/endpoints/gallery/posts/update.ts +++ b/src/server/api/endpoints/gallery/posts/update.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; -import { DriveFiles, GalleryPosts } from '../../../../../models'; -import { GalleryPost } from '../../../../../models/entities/gallery-post'; -import { ApiError } from '../../../error'; -import { DriveFile } from '@/models/entities/drive-file'; +import define from '../../../define.js'; +import { ID } from '../../../../../misc/cafy-id.js'; +import { DriveFiles, GalleryPosts } from '@/models/index.js'; +import { GalleryPost } from '@/models/entities/gallery-post.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/games/reversi/games.ts b/src/server/api/endpoints/games/reversi/games.ts index 6ac150ef2c..d62a039e16 100644 --- a/src/server/api/endpoints/games/reversi/games.ts +++ b/src/server/api/endpoints/games/reversi/games.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ReversiGames } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ReversiGames } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/games/reversi/games/show.ts b/src/server/api/endpoints/games/reversi/games/show.ts index a6fbdbaf6d..02da583f47 100644 --- a/src/server/api/endpoints/games/reversi/games/show.ts +++ b/src/server/api/endpoints/games/reversi/games/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import Reversi from '../../../../../../games/reversi/core'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { ReversiGames } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import Reversi from '../../../../../../games/reversi/core.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { ReversiGames } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/games/surrender.ts b/src/server/api/endpoints/games/reversi/games/surrender.ts index 41896b4ab5..371d2475f3 100644 --- a/src/server/api/endpoints/games/reversi/games/surrender.ts +++ b/src/server/api/endpoints/games/reversi/games/surrender.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishReversiGameStream } from '../../../../../../services/stream'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { ReversiGames } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishReversiGameStream } from '@/services/stream.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { ReversiGames } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/invitations.ts b/src/server/api/endpoints/games/reversi/invitations.ts index 6a73bdf0c4..5745ba566e 100644 --- a/src/server/api/endpoints/games/reversi/invitations.ts +++ b/src/server/api/endpoints/games/reversi/invitations.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { ReversiMatchings } from '../../../../../models'; +import define from '../../../define.js'; +import { ReversiMatchings } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/match.ts b/src/server/api/endpoints/games/reversi/match.ts index 55ff9225d9..e02d11f4eb 100644 --- a/src/server/api/endpoints/games/reversi/match.ts +++ b/src/server/api/endpoints/games/reversi/match.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream, publishReversiStream } from '../../../../../services/stream'; -import { eighteight } from '../../../../../games/reversi/maps'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { genId } from '@/misc/gen-id'; -import { ReversiMatchings, ReversiGames } from '../../../../../models'; -import { ReversiGame } from '../../../../../models/entities/games/reversi/game'; -import { ReversiMatching } from '../../../../../models/entities/games/reversi/matching'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream, publishReversiStream } from '@/services/stream.js'; +import { eighteight } from '../../../../../games/reversi/maps.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { genId } from '@/misc/gen-id.js'; +import { ReversiMatchings, ReversiGames } from '@/models/index.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiMatching } from '@/models/entities/games/reversi/matching.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/match/cancel.ts b/src/server/api/endpoints/games/reversi/match/cancel.ts index 0abd4b5c8f..2e5c086572 100644 --- a/src/server/api/endpoints/games/reversi/match/cancel.ts +++ b/src/server/api/endpoints/games/reversi/match/cancel.ts @@ -1,5 +1,5 @@ -import define from '../../../../define'; -import { ReversiMatchings } from '../../../../../../models'; +import define from '../../../../define.js'; +import { ReversiMatchings } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/get-online-users-count.ts b/src/server/api/endpoints/get-online-users-count.ts index a13363055f..00b838ddcd 100644 --- a/src/server/api/endpoints/get-online-users-count.ts +++ b/src/server/api/endpoints/get-online-users-count.ts @@ -1,7 +1,7 @@ -import { USER_ONLINE_THRESHOLD } from '@/const'; -import { Users } from '@/models'; +import { USER_ONLINE_THRESHOLD } from '@/const.js'; +import { Users } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import define from '../define'; +import define from '../define.js'; export const meta = { tags: ['meta'], diff --git a/src/server/api/endpoints/hashtags/list.ts b/src/server/api/endpoints/hashtags/list.ts index 6e37f909ee..0453b0acf8 100644 --- a/src/server/api/endpoints/hashtags/list.ts +++ b/src/server/api/endpoints/hashtags/list.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Hashtags } from '../../../../models'; +import define from '../../define.js'; +import { Hashtags } from '@/models/index.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/search.ts b/src/server/api/endpoints/hashtags/search.ts index 372ccd5084..025023f54e 100644 --- a/src/server/api/endpoints/hashtags/search.ts +++ b/src/server/api/endpoints/hashtags/search.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Hashtags } from '../../../../models'; +import define from '../../define.js'; +import { Hashtags } from '@/models/index.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/show.ts b/src/server/api/endpoints/hashtags/show.ts index 9e388ce145..50f330fef1 100644 --- a/src/server/api/endpoints/hashtags/show.ts +++ b/src/server/api/endpoints/hashtags/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Hashtags } from '../../../../models'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Hashtags } from '@/models/index.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index 5341c3e584..21ac69057b 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -1,10 +1,10 @@ import { Brackets } from 'typeorm'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { safeForSql } from '@/misc/safe-for-sql'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { safeForSql } from '@/misc/safe-for-sql.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; /* トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要 diff --git a/src/server/api/endpoints/hashtags/users.ts b/src/server/api/endpoints/hashtags/users.ts index cecbc80cd2..2ddf066e90 100644 --- a/src/server/api/endpoints/hashtags/users.ts +++ b/src/server/api/endpoints/hashtags/users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/i.ts b/src/server/api/endpoints/i.ts index c6b89124b6..12b97e9911 100644 --- a/src/server/api/endpoints/i.ts +++ b/src/server/api/endpoints/i.ts @@ -1,5 +1,5 @@ -import define from '../define'; -import { Users } from '../../../models'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index 9a74d7675b..1c1f0557da 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as speakeasy from 'speakeasy'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/key-done.ts b/src/server/api/endpoints/i/2fa/key-done.ts index 923a8b386c..ea9976bd56 100644 --- a/src/server/api/endpoints/i/2fa/key-done.ts +++ b/src/server/api/endpoints/i/2fa/key-done.ts @@ -2,16 +2,16 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import { promisify } from 'util'; import * as cbor from 'cbor'; -import define from '../../../define'; +import define from '../../../define.js'; import { UserProfiles, UserSecurityKeys, AttestationChallenges, Users -} from '../../../../../models'; -import config from '@/config'; -import { procedures, hash } from '../../../2fa'; -import { publishMainStream } from '../../../../../services/stream'; +} from '@/models/index.js'; +import config from '@/config/index.js'; +import { procedures, hash } from '../../../2fa.js'; +import { publishMainStream } from '@/services/stream.js'; const cborDecodeFirst = promisify(cbor.decodeFirst) as any; diff --git a/src/server/api/endpoints/i/2fa/password-less.ts b/src/server/api/endpoints/i/2fa/password-less.ts index ee0a065e43..b62ba25b98 100644 --- a/src/server/api/endpoints/i/2fa/password-less.ts +++ b/src/server/api/endpoints/i/2fa/password-less.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/register-key.ts b/src/server/api/endpoints/i/2fa/register-key.ts index 75f578fc5f..12e0afd93e 100644 --- a/src/server/api/endpoints/i/2fa/register-key.ts +++ b/src/server/api/endpoints/i/2fa/register-key.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles, AttestationChallenges } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles, AttestationChallenges } from '@/models/index.js'; import { promisify } from 'util'; import * as crypto from 'crypto'; -import { genId } from '@/misc/gen-id'; -import { hash } from '../../../2fa'; +import { genId } from '@/misc/gen-id.js'; +import { hash } from '../../../2fa.js'; const randomBytes = promisify(crypto.randomBytes); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index d40997d6ed..7a3a6ec4cf 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -2,9 +2,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; import * as QRCode from 'qrcode'; -import config from '@/config'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import config from '@/config/index.js'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/remove-key.ts b/src/server/api/endpoints/i/2fa/remove-key.ts index 135f0eb284..2c74a8a856 100644 --- a/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/src/server/api/endpoints/i/2fa/remove-key.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles, UserSecurityKeys, Users } from '../../../../../models'; -import { publishMainStream } from '../../../../../services/stream'; +import define from '../../../define.js'; +import { UserProfiles, UserSecurityKeys, Users } from '@/models/index.js'; +import { publishMainStream } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index e809f40c71..47f6c0f876 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/apps.ts b/src/server/api/endpoints/i/apps.ts index 69958f1ca4..3cb7038a53 100644 --- a/src/server/api/endpoints/i/apps.ts +++ b/src/server/api/endpoints/i/apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; +import define from '../../define.js'; +import { AccessTokens } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/authorized-apps.ts b/src/server/api/endpoints/i/authorized-apps.ts index 050d079d9b..63cb87cf09 100644 --- a/src/server/api/endpoints/i/authorized-apps.ts +++ b/src/server/api/endpoints/i/authorized-apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens, Apps } from '../../../../models'; +import define from '../../define.js'; +import { AccessTokens, Apps } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/change-password.ts b/src/server/api/endpoints/i/change-password.ts index 0a8b86e665..545df032cd 100644 --- a/src/server/api/endpoints/i/change-password.ts +++ b/src/server/api/endpoints/i/change-password.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../define'; -import { UserProfiles } from '../../../../models'; +import define from '../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/delete-account.ts b/src/server/api/endpoints/i/delete-account.ts index f5f0f32a4a..02c03e5ba0 100644 --- a/src/server/api/endpoints/i/delete-account.ts +++ b/src/server/api/endpoints/i/delete-account.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; -import { doPostSuspend } from '../../../../services/suspend-user'; -import { publishUserEvent } from '@/services/stream'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { doPostSuspend } from '@/services/suspend-user.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/export-blocking.ts b/src/server/api/endpoints/i/export-blocking.ts index 87cf7655b0..219fbb1ef1 100644 --- a/src/server/api/endpoints/i/export-blocking.ts +++ b/src/server/api/endpoints/i/export-blocking.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportBlockingJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportBlockingJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-following.ts b/src/server/api/endpoints/i/export-following.ts index 9afc96a24a..2d6a8c2e3a 100644 --- a/src/server/api/endpoints/i/export-following.ts +++ b/src/server/api/endpoints/i/export-following.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportFollowingJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportFollowingJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-mute.ts b/src/server/api/endpoints/i/export-mute.ts index 7bb24f8f84..a96ca1d5bb 100644 --- a/src/server/api/endpoints/i/export-mute.ts +++ b/src/server/api/endpoints/i/export-mute.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportMuteJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportMuteJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-notes.ts b/src/server/api/endpoints/i/export-notes.ts index 368a340512..ff8e02a01b 100644 --- a/src/server/api/endpoints/i/export-notes.ts +++ b/src/server/api/endpoints/i/export-notes.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportNotesJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportNotesJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-user-lists.ts b/src/server/api/endpoints/i/export-user-lists.ts index e1de59f321..4554e512d3 100644 --- a/src/server/api/endpoints/i/export-user-lists.ts +++ b/src/server/api/endpoints/i/export-user-lists.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportUserListsJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportUserListsJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/favorites.ts b/src/server/api/endpoints/i/favorites.ts index eb97e8bab6..99ce45e9b5 100644 --- a/src/server/api/endpoints/i/favorites.ts +++ b/src/server/api/endpoints/i/favorites.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { NoteFavorites } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { NoteFavorites } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'notes', 'favorites'], diff --git a/src/server/api/endpoints/i/gallery/likes.ts b/src/server/api/endpoints/i/gallery/likes.ts index e569261fa6..0ddcdad5b9 100644 --- a/src/server/api/endpoints/i/gallery/likes.ts +++ b/src/server/api/endpoints/i/gallery/likes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryLikes } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryLikes } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'gallery'], diff --git a/src/server/api/endpoints/i/gallery/posts.ts b/src/server/api/endpoints/i/gallery/posts.ts index d7c2e96c16..74518c792c 100644 --- a/src/server/api/endpoints/i/gallery/posts.ts +++ b/src/server/api/endpoints/i/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryPosts } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryPosts } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'gallery'], diff --git a/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/src/server/api/endpoints/i/get-word-muted-notes-count.ts index a69ebc286a..a18a5c779b 100644 --- a/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { MutedNotes } from '../../../../models'; +import define from '../../define.js'; +import { MutedNotes } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/import-following.ts b/src/server/api/endpoints/i/import-following.ts index 0349551073..bb4558cc5c 100644 --- a/src/server/api/endpoints/i/import-following.ts +++ b/src/server/api/endpoints/i/import-following.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { createImportFollowingJob } from '../../../../queue'; -import ms = require('ms'); -import { ApiError } from '../../error'; -import { DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { createImportFollowingJob } from '@/queue/index.js'; +import * as ms from 'ms'; +import { ApiError } from '../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/import-user-lists.ts b/src/server/api/endpoints/i/import-user-lists.ts index f40eb2745d..99465b1fed 100644 --- a/src/server/api/endpoints/i/import-user-lists.ts +++ b/src/server/api/endpoints/i/import-user-lists.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { createImportUserListsJob } from '../../../../queue'; -import ms = require('ms'); -import { ApiError } from '../../error'; -import { DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { createImportUserListsJob } from '@/queue/index.js'; +import * as ms from 'ms'; +import { ApiError } from '../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index a16766c92e..fb7fcea579 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { readNotification } from '../../common/read-notification'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notifications, Followings, Mutings, Users } from '../../../../models'; -import { notificationTypes } from '../../../../types'; -import read from '@/services/note/read'; +import { ID } from '@/misc/cafy-id.js'; +import { readNotification } from '../../common/read-notification.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notifications, Followings, Mutings, Users } from '@/models/index.js'; +import { notificationTypes } from '../../../../types.js'; +import read from '@/services/note/read.js'; export const meta = { tags: ['account', 'notifications'], diff --git a/src/server/api/endpoints/i/page-likes.ts b/src/server/api/endpoints/i/page-likes.ts index bb41499694..231b029b28 100644 --- a/src/server/api/endpoints/i/page-likes.ts +++ b/src/server/api/endpoints/i/page-likes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { PageLikes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { PageLikes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'pages'], diff --git a/src/server/api/endpoints/i/pages.ts b/src/server/api/endpoints/i/pages.ts index 981686adb0..1547212197 100644 --- a/src/server/api/endpoints/i/pages.ts +++ b/src/server/api/endpoints/i/pages.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Pages } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'pages'], diff --git a/src/server/api/endpoints/i/pin.ts b/src/server/api/endpoints/i/pin.ts index e1e0658996..689e1ae641 100644 --- a/src/server/api/endpoints/i/pin.ts +++ b/src/server/api/endpoints/i/pin.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { addPinned } from '../../../../services/i/pin'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { addPinned } from '@/services/i/pin.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account', 'notes'], diff --git a/src/server/api/endpoints/i/read-all-messaging-messages.ts b/src/server/api/endpoints/i/read-all-messaging-messages.ts index dd26a10a73..fe0e6e558a 100644 --- a/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { MessagingMessages, UserGroupJoinings } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { MessagingMessages, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['account', 'messaging'], diff --git a/src/server/api/endpoints/i/read-all-unread-notes.ts b/src/server/api/endpoints/i/read-all-unread-notes.ts index 64469a2ad5..635c483b75 100644 --- a/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { NoteUnreads } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { NoteUnreads } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/read-announcement.ts b/src/server/api/endpoints/i/read-announcement.ts index 0f58b823fc..6a1050c05e 100644 --- a/src/server/api/endpoints/i/read-announcement.ts +++ b/src/server/api/endpoints/i/read-announcement.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { genId } from '@/misc/gen-id'; -import { AnnouncementReads, Announcements, Users } from '../../../../models'; -import { publishMainStream } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { genId } from '@/misc/gen-id.js'; +import { AnnouncementReads, Announcements, Users } from '@/models/index.js'; +import { publishMainStream } from '@/services/stream.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/regenerate-token.ts b/src/server/api/endpoints/i/regenerate-token.ts index 3665ed0532..af22d53770 100644 --- a/src/server/api/endpoints/i/regenerate-token.ts +++ b/src/server/api/endpoints/i/regenerate-token.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import { publishMainStream, publishUserEvent } from '../../../../services/stream'; -import generateUserToken from '../../common/generate-native-user-token'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import generateUserToken from '../../common/generate-native-user-token.js'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get-all.ts b/src/server/api/endpoints/i/registry/get-all.ts index ce8653f22b..6d5a4ec31f 100644 --- a/src/server/api/endpoints/i/registry/get-all.ts +++ b/src/server/api/endpoints/i/registry/get-all.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get-detail.ts b/src/server/api/endpoints/i/registry/get-detail.ts index 441833d3d7..81a81b0217 100644 --- a/src/server/api/endpoints/i/registry/get-detail.ts +++ b/src/server/api/endpoints/i/registry/get-detail.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get.ts b/src/server/api/endpoints/i/registry/get.ts index 275e660cb6..8bdec7986a 100644 --- a/src/server/api/endpoints/i/registry/get.ts +++ b/src/server/api/endpoints/i/registry/get.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/keys-with-type.ts b/src/server/api/endpoints/i/registry/keys-with-type.ts index 06d77acbeb..1aeba71fe2 100644 --- a/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/keys.ts b/src/server/api/endpoints/i/registry/keys.ts index e4dd5044b4..1c3836d7a0 100644 --- a/src/server/api/endpoints/i/registry/keys.ts +++ b/src/server/api/endpoints/i/registry/keys.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/remove.ts b/src/server/api/endpoints/i/registry/remove.ts index 4f04d653b3..64cf5fbb74 100644 --- a/src/server/api/endpoints/i/registry/remove.ts +++ b/src/server/api/endpoints/i/registry/remove.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/scopes.ts b/src/server/api/endpoints/i/registry/scopes.ts index baf3ebdeca..094dfbef88 100644 --- a/src/server/api/endpoints/i/registry/scopes.ts +++ b/src/server/api/endpoints/i/registry/scopes.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/set.ts b/src/server/api/endpoints/i/registry/set.ts index 40f6368017..099ccd27ba 100644 --- a/src/server/api/endpoints/i/registry/set.ts +++ b/src/server/api/endpoints/i/registry/set.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/revoke-token.ts b/src/server/api/endpoints/i/revoke-token.ts index d22d9ca693..3f3a2fa939 100644 --- a/src/server/api/endpoints/i/revoke-token.ts +++ b/src/server/api/endpoints/i/revoke-token.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { publishUserEvent } from '@/services/stream'; +import define from '../../define.js'; +import { AccessTokens } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/signin-history.ts b/src/server/api/endpoints/i/signin-history.ts index 0395206144..215c7b1fc9 100644 --- a/src/server/api/endpoints/i/signin-history.ts +++ b/src/server/api/endpoints/i/signin-history.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Signins } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Signins } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/unpin.ts b/src/server/api/endpoints/i/unpin.ts index fe19b20905..f8c451aa2e 100644 --- a/src/server/api/endpoints/i/unpin.ts +++ b/src/server/api/endpoints/i/unpin.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { removePinned } from '../../../../services/i/pin'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { removePinned } from '@/services/i/pin.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account', 'notes'], diff --git a/src/server/api/endpoints/i/update-email.ts b/src/server/api/endpoints/i/update-email.ts index cd0e989e51..142a7aa75c 100644 --- a/src/server/api/endpoints/i/update-email.ts +++ b/src/server/api/endpoints/i/update-email.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; import rndstr from 'rndstr'; -import config from '@/config'; +import config from '@/config/index.js'; import * as ms from 'ms'; import * as bcrypt from 'bcryptjs'; -import { Users, UserProfiles } from '../../../../models'; -import { sendEmail } from '../../../../services/send-email'; -import { ApiError } from '../../error'; +import { Users, UserProfiles } from '@/models/index.js'; +import { sendEmail } from '@/services/send-email.js'; +import { ApiError } from '../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 96955354a3..e8881f94de 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -1,20 +1,20 @@ import $ from 'cafy'; import * as mfm from 'mfm-js'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream, publishUserEvent } from '../../../../services/stream'; -import acceptAllFollowRequests from '../../../../services/following/requests/accept-all'; -import { publishToFollowers } from '../../../../services/i/update'; -import define from '../../define'; -import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm'; -import { extractHashtags } from '@/misc/extract-hashtags'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import acceptAllFollowRequests from '@/services/following/requests/accept-all.js'; +import { publishToFollowers } from '@/services/i/update.js'; +import define from '../../define.js'; +import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; +import { extractHashtags } from '@/misc/extract-hashtags.js'; import * as langmap from 'langmap'; -import { updateUsertags } from '../../../../services/update-hashtag'; -import { ApiError } from '../../error'; -import { Users, DriveFiles, UserProfiles, Pages } from '../../../../models'; -import { User } from '../../../../models/entities/user'; -import { UserProfile } from '../../../../models/entities/user-profile'; -import { notificationTypes } from '../../../../types'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { updateUsertags } from '@/services/update-hashtag.js'; +import { ApiError } from '../../error.js'; +import { Users, DriveFiles, UserProfiles, Pages } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; +import { notificationTypes } from '../../../../types.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/user-group-invites.ts b/src/server/api/endpoints/i/user-group-invites.ts index 623274df92..57148bac5d 100644 --- a/src/server/api/endpoints/i/user-group-invites.ts +++ b/src/server/api/endpoints/i/user-group-invites.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { UserGroupInvitations } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { UserGroupInvitations } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'groups'], diff --git a/src/server/api/endpoints/messaging/history.ts b/src/server/api/endpoints/messaging/history.ts index 5f4f02455d..6f098a0940 100644 --- a/src/server/api/endpoints/messaging/history.ts +++ b/src/server/api/endpoints/messaging/history.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { MessagingMessage } from '../../../../models/entities/messaging-message'; -import { MessagingMessages, Mutings, UserGroupJoinings } from '../../../../models'; +import define from '../../define.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { MessagingMessages, Mutings, UserGroupJoinings } from '@/models/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/messaging/messages.ts b/src/server/api/endpoints/messaging/messages.ts index 087f5a7d62..3541001ae1 100644 --- a/src/server/api/endpoints/messaging/messages.ts +++ b/src/server/api/endpoints/messaging/messages.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { MessagingMessages, UserGroups, UserGroupJoinings, Users } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { MessagingMessages, UserGroups, UserGroupJoinings, Users } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message'; +import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/create.ts b/src/server/api/endpoints/messaging/messages/create.ts index a00513a24d..c6902dc1b6 100644 --- a/src/server/api/endpoints/messaging/messages/create.ts +++ b/src/server/api/endpoints/messaging/messages/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { MessagingMessages, DriveFiles, UserGroups, UserGroupJoinings, Blockings } from '../../../../../models'; -import { User } from '../../../../../models/entities/user'; -import { UserGroup } from '../../../../../models/entities/user-group'; -import { createMessage } from '../../../../../services/messages/create'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { MessagingMessages, DriveFiles, UserGroups, UserGroupJoinings, Blockings } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { createMessage } from '@/services/messages/create.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/delete.ts b/src/server/api/endpoints/messaging/messages/delete.ts index 5e5aa5fd13..54559560c9 100644 --- a/src/server/api/endpoints/messaging/messages/delete.ts +++ b/src/server/api/endpoints/messaging/messages/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; import * as ms from 'ms'; -import { ApiError } from '../../../error'; -import { MessagingMessages } from '../../../../../models'; -import { deleteMessage } from '../../../../../services/messages/delete'; +import { ApiError } from '../../../error.js'; +import { MessagingMessages } from '@/models/index.js'; +import { deleteMessage } from '@/services/messages/delete.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/read.ts b/src/server/api/endpoints/messaging/messages/read.ts index b17927da3f..ac822b6a36 100644 --- a/src/server/api/endpoints/messaging/messages/read.ts +++ b/src/server/api/endpoints/messaging/messages/read.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { MessagingMessages } from '../../../../../models'; -import { readUserMessagingMessage, readGroupMessagingMessage } from '../../../common/read-messaging-message'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { MessagingMessages } from '@/models/index.js'; +import { readUserMessagingMessage, readGroupMessagingMessage } from '../../../common/read-messaging-message.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 561d473d6f..579e963af9 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import config from '@/config'; -import define from '../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Ads, Emojis, Users } from '../../../models'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; +import config from '@/config/index.js'; +import define from '../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Ads, Emojis, Users } from '@/models/index.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; import { MoreThan } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/miauth/gen-token.ts b/src/server/api/endpoints/miauth/gen-token.ts index 68ef00eb28..b026d995a5 100644 --- a/src/server/api/endpoints/miauth/gen-token.ts +++ b/src/server/api/endpoints/miauth/gen-token.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../define.js'; +import { AccessTokens } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/mute/create.ts b/src/server/api/endpoints/mute/create.ts index 7f018a359a..5fdb21a449 100644 --- a/src/server/api/endpoints/mute/create.ts +++ b/src/server/api/endpoints/mute/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { genId } from '@/misc/gen-id'; -import { Mutings, NoteWatchings } from '../../../../models'; -import { Muting } from '../../../../models/entities/muting'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { genId } from '@/misc/gen-id.js'; +import { Mutings, NoteWatchings } from '@/models/index.js'; +import { Muting } from '@/models/entities/muting.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/mute/delete.ts b/src/server/api/endpoints/mute/delete.ts index bfb6a95e32..041e5df208 100644 --- a/src/server/api/endpoints/mute/delete.ts +++ b/src/server/api/endpoints/mute/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Mutings } from '../../../../models'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Mutings } from '@/models/index.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/mute/list.ts b/src/server/api/endpoints/mute/list.ts index 45952ec72e..0024506eb0 100644 --- a/src/server/api/endpoints/mute/list.ts +++ b/src/server/api/endpoints/mute/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Mutings } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Mutings } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/my/apps.ts b/src/server/api/endpoints/my/apps.ts index 908e24e1ba..268408698b 100644 --- a/src/server/api/endpoints/my/apps.ts +++ b/src/server/api/endpoints/my/apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Apps } from '../../../../models'; +import define from '../../define.js'; +import { Apps } from '@/models/index.js'; export const meta = { tags: ['account', 'app'], diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index fdb8bad247..6a9766d289 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../define'; -import { makePaginationQuery } from '../common/make-pagination-query'; -import { Notes } from '../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../define.js'; +import { makePaginationQuery } from '../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/children.ts b/src/server/api/endpoints/notes/children.ts index f4d2958810..de17c32f51 100644 --- a/src/server/api/endpoints/notes/children.ts +++ b/src/server/api/endpoints/notes/children.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; import { Brackets } from 'typeorm'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/clips.ts b/src/server/api/endpoints/notes/clips.ts index d116370b46..c3360d6f22 100644 --- a/src/server/api/endpoints/notes/clips.ts +++ b/src/server/api/endpoints/notes/clips.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips } from '../../../../models'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips } from '@/models/index.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; import { In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/conversation.ts b/src/server/api/endpoints/notes/conversation.ts index 0fd10df077..adf4ca2e10 100644 --- a/src/server/api/endpoints/notes/conversation.ts +++ b/src/server/api/endpoints/notes/conversation.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getNote } from '../../common/getters'; -import { Note } from '../../../../models/entities/note'; -import { Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getNote } from '../../common/getters.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index 9c055683f7..8c2db5213e 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; import * as ms from 'ms'; import { length } from 'stringz'; -import create from '../../../../services/note/create'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { User } from '../../../../models/entities/user'; -import { Users, DriveFiles, Notes, Channels, Blockings } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { Note } from '../../../../models/entities/note'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; -import { noteVisibilities } from '../../../../types'; -import { Channel } from '../../../../models/entities/channel'; +import create from '@/services/note/create.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { User } from '@/models/entities/user.js'; +import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { Note } from '@/models/entities/note.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; +import { noteVisibilities } from '../../../../types.js'; +import { Channel } from '@/models/entities/channel.js'; let maxNoteTextLength = 500; diff --git a/src/server/api/endpoints/notes/delete.ts b/src/server/api/endpoints/notes/delete.ts index 6a0652312a..e66718001b 100644 --- a/src/server/api/endpoints/notes/delete.ts +++ b/src/server/api/endpoints/notes/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import deleteNote from '../../../../services/note/delete'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import deleteNote from '@/services/note/delete.js'; +import define from '../../define.js'; import * as ms from 'ms'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/favorites/create.ts b/src/server/api/endpoints/notes/favorites/create.ts index b77b5d48ff..f406d6238a 100644 --- a/src/server/api/endpoints/notes/favorites/create.ts +++ b/src/server/api/endpoints/notes/favorites/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { NoteFavorites } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { NoteFavorites } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes', 'favorites'], diff --git a/src/server/api/endpoints/notes/favorites/delete.ts b/src/server/api/endpoints/notes/favorites/delete.ts index 4a1fc71a0d..624cf18948 100644 --- a/src/server/api/endpoints/notes/favorites/delete.ts +++ b/src/server/api/endpoints/notes/favorites/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { NoteFavorites } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { NoteFavorites } from '@/models/index.js'; export const meta = { tags: ['notes', 'favorites'], diff --git a/src/server/api/endpoints/notes/featured.ts b/src/server/api/endpoints/notes/featured.ts index 44c0fb23ab..aa8a8c09aa 100644 --- a/src/server/api/endpoints/notes/featured.ts +++ b/src/server/api/endpoints/notes/featured.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import define from '../../define.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts index 96bfde5aa2..ae2408ef40 100644 --- a/src/server/api/endpoints/notes/global-timeline.ts +++ b/src/server/api/endpoints/notes/global-timeline.ts @@ -1,15 +1,15 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts index 91a36fd0cc..4bebeab998 100644 --- a/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Followings, Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Followings, Notes } from '@/models/index.js'; import { Brackets } from 'typeorm'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts index 4f481b599d..95e748fae6 100644 --- a/src/server/api/endpoints/notes/local-timeline.ts +++ b/src/server/api/endpoints/notes/local-timeline.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index 6a2358228b..f3b8eecad6 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import read from '../../../../services/note/read'; -import { Notes, Followings } from '../../../../models'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import read from '@/services/note/read.js'; +import { Notes, Followings } from '@/models/index.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/polls/recommendation.ts b/src/server/api/endpoints/notes/polls/recommendation.ts index af8a527398..194c2ae276 100644 --- a/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/src/server/api/endpoints/notes/polls/recommendation.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Polls, Mutings, Notes, PollVotes } from '../../../../../models'; +import define from '../../../define.js'; +import { Polls, Mutings, Notes, PollVotes } from '@/models/index.js'; import { Brackets, In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index 6f2892960f..0fde90b592 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishNoteStream } from '../../../../../services/stream'; -import { createNotification } from '../../../../../services/create-notification'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { deliver } from '../../../../../queue'; -import { renderActivity } from '../../../../../remote/activitypub/renderer'; -import renderVote from '../../../../../remote/activitypub/renderer/vote'; -import { deliverQuestionUpdate } from '../../../../../services/note/polls/update'; -import { PollVotes, NoteWatchings, Users, Polls, Blockings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishNoteStream } from '@/services/stream.js'; +import { createNotification } from '@/services/create-notification.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { deliver } from '@/queue/index.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderVote from '@/remote/activitypub/renderer/vote.js'; +import { deliverQuestionUpdate } from '@/services/note/polls/update.js'; +import { PollVotes, NoteWatchings, Users, Polls, Blockings } from '@/models/index.js'; import { Not } from 'typeorm'; -import { IRemoteUser } from '../../../../../models/entities/user'; -import { genId } from '@/misc/gen-id'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/reactions.ts b/src/server/api/endpoints/notes/reactions.ts index df780bfa06..a67851d3b7 100644 --- a/src/server/api/endpoints/notes/reactions.ts +++ b/src/server/api/endpoints/notes/reactions.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { NoteReactions } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { NoteReactions } from '@/models/index.js'; import { DeepPartial } from 'typeorm'; -import { NoteReaction } from '../../../../models/entities/note-reaction'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; export const meta = { tags: ['notes', 'reactions'], diff --git a/src/server/api/endpoints/notes/reactions/create.ts b/src/server/api/endpoints/notes/reactions/create.ts index 3243332c50..41109746f8 100644 --- a/src/server/api/endpoints/notes/reactions/create.ts +++ b/src/server/api/endpoints/notes/reactions/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import createReaction from '../../../../../services/note/reaction/create'; -import define from '../../../define'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import createReaction from '@/services/note/reaction/create.js'; +import define from '../../../define.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['reactions', 'notes'], diff --git a/src/server/api/endpoints/notes/reactions/delete.ts b/src/server/api/endpoints/notes/reactions/delete.ts index b18cb533d6..b9eaf6978c 100644 --- a/src/server/api/endpoints/notes/reactions/delete.ts +++ b/src/server/api/endpoints/notes/reactions/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; import * as ms from 'ms'; -import deleteReaction from '../../../../../services/note/reaction/delete'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import deleteReaction from '@/services/note/reaction/delete.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['reactions', 'notes'], diff --git a/src/server/api/endpoints/notes/renotes.ts b/src/server/api/endpoints/notes/renotes.ts index 5e3b3ccbc6..b08173f249 100644 --- a/src/server/api/endpoints/notes/renotes.ts +++ b/src/server/api/endpoints/notes/renotes.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/replies.ts b/src/server/api/endpoints/notes/replies.ts index 7960078c8e..5a96c16fd2 100644 --- a/src/server/api/endpoints/notes/replies.ts +++ b/src/server/api/endpoints/notes/replies.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/search-by-tag.ts b/src/server/api/endpoints/notes/search-by-tag.ts index 39d99babac..2c0ad74635 100644 --- a/src/server/api/endpoints/notes/search-by-tag.ts +++ b/src/server/api/endpoints/notes/search-by-tag.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; import { Brackets } from 'typeorm'; -import { safeForSql } from '@/misc/safe-for-sql'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { safeForSql } from '@/misc/safe-for-sql.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes', 'hashtags'], diff --git a/src/server/api/endpoints/notes/search.ts b/src/server/api/endpoints/notes/search.ts index 0e0eaa06a8..45442c2548 100644 --- a/src/server/api/endpoints/notes/search.ts +++ b/src/server/api/endpoints/notes/search.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import es from '../../../../db/elasticsearch'; -import define from '../../define'; -import { Notes } from '../../../../models'; +import es from '../../../../db/elasticsearch.js'; +import define from '../../define.js'; +import { Notes } from '@/models/index.js'; import { In } from 'typeorm'; -import { ID } from '@/misc/cafy-id'; -import config from '@/config'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import config from '@/config/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/show.ts b/src/server/api/endpoints/notes/show.ts index fc8e30788d..8387279b17 100644 --- a/src/server/api/endpoints/notes/show.ts +++ b/src/server/api/endpoints/notes/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/state.ts b/src/server/api/endpoints/notes/state.ts index 8af09f07dd..bd2e85ea9d 100644 --- a/src/server/api/endpoints/notes/state.ts +++ b/src/server/api/endpoints/notes/state.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { NoteFavorites, NoteWatchings } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { NoteFavorites, NoteWatchings } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index 5f03400919..e1fd2d5fca 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -1,16 +1,16 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes, Followings } from '../../../../models'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes, Followings } from '@/models/index.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/translate.ts b/src/server/api/endpoints/notes/translate.ts index 67c02432c8..66354a2ea4 100644 --- a/src/server/api/endpoints/notes/translate.ts +++ b/src/server/api/endpoints/notes/translate.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; import fetch from 'node-fetch'; -import config from '@/config'; -import { getAgentByUrl } from '@/misc/fetch'; +import config from '@/config/index.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; import { URLSearchParams } from 'url'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/unrenote.ts b/src/server/api/endpoints/notes/unrenote.ts index 5e016f293f..eec7a21515 100644 --- a/src/server/api/endpoints/notes/unrenote.ts +++ b/src/server/api/endpoints/notes/unrenote.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import deleteNote from '../../../../services/note/delete'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import deleteNote from '@/services/note/delete.js'; +import define from '../../define.js'; import * as ms from 'ms'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Notes, Users } from '../../../../models'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Notes, Users } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts index e160fff25a..15abaa6c22 100644 --- a/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/src/server/api/endpoints/notes/user-list-timeline.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { UserLists, UserListJoinings, Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { UserLists, UserListJoinings, Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/watching/create.ts b/src/server/api/endpoints/notes/watching/create.ts index 74d31fe1a3..1c2c1652ae 100644 --- a/src/server/api/endpoints/notes/watching/create.ts +++ b/src/server/api/endpoints/notes/watching/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import watch from '../../../../../services/note/watch'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import watch from '@/services/note/watch.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/watching/delete.ts b/src/server/api/endpoints/notes/watching/delete.ts index a91d72be05..b418d3af2b 100644 --- a/src/server/api/endpoints/notes/watching/delete.ts +++ b/src/server/api/endpoints/notes/watching/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import unwatch from '../../../../../services/note/unwatch'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import unwatch from '@/services/note/unwatch.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notifications/create.ts b/src/server/api/endpoints/notifications/create.ts index 6267699e90..5231d9011b 100644 --- a/src/server/api/endpoints/notifications/create.ts +++ b/src/server/api/endpoints/notifications/create.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { createNotification } from '../../../../services/create-notification'; +import define from '../../define.js'; +import { createNotification } from '@/services/create-notification.js'; export const meta = { tags: ['notifications'], diff --git a/src/server/api/endpoints/notifications/mark-all-as-read.ts b/src/server/api/endpoints/notifications/mark-all-as-read.ts index cce54587c7..d0dc7be31b 100644 --- a/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Notifications } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Notifications } from '@/models/index.js'; export const meta = { tags: ['notifications', 'account'], diff --git a/src/server/api/endpoints/notifications/read.ts b/src/server/api/endpoints/notifications/read.ts index fe8e5ba44f..94140db82e 100644 --- a/src/server/api/endpoints/notifications/read.ts +++ b/src/server/api/endpoints/notifications/read.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Notifications } from '../../../../models'; -import { readNotification } from '../../common/read-notification'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Notifications } from '@/models/index.js'; +import { readNotification } from '../../common/read-notification.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['notifications', 'account'], diff --git a/src/server/api/endpoints/page-push.ts b/src/server/api/endpoints/page-push.ts index 9ec9f9184c..1d48303394 100644 --- a/src/server/api/endpoints/page-push.ts +++ b/src/server/api/endpoints/page-push.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../define'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream } from '../../../services/stream'; -import { Users, Pages } from '../../../models'; -import { ApiError } from '../error'; +import define from '../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream } from '@/services/stream.js'; +import { Users, Pages } from '@/models/index.js'; +import { ApiError } from '../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/pages/create.ts b/src/server/api/endpoints/pages/create.ts index 07e0969bdd..4f8a09b02a 100644 --- a/src/server/api/endpoints/pages/create.ts +++ b/src/server/api/endpoints/pages/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../define'; -import { ID } from '@/misc/cafy-id'; -import { Pages, DriveFiles } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { Page } from '../../../../models/entities/page'; -import { ApiError } from '../../error'; +import define from '../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Pages, DriveFiles } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { Page } from '@/models/entities/page.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/delete.ts b/src/server/api/endpoints/pages/delete.ts index 12a3360e43..8777c65e42 100644 --- a/src/server/api/endpoints/pages/delete.ts +++ b/src/server/api/endpoints/pages/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/featured.ts b/src/server/api/endpoints/pages/featured.ts index 19802d0448..68adac930d 100644 --- a/src/server/api/endpoints/pages/featured.ts +++ b/src/server/api/endpoints/pages/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Pages } from '../../../../models'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/like.ts b/src/server/api/endpoints/pages/like.ts index bed8e975ec..ac0f577eb8 100644 --- a/src/server/api/endpoints/pages/like.ts +++ b/src/server/api/endpoints/pages/like.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, PageLikes } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, PageLikes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/show.ts b/src/server/api/endpoints/pages/show.ts index d4d04bccff..21084d3b9a 100644 --- a/src/server/api/endpoints/pages/show.ts +++ b/src/server/api/endpoints/pages/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, Users } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { Page } from '../../../../models/entities/page'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, Users } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Page } from '@/models/entities/page.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/unlike.ts b/src/server/api/endpoints/pages/unlike.ts index a5e22a2c7b..dddecccf62 100644 --- a/src/server/api/endpoints/pages/unlike.ts +++ b/src/server/api/endpoints/pages/unlike.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, PageLikes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, PageLikes } from '@/models/index.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/update.ts b/src/server/api/endpoints/pages/update.ts index 6d1ae4c6fe..d1df9b08a2 100644 --- a/src/server/api/endpoints/pages/update.ts +++ b/src/server/api/endpoints/pages/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, DriveFiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, DriveFiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; import { Not } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/ping.ts b/src/server/api/endpoints/ping.ts index 0b1bb6e164..1d342dac33 100644 --- a/src/server/api/endpoints/ping.ts +++ b/src/server/api/endpoints/ping.ts @@ -1,4 +1,4 @@ -import define from '../define'; +import define from '../define.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/pinned-users.ts b/src/server/api/endpoints/pinned-users.ts index bcef072fed..0ea5e9b390 100644 --- a/src/server/api/endpoints/pinned-users.ts +++ b/src/server/api/endpoints/pinned-users.ts @@ -1,8 +1,8 @@ -import define from '../define'; -import { Users } from '../../../models'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { parseAcct } from '@/misc/acct'; -import { User } from '../../../models/entities/user'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { parseAcct } from '@/misc/acct.js'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/promo/read.ts b/src/server/api/endpoints/promo/read.ts index 32b543295d..92a6768988 100644 --- a/src/server/api/endpoints/promo/read.ts +++ b/src/server/api/endpoints/promo/read.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getNote } from '../../common/getters'; -import { PromoReads } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getNote } from '../../common/getters.js'; +import { PromoReads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/request-reset-password.ts b/src/server/api/endpoints/request-reset-password.ts index c880df7527..754a5a1c87 100644 --- a/src/server/api/endpoints/request-reset-password.ts +++ b/src/server/api/endpoints/request-reset-password.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../services/stream'; -import define from '../define'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../define.js'; import rndstr from 'rndstr'; -import config from '@/config'; +import config from '@/config/index.js'; import * as ms from 'ms'; -import { Users, UserProfiles, PasswordResetRequests } from '../../../models'; -import { sendEmail } from '../../../services/send-email'; -import { ApiError } from '../error'; -import { genId } from '@/misc/gen-id'; +import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js'; +import { sendEmail } from '@/services/send-email.js'; +import { ApiError } from '../error.js'; +import { genId } from '@/misc/gen-id.js'; import { IsNull } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/reset-db.ts b/src/server/api/endpoints/reset-db.ts index f430869302..c6ad8303fa 100644 --- a/src/server/api/endpoints/reset-db.ts +++ b/src/server/api/endpoints/reset-db.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../define'; -import { ApiError } from '../error'; -import { resetDb } from '@/db/postgre'; +import define from '../define.js'; +import { ApiError } from '../error.js'; +import { resetDb } from '@/db/postgre.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/reset-password.ts b/src/server/api/endpoints/reset-password.ts index 5f79bdbd00..f32e499e01 100644 --- a/src/server/api/endpoints/reset-password.ts +++ b/src/server/api/endpoints/reset-password.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import { publishMainStream } from '../../../services/stream'; -import define from '../define'; -import { Users, UserProfiles, PasswordResetRequests } from '../../../models'; -import { ApiError } from '../error'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../define.js'; +import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js'; +import { ApiError } from '../error.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/room/show.ts b/src/server/api/endpoints/room/show.ts index 85cd57aef4..dcedde5db3 100644 --- a/src/server/api/endpoints/room/show.ts +++ b/src/server/api/endpoints/room/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, UserProfiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { toPunyNullable } from '@/misc/convert-host'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['room'], diff --git a/src/server/api/endpoints/room/update.ts b/src/server/api/endpoints/room/update.ts index af8b80be9a..2ee44e157c 100644 --- a/src/server/api/endpoints/room/update.ts +++ b/src/server/api/endpoints/room/update.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { tags: ['room'], diff --git a/src/server/api/endpoints/server-info.ts b/src/server/api/endpoints/server-info.ts index 4e636d331c..23a7aabba4 100644 --- a/src/server/api/endpoints/server-info.ts +++ b/src/server/api/endpoints/server-info.ts @@ -1,6 +1,6 @@ import * as os from 'os'; import * as si from 'systeminformation'; -import define from '../define'; +import define from '../define.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts index f9c17f86eb..84b56c0ba9 100644 --- a/src/server/api/endpoints/stats.ts +++ b/src/server/api/endpoints/stats.ts @@ -1,6 +1,6 @@ -import define from '../define'; -import { NoteReactions, Notes, Users } from '../../../models'; -import { federationChart, driveChart } from '../../../services/chart'; +import define from '../define.js'; +import { NoteReactions, Notes, Users } from '@/models/index.js'; +import { federationChart, driveChart } from '@/services/chart/index.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/sw/register.ts b/src/server/api/endpoints/sw/register.ts index 43d4118df6..c008e6ec70 100644 --- a/src/server/api/endpoints/sw/register.ts +++ b/src/server/api/endpoints/sw/register.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { genId } from '@/misc/gen-id'; -import { SwSubscriptions } from '../../../../models'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { genId } from '@/misc/gen-id.js'; +import { SwSubscriptions } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/username/available.ts b/src/server/api/endpoints/username/available.ts index cd434b582e..38442fdc9c 100644 --- a/src/server/api/endpoints/username/available.ts +++ b/src/server/api/endpoints/username/available.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users, UsedUsernames } from '../../../../models'; +import define from '../../define.js'; +import { Users, UsedUsernames } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users.ts b/src/server/api/endpoints/users.ts index 3c30f459da..462055b285 100644 --- a/src/server/api/endpoints/users.ts +++ b/src/server/api/endpoints/users.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../define'; -import { Users } from '../../../models'; -import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../common/generate-block-query'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; +import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../common/generate-block-query.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/clips.ts b/src/server/api/endpoints/users/clips.ts index 12aa964034..8e53843bb3 100644 --- a/src/server/api/endpoints/users/clips.ts +++ b/src/server/api/endpoints/users/clips.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Clips } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Clips } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'clips'], diff --git a/src/server/api/endpoints/users/followers.ts b/src/server/api/endpoints/users/followers.ts index c9fe36e4e4..896c3ca1cd 100644 --- a/src/server/api/endpoints/users/followers.ts +++ b/src/server/api/endpoints/users/followers.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { toPunyNullable } from '@/misc/convert-host'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/following.ts b/src/server/api/endpoints/users/following.ts index c3dd90ff7e..ab60cc02fb 100644 --- a/src/server/api/endpoints/users/following.ts +++ b/src/server/api/endpoints/users/following.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { toPunyNullable } from '@/misc/convert-host'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/gallery/posts.ts b/src/server/api/endpoints/users/gallery/posts.ts index 1da6bced5c..7c5a7d1cf3 100644 --- a/src/server/api/endpoints/users/gallery/posts.ts +++ b/src/server/api/endpoints/users/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryPosts } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryPosts } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'gallery'], diff --git a/src/server/api/endpoints/users/get-frequently-replied-users.ts b/src/server/api/endpoints/users/get-frequently-replied-users.ts index bdfb7772ae..4207aa004c 100644 --- a/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { maximum } from '../../../../prelude/array'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { maximum } from '../../../../prelude/array.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; import { Not, In, IsNull } from 'typeorm'; -import { Notes, Users } from '../../../../models'; +import { Notes, Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/groups/create.ts b/src/server/api/endpoints/users/groups/create.ts index 2cd0653baa..7c3d5d258d 100644 --- a/src/server/api/endpoints/users/groups/create.ts +++ b/src/server/api/endpoints/users/groups/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroup } from '../../../../../models/entities/user-group'; -import { UserGroupJoining } from '../../../../../models/entities/user-group-joining'; +import define from '../../../define.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { UserGroupJoining } from '@/models/entities/user-group-joining.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/groups/delete.ts b/src/server/api/endpoints/users/groups/delete.ts index 4c4a8c15b1..71d6c615a7 100644 --- a/src/server/api/endpoints/users/groups/delete.ts +++ b/src/server/api/endpoints/users/groups/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/groups/invitations/accept.ts b/src/server/api/endpoints/users/groups/invitations/accept.ts index 943d158661..6eab46337d 100644 --- a/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { UserGroupJoinings, UserGroupInvitations } from '../../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroupJoining } from '../../../../../../models/entities/user-group-joining'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { UserGroupJoinings, UserGroupInvitations } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroupJoining } from '@/models/entities/user-group-joining.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/invitations/reject.ts b/src/server/api/endpoints/users/groups/invitations/reject.ts index 4bc902ae5d..ff0ff58f3c 100644 --- a/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { UserGroupInvitations } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { UserGroupInvitations } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/invite.ts b/src/server/api/endpoints/users/groups/invite.ts index 688b18f69d..2a4af72662 100644 --- a/src/server/api/endpoints/users/groups/invite.ts +++ b/src/server/api/endpoints/users/groups/invite.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings, UserGroupInvitations } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroupInvitation } from '../../../../../models/entities/user-group-invitation'; -import { createNotification } from '../../../../../services/create-notification'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings, UserGroupInvitations } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js'; +import { createNotification } from '@/services/create-notification.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/joined.ts b/src/server/api/endpoints/users/groups/joined.ts index b25341c854..4066c6ddc3 100644 --- a/src/server/api/endpoints/users/groups/joined.ts +++ b/src/server/api/endpoints/users/groups/joined.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import define from '../../../define.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; import { Not, In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/users/groups/owned.ts b/src/server/api/endpoints/users/groups/owned.ts index e0b003c9e4..0111ff09d1 100644 --- a/src/server/api/endpoints/users/groups/owned.ts +++ b/src/server/api/endpoints/users/groups/owned.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserGroups } from '../../../../../models'; +import define from '../../../define.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups', 'account'], diff --git a/src/server/api/endpoints/users/groups/pull.ts b/src/server/api/endpoints/users/groups/pull.ts index d93a16bd9d..4e080074b4 100644 --- a/src/server/api/endpoints/users/groups/pull.ts +++ b/src/server/api/endpoints/users/groups/pull.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/show.ts b/src/server/api/endpoints/users/groups/show.ts index 1b71933c20..666c159c6d 100644 --- a/src/server/api/endpoints/users/groups/show.ts +++ b/src/server/api/endpoints/users/groups/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'account'], diff --git a/src/server/api/endpoints/users/groups/transfer.ts b/src/server/api/endpoints/users/groups/transfer.ts index d6376993c9..a216e80025 100644 --- a/src/server/api/endpoints/users/groups/transfer.ts +++ b/src/server/api/endpoints/users/groups/transfer.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/update.ts b/src/server/api/endpoints/users/groups/update.ts index a403152b4e..c6c1b14818 100644 --- a/src/server/api/endpoints/users/groups/update.ts +++ b/src/server/api/endpoints/users/groups/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/lists/create.ts b/src/server/api/endpoints/users/lists/create.ts index c524130089..89af90ea52 100644 --- a/src/server/api/endpoints/users/lists/create.ts +++ b/src/server/api/endpoints/users/lists/create.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserLists } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserList } from '../../../../../models/entities/user-list'; +import define from '../../../define.js'; +import { UserLists } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserList } from '@/models/entities/user-list.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/lists/delete.ts b/src/server/api/endpoints/users/lists/delete.ts index ecae5641c5..d33222242e 100644 --- a/src/server/api/endpoints/users/lists/delete.ts +++ b/src/server/api/endpoints/users/lists/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/lists/list.ts b/src/server/api/endpoints/users/lists/list.ts index 1548208714..f186408981 100644 --- a/src/server/api/endpoints/users/lists/list.ts +++ b/src/server/api/endpoints/users/lists/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserLists } from '../../../../../models'; +import define from '../../../define.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists', 'account'], diff --git a/src/server/api/endpoints/users/lists/pull.ts b/src/server/api/endpoints/users/lists/pull.ts index f8b5df0fc5..db15d67d98 100644 --- a/src/server/api/endpoints/users/lists/pull.ts +++ b/src/server/api/endpoints/users/lists/pull.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishUserListStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserLists, UserListJoinings, Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishUserListStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserLists, UserListJoinings, Users } from '@/models/index.js'; export const meta = { tags: ['lists', 'users'], diff --git a/src/server/api/endpoints/users/lists/push.ts b/src/server/api/endpoints/users/lists/push.ts index 7bb6fc7f79..266e813b16 100644 --- a/src/server/api/endpoints/users/lists/push.ts +++ b/src/server/api/endpoints/users/lists/push.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { pushUserToUserList } from '../../../../../services/user-list/push'; -import { UserLists, UserListJoinings, Blockings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { pushUserToUserList } from '@/services/user-list/push.js'; +import { UserLists, UserListJoinings, Blockings } from '@/models/index.js'; export const meta = { tags: ['lists', 'users'], diff --git a/src/server/api/endpoints/users/lists/show.ts b/src/server/api/endpoints/users/lists/show.ts index ff9ed001f7..c3a49b7472 100644 --- a/src/server/api/endpoints/users/lists/show.ts +++ b/src/server/api/endpoints/users/lists/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists', 'account'], diff --git a/src/server/api/endpoints/users/lists/update.ts b/src/server/api/endpoints/users/lists/update.ts index eaa420a5b9..c883ed420f 100644 --- a/src/server/api/endpoints/users/lists/update.ts +++ b/src/server/api/endpoints/users/lists/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index 836c3c97b7..ae6d75e641 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; import { Brackets } from 'typeorm'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['users', 'notes'], diff --git a/src/server/api/endpoints/users/pages.ts b/src/server/api/endpoints/users/pages.ts index b9f37f3210..b27b21bac5 100644 --- a/src/server/api/endpoints/users/pages.ts +++ b/src/server/api/endpoints/users/pages.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Pages } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'pages'], diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts index fba4f4f682..0c86c13366 100644 --- a/src/server/api/endpoints/users/recommendation.ts +++ b/src/server/api/endpoints/users/recommendation.ts @@ -1,9 +1,9 @@ import * as ms from 'ms'; import $ from 'cafy'; -import define from '../../define'; -import { Users, Followings } from '../../../../models'; -import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query'; +import define from '../../define.js'; +import { Users, Followings } from '@/models/index.js'; +import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/relation.ts b/src/server/api/endpoints/users/relation.ts index 18ec5d44b3..5998f2dbc2 100644 --- a/src/server/api/endpoints/users/relation.ts +++ b/src/server/api/endpoints/users/relation.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { ID } from '@/misc/cafy-id'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/report-abuse.ts b/src/server/api/endpoints/users/report-abuse.ts index 776d683700..37de2d533c 100644 --- a/src/server/api/endpoints/users/report-abuse.ts +++ b/src/server/api/endpoints/users/report-abuse.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { publishAdminStream } from '../../../../services/stream'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { AbuseUserReports, Users } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { publishAdminStream } from '@/services/stream.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { AbuseUserReports, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/search-by-username-and-host.ts b/src/server/api/endpoints/users/search-by-username-and-host.ts index 13c5a18dbe..690c346e28 100644 --- a/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index c183194c41..46e179b6dc 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { UserProfiles, Users } from '../../../../models'; -import { User } from '../../../../models/entities/user'; +import define from '../../define.js'; +import { UserProfiles, Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index fde2b5a14d..bd0d65f760 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { resolveUser } from '../../../../remote/resolve-user'; -import define from '../../define'; -import { apiLogger } from '../../logger'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { Users } from '../../../../models'; +import { resolveUser } from '@/remote/resolve-user.js'; +import define from '../../define.js'; +import { apiLogger } from '../../logger.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Users } from '@/models/index.js'; import { In } from 'typeorm'; -import { User } from '@/models/entities/user'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/stats.ts b/src/server/api/endpoints/users/stats.ts index 6763c1774e..7cf08f71c9 100644 --- a/src/server/api/endpoints/users/stats.ts +++ b/src/server/api/endpoints/users/stats.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, ReversiGames, Users } from '../../../../models'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, ReversiGames, Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/index.ts b/src/server/api/index.ts index aec4a97379..b967f70b3a 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -8,14 +8,14 @@ import * as multer from '@koa/multer'; import * as bodyParser from 'koa-bodyparser'; import * as cors from '@koa/cors'; -import endpoints from './endpoints'; -import handler from './api-handler'; -import signup from './private/signup'; -import signin from './private/signin'; -import discord from './service/discord'; -import github from './service/github'; -import twitter from './service/twitter'; -import { Instances, AccessTokens, Users } from '../../models'; +import endpoints from './endpoints.js'; +import handler from './api-handler.js'; +import signup from './private/signup.js'; +import signin from './private/signin.js'; +import discord from './service/discord.js'; +import github from './service/github.js'; +import twitter from './service/twitter.js'; +import { Instances, AccessTokens, Users } from '@/models/index.js'; // Init app const app = new Koa(); diff --git a/src/server/api/limiter.ts b/src/server/api/limiter.ts index 540ca24994..f624bd1166 100644 --- a/src/server/api/limiter.ts +++ b/src/server/api/limiter.ts @@ -1,9 +1,9 @@ import * as Limiter from 'ratelimiter'; -import { redisClient } from '../../db/redis'; -import { IEndpoint } from './endpoints'; -import { getAcct } from '@/misc/acct'; -import { User } from '../../models/entities/user'; -import Logger from '../../services/logger'; +import { redisClient } from '../../db/redis.js'; +import { IEndpoint } from './endpoints.js'; +import { getAcct } from '@/misc/acct.js'; +import { User } from '@/models/entities/user.js'; +import Logger from '@/services/logger.js'; const logger = new Logger('limiter'); diff --git a/src/server/api/logger.ts b/src/server/api/logger.ts index dde4b0d5fc..ec22d6c3e2 100644 --- a/src/server/api/logger.ts +++ b/src/server/api/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../../services/logger'; +import Logger from '@/services/logger.js'; export const apiLogger = new Logger('api'); diff --git a/src/server/api/openapi/description.ts b/src/server/api/openapi/description.ts index 6306920b7a..b9e544b04c 100644 --- a/src/server/api/openapi/description.ts +++ b/src/server/api/openapi/description.ts @@ -1,6 +1,6 @@ -import endpoints from '../endpoints'; -import * as locale from '../../../../locales/'; -import { kinds as kindsList } from '@/misc/api-permissions'; +import endpoints from '../endpoints.js'; +import * as locale from '../../../../locales/index.js'; +import { kinds as kindsList } from '@/misc/api-permissions.js'; export interface IKindInfo { endpoints: string[]; diff --git a/src/server/api/openapi/gen-spec.ts b/src/server/api/openapi/gen-spec.ts index adac3bda2c..de87288b42 100644 --- a/src/server/api/openapi/gen-spec.ts +++ b/src/server/api/openapi/gen-spec.ts @@ -1,9 +1,9 @@ -import endpoints from '../endpoints'; +import endpoints from '../endpoints.js'; import { Context } from 'cafy'; -import config from '@/config'; -import { errors as basicErrors } from './errors'; -import { schemas, convertSchemaToOpenApiSchema } from './schemas'; -import { getDescription } from './description'; +import config from '@/config/index.js'; +import { errors as basicErrors } from './errors.js'; +import { schemas, convertSchemaToOpenApiSchema } from './schemas.js'; +import { getDescription } from './description.js'; export function genOpenapiSpec(lang = 'ja-JP') { const spec = { diff --git a/src/server/api/openapi/schemas.ts b/src/server/api/openapi/schemas.ts index ee2773fe47..e8bbfe5277 100644 --- a/src/server/api/openapi/schemas.ts +++ b/src/server/api/openapi/schemas.ts @@ -1,26 +1,26 @@ -import { packedUserSchema } from '../../../models/repositories/user'; -import { Schema } from '@/misc/schema'; -import { packedNoteSchema } from '../../../models/repositories/note'; -import { packedUserListSchema } from '../../../models/repositories/user-list'; -import { packedAppSchema } from '../../../models/repositories/app'; -import { packedMessagingMessageSchema } from '../../../models/repositories/messaging-message'; -import { packedNotificationSchema } from '../../../models/repositories/notification'; -import { packedDriveFileSchema } from '../../../models/repositories/drive-file'; -import { packedDriveFolderSchema } from '../../../models/repositories/drive-folder'; -import { packedFollowingSchema } from '../../../models/repositories/following'; -import { packedMutingSchema } from '../../../models/repositories/muting'; -import { packedBlockingSchema } from '../../../models/repositories/blocking'; -import { packedNoteReactionSchema } from '../../../models/repositories/note-reaction'; -import { packedHashtagSchema } from '../../../models/repositories/hashtag'; -import { packedPageSchema } from '../../../models/repositories/page'; -import { packedUserGroupSchema } from '../../../models/repositories/user-group'; -import { packedNoteFavoriteSchema } from '../../../models/repositories/note-favorite'; -import { packedChannelSchema } from '../../../models/repositories/channel'; -import { packedAntennaSchema } from '../../../models/repositories/antenna'; -import { packedClipSchema } from '../../../models/repositories/clip'; -import { packedFederationInstanceSchema } from '../../../models/repositories/federation-instance'; -import { packedQueueCountSchema } from '../../../models/repositories/queue'; -import { packedGalleryPostSchema } from '@/models/repositories/gallery-post'; +import { packedUserSchema } from '@/models/repositories/user.js'; +import { Schema } from '@/misc/schema.js'; +import { packedNoteSchema } from '@/models/repositories/note.js'; +import { packedUserListSchema } from '@/models/repositories/user-list.js'; +import { packedAppSchema } from '@/models/repositories/app.js'; +import { packedMessagingMessageSchema } from '@/models/repositories/messaging-message.js'; +import { packedNotificationSchema } from '@/models/repositories/notification.js'; +import { packedDriveFileSchema } from '@/models/repositories/drive-file.js'; +import { packedDriveFolderSchema } from '@/models/repositories/drive-folder.js'; +import { packedFollowingSchema } from '@/models/repositories/following.js'; +import { packedMutingSchema } from '@/models/repositories/muting.js'; +import { packedBlockingSchema } from '@/models/repositories/blocking.js'; +import { packedNoteReactionSchema } from '@/models/repositories/note-reaction.js'; +import { packedHashtagSchema } from '@/models/repositories/hashtag.js'; +import { packedPageSchema } from '@/models/repositories/page.js'; +import { packedUserGroupSchema } from '@/models/repositories/user-group.js'; +import { packedNoteFavoriteSchema } from '@/models/repositories/note-favorite.js'; +import { packedChannelSchema } from '@/models/repositories/channel.js'; +import { packedAntennaSchema } from '@/models/repositories/antenna.js'; +import { packedClipSchema } from '@/models/repositories/clip.js'; +import { packedFederationInstanceSchema } from '@/models/repositories/federation-instance.js'; +import { packedQueueCountSchema } from '@/models/repositories/queue.js'; +import { packedGalleryPostSchema } from '@/models/repositories/gallery-post.js'; export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts index c01c1f265a..1eda141919 100644 --- a/src/server/api/private/signin.ts +++ b/src/server/api/private/signin.ts @@ -1,12 +1,12 @@ import * as Koa from 'koa'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; -import signin from '../common/signin'; -import config from '@/config'; -import { Users, Signins, UserProfiles, UserSecurityKeys, AttestationChallenges } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; -import { genId } from '@/misc/gen-id'; -import { verifyLogin, hash } from '../2fa'; +import signin from '../common/signin.js'; +import config from '@/config/index.js'; +import { Users, Signins, UserProfiles, UserSecurityKeys, AttestationChallenges } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { genId } from '@/misc/gen-id.js'; +import { verifyLogin, hash } from '../2fa.js'; import { randomBytes } from 'crypto'; export default async (ctx: Koa.Context) => { diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts index f0cf75797a..e554b49a63 100644 --- a/src/server/api/private/signup.ts +++ b/src/server/api/private/signup.ts @@ -1,8 +1,8 @@ import * as Koa from 'koa'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { verifyHcaptcha, verifyRecaptcha } from '@/misc/captcha'; -import { Users, RegistrationTickets } from '../../../models'; -import { signup } from '../common/signup'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { verifyHcaptcha, verifyRecaptcha } from '@/misc/captcha.js'; +import { Users, RegistrationTickets } from '@/models/index.js'; +import { signup } from '../common/signup.js'; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts index a684e71fc6..986a4d184c 100644 --- a/src/server/api/service/discord.ts +++ b/src/server/api/service/discord.ts @@ -1,15 +1,15 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; -import { getJson } from '@/misc/fetch'; +import { getJson } from '@/misc/fetch.js'; import { OAuth2 } from 'oauth'; -import config from '@/config'; -import { publishMainStream } from '../../../services/stream'; -import { redisClient } from '../../../db/redis'; +import config from '@/config/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { redisClient } from '../../../db/redis.js'; import { v4 as uuid } from 'uuid'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts index 12435b7e81..841b8e5d12 100644 --- a/src/server/api/service/github.ts +++ b/src/server/api/service/github.ts @@ -1,15 +1,15 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; -import { getJson } from '@/misc/fetch'; +import { getJson } from '@/misc/fetch.js'; import { OAuth2 } from 'oauth'; -import config from '@/config'; -import { publishMainStream } from '../../../services/stream'; -import { redisClient } from '../../../db/redis'; +import config from '@/config/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { redisClient } from '../../../db/redis.js'; import { v4 as uuid } from 'uuid'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts index 8520a5656f..5b08e0533a 100644 --- a/src/server/api/service/twitter.ts +++ b/src/server/api/service/twitter.ts @@ -2,13 +2,13 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; import { v4 as uuid } from 'uuid'; import autwh from 'autwh'; -import { redisClient } from '../../../db/redis'; -import { publishMainStream } from '../../../services/stream'; -import config from '@/config'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import { redisClient } from '../../../db/redis.js'; +import { publishMainStream } from '@/services/stream.js'; +import config from '@/config/index.js'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/stream/channels/admin.ts b/src/server/api/stream/channels/admin.ts index 1ff932d1dd..e68490d05c 100644 --- a/src/server/api/stream/channels/admin.ts +++ b/src/server/api/stream/channels/admin.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'admin'; diff --git a/src/server/api/stream/channels/antenna.ts b/src/server/api/stream/channels/antenna.ts index db4fab8412..6c672ffd65 100644 --- a/src/server/api/stream/channels/antenna.ts +++ b/src/server/api/stream/channels/antenna.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'antenna'; diff --git a/src/server/api/stream/channels/channel.ts b/src/server/api/stream/channels/channel.ts index 7910f0f2f8..8665c8253d 100644 --- a/src/server/api/stream/channels/channel.ts +++ b/src/server/api/stream/channels/channel.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes, Users } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; -import { PackedNote } from '../../../../models/repositories/note'; -import { User } from '../../../../models/entities/user'; +import Channel from '../channel.js'; +import { Notes, Users } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { User } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'channel'; diff --git a/src/server/api/stream/channels/drive.ts b/src/server/api/stream/channels/drive.ts index 4112dd9b04..66f2647942 100644 --- a/src/server/api/stream/channels/drive.ts +++ b/src/server/api/stream/channels/drive.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'drive'; diff --git a/src/server/api/stream/channels/games/reversi-game.ts b/src/server/api/stream/channels/games/reversi-game.ts index e1c2116ac6..a13d79d3c3 100644 --- a/src/server/api/stream/channels/games/reversi-game.ts +++ b/src/server/api/stream/channels/games/reversi-game.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; import * as CRC32 from 'crc-32'; -import { publishReversiGameStream } from '../../../../../services/stream'; -import Reversi from '../../../../../games/reversi/core'; -import * as maps from '../../../../../games/reversi/maps'; -import Channel from '../../channel'; -import { ReversiGame } from '../../../../../models/entities/games/reversi/game'; -import { ReversiGames, Users } from '../../../../../models'; -import { User } from '../../../../../models/entities/user'; +import { publishReversiGameStream } from '@/services/stream.js'; +import Reversi from '../../../../../games/reversi/core.js'; +import * as maps from '../../../../../games/reversi/maps.js'; +import Channel from '../../channel.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiGames, Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'gamesReversiGame'; diff --git a/src/server/api/stream/channels/games/reversi.ts b/src/server/api/stream/channels/games/reversi.ts index e0e41d9acd..f8fa7b94e1 100644 --- a/src/server/api/stream/channels/games/reversi.ts +++ b/src/server/api/stream/channels/games/reversi.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import { publishMainStream } from '../../../../../services/stream'; -import Channel from '../../channel'; -import { ReversiMatchings } from '../../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import Channel from '../../channel.js'; +import { ReversiMatchings } from '@/models/index.js'; export default class extends Channel { public readonly chName = 'gamesReversi'; diff --git a/src/server/api/stream/channels/global-timeline.ts b/src/server/api/stream/channels/global-timeline.ts index 02792bffa4..1e1e8b5c96 100644 --- a/src/server/api/stream/channels/global-timeline.ts +++ b/src/server/api/stream/channels/global-timeline.ts @@ -1,11 +1,11 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'globalTimeline'; diff --git a/src/server/api/stream/channels/hashtag.ts b/src/server/api/stream/channels/hashtag.ts index 4cabd4db62..8a5b7a267d 100644 --- a/src/server/api/stream/channels/hashtag.ts +++ b/src/server/api/stream/channels/hashtag.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'hashtag'; diff --git a/src/server/api/stream/channels/home-timeline.ts b/src/server/api/stream/channels/home-timeline.ts index 7659b5ffa3..e19cd077c3 100644 --- a/src/server/api/stream/channels/home-timeline.ts +++ b/src/server/api/stream/channels/home-timeline.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'homeTimeline'; diff --git a/src/server/api/stream/channels/hybrid-timeline.ts b/src/server/api/stream/channels/hybrid-timeline.ts index 664435f674..4d48075af6 100644 --- a/src/server/api/stream/channels/hybrid-timeline.ts +++ b/src/server/api/stream/channels/hybrid-timeline.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { PackedUser } from '../../../../models/repositories/user'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { PackedUser } from '@/models/repositories/user.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'hybridTimeline'; diff --git a/src/server/api/stream/channels/index.ts b/src/server/api/stream/channels/index.ts index 1841573043..39f4d235f1 100644 --- a/src/server/api/stream/channels/index.ts +++ b/src/server/api/stream/channels/index.ts @@ -1,20 +1,20 @@ -import main from './main'; -import homeTimeline from './home-timeline'; -import localTimeline from './local-timeline'; -import hybridTimeline from './hybrid-timeline'; -import globalTimeline from './global-timeline'; -import serverStats from './server-stats'; -import queueStats from './queue-stats'; -import userList from './user-list'; -import antenna from './antenna'; -import messaging from './messaging'; -import messagingIndex from './messaging-index'; -import drive from './drive'; -import hashtag from './hashtag'; -import channel from './channel'; -import admin from './admin'; -import gamesReversi from './games/reversi'; -import gamesReversiGame from './games/reversi-game'; +import main from './main.js'; +import homeTimeline from './home-timeline.js'; +import localTimeline from './local-timeline.js'; +import hybridTimeline from './hybrid-timeline.js'; +import globalTimeline from './global-timeline.js'; +import serverStats from './server-stats.js'; +import queueStats from './queue-stats.js'; +import userList from './user-list.js'; +import antenna from './antenna.js'; +import messaging from './messaging.js'; +import messagingIndex from './messaging-index.js'; +import drive from './drive.js'; +import hashtag from './hashtag.js'; +import channel from './channel.js'; +import admin from './admin.js'; +import gamesReversi from './games/reversi.js'; +import gamesReversiGame from './games/reversi-game.js'; export default { main, diff --git a/src/server/api/stream/channels/local-timeline.ts b/src/server/api/stream/channels/local-timeline.ts index 528059daba..c01ca5347b 100644 --- a/src/server/api/stream/channels/local-timeline.ts +++ b/src/server/api/stream/channels/local-timeline.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { PackedUser } from '../../../../models/repositories/user'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { PackedUser } from '@/models/repositories/user.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'localTimeline'; diff --git a/src/server/api/stream/channels/main.ts b/src/server/api/stream/channels/main.ts index 780bc0b89f..103c61a0fb 100644 --- a/src/server/api/stream/channels/main.ts +++ b/src/server/api/stream/channels/main.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; export default class extends Channel { public readonly chName = 'main'; diff --git a/src/server/api/stream/channels/messaging-index.ts b/src/server/api/stream/channels/messaging-index.ts index 0c495398ab..24f8aad400 100644 --- a/src/server/api/stream/channels/messaging-index.ts +++ b/src/server/api/stream/channels/messaging-index.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'messagingIndex'; diff --git a/src/server/api/stream/channels/messaging.ts b/src/server/api/stream/channels/messaging.ts index 58427e2771..c16507a5f3 100644 --- a/src/server/api/stream/channels/messaging.ts +++ b/src/server/api/stream/channels/messaging.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message'; -import Channel from '../channel'; -import { UserGroupJoinings, Users, MessagingMessages } from '../../../../models'; -import { User, ILocalUser, IRemoteUser } from '../../../../models/entities/user'; +import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message.js'; +import Channel from '../channel.js'; +import { UserGroupJoinings, Users, MessagingMessages } from '@/models/index.js'; +import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'messaging'; diff --git a/src/server/api/stream/channels/queue-stats.ts b/src/server/api/stream/channels/queue-stats.ts index 0bda0cfcb9..f05e619b96 100644 --- a/src/server/api/stream/channels/queue-stats.ts +++ b/src/server/api/stream/channels/queue-stats.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; import Xev from 'xev'; -import Channel from '../channel'; +import Channel from '../channel.js'; const ev = new Xev(); diff --git a/src/server/api/stream/channels/server-stats.ts b/src/server/api/stream/channels/server-stats.ts index d245a7f70c..76eb5b0f26 100644 --- a/src/server/api/stream/channels/server-stats.ts +++ b/src/server/api/stream/channels/server-stats.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; import Xev from 'xev'; -import Channel from '../channel'; +import Channel from '../channel.js'; const ev = new Xev(); diff --git a/src/server/api/stream/channels/user-list.ts b/src/server/api/stream/channels/user-list.ts index 1f42fbe49e..ca8e46d507 100644 --- a/src/server/api/stream/channels/user-list.ts +++ b/src/server/api/stream/channels/user-list.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes, UserListJoinings, UserLists } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { User } from '../../../../models/entities/user'; -import { PackedNote } from '../../../../models/repositories/note'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import Channel from '../channel.js'; +import { Notes, UserListJoinings, UserLists } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { User } from '@/models/entities/user.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'userList'; diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 96d4194a7d..1947be0a75 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -1,20 +1,20 @@ import autobind from 'autobind-decorator'; import * as websocket from 'websocket'; -import { readNotification } from '../common/read-notification'; -import call from '../call'; -import readNote from '../../../services/note/read'; -import Channel from './channel'; -import channels from './channels'; +import { readNotification } from '../common/read-notification.js'; +import call from '../call.js'; +import readNote from '@/services/note/read.js'; +import Channel from './channel.js'; +import channels from './channels/index.js'; import { EventEmitter } from 'events'; -import { User } from '../../../models/entities/user'; -import { Channel as ChannelModel } from '../../../models/entities/channel'; -import { Users, Followings, Mutings, UserProfiles, ChannelFollowings, Blockings } from '../../../models'; -import { ApiError } from '../error'; -import { AccessToken } from '../../../models/entities/access-token'; -import { UserProfile } from '../../../models/entities/user-profile'; -import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream } from '../../../services/stream'; -import { UserGroup } from '../../../models/entities/user-group'; -import { PackedNote } from '../../../models/repositories/note'; +import { User } from '@/models/entities/user.js'; +import { Channel as ChannelModel } from '@/models/entities/channel.js'; +import { Users, Followings, Mutings, UserProfiles, ChannelFollowings, Blockings } from '@/models/index.js'; +import { ApiError } from '../error.js'; +import { AccessToken } from '@/models/entities/access-token.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; +import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream } from '@/services/stream.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { PackedNote } from '@/models/repositories/note.js'; /** * Main stream connection diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index b431bc5ad3..115692bed0 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -1,12 +1,12 @@ import * as http from 'http'; import * as websocket from 'websocket'; -import MainStreamConnection from './stream'; +import MainStreamConnection from './stream/index.js'; import { ParsedUrlQuery } from 'querystring'; -import authenticate from './authenticate'; +import authenticate from './authenticate.js'; import { EventEmitter } from 'events'; -import { subsdcriber as redisClient } from '../../db/redis'; -import { Users } from '@/models'; +import { subsdcriber as redisClient } from '../../db/redis.js'; +import { Users } from '@/models/index.js'; module.exports = (server: http.Server) => { // Init websocket server diff --git a/src/server/file/index.ts b/src/server/file/index.ts index 0410efb99c..c58c3cbf25 100644 --- a/src/server/file/index.ts +++ b/src/server/file/index.ts @@ -3,10 +3,16 @@ */ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as Koa from 'koa'; import * as cors from '@koa/cors'; import * as Router from '@koa/router'; -import sendDriveFile from './send-drive-file'; +import sendDriveFile from './send-drive-file.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); // Init app const app = new Koa(); @@ -16,7 +22,7 @@ app.use(cors()); const router = new Router(); router.get('/app-default.jpg', ctx => { - const file = fs.createReadStream(`${__dirname}/assets/dummy.png`); + const file = fs.createReadStream(`${_dirname}/assets/dummy.png`); ctx.body = file; ctx.set('Content-Type', 'image/jpeg'); ctx.set('Cache-Control', 'max-age=31536000, immutable'); diff --git a/src/server/file/send-drive-file.ts b/src/server/file/send-drive-file.ts index 9745b1201d..f4f4bdb3c7 100644 --- a/src/server/file/send-drive-file.ts +++ b/src/server/file/send-drive-file.ts @@ -1,18 +1,24 @@ +import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as Koa from 'koa'; import * as send from 'koa-send'; import * as rename from 'rename'; import * as tmp from 'tmp'; -import * as fs from 'fs'; -import { serverLogger } from '..'; -import { contentDisposition } from '@/misc/content-disposition'; -import { DriveFiles } from '../../models'; -import { InternalStorage } from '../../services/drive/internal-storage'; -import { downloadUrl } from '@/misc/download-url'; -import { detectType } from '@/misc/get-file-info'; -import { convertToJpeg, convertToPngOrJpeg } from '../../services/drive/image-processor'; -import { GenerateVideoThumbnail } from '../../services/drive/generate-video-thumbnail'; +import { serverLogger } from '../index.js'; +import { contentDisposition } from '@/misc/content-disposition.js'; +import { DriveFiles } from '@/models/index.js'; +import { InternalStorage } from '@/services/drive/internal-storage.js'; +import { downloadUrl } from '@/misc/download-url.js'; +import { detectType } from '@/misc/get-file-info.js'; +import { convertToJpeg, convertToPngOrJpeg } from '@/services/drive/image-processor.js'; +import { GenerateVideoThumbnail } from '@/services/drive/generate-video-thumbnail.js'; -const assets = `${__dirname}/../../server/file/assets/`; +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); + +const assets = `${_dirname}/../../server/file/assets/`; const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => { serverLogger.error(e); diff --git a/src/server/index.ts b/src/server/index.ts index 3b43aa7674..bf83b7dd42 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -13,19 +13,19 @@ import * as koaLogger from 'koa-logger'; import * as requestStats from 'request-stats'; import * as slow from 'koa-slow'; -import activityPub from './activitypub'; -import nodeinfo from './nodeinfo'; -import wellKnown from './well-known'; -import config from '@/config'; -import apiServer from './api'; -import { sum } from '../prelude/array'; -import Logger from '../services/logger'; -import { program } from '../argv'; -import { UserProfiles, Users } from '../models'; -import { networkChart } from '../services/chart'; -import { genAvatar } from '@/misc/gen-avatar'; -import { createTemp } from '@/misc/create-temp'; -import { publishMainStream } from '../services/stream'; +import activityPub from './activitypub.js'; +import nodeinfo from './nodeinfo.js'; +import wellKnown from './well-known.js'; +import config from '@/config/index.js'; +import apiServer from './api/index.js'; +import { sum } from '../prelude/array.js'; +import Logger from '@/services/logger.js'; +import { program } from '../argv.js'; +import { UserProfiles, Users } from '@/models/index.js'; +import { networkChart } from '@/services/chart/index.js'; +import { genAvatar } from '@/misc/gen-avatar.js'; +import { createTemp } from '@/misc/create-temp.js'; +import { publishMainStream } from '@/services/stream.js'; export const serverLogger = new Logger('server', 'gray', false); diff --git a/src/server/nodeinfo.ts b/src/server/nodeinfo.ts index 7a1d5b6292..3600bd2acd 100644 --- a/src/server/nodeinfo.ts +++ b/src/server/nodeinfo.ts @@ -1,9 +1,9 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users } from '../models'; -// import User from '../models/user'; -// import Note from '../models/note'; +import config from '@/config/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users } from '@/models/index.js'; +// import User from '../models/user.js'; +// import Note from '../models/note.js'; const router = new Router(); diff --git a/src/server/proxy/index.ts b/src/server/proxy/index.ts index 9ef198d31b..210c2fcf12 100644 --- a/src/server/proxy/index.ts +++ b/src/server/proxy/index.ts @@ -5,7 +5,7 @@ import * as Koa from 'koa'; import * as cors from '@koa/cors'; import * as Router from '@koa/router'; -import { proxyMedia } from './proxy-media'; +import { proxyMedia } from './proxy-media.js'; // Init app const app = new Koa(); diff --git a/src/server/proxy/proxy-media.ts b/src/server/proxy/proxy-media.ts index f91df55624..3200266bed 100644 --- a/src/server/proxy/proxy-media.ts +++ b/src/server/proxy/proxy-media.ts @@ -1,10 +1,10 @@ import * as fs from 'fs'; import * as Koa from 'koa'; -import { serverLogger } from '..'; -import { IImage, convertToPng, convertToJpeg } from '../../services/drive/image-processor'; -import { createTemp } from '@/misc/create-temp'; -import { downloadUrl } from '@/misc/download-url'; -import { detectType } from '@/misc/get-file-info'; +import { serverLogger } from '../index.js'; +import { IImage, convertToPng, convertToJpeg } from '@/services/drive/image-processor.js'; +import { createTemp } from '@/misc/create-temp.js'; +import { downloadUrl } from '@/misc/download-url.js'; +import { detectType } from '@/misc/get-file-info.js'; export async function proxyMedia(ctx: Koa.Context) { const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url; diff --git a/src/server/web/feed.ts b/src/server/web/feed.ts index d4792c63aa..57b1401e35 100644 --- a/src/server/web/feed.ts +++ b/src/server/web/feed.ts @@ -1,7 +1,7 @@ import { Feed } from 'feed'; -import config from '@/config'; -import { User } from '../../models/entities/user'; -import { Notes, DriveFiles, UserProfiles } from '../../models'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Notes, DriveFiles, UserProfiles } from '@/models/index.js'; import { In } from 'typeorm'; export default async function(user: User) { diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 44ab2a997f..68cfc5d0f0 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -4,7 +4,9 @@ import * as os from 'os'; import * as fs from 'fs'; -import ms = require('ms'); +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import * as ms from 'ms'; import * as Koa from 'koa'; import * as Router from '@koa/router'; import * as send from 'koa-send'; @@ -13,37 +15,41 @@ import * as views from 'koa-views'; import * as glob from 'glob'; import * as MarkdownIt from 'markdown-it'; -import packFeed from './feed'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { genOpenapiSpec } from '../api/openapi/gen-spec'; -import config from '@/config'; -import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '../../models'; -import { parseAcct } from '@/misc/acct'; -import { getNoteSummary } from '@/misc/get-note-summary'; +import packFeed from './feed.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { genOpenapiSpec } from '../api/openapi/gen-spec.js'; +import config from '@/config/index.js'; +import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '@/models/index.js'; +import { parseAcct } from '@/misc/acct.js'; +import { getNoteSummary } from '@/misc/get-note-summary.js'; import { getConnection } from 'typeorm'; -import { redisClient } from '../../db/redis'; -import locales = require('../../../locales'); +import { redisClient } from '../../db/redis.js'; +import locales from '../../../locales/index.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); const markdown = MarkdownIt({ html: true }); -const changelog = fs.readFileSync(`${__dirname}/../../../CHANGELOG.md`, { encoding: 'utf8' }); +const changelog = fs.readFileSync(`${_dirname}/../../../CHANGELOG.md`, { encoding: 'utf8' }); function genDoc(path: string): string { let md = fs.readFileSync(path, { encoding: 'utf8' }); md = md.replace('', changelog); return md; } -const staticAssets = `${__dirname}/../../../assets/`; -const docAssets = `${__dirname}/../../../src/docs/`; -const assets = `${__dirname}/../../assets/`; +const staticAssets = `${_dirname}/../../../assets/`; +const docAssets = `${_dirname}/../../../src/docs/`; +const assets = `${_dirname}/../../assets/`; // Init app const app = new Koa(); // Init renderer -app.use(views(__dirname + '/views', { +app.use(views(_dirname + '/views', { extension: 'pug', options: { version: config.version, @@ -52,7 +58,7 @@ app.use(views(__dirname + '/views', { })); // Serve favicon -app.use(favicon(`${__dirname}/../../../assets/favicon.ico`)); +app.use(favicon(`${_dirname}/../../../assets/favicon.ico`)); // Common request handler app.use(async (ctx, next) => { @@ -75,7 +81,7 @@ router.get('/static-assets/(.*)', async ctx => { router.get('/doc-assets/(.*)', async ctx => { if (ctx.path.includes('..')) return; - const path = `${__dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`; + const path = `${_dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`; const doc = genDoc(path); ctx.set('Content-Type', 'text/plain; charset=utf-8'); ctx.body = doc; @@ -134,7 +140,7 @@ router.get('/docs.json', async ctx => { ctx.body = []; return; } - const dirPath = `${__dirname}/../../../src/docs/${lang}`.replace(/\\/g, '/'); + const dirPath = `${_dirname}/../../../src/docs/${lang}`.replace(/\\/g, '/'); const paths = glob.sync(`${dirPath}/**/*.md`); const docs: { path: string; title: string; summary: string; }[] = []; for (const path of paths) { diff --git a/src/server/web/manifest.ts b/src/server/web/manifest.ts index 918fe27c03..a35b2a5696 100644 --- a/src/server/web/manifest.ts +++ b/src/server/web/manifest.ts @@ -1,6 +1,6 @@ import * as Koa from 'koa'; import * as manifest from './manifest.json'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { fetchMeta } from '@/misc/fetch-meta.js'; module.exports = async (ctx: Koa.Context) => { const json = JSON.parse(JSON.stringify(manifest)); diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts index 1ba8e0034a..af9e2c77f5 100644 --- a/src/server/web/url-preview.ts +++ b/src/server/web/url-preview.ts @@ -1,10 +1,10 @@ import * as Koa from 'koa'; import summaly from 'summaly'; -import { fetchMeta } from '@/misc/fetch-meta'; -import Logger from '../../services/logger'; -import config from '@/config'; -import { query } from '../../prelude/url'; -import { getJson } from '@/misc/fetch'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import Logger from '@/services/logger.js'; +import config from '@/config/index.js'; +import { query } from '../../prelude/url.js'; +import { getJson } from '@/misc/fetch.js'; const logger = new Logger('url-preview'); diff --git a/src/server/well-known.ts b/src/server/well-known.ts index 5771db91d0..d5fd44069d 100644 --- a/src/server/well-known.ts +++ b/src/server/well-known.ts @@ -1,11 +1,11 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { parseAcct, Acct } from '@/misc/acct'; -import { links } from './nodeinfo'; -import { escapeAttribute, escapeValue } from '../prelude/xml'; -import { Users } from '../models'; -import { User } from '../models/entities/user'; +import config from '@/config/index.js'; +import { parseAcct, Acct } from '@/misc/acct.js'; +import { links } from './nodeinfo.js'; +import { escapeAttribute, escapeValue } from '../prelude/xml.js'; +import { Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; // Init router const router = new Router(); diff --git a/src/services/add-note-to-antenna.ts b/src/services/add-note-to-antenna.ts index 56d0149155..f285b7a605 100644 --- a/src/services/add-note-to-antenna.ts +++ b/src/services/add-note-to-antenna.ts @@ -1,10 +1,10 @@ -import { Antenna } from '../models/entities/antenna'; -import { Note } from '../models/entities/note'; -import { AntennaNotes, Mutings, Notes } from '../models'; -import { genId } from '@/misc/gen-id'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { publishAntennaStream, publishMainStream } from './stream'; -import { User } from '../models/entities/user'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Note } from '@/models/entities/note.js'; +import { AntennaNotes, Mutings, Notes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { publishAntennaStream, publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }) { // 通知しない設定になっているか、自分自身の投稿なら既読にする diff --git a/src/services/blocking/create.ts b/src/services/blocking/create.ts index d92856689c..415223f089 100644 --- a/src/services/blocking/create.ts +++ b/src/services/blocking/create.ts @@ -1,14 +1,14 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import renderBlock from '../../remote/activitypub/renderer/block'; -import { deliver } from '../../queue'; -import renderReject from '../../remote/activitypub/renderer/reject'; -import { User } from '../../models/entities/user'; -import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '../../models'; -import { perUserFollowingChart } from '../chart'; -import { genId } from '@/misc/gen-id'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import renderBlock from '@/remote/activitypub/renderer/block.js'; +import { deliver } from '@/queue/index.js'; +import renderReject from '@/remote/activitypub/renderer/reject.js'; +import { User } from '@/models/entities/user.js'; +import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '@/models/index.js'; +import { perUserFollowingChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; export default async function(blocker: User, blockee: User) { await Promise.all([ diff --git a/src/services/blocking/delete.ts b/src/services/blocking/delete.ts index 2c05cb7f3f..240c0b15d1 100644 --- a/src/services/blocking/delete.ts +++ b/src/services/blocking/delete.ts @@ -1,10 +1,10 @@ -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderBlock from '../../remote/activitypub/renderer/block'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { deliver } from '../../queue'; -import Logger from '../logger'; -import { User } from '../../models/entities/user'; -import { Blockings, Users } from '../../models'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderBlock from '@/remote/activitypub/renderer/block.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { deliver } from '@/queue/index.js'; +import Logger from '../logger.js'; +import { User } from '@/models/entities/user.js'; +import { Blockings, Users } from '@/models/index.js'; const logger = new Logger('blocking/delete'); diff --git a/src/services/chart/charts/classes/active-users.ts b/src/services/chart/charts/classes/active-users.ts index e732b25d24..959eb0f8e1 100644 --- a/src/services/chart/charts/classes/active-users.ts +++ b/src/services/chart/charts/classes/active-users.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/active-users'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/active-users.js'; type ActiveUsersLog = SchemaType; diff --git a/src/services/chart/charts/classes/drive.ts b/src/services/chart/charts/classes/drive.ts index 18537918f0..9bd64074ed 100644 --- a/src/services/chart/charts/classes/drive.ts +++ b/src/services/chart/charts/classes/drive.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/drive'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/drive.js'; type DriveLog = SchemaType; diff --git a/src/services/chart/charts/classes/federation.ts b/src/services/chart/charts/classes/federation.ts index e593a53cf1..39feed7b14 100644 --- a/src/services/chart/charts/classes/federation.ts +++ b/src/services/chart/charts/classes/federation.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Instances } from '../../../../models'; -import { name, schema } from '../schemas/federation'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Instances } from '@/models/index.js'; +import { name, schema } from '../schemas/federation.js'; type FederationLog = SchemaType; diff --git a/src/services/chart/charts/classes/hashtag.ts b/src/services/chart/charts/classes/hashtag.ts index 98d5421c9b..13f4598499 100644 --- a/src/services/chart/charts/classes/hashtag.ts +++ b/src/services/chart/charts/classes/hashtag.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/hashtag'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/hashtag.js'; type HashtagLog = SchemaType; diff --git a/src/services/chart/charts/classes/instance.ts b/src/services/chart/charts/classes/instance.ts index f93da58d61..429d4067bd 100644 --- a/src/services/chart/charts/classes/instance.ts +++ b/src/services/chart/charts/classes/instance.ts @@ -1,11 +1,11 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles, Followings, Users, Notes } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/instance'; -import { Note } from '../../../../models/entities/note'; -import { toPuny } from '@/misc/convert-host'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles, Followings, Users, Notes } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/instance.js'; +import { Note } from '@/models/entities/note.js'; +import { toPuny } from '@/misc/convert-host.js'; type InstanceLog = SchemaType; diff --git a/src/services/chart/charts/classes/network.ts b/src/services/chart/charts/classes/network.ts index 2ce75e0b34..1e39115b02 100644 --- a/src/services/chart/charts/classes/network.ts +++ b/src/services/chart/charts/classes/network.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/network'; +import Chart, { DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/network.js'; type NetworkLog = SchemaType; diff --git a/src/services/chart/charts/classes/notes.ts b/src/services/chart/charts/classes/notes.ts index a6eb653b70..7cc3c7de83 100644 --- a/src/services/chart/charts/classes/notes.ts +++ b/src/services/chart/charts/classes/notes.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Notes } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Notes } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { Note } from '../../../../models/entities/note'; -import { name, schema } from '../schemas/notes'; +import { Note } from '@/models/entities/note.js'; +import { name, schema } from '../schemas/notes.js'; type NotesLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-drive.ts b/src/services/chart/charts/classes/per-user-drive.ts index 182e5927e8..04b29c0abe 100644 --- a/src/services/chart/charts/classes/per-user-drive.ts +++ b/src/services/chart/charts/classes/per-user-drive.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/per-user-drive'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/per-user-drive.js'; type PerUserDriveLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-following.ts b/src/services/chart/charts/classes/per-user-following.ts index 5972d3759b..43ca9d3b6c 100644 --- a/src/services/chart/charts/classes/per-user-following.ts +++ b/src/services/chart/charts/classes/per-user-following.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Followings, Users } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Followings, Users } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { User } from '../../../../models/entities/user'; -import { name, schema } from '../schemas/per-user-following'; +import { User } from '@/models/entities/user.js'; +import { name, schema } from '../schemas/per-user-following.js'; type PerUserFollowingLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-notes.ts b/src/services/chart/charts/classes/per-user-notes.ts index 7f93965adb..3da16f8139 100644 --- a/src/services/chart/charts/classes/per-user-notes.ts +++ b/src/services/chart/charts/classes/per-user-notes.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { name, schema } from '../schemas/per-user-notes'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { name, schema } from '../schemas/per-user-notes.js'; type PerUserNotesLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-reactions.ts b/src/services/chart/charts/classes/per-user-reactions.ts index 69ed81cd44..d4665c0677 100644 --- a/src/services/chart/charts/classes/per-user-reactions.ts +++ b/src/services/chart/charts/classes/per-user-reactions.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { Note } from '../../../../models/entities/note'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/per-user-reactions'; +import Chart, { DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/per-user-reactions.js'; type PerUserReactionsLog = SchemaType; diff --git a/src/services/chart/charts/classes/test-grouped.ts b/src/services/chart/charts/classes/test-grouped.ts index 84e6d5e33f..a667aaff15 100644 --- a/src/services/chart/charts/classes/test-grouped.ts +++ b/src/services/chart/charts/classes/test-grouped.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test-grouped'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test-grouped.js'; type TestGroupedLog = SchemaType; diff --git a/src/services/chart/charts/classes/test-unique.ts b/src/services/chart/charts/classes/test-unique.ts index 559fda13c9..c0ca5f625c 100644 --- a/src/services/chart/charts/classes/test-unique.ts +++ b/src/services/chart/charts/classes/test-unique.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test-unique'; +import Chart, { DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test-unique.js'; type TestUniqueLog = SchemaType; diff --git a/src/services/chart/charts/classes/test.ts b/src/services/chart/charts/classes/test.ts index a91d5e1895..829867f5ed 100644 --- a/src/services/chart/charts/classes/test.ts +++ b/src/services/chart/charts/classes/test.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test.js'; type TestLog = SchemaType; diff --git a/src/services/chart/charts/classes/users.ts b/src/services/chart/charts/classes/users.ts index 8f208de6d6..be279cb8c1 100644 --- a/src/services/chart/charts/classes/users.ts +++ b/src/services/chart/charts/classes/users.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { User } from '../../../../models/entities/user'; -import { name, schema } from '../schemas/users'; +import { User } from '@/models/entities/user.js'; +import { name, schema } from '../schemas/users.js'; type UsersLog = SchemaType; diff --git a/src/services/chart/core.ts b/src/services/chart/core.ts index 3c0526d2e5..109d75933b 100644 --- a/src/services/chart/core.ts +++ b/src/services/chart/core.ts @@ -6,11 +6,11 @@ import * as nestedProperty from 'nested-property'; import autobind from 'autobind-decorator'; -import Logger from '../logger'; -import { Schema } from '@/misc/schema'; +import Logger from '../logger.js'; +import { Schema } from '@/misc/schema.js'; import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm'; -import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time'; -import { getChartInsertLock } from '@/misc/app-lock'; +import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time.js'; +import { getChartInsertLock } from '@/misc/app-lock.js'; const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test'); diff --git a/src/services/chart/entities.ts b/src/services/chart/entities.ts index e3d5e6f8c6..357a4a5b58 100644 --- a/src/services/chart/entities.ts +++ b/src/services/chart/entities.ts @@ -1,7 +1,13 @@ -import Chart from './core'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import Chart from './core.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export const entities = Object.values(require('require-all')({ - dirname: __dirname + '/charts/schemas', + dirname: _dirname + '/charts/schemas', filter: /^.+\.[jt]s$/, resolve: (x: any) => { return Chart.schemaToEntity(x.name, x.schema); diff --git a/src/services/chart/index.ts b/src/services/chart/index.ts index 61eb431ea3..b070ed8637 100644 --- a/src/services/chart/index.ts +++ b/src/services/chart/index.ts @@ -1,16 +1,16 @@ -import FederationChart from './charts/classes/federation'; -import NotesChart from './charts/classes/notes'; -import UsersChart from './charts/classes/users'; -import NetworkChart from './charts/classes/network'; -import ActiveUsersChart from './charts/classes/active-users'; -import InstanceChart from './charts/classes/instance'; -import PerUserNotesChart from './charts/classes/per-user-notes'; -import DriveChart from './charts/classes/drive'; -import PerUserReactionsChart from './charts/classes/per-user-reactions'; -import HashtagChart from './charts/classes/hashtag'; -import PerUserFollowingChart from './charts/classes/per-user-following'; -import PerUserDriveChart from './charts/classes/per-user-drive'; -import { beforeShutdown } from '@/misc/before-shutdown'; +import FederationChart from './charts/classes/federation.js'; +import NotesChart from './charts/classes/notes.js'; +import UsersChart from './charts/classes/users.js'; +import NetworkChart from './charts/classes/network.js'; +import ActiveUsersChart from './charts/classes/active-users.js'; +import InstanceChart from './charts/classes/instance.js'; +import PerUserNotesChart from './charts/classes/per-user-notes.js'; +import DriveChart from './charts/classes/drive.js'; +import PerUserReactionsChart from './charts/classes/per-user-reactions.js'; +import HashtagChart from './charts/classes/hashtag.js'; +import PerUserFollowingChart from './charts/classes/per-user-following.js'; +import PerUserDriveChart from './charts/classes/per-user-drive.js'; +import { beforeShutdown } from '@/misc/before-shutdown.js'; export const federationChart = new FederationChart(); export const notesChart = new NotesChart(); diff --git a/src/services/create-notification.ts b/src/services/create-notification.ts index 7d2726971f..d0ee0e0481 100644 --- a/src/services/create-notification.ts +++ b/src/services/create-notification.ts @@ -1,10 +1,10 @@ -import { publishMainStream } from './stream'; -import pushSw from './push-notification'; -import { Notifications, Mutings, UserProfiles, Users } from '../models'; -import { genId } from '@/misc/gen-id'; -import { User } from '../models/entities/user'; -import { Notification } from '../models/entities/notification'; -import { sendEmailNotification } from './send-email-notification'; +import { publishMainStream } from '@/services/stream.js'; +import pushSw from './push-notification.js'; +import { Notifications, Mutings, UserProfiles, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { User } from '@/models/entities/user.js'; +import { Notification } from '@/models/entities/notification.js'; +import { sendEmailNotification } from './send-email-notification.js'; export async function createNotification( notifieeId: User['id'], diff --git a/src/services/create-system-user.ts b/src/services/create-system-user.ts index 052ceb6c99..de03dd4890 100644 --- a/src/services/create-system-user.ts +++ b/src/services/create-system-user.ts @@ -1,13 +1,13 @@ import * as bcrypt from 'bcryptjs'; import { v4 as uuid } from 'uuid'; -import generateNativeUserToken from '../server/api/common/generate-native-user-token'; -import { genRsaKeyPair } from '@/misc/gen-key-pair'; -import { User } from '../models/entities/user'; -import { UserProfile } from '../models/entities/user-profile'; +import generateNativeUserToken from '../server/api/common/generate-native-user-token.js'; +import { genRsaKeyPair } from '@/misc/gen-key-pair.js'; +import { User } from '@/models/entities/user.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; import { getConnection } from 'typeorm'; -import { genId } from '@/misc/gen-id'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { UsedUsername } from '../models/entities/used-username'; +import { genId } from '@/misc/gen-id.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { UsedUsername } from '@/models/entities/used-username.js'; export async function createSystemUser(username: string) { const password = uuid(); diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index 2356a23cbe..e1092d068d 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -2,23 +2,23 @@ import * as fs from 'fs'; import { v4 as uuid } from 'uuid'; -import { publishMainStream, publishDriveStream } from '../stream'; -import { deleteFile } from './delete-file'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { GenerateVideoThumbnail } from './generate-video-thumbnail'; -import { driveLogger } from './logger'; -import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor'; -import { contentDisposition } from '@/misc/content-disposition'; -import { getFileInfo } from '@/misc/get-file-info'; -import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models'; -import { InternalStorage } from './internal-storage'; -import { DriveFile } from '../../models/entities/drive-file'; -import { IRemoteUser, User } from '../../models/entities/user'; -import { driveChart, perUserDriveChart, instanceChart } from '../chart'; -import { genId } from '@/misc/gen-id'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; +import { publishMainStream, publishDriveStream } from '@/services/stream.js'; +import { deleteFile } from './delete-file.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { GenerateVideoThumbnail } from './generate-video-thumbnail.js'; +import { driveLogger } from './logger.js'; +import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor.js'; +import { contentDisposition } from '@/misc/content-disposition.js'; +import { getFileInfo } from '@/misc/get-file-info.js'; +import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '@/models/index.js'; +import { InternalStorage } from './internal-storage.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { IRemoteUser, User } from '@/models/entities/user.js'; +import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import * as S3 from 'aws-sdk/clients/s3'; -import { getS3 } from './s3'; +import { getS3 } from './s3.js'; import * as sharp from 'sharp'; const logger = driveLogger.createSubLogger('register', 'yellow'); diff --git a/src/services/drive/delete-file.ts b/src/services/drive/delete-file.ts index 2dd2445321..9deb1768b6 100644 --- a/src/services/drive/delete-file.ts +++ b/src/services/drive/delete-file.ts @@ -1,19 +1,19 @@ -import { DriveFile } from '../../models/entities/drive-file'; -import { InternalStorage } from './internal-storage'; -import { DriveFiles, Instances, Notes, Users } from '../../models'; -import { driveChart, perUserDriveChart, instanceChart } from '../chart'; -import { createDeleteObjectStorageFileJob } from '../../queue'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getS3 } from './s3'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { InternalStorage } from './internal-storage.js'; +import { DriveFiles, Instances, Notes, Users } from '@/models/index.js'; +import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index.js'; +import { createDeleteObjectStorageFileJob } from '@/queue/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { getS3 } from './s3.js'; import { v4 as uuid } from 'uuid'; -import { Note } from '../../models/entities/note'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import config from '@/config'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; +import { Note } from '@/models/entities/note.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderDelete from '@/remote/activitypub/renderer/delete.js'; +import renderTombstone from '@/remote/activitypub/renderer/tombstone.js'; +import config from '@/config/index.js'; +import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; import { Brackets } from 'typeorm'; -import { deliverToRelays } from '../relay'; +import { deliverToRelays } from '../relay.js'; export async function deleteFile(file: DriveFile, isExpired = false) { if (file.storedInternal) { diff --git a/src/services/drive/generate-video-thumbnail.ts b/src/services/drive/generate-video-thumbnail.ts index f0adc7c338..e5cb243d4d 100644 --- a/src/services/drive/generate-video-thumbnail.ts +++ b/src/services/drive/generate-video-thumbnail.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as tmp from 'tmp'; -import { IImage, convertToJpeg } from './image-processor'; +import { IImage, convertToJpeg } from './image-processor.js'; import * as FFmpeg from 'fluent-ffmpeg'; export async function GenerateVideoThumbnail(path: string): Promise { diff --git a/src/services/drive/internal-storage.ts b/src/services/drive/internal-storage.ts index 5ec563584f..e857f942cc 100644 --- a/src/services/drive/internal-storage.ts +++ b/src/services/drive/internal-storage.ts @@ -1,9 +1,15 @@ import * as fs from 'fs'; import * as Path from 'path'; -import config from '@/config'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import config from '@/config/index.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export class InternalStorage { - private static readonly path = Path.resolve(__dirname, '../../../files'); + private static readonly path = Path.resolve(_dirname, '../../../files'); public static resolvePath = (key: string) => Path.resolve(InternalStorage.path, key); diff --git a/src/services/drive/logger.ts b/src/services/drive/logger.ts index 655d074d6e..917a8317e2 100644 --- a/src/services/drive/logger.ts +++ b/src/services/drive/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../logger'; +import Logger from '../logger.js'; export const driveLogger = new Logger('drive', 'blue'); diff --git a/src/services/drive/s3.ts b/src/services/drive/s3.ts index e75937861b..89fad70dc5 100644 --- a/src/services/drive/s3.ts +++ b/src/services/drive/s3.ts @@ -1,7 +1,7 @@ import { URL } from 'url'; import * as S3 from 'aws-sdk/clients/s3'; -import { Meta } from '../../models/entities/meta'; -import { getAgentByUrl } from '@/misc/fetch'; +import { Meta } from '@/models/entities/meta.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; export function getS3(meta: Meta) { const u = meta.objectStorageEndpoint != null diff --git a/src/services/drive/upload-from-url.ts b/src/services/drive/upload-from-url.ts index 2f660d9035..21b294142b 100644 --- a/src/services/drive/upload-from-url.ts +++ b/src/services/drive/upload-from-url.ts @@ -1,12 +1,12 @@ import { URL } from 'url'; -import create from './add-file'; -import { User } from '../../models/entities/user'; -import { driveLogger } from './logger'; -import { createTemp } from '@/misc/create-temp'; -import { downloadUrl } from '@/misc/download-url'; -import { DriveFolder } from '../../models/entities/drive-folder'; -import { DriveFile } from '../../models/entities/drive-file'; -import { DriveFiles } from '../../models'; +import create from './add-file.js'; +import { User } from '@/models/entities/user.js'; +import { driveLogger } from './logger.js'; +import { createTemp } from '@/misc/create-temp.js'; +import { downloadUrl } from '@/misc/download-url.js'; +import { DriveFolder } from '@/models/entities/drive-folder.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; const logger = driveLogger.createSubLogger('downloader'); diff --git a/src/services/fetch-instance-metadata.ts b/src/services/fetch-instance-metadata.ts index e016e73a60..d21064868c 100644 --- a/src/services/fetch-instance-metadata.ts +++ b/src/services/fetch-instance-metadata.ts @@ -1,10 +1,10 @@ import { DOMWindow, JSDOM } from 'jsdom'; import fetch from 'node-fetch'; -import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch'; -import { Instance } from '../models/entities/instance'; -import { Instances } from '../models'; -import { getFetchInstanceMetadataLock } from '@/misc/app-lock'; -import Logger from './logger'; +import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch.js'; +import { Instance } from '@/models/entities/instance.js'; +import { Instances } from '@/models/index.js'; +import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js'; +import Logger from './logger.js'; import { URL } from 'url'; const logger = new Logger('metadata', 'cyan'); diff --git a/src/services/following/create.ts b/src/services/following/create.ts index de12285fc7..194b95dea0 100644 --- a/src/services/following/create.ts +++ b/src/services/following/create.ts @@ -1,19 +1,19 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderAccept from '../../remote/activitypub/renderer/accept'; -import renderReject from '../../remote/activitypub/renderer/reject'; -import { deliver } from '../../queue'; -import createFollowRequest from './requests/create'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import Logger from '../logger'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../models/entities/user'; -import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '../../models'; -import { instanceChart, perUserFollowingChart } from '../chart'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../create-notification'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderAccept from '@/remote/activitypub/renderer/accept.js'; +import renderReject from '@/remote/activitypub/renderer/reject.js'; +import { deliver } from '@/queue/index.js'; +import createFollowRequest from './requests/create.js'; +import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import Logger from '../logger.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User } from '@/models/entities/user.js'; +import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '@/models/index.js'; +import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../create-notification.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; const logger = new Logger('following/create'); diff --git a/src/services/following/delete.ts b/src/services/following/delete.ts index d0df0de6ae..3ea226744c 100644 --- a/src/services/following/delete.ts +++ b/src/services/following/delete.ts @@ -1,13 +1,13 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { deliver } from '../../queue'; -import Logger from '../logger'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { User } from '../../models/entities/user'; -import { Followings, Users, Instances } from '../../models'; -import { instanceChart, perUserFollowingChart } from '../chart'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { deliver } from '@/queue/index.js'; +import Logger from '../logger.js'; +import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import { User } from '@/models/entities/user.js'; +import { Followings, Users, Instances } from '@/models/index.js'; +import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js'; const logger = new Logger('following/delete'); diff --git a/src/services/following/requests/accept-all.ts b/src/services/following/requests/accept-all.ts index 5fc70fcf1b..8025a134f3 100644 --- a/src/services/following/requests/accept-all.ts +++ b/src/services/following/requests/accept-all.ts @@ -1,6 +1,6 @@ -import accept from './accept'; -import { User } from '../../../models/entities/user'; -import { FollowRequests, Users } from '../../../models'; +import accept from './accept.js'; +import { User } from '@/models/entities/user.js'; +import { FollowRequests, Users } from '@/models/index.js'; /** * 指定したユーザー宛てのフォローリクエストをすべて承認 diff --git a/src/services/following/requests/accept.ts b/src/services/following/requests/accept.ts index 4277a1a1e9..ff4d0ff998 100644 --- a/src/services/following/requests/accept.ts +++ b/src/services/following/requests/accept.ts @@ -1,12 +1,12 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderAccept from '../../../remote/activitypub/renderer/accept'; -import { deliver } from '../../../queue'; -import { publishMainStream } from '../../stream'; -import { insertFollowingDoc } from '../create'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { FollowRequests, Users } from '../../../models'; -import { IdentifiableError } from '@/misc/identifiable-error'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderAccept from '@/remote/activitypub/renderer/accept.js'; +import { deliver } from '@/queue/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { insertFollowingDoc } from '../create.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { FollowRequests, Users } from '@/models/index.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) { const request = await FollowRequests.findOne({ diff --git a/src/services/following/requests/cancel.ts b/src/services/following/requests/cancel.ts index 53c20088ca..3f60fefd10 100644 --- a/src/services/following/requests/cancel.ts +++ b/src/services/following/requests/cancel.ts @@ -1,11 +1,11 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderUndo from '../../../remote/activitypub/renderer/undo'; -import { deliver } from '../../../queue'; -import { publishMainStream } from '../../stream'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users, FollowRequests } from '../../../models'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { deliver } from '@/queue/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { Users, FollowRequests } from '@/models/index.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host'] }) { if (Users.isRemoteUser(followee)) { diff --git a/src/services/following/requests/create.ts b/src/services/following/requests/create.ts index 584591b003..8f26a66119 100644 --- a/src/services/following/requests/create.ts +++ b/src/services/following/requests/create.ts @@ -1,11 +1,11 @@ -import { publishMainStream } from '../../stream'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import { deliver } from '../../../queue'; -import { User } from '../../../models/entities/user'; -import { Blockings, FollowRequests, Users } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../../create-notification'; +import { publishMainStream } from '@/services/stream.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +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'; 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/src/services/following/requests/reject.ts b/src/services/following/requests/reject.ts index 45effc5802..e180f1dc4a 100644 --- a/src/services/following/requests/reject.ts +++ b/src/services/following/requests/reject.ts @@ -1,11 +1,11 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderReject from '../../../remote/activitypub/renderer/reject'; -import { deliver } from '../../../queue'; -import { publishMainStream, publishUserEvent } from '../../stream'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users, FollowRequests, Followings } from '../../../models'; -import { decrementFollowing } from '../delete'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderFollow from '@/remote/activitypub/renderer/follow.js'; +import renderReject from '@/remote/activitypub/renderer/reject.js'; +import { deliver } from '@/queue/index.js'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { Users, FollowRequests, Followings } from '@/models/index.js'; +import { decrementFollowing } from '../delete.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host'] }, follower: User) { if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { diff --git a/src/services/i/pin.ts b/src/services/i/pin.ts index e3a73b5b98..da95b60707 100644 --- a/src/services/i/pin.ts +++ b/src/services/i/pin.ts @@ -1,15 +1,15 @@ -import config from '@/config'; -import renderAdd from '../../remote/activitypub/renderer/add'; -import renderRemove from '../../remote/activitypub/renderer/remove'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../models/entities/user'; -import { Note } from '../../models/entities/note'; -import { Notes, UserNotePinings, Users } from '../../models'; -import { UserNotePining } from '../../models/entities/user-note-pining'; -import { genId } from '@/misc/gen-id'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../relay'; +import config from '@/config/index.js'; +import renderAdd from '@/remote/activitypub/renderer/add.js'; +import renderRemove from '@/remote/activitypub/renderer/remove.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes, UserNotePinings, Users } from '@/models/index.js'; +import { UserNotePining } from '@/models/entities/user-note-pining.js'; +import { genId } from '@/misc/gen-id.js'; +import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; +import { deliverToRelays } from '../relay.js'; /** * 指定した投稿をピン留めします diff --git a/src/services/i/update.ts b/src/services/i/update.ts index 8d40b08a85..1fbaf40df1 100644 --- a/src/services/i/update.ts +++ b/src/services/i/update.ts @@ -1,10 +1,10 @@ -import renderUpdate from '../../remote/activitypub/renderer/update'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { Users } from '../../models'; -import { User } from '../../models/entities/user'; -import { renderPerson } from '../../remote/activitypub/renderer/person'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../relay'; +import renderUpdate from '@/remote/activitypub/renderer/update.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { renderPerson } from '@/remote/activitypub/renderer/person.js'; +import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; +import { deliverToRelays } from '../relay.js'; export async function publishToFollowers(userId: User['id']) { const user = await Users.findOne(userId); diff --git a/src/services/insert-moderation-log.ts b/src/services/insert-moderation-log.ts index 8ba64fa34b..1d8fe9a9d7 100644 --- a/src/services/insert-moderation-log.ts +++ b/src/services/insert-moderation-log.ts @@ -1,6 +1,6 @@ -import { ModerationLogs } from '../models'; -import { genId } from '@/misc/gen-id'; -import { User } from '@/models/entities/user'; +import { ModerationLogs } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { User } from '@/models/entities/user.js'; export async function insertModerationLog(moderator: { id: User['id'] }, type: string, info?: Record) { await ModerationLogs.insert({ diff --git a/src/services/instance-actor.ts b/src/services/instance-actor.ts index 9b9c746061..6a592363ed 100644 --- a/src/services/instance-actor.ts +++ b/src/services/instance-actor.ts @@ -1,7 +1,7 @@ -import { createSystemUser } from './create-system-user'; -import { ILocalUser } from '../models/entities/user'; -import { Users } from '../models'; -import { Cache } from '@/misc/cache'; +import { createSystemUser } from './create-system-user.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; +import { Cache } from '@/misc/cache.js'; const ACTOR_USERNAME = 'instance.actor' as const; diff --git a/src/services/logger.ts b/src/services/logger.ts index de62b3aca9..ac74c13af9 100644 --- a/src/services/logger.ts +++ b/src/services/logger.ts @@ -2,13 +2,13 @@ import * as cluster from 'cluster'; import * as os from 'os'; import * as chalk from 'chalk'; import * as dateformat from 'dateformat'; -import { program } from '../argv'; +import { program } from '../argv.js'; import { getRepository } from 'typeorm'; -import { Log } from '../models/entities/log'; -import { genId } from '@/misc/gen-id'; -import config from '@/config'; +import { Log } from '@/models/entities/log.js'; +import { genId } from '@/misc/gen-id.js'; +import config from '@/config/index.js'; -const SyslogPro = require('syslog-pro'); +import SyslogPro from 'syslog-pro'; type Domain = { name: string; diff --git a/src/services/messages/create.ts b/src/services/messages/create.ts index f84729cdeb..c6430f07be 100644 --- a/src/services/messages/create.ts +++ b/src/services/messages/create.ts @@ -1,17 +1,17 @@ -import { User } from '../../models/entities/user'; -import { UserGroup } from '../../models/entities/user-group'; -import { DriveFile } from '../../models/entities/drive-file'; -import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '../../models'; -import { genId } from '@/misc/gen-id'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '../stream'; -import pushNotification from '../push-notification'; +import { User } from '@/models/entities/user.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '@/services/stream.js'; +import pushNotification from '../push-notification.js'; import { Not } from 'typeorm'; -import { Note } from '../../models/entities/note'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { deliver } from '../../queue'; +import { Note } from '@/models/entities/note.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import renderCreate from '@/remote/activitypub/renderer/create.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { deliver } from '@/queue/index.js'; export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | undefined, file: DriveFile | null, uri?: string) { const message = { diff --git a/src/services/messages/delete.ts b/src/services/messages/delete.ts index 522815e554..82eb6cb21c 100644 --- a/src/services/messages/delete.ts +++ b/src/services/messages/delete.ts @@ -1,11 +1,11 @@ -import config from '@/config'; -import { MessagingMessages, Users } from '../../models'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { publishGroupMessagingStream, publishMessagingStream } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import { deliver } from '../../queue'; +import config from '@/config/index.js'; +import { MessagingMessages, Users } from '@/models/index.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { publishGroupMessagingStream, publishMessagingStream } from '@/services/stream.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderDelete from '@/remote/activitypub/renderer/delete.js'; +import renderTombstone from '@/remote/activitypub/renderer/tombstone.js'; +import { deliver } from '@/queue/index.js'; export async function deleteMessage(message: MessagingMessage) { await MessagingMessages.delete(message.id); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 13d612cf80..d89663c784 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -1,39 +1,39 @@ import * as mfm from 'mfm-js'; -import es from '../../db/elasticsearch'; -import { publishMainStream, publishNotesStream } from '../stream'; -import DeliverManager from '../../remote/activitypub/deliver-manager'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { resolveUser } from '../../remote/resolve-user'; -import config from '@/config'; -import { updateHashtags } from '../update-hashtag'; -import { concat } from '../../prelude/array'; -import insertNoteUnread from './unread'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { extractMentions } from '@/misc/extract-mentions'; -import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm'; -import { extractHashtags } from '@/misc/extract-hashtags'; -import { Note, IMentionedRemoteUsers } from '../../models/entities/note'; -import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings } from '../../models'; -import { DriveFile } from '../../models/entities/drive-file'; -import { App } from '../../models/entities/app'; +import es from '../../db/elasticsearch.js'; +import { publishMainStream, publishNotesStream } from '@/services/stream.js'; +import DeliverManager from '@/remote/activitypub/deliver-manager.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import renderCreate from '@/remote/activitypub/renderer/create.js'; +import renderAnnounce from '@/remote/activitypub/renderer/announce.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { resolveUser } from '@/remote/resolve-user.js'; +import config from '@/config/index.js'; +import { updateHashtags } from '../update-hashtag.js'; +import { concat } from '../../prelude/array.js'; +import insertNoteUnread from './unread.js'; +import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import { extractMentions } from '@/misc/extract-mentions.js'; +import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; +import { extractHashtags } from '@/misc/extract-hashtags.js'; +import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { App } from '@/models/entities/app.js'; import { Not, getConnection, In } from 'typeorm'; -import { User, ILocalUser, IRemoteUser } from '../../models/entities/user'; -import { genId } from '@/misc/gen-id'; -import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '../chart'; -import { Poll, IPoll } from '../../models/entities/poll'; -import { createNotification } from '../create-notification'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { checkHitAntenna } from '@/misc/check-hit-antenna'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { addNoteToAntenna } from '../add-note-to-antenna'; -import { countSameRenotes } from '@/misc/count-same-renotes'; -import { deliverToRelays } from '../relay'; -import { Channel } from '../../models/entities/channel'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { getAntennas } from '@/misc/antenna-cache'; +import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js'; +import { genId } from '@/misc/gen-id.js'; +import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '@/services/chart/index.js'; +import { Poll, IPoll } from '@/models/entities/poll.js'; +import { createNotification } from '../create-notification.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; +import { checkHitAntenna } from '@/misc/check-hit-antenna.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { addNoteToAntenna } from '../add-note-to-antenna.js'; +import { countSameRenotes } from '@/misc/count-same-renotes.js'; +import { deliverToRelays } from '../relay.js'; +import { Channel } from '@/models/entities/channel.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; diff --git a/src/services/note/delete.ts b/src/services/note/delete.ts index a7ac86e106..353cd88034 100644 --- a/src/services/note/delete.ts +++ b/src/services/note/delete.ts @@ -1,18 +1,18 @@ -import { publishNoteStream } from '../stream'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import config from '@/config'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { User, ILocalUser, IRemoteUser } from '../../models/entities/user'; -import { Note, IMentionedRemoteUsers } from '../../models/entities/note'; -import { Notes, Users, Instances } from '../../models'; -import { notesChart, perUserNotesChart, instanceChart } from '../chart'; -import { deliverToFollowers, deliverToUser } from '../../remote/activitypub/deliver-manager'; -import { countSameRenotes } from '@/misc/count-same-renotes'; -import { deliverToRelays } from '../relay'; +import { publishNoteStream } from '@/services/stream.js'; +import renderDelete from '@/remote/activitypub/renderer/delete.js'; +import renderAnnounce from '@/remote/activitypub/renderer/announce.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderTombstone from '@/remote/activitypub/renderer/tombstone.js'; +import config from '@/config/index.js'; +import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js'; +import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { Notes, Users, Instances } from '@/models/index.js'; +import { notesChart, perUserNotesChart, instanceChart } from '@/services/chart/index.js'; +import { deliverToFollowers, deliverToUser } from '@/remote/activitypub/deliver-manager.js'; +import { countSameRenotes } from '@/misc/count-same-renotes.js'; +import { deliverToRelays } from '../relay.js'; import { Brackets, In } from 'typeorm'; /** diff --git a/src/services/note/polls/update.ts b/src/services/note/polls/update.ts index a33efab668..88baf16b64 100644 --- a/src/services/note/polls/update.ts +++ b/src/services/note/polls/update.ts @@ -1,10 +1,10 @@ -import renderUpdate from '../../../remote/activitypub/renderer/update'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderNote from '../../../remote/activitypub/renderer/note'; -import { Users, Notes } from '../../../models'; -import { Note } from '../../../models/entities/note'; -import { deliverToFollowers } from '../../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../../relay'; +import renderUpdate from '@/remote/activitypub/renderer/update.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +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'; export async function deliverQuestionUpdate(noteId: Note['id']) { const note = await Notes.findOne(noteId); diff --git a/src/services/note/polls/vote.ts b/src/services/note/polls/vote.ts index d3cf9f2117..36e06cb6a2 100644 --- a/src/services/note/polls/vote.ts +++ b/src/services/note/polls/vote.ts @@ -1,10 +1,10 @@ -import { publishNoteStream } from '../../stream'; -import { User } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { PollVotes, NoteWatchings, Polls, Blockings } from '../../../models'; +import { publishNoteStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { PollVotes, NoteWatchings, Polls, Blockings } from '@/models/index.js'; import { Not } from 'typeorm'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../../create-notification'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../../create-notification.js'; export default async function(user: User, note: Note, choice: number) { const poll = await Polls.findOne(note.id); diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index b8a8d172f1..f2dd273c42 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -1,19 +1,19 @@ -import { publishNoteStream } from '../../stream'; -import { renderLike } from '../../../remote/activitypub/renderer/like'; -import DeliverManager from '../../../remote/activitypub/deliver-manager'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import { toDbReaction, decodeReaction } from '@/misc/reaction-lib'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '../../../models'; +import { publishNoteStream } from '@/services/stream.js'; +import { renderLike } from '@/remote/activitypub/renderer/like.js'; +import DeliverManager from '@/remote/activitypub/deliver-manager.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { toDbReaction, decodeReaction } from '@/misc/reaction-lib.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index.js'; import { Not } from 'typeorm'; -import { perUserReactionsChart } from '../../chart'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../../create-notification'; -import deleteReaction from './delete'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { NoteReaction } from '../../../models/entities/note-reaction'; -import { IdentifiableError } from '@/misc/identifiable-error'; +import { perUserReactionsChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../../create-notification.js'; +import deleteReaction from './delete.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'; export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => { // Check blocking diff --git a/src/services/note/reaction/delete.ts b/src/services/note/reaction/delete.ts index 712031fa88..86e7b640ee 100644 --- a/src/services/note/reaction/delete.ts +++ b/src/services/note/reaction/delete.ts @@ -1,13 +1,13 @@ -import { publishNoteStream } from '../../stream'; -import { renderLike } from '../../../remote/activitypub/renderer/like'; -import renderUndo from '../../../remote/activitypub/renderer/undo'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import DeliverManager from '../../../remote/activitypub/deliver-manager'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { NoteReactions, Users, Notes } from '../../../models'; -import { decodeReaction } from '@/misc/reaction-lib'; +import { publishNoteStream } from '@/services/stream.js'; +import { renderLike } from '@/remote/activitypub/renderer/like.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import DeliverManager from '@/remote/activitypub/deliver-manager.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteReactions, Users, Notes } from '@/models/index.js'; +import { decodeReaction } from '@/misc/reaction-lib.js'; export default async (user: { id: User['id']; host: User['host']; }, note: Note) => { // if already unreacted diff --git a/src/services/note/read.ts b/src/services/note/read.ts index a661c0a9d0..ac450af78b 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -1,13 +1,13 @@ -import { publishMainStream } from '../stream'; -import { Note } from '../../models/entities/note'; -import { User } from '../../models/entities/user'; -import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '../../models'; +import { publishMainStream } from '@/services/stream.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index.js'; import { Not, IsNull, In } from 'typeorm'; -import { Channel } from '../../models/entities/channel'; -import { checkHitAntenna } from '@/misc/check-hit-antenna'; -import { getAntennas } from '@/misc/antenna-cache'; -import { PackedNote } from '../../models/repositories/note'; -import { readNotificationByQuery } from '@/server/api/common/read-notification'; +import { Channel } from '@/models/entities/channel.js'; +import { checkHitAntenna } from '@/misc/check-hit-antenna.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { readNotificationByQuery } from '@/server/api/common/read-notification.js'; /** * Mark notes as read diff --git a/src/services/note/unread.ts b/src/services/note/unread.ts index 5cfba0f342..b68ff7974f 100644 --- a/src/services/note/unread.ts +++ b/src/services/note/unread.ts @@ -1,8 +1,8 @@ -import { Note } from '../../models/entities/note'; -import { publishMainStream } from '../stream'; -import { User } from '../../models/entities/user'; -import { Mutings, NoteUnreads } from '../../models'; -import { genId } from '@/misc/gen-id'; +import { Note } from '@/models/entities/note.js'; +import { publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { Mutings, NoteUnreads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export default async function(userId: User['id'], note: Note, params: { // NOTE: isSpecifiedがtrueならisMentionedは必ずfalse diff --git a/src/services/note/unwatch.ts b/src/services/note/unwatch.ts index 047ac343be..32da2cf148 100644 --- a/src/services/note/unwatch.ts +++ b/src/services/note/unwatch.ts @@ -1,6 +1,6 @@ -import { User } from '../../models/entities/user'; -import { NoteWatchings } from '../../models'; -import { Note } from '../../models/entities/note'; +import { User } from '@/models/entities/user.js'; +import { NoteWatchings } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; export default async (me: User['id'], note: Note) => { await NoteWatchings.delete({ diff --git a/src/services/note/watch.ts b/src/services/note/watch.ts index e333f04286..12d97c8458 100644 --- a/src/services/note/watch.ts +++ b/src/services/note/watch.ts @@ -1,8 +1,8 @@ -import { User } from '../../models/entities/user'; -import { Note } from '../../models/entities/note'; -import { NoteWatchings } from '../../models'; -import { genId } from '@/misc/gen-id'; -import { NoteWatching } from '../../models/entities/note-watching'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteWatchings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { NoteWatching } from '@/models/entities/note-watching.js'; export default async (me: User['id'], note: Note) => { // 自分の投稿はwatchできない diff --git a/src/services/push-notification.ts b/src/services/push-notification.ts index 6c0b77c31f..bedfa0533d 100644 --- a/src/services/push-notification.ts +++ b/src/services/push-notification.ts @@ -1,9 +1,9 @@ import * as push from 'web-push'; -import config from '@/config'; -import { SwSubscriptions } from '../models'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { PackedNotification } from '../models/repositories/notification'; -import { PackedMessagingMessage } from '../models/repositories/messaging-message'; +import config from '@/config/index.js'; +import { SwSubscriptions } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { PackedNotification } from '../models/repositories/notification.js'; +import { PackedMessagingMessage } from '../models/repositories/messaging-message.js'; type notificationType = 'notification' | 'unreadMessagingMessage'; type notificationBody = PackedNotification | PackedMessagingMessage; diff --git a/src/services/register-or-fetch-instance-doc.ts b/src/services/register-or-fetch-instance-doc.ts index 2edf85fd9f..0bbc9ab275 100644 --- a/src/services/register-or-fetch-instance-doc.ts +++ b/src/services/register-or-fetch-instance-doc.ts @@ -1,9 +1,9 @@ -import { Instance } from '../models/entities/instance'; -import { Instances } from '../models'; -import { federationChart } from './chart'; -import { genId } from '@/misc/gen-id'; -import { toPuny } from '@/misc/convert-host'; -import { Cache } from '@/misc/cache'; +import { Instance } from '@/models/entities/instance.js'; +import { Instances } from '@/models/index.js'; +import { federationChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { Cache } from '@/misc/cache.js'; const cache = new Cache(1000 * 60 * 60); diff --git a/src/services/relay.ts b/src/services/relay.ts index a2cc711bd3..8e0fa12fb3 100644 --- a/src/services/relay.ts +++ b/src/services/relay.ts @@ -1,11 +1,11 @@ -import { createSystemUser } from './create-system-user'; -import { renderFollowRelay } from '../remote/activitypub/renderer/follow-relay'; -import { renderActivity, attachLdSignature } from '../remote/activitypub/renderer'; -import renderUndo from '../remote/activitypub/renderer/undo'; -import { deliver } from '../queue'; -import { ILocalUser, User } from '../models/entities/user'; -import { Users, Relays } from '../models'; -import { genId } from '@/misc/gen-id'; +import { createSystemUser } from './create-system-user.js'; +import { renderFollowRelay } from '@/remote/activitypub/renderer/follow-relay.js'; +import { renderActivity, attachLdSignature } from '@/remote/activitypub/renderer/index.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { deliver } from '@/queue/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; +import { Users, Relays } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; const ACTOR_USERNAME = 'relay.actor' as const; diff --git a/src/services/send-email-notification.ts b/src/services/send-email-notification.ts index ad17429516..18f5b76074 100644 --- a/src/services/send-email-notification.ts +++ b/src/services/send-email-notification.ts @@ -1,9 +1,9 @@ -import { UserProfiles } from '../models'; -import { User } from '../models/entities/user'; -import { sendEmail } from './send-email'; -import * as locales from '../../locales/'; -import { I18n } from '@/misc/i18n'; -import { getAcct } from '@/misc/acct'; +import { UserProfiles } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { sendEmail } from './send-email.js'; +import * as locales from '../../locales/index.js'; +import { I18n } from '@/misc/i18n.js'; +import { getAcct } from '@/misc/acct.js'; // TODO: locale ファイルをクライアント用とサーバー用で分けたい diff --git a/src/services/send-email.ts b/src/services/send-email.ts index 4784ba5510..135fb3d329 100644 --- a/src/services/send-email.ts +++ b/src/services/send-email.ts @@ -1,7 +1,7 @@ import * as nodemailer from 'nodemailer'; -import { fetchMeta } from '@/misc/fetch-meta'; -import Logger from './logger'; -import config from '@/config'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import Logger from './logger.js'; +import config from '@/config/index.js'; export const logger = new Logger('email'); diff --git a/src/services/stream.ts b/src/services/stream.ts index 6258dc5a7d..e334944533 100644 --- a/src/services/stream.ts +++ b/src/services/stream.ts @@ -1,12 +1,12 @@ -import { redisClient } from '../db/redis'; -import { User } from '../models/entities/user'; -import { Note } from '../models/entities/note'; -import { UserList } from '../models/entities/user-list'; -import { ReversiGame } from '../models/entities/games/reversi/game'; -import { UserGroup } from '../models/entities/user-group'; -import config from '@/config'; -import { Antenna } from '../models/entities/antenna'; -import { Channel } from '../models/entities/channel'; +import { redisClient } from '../db/redis.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { UserList } from '@/models/entities/user-list.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import config from '@/config/index.js'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Channel } from '@/models/entities/channel.js'; class Publisher { private publish = (channel: string, type: string | null, value?: any): void => { diff --git a/src/services/suspend-user.ts b/src/services/suspend-user.ts index c868c01305..5ec639b1b8 100644 --- a/src/services/suspend-user.ts +++ b/src/services/suspend-user.ts @@ -1,9 +1,9 @@ -import renderDelete from '../remote/activitypub/renderer/delete'; -import { renderActivity } from '../remote/activitypub/renderer'; -import { deliver } from '../queue'; -import config from '@/config'; -import { User } from '../models/entities/user'; -import { Users, Followings } from '../models'; +import renderDelete from '@/remote/activitypub/renderer/delete.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { deliver } from '@/queue/index.js'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Users, Followings } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; export async function doPostSuspend(user: { id: User['id']; host: User['host'] }) { diff --git a/src/services/unsuspend-user.ts b/src/services/unsuspend-user.ts index 5bc4bba423..3728e05392 100644 --- a/src/services/unsuspend-user.ts +++ b/src/services/unsuspend-user.ts @@ -1,10 +1,10 @@ -import renderDelete from '../remote/activitypub/renderer/delete'; -import renderUndo from '../remote/activitypub/renderer/undo'; -import { renderActivity } from '../remote/activitypub/renderer'; -import { deliver } from '../queue'; -import config from '@/config'; -import { User } from '../models/entities/user'; -import { Users, Followings } from '../models'; +import renderDelete from '@/remote/activitypub/renderer/delete.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { deliver } from '@/queue/index.js'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Users, Followings } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; export async function doPostUnsuspend(user: User) { diff --git a/src/services/update-hashtag.ts b/src/services/update-hashtag.ts index 6b7208f005..b6fb38bc5a 100644 --- a/src/services/update-hashtag.ts +++ b/src/services/update-hashtag.ts @@ -1,9 +1,9 @@ -import { User } from '../models/entities/user'; -import { Hashtags, Users } from '../models'; -import { hashtagChart } from './chart'; -import { genId } from '@/misc/gen-id'; -import { Hashtag } from '../models/entities/hashtag'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { User } from '@/models/entities/user.js'; +import { Hashtags, Users } from '@/models/index.js'; +import { hashtagChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { Hashtag } from '@/models/entities/hashtag.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export async function updateHashtags(user: { id: User['id']; host: User['host']; }, tags: string[]) { for (const tag of tags) { diff --git a/src/services/user-list/push.ts b/src/services/user-list/push.ts index 3dd9a8576b..01e9243c12 100644 --- a/src/services/user-list/push.ts +++ b/src/services/user-list/push.ts @@ -1,11 +1,11 @@ -import { publishUserListStream } from '../stream'; -import { User } from '../../models/entities/user'; -import { UserList } from '../../models/entities/user-list'; -import { UserListJoinings, Users } from '../../models'; -import { UserListJoining } from '../../models/entities/user-list-joining'; -import { genId } from '@/misc/gen-id'; -import { fetchProxyAccount } from '@/misc/fetch-proxy-account'; -import createFollowing from '../following/create'; +import { publishUserListStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { UserList } from '@/models/entities/user-list.js'; +import { UserListJoinings, Users } from '@/models/index.js'; +import { UserListJoining } from '@/models/entities/user-list-joining.js'; +import { genId } from '@/misc/gen-id.js'; +import { fetchProxyAccount } from '@/misc/fetch-proxy-account.js'; +import createFollowing from '../following/create.js'; export async function pushUserToUserList(target: User, list: UserList) { await UserListJoinings.insert({ diff --git a/src/tools/accept-migration.ts b/src/tools/accept-migration.ts index 0622869398..adbfcdadf7 100644 --- a/src/tools/accept-migration.ts +++ b/src/tools/accept-migration.ts @@ -1,7 +1,7 @@ // ex) node built/tools/accept-migration Yo 1000000000001 import { createConnection } from 'typeorm'; -import config from '@/config'; +import config from '@/config/index.js'; createConnection({ type: 'postgres', diff --git a/src/tools/add-emoji.ts b/src/tools/add-emoji.ts index ca25d1348b..054286c647 100644 --- a/src/tools/add-emoji.ts +++ b/src/tools/add-emoji.ts @@ -1,5 +1,5 @@ -import { Emojis } from '../models'; -import { genId } from '@/misc/gen-id'; +import { Emojis } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; async function main(name: string, url: string, alias?: string): Promise { const aliases = alias != null ? [ alias ] : []; diff --git a/src/tools/demote-admin.ts b/src/tools/demote-admin.ts index 5e3e64bffb..37bd5007a8 100644 --- a/src/tools/demote-admin.ts +++ b/src/tools/demote-admin.ts @@ -1,6 +1,6 @@ -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; import { getRepository } from 'typeorm'; -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; async function main(username: string) { if (!username) throw `username required`; diff --git a/src/tools/mark-admin.ts b/src/tools/mark-admin.ts index 5844bb464e..4c583926eb 100644 --- a/src/tools/mark-admin.ts +++ b/src/tools/mark-admin.ts @@ -1,6 +1,6 @@ -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; import { getRepository } from 'typeorm'; -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; async function main(username: string) { if (!username) throw `username required`; diff --git a/src/tools/refresh-question.ts b/src/tools/refresh-question.ts index 83d71ff303..3e850ba83c 100644 --- a/src/tools/refresh-question.ts +++ b/src/tools/refresh-question.ts @@ -1,4 +1,4 @@ -import { updateQuestion } from '../remote/activitypub/models/question'; +import { updateQuestion } from '@/remote/activitypub/models/question.js'; async function main(uri: string): Promise { return await updateQuestion(uri); diff --git a/src/tools/resync-remote-user.ts b/src/tools/resync-remote-user.ts index ad2e231eb5..3c02fb94c7 100644 --- a/src/tools/resync-remote-user.ts +++ b/src/tools/resync-remote-user.ts @@ -1,9 +1,9 @@ -import { initDb } from '@/db/postgre'; -import { parseAcct } from '@/misc/acct'; +import { initDb } from '@/db/postgre.js'; +import { parseAcct } from '@/misc/acct.js'; async function main(acct: string): Promise { await initDb(); - const { resolveUser } = await import('../remote/resolve-user'); + const { resolveUser } = await import('@/remote/resolve-user'); const { username, host } = parseAcct(acct); await resolveUser(username, host, {}, true); diff --git a/src/tools/show-signin-history.ts b/src/tools/show-signin-history.ts index fd7cd39e38..6fdff3902e 100644 --- a/src/tools/show-signin-history.ts +++ b/src/tools/show-signin-history.ts @@ -1,4 +1,4 @@ -import { Users, Signins } from '../models'; +import { Users, Signins } from '@/models/index.js'; // node built/tools/show-signin-history username // => {Success} {Date} {IPAddrsss} diff --git a/src/tsconfig.json b/src/tsconfig.json index 9389008eef..4a03a17432 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -12,6 +12,7 @@ "target": "es2017", "module": "commonjs", "moduleResolution": "node", + "allowSyntheticDefaultImports": true, "removeComments": false, "noLib": false, "strict": true, diff --git a/test/tsconfig.json b/test/tsconfig.json index 31a537805a..9f9e724ea2 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -12,6 +12,7 @@ "target": "es2017", "module": "commonjs", "moduleResolution": "node", + "allowSyntheticDefaultImports": true, "removeComments": false, "noLib": false, "strict": true,