diff --git a/packages/backend/src/boot/index.ts b/packages/backend/src/boot/index.ts index 489350a155..37c4ab0980 100644 --- a/packages/backend/src/boot/index.ts +++ b/packages/backend/src/boot/index.ts @@ -5,11 +5,11 @@ import Xev from "xev"; import Logger from "@/services/logger.js"; import { envOption } from "../env.js"; +import os from "node:os"; // for typeorm import "reflect-metadata"; import { masterMain } from "./master.js"; import { workerMain } from "./worker.js"; -import os from "node:os"; const logger = new Logger("core", "cyan"); const clusterLogger = logger.createSubLogger("cluster", "orange", false); diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index 89f72227a1..bc0dd182c4 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -1,18 +1,18 @@ -import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; -import { dirname } from "node:path"; -import * as os from "node:os"; import cluster from "node:cluster"; +import * as fs from "node:fs"; +import * as os from "node:os"; +import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import chalk from "chalk"; import chalkTemplate from "chalk-template"; import semver from "semver"; -import Logger from "@/services/logger.js"; import loadConfig from "@/config/load.js"; import type { Config } from "@/config/types.js"; +import { db, initDb } from "@/db/postgre.js"; import { envOption } from "@/env.js"; import { showMachineInfo } from "@/misc/show-machine-info.js"; -import { db, initDb } from "@/db/postgre.js"; +import Logger from "@/services/logger.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/boot/worker.ts b/packages/backend/src/boot/worker.ts index 0acdcd97c6..b407004ac1 100644 --- a/packages/backend/src/boot/worker.ts +++ b/packages/backend/src/boot/worker.ts @@ -1,6 +1,6 @@ import cluster from "node:cluster"; -import { initDb } from "@/db/postgre.js"; import os from "node:os"; +import { initDb } from "@/db/postgre.js"; /** * Init worker process diff --git a/packages/backend/src/config/load.ts b/packages/backend/src/config/load.ts index 2ff3309264..e5279d2b21 100644 --- a/packages/backend/src/config/load.ts +++ b/packages/backend/src/config/load.ts @@ -3,10 +3,10 @@ */ import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import * as yaml from "js-yaml"; -import type { Source, Mixin } from "./types.js"; +import type { Mixin, Source } from "./types.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/daemons/queue-stats.ts b/packages/backend/src/daemons/queue-stats.ts index c358518fa4..82e8226e99 100644 --- a/packages/backend/src/daemons/queue-stats.ts +++ b/packages/backend/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ -import Xev from "xev"; import { deliverQueue, inboxQueue } from "@/queue/queues.js"; +import Xev from "xev"; const ev = new Xev(); diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index dc7493381c..aad5d6b36c 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -1,8 +1,8 @@ +import meilisearch from "@/db/meilisearch.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import * as osUtils from "os-utils"; import si from "systeminformation"; import Xev from "xev"; -import * as osUtils from "os-utils"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import meilisearch from "@/db/meilisearch.js"; const ev = new Xev(); diff --git a/packages/backend/src/db/elasticsearch.ts b/packages/backend/src/db/elasticsearch.ts index 2640e7f918..f6ecc1b72f 100644 --- a/packages/backend/src/db/elasticsearch.ts +++ b/packages/backend/src/db/elasticsearch.ts @@ -1,5 +1,5 @@ -import * as elasticsearch from "@elastic/elasticsearch"; import config from "@/config/index.js"; +import * as elasticsearch from "@elastic/elasticsearch"; const index = { settings: { diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index 40efaa5864..a98c3e80ce 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -1,9 +1,9 @@ import { Health, Index, MeiliSearch, Stats } from "meilisearch"; import { dbLogger } from "./logger.js"; +import * as url from "url"; import config from "@/config/index.js"; import { Note } from "@/models/entities/note.js"; -import * as url from "url"; import { ILocalUser } from "@/models/entities/user.js"; import { Followings, Users } from "@/models/index.js"; diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index d68f919a75..7d4666bba5 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -2,76 +2,76 @@ import pg from "pg"; pg.types.setTypeParser(20, Number); +import config from "@/config/index.js"; +import * as highlight from "cli-highlight"; import type { Logger } from "typeorm"; import { DataSource } from "typeorm"; -import * as highlight from "cli-highlight"; -import config from "@/config/index.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 { NoteThreadMuting } from "@/models/entities/note-thread-muting.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 { RenoteMuting } from "@/models/entities/renote-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 { 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 { AccessToken } from "@/models/entities/access-token.js"; +import { Ad } from "@/models/entities/ad.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 { Announcement } from "@/models/entities/announcement.js"; import { Antenna } from "@/models/entities/antenna.js"; -import { PromoNote } from "@/models/entities/promo-note.js"; -import { PromoRead } from "@/models/entities/promo-read.js"; -import { Relay } from "@/models/entities/relay.js"; -import { MutedNote } from "@/models/entities/muted-note.js"; -import { Channel } from "@/models/entities/channel.js"; +import { App } from "@/models/entities/app.js"; +import { AttestationChallenge } from "@/models/entities/attestation-challenge.js"; +import { AuthSession } from "@/models/entities/auth-session.js"; +import { Blocking } from "@/models/entities/blocking.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"; -import { UserPending } from "@/models/entities/user-pending.js"; -import { Webhook } from "@/models/entities/webhook.js"; -import { UserIp } from "@/models/entities/user-ip.js"; +import { Channel } from "@/models/entities/channel.js"; +import { ClipNote } from "@/models/entities/clip-note.js"; +import { Clip } from "@/models/entities/clip.js"; +import { DriveFile } from "@/models/entities/drive-file.js"; +import { DriveFolder } from "@/models/entities/drive-folder.js"; +import { Emoji } from "@/models/entities/emoji.js"; +import { FollowRequest } from "@/models/entities/follow-request.js"; +import { Following } from "@/models/entities/following.js"; +import { GalleryLike } from "@/models/entities/gallery-like.js"; +import { GalleryPost } from "@/models/entities/gallery-post.js"; +import { Hashtag } from "@/models/entities/hashtag.js"; +import { Instance } from "@/models/entities/instance.js"; +import { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { Meta } from "@/models/entities/meta.js"; +import { ModerationLog } from "@/models/entities/moderation-log.js"; +import { MutedNote } from "@/models/entities/muted-note.js"; +import { Muting } from "@/models/entities/muting.js"; import { NoteEdit } from "@/models/entities/note-edit.js"; +import { NoteFavorite } from "@/models/entities/note-favorite.js"; +import { NoteReaction } from "@/models/entities/note-reaction.js"; +import { NoteThreadMuting } from "@/models/entities/note-thread-muting.js"; +import { NoteUnread } from "@/models/entities/note-unread.js"; +import { NoteWatching } from "@/models/entities/note-watching.js"; +import { Note } from "@/models/entities/note.js"; +import { Notification } from "@/models/entities/notification.js"; +import { PageLike } from "@/models/entities/page-like.js"; +import { Page } from "@/models/entities/page.js"; +import { PasswordResetRequest } from "@/models/entities/password-reset-request.js"; +import { PollVote } from "@/models/entities/poll-vote.js"; +import { Poll } from "@/models/entities/poll.js"; +import { PromoNote } from "@/models/entities/promo-note.js"; +import { PromoRead } from "@/models/entities/promo-read.js"; +import { RegistrationTicket } from "@/models/entities/registration-tickets.js"; +import { RegistryItem } from "@/models/entities/registry-item.js"; +import { Relay } from "@/models/entities/relay.js"; +import { RenoteMuting } from "@/models/entities/renote-muting.js"; +import { Signin } from "@/models/entities/signin.js"; +import { SwSubscription } from "@/models/entities/sw-subscription.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { UserGroupInvitation } from "@/models/entities/user-group-invitation.js"; +import { UserGroupJoining } from "@/models/entities/user-group-joining.js"; +import { UserGroup } from "@/models/entities/user-group.js"; +import { UserIp } from "@/models/entities/user-ip.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { UserListJoining } from "@/models/entities/user-list-joining.js"; +import { UserList } from "@/models/entities/user-list.js"; +import { UserNotePining } from "@/models/entities/user-note-pining.js"; +import { UserPending } from "@/models/entities/user-pending.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { UserPublickey } from "@/models/entities/user-publickey.js"; +import { UserSecurityKey } from "@/models/entities/user-security-key.js"; +import { User } from "@/models/entities/user.js"; +import { Webhook } from "@/models/entities/webhook.js"; import { entities as charts } from "@/services/chart/entities.js"; import { dbLogger } from "./logger.js"; diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index 215effd8ea..aa7ffbb415 100644 --- a/packages/backend/src/db/redis.ts +++ b/packages/backend/src/db/redis.ts @@ -1,5 +1,5 @@ -import Redis from "ioredis"; import config from "@/config/index.js"; +import Redis from "ioredis"; export function createConnection() { let source = config.redis; diff --git a/packages/backend/src/mfm/to-html.ts b/packages/backend/src/mfm/to-html.ts index 47ee0c8890..c2f4a9e78e 100644 --- a/packages/backend/src/mfm/to-html.ts +++ b/packages/backend/src/mfm/to-html.ts @@ -1,8 +1,8 @@ +import config from "@/config/index.js"; +import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; +import { intersperse } from "@/prelude/array.js"; import { Window } from "happy-dom"; import type * as mfm from "mfm-js"; -import config from "@/config/index.js"; -import { intersperse } from "@/prelude/array.js"; -import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; export function toHtml( nodes: mfm.MfmNode[] | null, diff --git a/packages/backend/src/misc/antenna-cache.ts b/packages/backend/src/misc/antenna-cache.ts index 7f199c3967..a4fc874140 100644 --- a/packages/backend/src/misc/antenna-cache.ts +++ b/packages/backend/src/misc/antenna-cache.ts @@ -1,6 +1,6 @@ -import { Antennas } from "@/models/index.js"; -import type { Antenna } from "@/models/entities/antenna.js"; import { subscriber } from "@/db/redis.js"; +import type { Antenna } from "@/models/entities/antenna.js"; +import { Antennas } from "@/models/index.js"; let antennasFetched = false; let antennas: Antenna[] = []; diff --git a/packages/backend/src/misc/before-shutdown.ts b/packages/backend/src/misc/before-shutdown.ts index 0820418356..721e1af1b8 100644 --- a/packages/backend/src/misc/before-shutdown.ts +++ b/packages/backend/src/misc/before-shutdown.ts @@ -1,7 +1,5 @@ // https://gist.github.com/nfantone/1eaa803772025df69d07f4dbf5df7e58 -"use strict"; - /** * @callback BeforeShutdownListener * @param {string} [signalOrEvent] The exit signal or event name received on the process. diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index 913258f05a..b86dd6ed37 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -1,6 +1,6 @@ import { redisClient } from "@/db/redis.js"; -import { encode, decode } from "msgpackr"; import { ChainableCommander } from "ioredis"; +import { decode, encode } from "msgpackr"; export class Cache { private ttl: number; diff --git a/packages/backend/src/misc/captcha.ts b/packages/backend/src/misc/captcha.ts index b3b3dca39d..4da04905f6 100644 --- a/packages/backend/src/misc/captcha.ts +++ b/packages/backend/src/misc/captcha.ts @@ -1,7 +1,7 @@ -import fetch from "node-fetch"; import { URLSearchParams } from "node:url"; -import { getAgentByUrl } from "@/misc/fetch.js"; import config from "@/config/index.js"; +import { getAgentByUrl } from "@/misc/fetch.js"; +import fetch from "node-fetch"; export async function verifyRecaptcha(secret: string, response: string) { const result = await getCaptchaResponse( diff --git a/packages/backend/src/misc/check-hit-antenna.ts b/packages/backend/src/misc/check-hit-antenna.ts index 1f4f2f2fae..6d2a01ac08 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -1,12 +1,12 @@ +import * as Acct from "@/misc/acct.js"; +import { Cache } from "@/misc/cache.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import type { Packed } from "@/misc/schema.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, UserProfiles } from "@/models/index.js"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import * as Acct from "@/misc/acct.js"; -import type { Packed } from "@/misc/schema.js"; -import { Cache } from "@/misc/cache.js"; -import { getWordHardMute } from "@/misc/check-word-mute.js"; const blockingCache = new Cache("blocking", 60 * 5); const mutedWordsCache = new Cache("mutedWords", 60 * 5); diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index 5686aef2f7..c5348d168d 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -1,5 +1,5 @@ -import RE2 from "re2"; import type { Note } from "@/models/entities/note.js"; +import RE2 from "re2"; type NoteLike = { userId: Note["userId"]; diff --git a/packages/backend/src/misc/convert-host.ts b/packages/backend/src/misc/convert-host.ts index 856ce3c127..3d7a7abbd7 100644 --- a/packages/backend/src/misc/convert-host.ts +++ b/packages/backend/src/misc/convert-host.ts @@ -1,6 +1,6 @@ import { URL } from "node:url"; -import config from "@/config/index.js"; import { toASCII } from "punycode"; +import config from "@/config/index.js"; export function getFullApAccount(username: string, host: string | null) { return host diff --git a/packages/backend/src/misc/detect-language.ts b/packages/backend/src/misc/detect-language.ts index 6147247dee..15763d5afa 100644 --- a/packages/backend/src/misc/detect-language.ts +++ b/packages/backend/src/misc/detect-language.ts @@ -1,5 +1,5 @@ -import { detect } from "tinyld"; import * as mfm from "mfm-js"; +import { detect } from "tinyld"; export default function detectLanguage(text: string): string { const nodes = mfm.parse(text); diff --git a/packages/backend/src/misc/download-url.ts b/packages/backend/src/misc/download-url.ts index 83680c175f..0112dcfbac 100644 --- a/packages/backend/src/misc/download-url.ts +++ b/packages/backend/src/misc/download-url.ts @@ -1,13 +1,13 @@ import * as fs from "node:fs"; import * as stream from "node:stream"; import * as util from "node:util"; -import got, * as Got from "got"; -import { httpAgent, httpsAgent, StatusError } from "./fetch.js"; import config from "@/config/index.js"; -import chalk from "chalk"; import Logger from "@/services/logger.js"; +import chalk from "chalk"; +import got, * as Got from "got"; import IPCIDR from "ip-cidr"; import PrivateIp from "private-ip"; +import { StatusError, httpAgent, httpsAgent } from "./fetch.js"; const pipeline = util.promisify(stream.pipeline); diff --git a/packages/backend/src/misc/emoji-meta.ts b/packages/backend/src/misc/emoji-meta.ts index 2b9365b826..360cf93145 100644 --- a/packages/backend/src/misc/emoji-meta.ts +++ b/packages/backend/src/misc/emoji-meta.ts @@ -2,9 +2,9 @@ import probeImageSize from "probe-image-size"; import { Mutex } from "redis-semaphore"; import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; +import { redisClient } from "@/db/redis.js"; import Logger from "@/services/logger.js"; import { Cache } from "./cache.js"; -import { redisClient } from "@/db/redis.js"; export type Size = { width: number; diff --git a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts index 7de32e6d60..f79f8c431c 100644 --- a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts +++ b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts @@ -1,5 +1,5 @@ -import * as mfm from "mfm-js"; import { unique } from "@/prelude/array.js"; +import * as mfm from "mfm-js"; export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { const emojiNodes = mfm.extract(nodes, (node) => { diff --git a/packages/backend/src/misc/extract-hashtags.ts b/packages/backend/src/misc/extract-hashtags.ts index 826e36221b..2b575e8a9e 100644 --- a/packages/backend/src/misc/extract-hashtags.ts +++ b/packages/backend/src/misc/extract-hashtags.ts @@ -1,5 +1,5 @@ -import * as mfm from "mfm-js"; import { unique } from "@/prelude/array.js"; +import * as mfm from "mfm-js"; export function extractHashtags(nodes: mfm.MfmNode[]): string[] { const hashtagNodes = mfm.extract(nodes, (node) => node.type === "hashtag"); diff --git a/packages/backend/src/misc/fetch-proxy-account.ts b/packages/backend/src/misc/fetch-proxy-account.ts index a277db6fb9..4aa20cbcbb 100644 --- a/packages/backend/src/misc/fetch-proxy-account.ts +++ b/packages/backend/src/misc/fetch-proxy-account.ts @@ -1,6 +1,6 @@ -import { fetchMeta } from "./fetch-meta.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import { fetchMeta } from "./fetch-meta.js"; export async function fetchProxyAccount(): Promise { const meta = await fetchMeta(); diff --git a/packages/backend/src/misc/fetch.ts b/packages/backend/src/misc/fetch.ts index e47ef0d47a..d7e8ce69fb 100644 --- a/packages/backend/src/misc/fetch.ts +++ b/packages/backend/src/misc/fetch.ts @@ -1,10 +1,10 @@ import * as http from "node:http"; import * as https from "node:https"; import type { URL } from "node:url"; -import CacheableLookup from "cacheable-lookup"; -import fetch from "node-fetch"; -import { HttpProxyAgent, HttpsProxyAgent } from "hpagent"; import config from "@/config/index.js"; +import CacheableLookup from "cacheable-lookup"; +import { HttpProxyAgent, HttpsProxyAgent } from "hpagent"; +import fetch from "node-fetch"; export async function getJson( url: string, diff --git a/packages/backend/src/misc/gen-id.ts b/packages/backend/src/misc/gen-id.ts index 737bbe488f..5da622b97a 100644 --- a/packages/backend/src/misc/gen-id.ts +++ b/packages/backend/src/misc/gen-id.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; import { nativeCreateId, - nativeInitIdGenerator, nativeGetTimestamp, + nativeInitIdGenerator, } from "native-utils/built/index.js"; const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24); diff --git a/packages/backend/src/misc/get-file-info.ts b/packages/backend/src/misc/get-file-info.ts index 76964890e7..a008e9c294 100644 --- a/packages/backend/src/misc/get-file-info.ts +++ b/packages/backend/src/misc/get-file-info.ts @@ -1,17 +1,17 @@ -import * as fs from "node:fs"; import * as crypto from "node:crypto"; +import * as fs from "node:fs"; import { join } from "node:path"; import * as stream from "node:stream"; import * as util from "node:util"; +import { detectSensitive } from "@/services/detect-sensitive.js"; +import { encode } from "blurhash"; import { FSWatcher } from "chokidar"; import { fileTypeFromFile } from "file-type"; -import probeImageSize from "probe-image-size"; import FFmpeg from "fluent-ffmpeg"; import isSvg from "is-svg"; import { type predictionType } from "nsfwjs"; +import probeImageSize from "probe-image-size"; import sharp from "sharp"; -import { encode } from "blurhash"; -import { detectSensitive } from "@/services/detect-sensitive.js"; import { createTempDir } from "./create-temp.js"; const pipeline = util.promisify(stream.pipeline); diff --git a/packages/backend/src/misc/keypair-store.ts b/packages/backend/src/misc/keypair-store.ts index 6255773599..b8c0ed5dcd 100644 --- a/packages/backend/src/misc/keypair-store.ts +++ b/packages/backend/src/misc/keypair-store.ts @@ -1,6 +1,6 @@ -import { UserKeypairs } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; import type { UserKeypair } from "@/models/entities/user-keypair.js"; +import type { User } from "@/models/entities/user.js"; +import { UserKeypairs } from "@/models/index.js"; import { Cache } from "./cache.js"; const cache = new Cache("keypairStore", 60 * 30); diff --git a/packages/backend/src/misc/password.ts b/packages/backend/src/misc/password.ts index c63f89f5c9..52c1393424 100644 --- a/packages/backend/src/misc/password.ts +++ b/packages/backend/src/misc/password.ts @@ -1,5 +1,5 @@ -import bcrypt from "bcryptjs"; import * as argon2 from "argon2"; +import bcrypt from "bcryptjs"; export async function hashPassword(password: string): Promise { return argon2.hash(password); diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 795a267f91..d509a9f5be 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -1,13 +1,13 @@ -import { In, IsNull } from "typeorm"; -import { Emojis } from "@/models/index.js"; +import config from "@/config/index.js"; +import { redisClient } from "@/db/redis.js"; import type { Emoji } from "@/models/entities/emoji.js"; import type { Note } from "@/models/entities/note.js"; +import { Emojis } from "@/models/index.js"; +import { query } from "@/prelude/url.js"; +import { In, IsNull } from "typeorm"; 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"; -import { redisClient } from "@/db/redis.js"; const cache = new Cache("populateEmojis", 60 * 60 * 12); diff --git a/packages/backend/src/misc/process-masto-notes.ts b/packages/backend/src/misc/process-masto-notes.ts index 1327b4cff0..886574218c 100644 --- a/packages/backend/src/misc/process-masto-notes.ts +++ b/packages/backend/src/misc/process-masto-notes.ts @@ -1,13 +1,13 @@ import * as fs from "node:fs"; +import * as Path from "node:path"; +import { Users } from "@/models/index.js"; +import { addFile } from "@/services/drive/add-file.js"; import Logger from "@/services/logger.js"; +import decompress from "decompress"; +import gunzip from "gunzip-maybe"; +import * as tar from "tar-stream"; import { createTemp, createTempDir } from "./create-temp.js"; import { downloadUrl } from "./download-url.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { Users } from "@/models/index.js"; -import * as tar from "tar-stream"; -import gunzip from "gunzip-maybe"; -import decompress from "decompress"; -import * as Path from "node:path"; const logger = new Logger("process-masto-notes"); diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index db88b05900..b3e4903fa3 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -1,8 +1,8 @@ +import { Emojis } from "@/models/index.js"; +import { IsNull } from "typeorm"; +import { toPunyNullable } from "./convert-host.js"; import { emojiRegex } from "./emoji-regex.js"; import { fetchMeta } from "./fetch-meta.js"; -import { Emojis } from "@/models/index.js"; -import { toPunyNullable } from "./convert-host.js"; -import { IsNull } from "typeorm"; export function convertReactions(reactions: Record) { const result = new Map(); diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 6e03d30d91..4e0fdc5d4b 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -1,36 +1,36 @@ -import { - packedUserLiteSchema, - packedUserDetailedNotMeOnlySchema, - packedMeDetailedOnlySchema, - packedUserDetailedNotMeSchema, - packedMeDetailedSchema, - packedUserDetailedSchema, - packedUserSchema, -} from "@/models/schema/user.js"; -import { packedNoteSchema } from "@/models/schema/note.js"; -import { packedUserListSchema } from "@/models/schema/user-list.js"; +import { packedAntennaSchema } from "@/models/schema/antenna.js"; import { packedAppSchema } from "@/models/schema/app.js"; -import { packedMessagingMessageSchema } from "@/models/schema/messaging-message.js"; -import { packedNotificationSchema } from "@/models/schema/notification.js"; +import { packedBlockingSchema } from "@/models/schema/blocking.js"; +import { packedChannelSchema } from "@/models/schema/channel.js"; +import { packedClipSchema } from "@/models/schema/clip.js"; import { packedDriveFileSchema } from "@/models/schema/drive-file.js"; import { packedDriveFolderSchema } from "@/models/schema/drive-folder.js"; -import { packedFollowingSchema } from "@/models/schema/following.js"; -import { packedMutingSchema } from "@/models/schema/muting.js"; -import { packedRenoteMutingSchema } from "@/models/schema/renote-muting.js"; -import { packedBlockingSchema } from "@/models/schema/blocking.js"; -import { packedNoteReactionSchema } from "@/models/schema/note-reaction.js"; -import { packedHashtagSchema } from "@/models/schema/hashtag.js"; -import { packedPageSchema } from "@/models/schema/page.js"; -import { packedUserGroupSchema } from "@/models/schema/user-group.js"; -import { packedNoteFavoriteSchema } from "@/models/schema/note-favorite.js"; -import { packedChannelSchema } from "@/models/schema/channel.js"; -import { packedAntennaSchema } from "@/models/schema/antenna.js"; -import { packedClipSchema } from "@/models/schema/clip.js"; -import { packedFederationInstanceSchema } from "@/models/schema/federation-instance.js"; -import { packedQueueCountSchema } from "@/models/schema/queue.js"; -import { packedGalleryPostSchema } from "@/models/schema/gallery-post.js"; import { packedEmojiSchema } from "@/models/schema/emoji.js"; +import { packedFederationInstanceSchema } from "@/models/schema/federation-instance.js"; +import { packedFollowingSchema } from "@/models/schema/following.js"; +import { packedGalleryPostSchema } from "@/models/schema/gallery-post.js"; +import { packedHashtagSchema } from "@/models/schema/hashtag.js"; +import { packedMessagingMessageSchema } from "@/models/schema/messaging-message.js"; +import { packedMutingSchema } from "@/models/schema/muting.js"; import { packedNoteEdit } from "@/models/schema/note-edit.js"; +import { packedNoteFavoriteSchema } from "@/models/schema/note-favorite.js"; +import { packedNoteReactionSchema } from "@/models/schema/note-reaction.js"; +import { packedNoteSchema } from "@/models/schema/note.js"; +import { packedNotificationSchema } from "@/models/schema/notification.js"; +import { packedPageSchema } from "@/models/schema/page.js"; +import { packedQueueCountSchema } from "@/models/schema/queue.js"; +import { packedRenoteMutingSchema } from "@/models/schema/renote-muting.js"; +import { packedUserGroupSchema } from "@/models/schema/user-group.js"; +import { packedUserListSchema } from "@/models/schema/user-list.js"; +import { + packedMeDetailedOnlySchema, + packedMeDetailedSchema, + packedUserDetailedNotMeOnlySchema, + packedUserDetailedNotMeSchema, + packedUserDetailedSchema, + packedUserLiteSchema, + packedUserSchema, +} from "@/models/schema/user.js"; export const refs = { UserLite: packedUserLiteSchema, diff --git a/packages/backend/src/misc/show-machine-info.ts b/packages/backend/src/misc/show-machine-info.ts index d3a28cbd37..7b5db8d2aa 100644 --- a/packages/backend/src/misc/show-machine-info.ts +++ b/packages/backend/src/misc/show-machine-info.ts @@ -1,6 +1,6 @@ import * as os from "node:os"; -import sysUtils from "systeminformation"; import type Logger from "@/services/logger.js"; +import sysUtils from "systeminformation"; export async function showMachineInfo(parentLogger: Logger) { const logger = parentLogger.createSubLogger("machine"); diff --git a/packages/backend/src/misc/skipped-instances.ts b/packages/backend/src/misc/skipped-instances.ts index 785393022a..59d5a2fc6e 100644 --- a/packages/backend/src/misc/skipped-instances.ts +++ b/packages/backend/src/misc/skipped-instances.ts @@ -1,8 +1,8 @@ -import { Brackets } from "typeorm"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Instances } from "@/models/index.js"; -import type { Instance } from "@/models/entities/instance.js"; import { DAY } from "@/const.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import type { Instance } from "@/models/entities/instance.js"; +import { Instances } from "@/models/index.js"; +import { Brackets } from "typeorm"; import { shouldBlockInstance } from "./should-block-instance.js"; // Threshold from last contact after which an instance will be considered diff --git a/packages/backend/src/misc/webhook-cache.ts b/packages/backend/src/misc/webhook-cache.ts index 1eda5eaecd..6ffbde5cb7 100644 --- a/packages/backend/src/misc/webhook-cache.ts +++ b/packages/backend/src/misc/webhook-cache.ts @@ -1,6 +1,6 @@ -import { Webhooks } from "@/models/index.js"; -import type { Webhook } from "@/models/entities/webhook.js"; import { subscriber } from "@/db/redis.js"; +import type { Webhook } from "@/models/entities/webhook.js"; +import { Webhooks } from "@/models/index.js"; let webhooksFetched = false; let webhooks: Webhook[] = []; diff --git a/packages/backend/src/models/entities/abuse-user-report.ts b/packages/backend/src/models/entities/abuse-user-report.ts index cb4d55851d..47063cca53 100644 --- a/packages/backend/src/models/entities/abuse-user-report.ts +++ b/packages/backend/src/models/entities/abuse-user-report.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class AbuseUserReport { diff --git a/packages/backend/src/models/entities/access-token.ts b/packages/backend/src/models/entities/access-token.ts index 8b950b171b..260f3f832d 100644 --- a/packages/backend/src/models/entities/access-token.ts +++ b/packages/backend/src/models/entities/access-token.ts @@ -1,14 +1,14 @@ import { - Entity, - PrimaryColumn, - Index, Column, - ManyToOne, + Entity, + Index, JoinColumn, + ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { App } from "./app.js"; import { id } from "../id.js"; +import { App } from "./app.js"; +import { User } from "./user.js"; @Entity() export class AccessToken { diff --git a/packages/backend/src/models/entities/ad.ts b/packages/backend/src/models/entities/ad.ts index 80d54ddd52..0fad2bdbbb 100644 --- a/packages/backend/src/models/entities/ad.ts +++ b/packages/backend/src/models/entities/ad.ts @@ -1,4 +1,4 @@ -import { Entity, Index, Column, PrimaryColumn } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/announcement-read.ts b/packages/backend/src/models/entities/announcement-read.ts index 79af9e48e3..68dcbffc0c 100644 --- a/packages/backend/src/models/entities/announcement-read.ts +++ b/packages/backend/src/models/entities/announcement-read.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { Announcement } from "./announcement.js"; import { id } from "../id.js"; +import { Announcement } from "./announcement.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "announcementId"], { unique: true }) diff --git a/packages/backend/src/models/entities/announcement.ts b/packages/backend/src/models/entities/announcement.ts index 7872c0fe1c..baa69ebe8b 100644 --- a/packages/backend/src/models/entities/announcement.ts +++ b/packages/backend/src/models/entities/announcement.ts @@ -1,4 +1,4 @@ -import { Entity, Index, Column, PrimaryColumn } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/antenna.ts b/packages/backend/src/models/entities/antenna.ts index 633dcc1d27..b535afc1e9 100644 --- a/packages/backend/src/models/entities/antenna.ts +++ b/packages/backend/src/models/entities/antenna.ts @@ -1,15 +1,15 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; -import { UserList } from "./user-list.js"; import { UserGroupJoining } from "./user-group-joining.js"; +import { UserList } from "./user-list.js"; +import { User } from "./user.js"; @Entity() export class Antenna { diff --git a/packages/backend/src/models/entities/app.ts b/packages/backend/src/models/entities/app.ts index a41e35aa91..30f893c1aa 100644 --- a/packages/backend/src/models/entities/app.ts +++ b/packages/backend/src/models/entities/app.ts @@ -1,6 +1,6 @@ -import { Entity, PrimaryColumn, Column, Index, ManyToOne } from "typeorm"; -import { User } from "./user.js"; +import { Column, Entity, Index, ManyToOne, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class App { diff --git a/packages/backend/src/models/entities/attestation-challenge.ts b/packages/backend/src/models/entities/attestation-challenge.ts index 6a3a9c8ed7..1fe363a236 100644 --- a/packages/backend/src/models/entities/attestation-challenge.ts +++ b/packages/backend/src/models/entities/attestation-challenge.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, - Entity, - JoinColumn, Column, - ManyToOne, + Entity, Index, + JoinColumn, + ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class AttestationChallenge { diff --git a/packages/backend/src/models/entities/auth-session.ts b/packages/backend/src/models/entities/auth-session.ts index b31dca56cf..c7028cff09 100644 --- a/packages/backend/src/models/entities/auth-session.ts +++ b/packages/backend/src/models/entities/auth-session.ts @@ -1,14 +1,14 @@ import { - Entity, - PrimaryColumn, - Index, Column, - ManyToOne, + Entity, + Index, JoinColumn, + ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { App } from "./app.js"; import { id } from "../id.js"; +import { App } from "./app.js"; +import { User } from "./user.js"; @Entity() export class AuthSession { diff --git a/packages/backend/src/models/entities/blocking.ts b/packages/backend/src/models/entities/blocking.ts index 55f677a981..edbbca9c11 100644 --- a/packages/backend/src/models/entities/blocking.ts +++ b/packages/backend/src/models/entities/blocking.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() @Index(["blockerId", "blockeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel-following.ts b/packages/backend/src/models/entities/channel-following.ts index ee329fa50f..9c1ac9eacc 100644 --- a/packages/backend/src/models/entities/channel-following.ts +++ b/packages/backend/src/models/entities/channel-following.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import { Channel } from "./channel.js"; +import { User } from "./user.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel-note-pining.ts b/packages/backend/src/models/entities/channel-note-pining.ts index 67d1d48ccd..adef9a4612 100644 --- a/packages/backend/src/models/entities/channel-note-pining.ts +++ b/packages/backend/src/models/entities/channel-note-pining.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { Note } from "./note.js"; -import { Channel } from "./channel.js"; import { id } from "../id.js"; +import { Channel } from "./channel.js"; +import { Note } from "./note.js"; @Entity() @Index(["channelId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel.ts b/packages/backend/src/models/entities/channel.ts index ea22fed50b..06b835c0f2 100644 --- a/packages/backend/src/models/entities/channel.ts +++ b/packages/backend/src/models/entities/channel.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; +import { User } from "./user.js"; @Entity() export class Channel { diff --git a/packages/backend/src/models/entities/clip-note.ts b/packages/backend/src/models/entities/clip-note.ts index 1697474a84..1e2c0f89a0 100644 --- a/packages/backend/src/models/entities/clip-note.ts +++ b/packages/backend/src/models/entities/clip-note.ts @@ -1,14 +1,14 @@ import { + Column, Entity, Index, JoinColumn, - Column, ManyToOne, PrimaryColumn, } from "typeorm"; -import { Note } from "./note.js"; -import { Clip } from "./clip.js"; import { id } from "../id.js"; +import { Clip } from "./clip.js"; +import { Note } from "./note.js"; @Entity() @Index(["noteId", "clipId"], { unique: true }) diff --git a/packages/backend/src/models/entities/clip.ts b/packages/backend/src/models/entities/clip.ts index 9554703a4c..8f5ce524e3 100644 --- a/packages/backend/src/models/entities/clip.ts +++ b/packages/backend/src/models/entities/clip.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class Clip { diff --git a/packages/backend/src/models/entities/drive-file.ts b/packages/backend/src/models/entities/drive-file.ts index da93f32a82..1174a628f5 100644 --- a/packages/backend/src/models/entities/drive-file.ts +++ b/packages/backend/src/models/entities/drive-file.ts @@ -1,15 +1,15 @@ +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; -import { User } from "./user.js"; import { DriveFolder } from "./drive-folder.js"; -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "folderId", "id"]) diff --git a/packages/backend/src/models/entities/drive-folder.ts b/packages/backend/src/models/entities/drive-folder.ts index 0bb2c7a3d2..bc4ef9d309 100644 --- a/packages/backend/src/models/entities/drive-folder.ts +++ b/packages/backend/src/models/entities/drive-folder.ts @@ -1,13 +1,13 @@ import { + Column, + Entity, + Index, JoinColumn, ManyToOne, - Entity, PrimaryColumn, - Index, - Column, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class DriveFolder { diff --git a/packages/backend/src/models/entities/emoji.ts b/packages/backend/src/models/entities/emoji.ts index 87b525dc59..760213e670 100644 --- a/packages/backend/src/models/entities/emoji.ts +++ b/packages/backend/src/models/entities/emoji.ts @@ -1,4 +1,4 @@ -import { PrimaryColumn, Entity, Index, Column } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/follow-request.ts b/packages/backend/src/models/entities/follow-request.ts index 281eab9174..3e4bf423b4 100644 --- a/packages/backend/src/models/entities/follow-request.ts +++ b/packages/backend/src/models/entities/follow-request.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/following.ts b/packages/backend/src/models/entities/following.ts index ea8f325650..841553e5f7 100644 --- a/packages/backend/src/models/entities/following.ts +++ b/packages/backend/src/models/entities/following.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/gallery-like.ts b/packages/backend/src/models/entities/gallery-like.ts index 259feb8bbb..8393930ae9 100644 --- a/packages/backend/src/models/entities/gallery-like.ts +++ b/packages/backend/src/models/entities/gallery-like.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import { GalleryPost } from "./gallery-post.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "postId"], { unique: true }) diff --git a/packages/backend/src/models/entities/gallery-post.ts b/packages/backend/src/models/entities/gallery-post.ts index 938348659d..601d323a84 100644 --- a/packages/backend/src/models/entities/gallery-post.ts +++ b/packages/backend/src/models/entities/gallery-post.ts @@ -1,14 +1,14 @@ import { + Column, Entity, Index, JoinColumn, - Column, - PrimaryColumn, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import type { DriveFile } from "./drive-file.js"; +import { User } from "./user.js"; @Entity() export class GalleryPost { diff --git a/packages/backend/src/models/entities/hashtag.ts b/packages/backend/src/models/entities/hashtag.ts index 7b3df1cc22..60a4c4049d 100644 --- a/packages/backend/src/models/entities/hashtag.ts +++ b/packages/backend/src/models/entities/hashtag.ts @@ -1,6 +1,6 @@ -import { Entity, PrimaryColumn, Index, Column } from "typeorm"; -import type { User } from "./user.js"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; +import type { User } from "./user.js"; @Entity() export class Hashtag { diff --git a/packages/backend/src/models/entities/instance.ts b/packages/backend/src/models/entities/instance.ts index 7b7701d07d..d2e147803d 100644 --- a/packages/backend/src/models/entities/instance.ts +++ b/packages/backend/src/models/entities/instance.ts @@ -1,4 +1,4 @@ -import { Entity, PrimaryColumn, Index, Column } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/messaging-message.ts b/packages/backend/src/models/entities/messaging-message.ts index d1da00eaef..38fcb92d35 100644 --- a/packages/backend/src/models/entities/messaging-message.ts +++ b/packages/backend/src/models/entities/messaging-message.ts @@ -1,15 +1,15 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { DriveFile } from "./drive-file.js"; import { id } from "../id.js"; +import { DriveFile } from "./drive-file.js"; import { UserGroup } from "./user-group.js"; +import { User } from "./user.js"; @Entity() export class MessagingMessage { diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index c1e3be58f4..b8e71368d3 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -1,7 +1,7 @@ -import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; -import { User } from "./user.js"; import type { Clip } from "./clip.js"; +import { User } from "./user.js"; @Entity() export class Meta { diff --git a/packages/backend/src/models/entities/moderation-log.ts b/packages/backend/src/models/entities/moderation-log.ts index 26bf1cdfa4..dd81139512 100644 --- a/packages/backend/src/models/entities/moderation-log.ts +++ b/packages/backend/src/models/entities/moderation-log.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class ModerationLog { diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts index 0ee245aea9..5d9566a198 100644 --- a/packages/backend/src/models/entities/muted-note.ts +++ b/packages/backend/src/models/entities/muted-note.ts @@ -1,15 +1,15 @@ import { + Column, Entity, Index, JoinColumn, - Column, ManyToOne, PrimaryColumn, } from "typeorm"; +import { mutedNoteReasons } from "../../types.js"; +import { id } from "../id.js"; 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/packages/backend/src/models/entities/muting.ts b/packages/backend/src/models/entities/muting.ts index 603619b468..b4c3a580b3 100644 --- a/packages/backend/src/models/entities/muting.ts +++ b/packages/backend/src/models/entities/muting.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() @Index(["muterId", "muteeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-edit.ts b/packages/backend/src/models/entities/note-edit.ts index 8761e2b153..fea5c3520e 100644 --- a/packages/backend/src/models/entities/note-edit.ts +++ b/packages/backend/src/models/entities/note-edit.ts @@ -1,14 +1,14 @@ import { - Entity, - JoinColumn, Column, + Entity, + Index, + JoinColumn, ManyToOne, PrimaryColumn, - Index, } from "typeorm"; -import { Note } from "./note.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; +import { Note } from "./note.js"; @Entity() export class NoteEdit { diff --git a/packages/backend/src/models/entities/note-favorite.ts b/packages/backend/src/models/entities/note-favorite.ts index 19641ecf45..5076695c20 100644 --- a/packages/backend/src/models/entities/note-favorite.ts +++ b/packages/backend/src/models/entities/note-favorite.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; +import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; -import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-reaction.ts b/packages/backend/src/models/entities/note-reaction.ts index 5e2a8d3e89..35bac22b01 100644 --- a/packages/backend/src/models/entities/note-reaction.ts +++ b/packages/backend/src/models/entities/note-reaction.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { Note } from "./note.js"; import { id } from "../id.js"; +import { Note } from "./note.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-thread-muting.ts b/packages/backend/src/models/entities/note-thread-muting.ts index 7e5fad59a4..1b2bbebdc3 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "threadId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-unread.ts b/packages/backend/src/models/entities/note-unread.ts index 95695cbc8e..a85db90959 100644 --- a/packages/backend/src/models/entities/note-unread.ts +++ b/packages/backend/src/models/entities/note-unread.ts @@ -1,15 +1,15 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { Note } from "./note.js"; import { id } from "../id.js"; import type { Channel } from "./channel.js"; +import { Note } from "./note.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-watching.ts b/packages/backend/src/models/entities/note-watching.ts index 724b084af2..8bc296df5e 100644 --- a/packages/backend/src/models/entities/note-watching.ts +++ b/packages/backend/src/models/entities/note-watching.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { Note } from "./note.js"; import { id } from "../id.js"; +import { Note } from "./note.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index 2b9de38cbe..3c6fb9d1a7 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -1,16 +1,16 @@ import { + Column, Entity, Index, JoinColumn, - Column, - PrimaryColumn, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import type { DriveFile } from "./drive-file.js"; -import { id } from "../id.js"; import { noteVisibilities } from "../../types.js"; +import { id } from "../id.js"; import { Channel } from "./channel.js"; +import type { DriveFile } from "./drive-file.js"; +import { User } from "./user.js"; @Entity() @Index("IDX_NOTE_TAGS", { synchronize: false }) diff --git a/packages/backend/src/models/entities/notification.ts b/packages/backend/src/models/entities/notification.ts index da23f7d3ee..ea1a0f8c20 100644 --- a/packages/backend/src/models/entities/notification.ts +++ b/packages/backend/src/models/entities/notification.ts @@ -1,18 +1,18 @@ +import { notificationTypes } from "@/types.js"; import { + Column, Entity, Index, JoinColumn, ManyToOne, - Column, PrimaryColumn, } from "typeorm"; -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"; +import { FollowRequest } from "./follow-request.js"; +import { Note } from "./note.js"; +import { UserGroupInvitation } from "./user-group-invitation.js"; +import { User } from "./user.js"; @Entity() export class Notification { diff --git a/packages/backend/src/models/entities/page-like.ts b/packages/backend/src/models/entities/page-like.ts index 6304e0b24c..f93221e281 100644 --- a/packages/backend/src/models/entities/page-like.ts +++ b/packages/backend/src/models/entities/page-like.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import { Page } from "./page.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "pageId"], { unique: true }) diff --git a/packages/backend/src/models/entities/page.ts b/packages/backend/src/models/entities/page.ts index d0733c8ce4..f80ac570b9 100644 --- a/packages/backend/src/models/entities/page.ts +++ b/packages/backend/src/models/entities/page.ts @@ -1,14 +1,14 @@ import { + Column, Entity, Index, JoinColumn, - Column, - PrimaryColumn, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "name"], { unique: true }) diff --git a/packages/backend/src/models/entities/password-reset-request.ts b/packages/backend/src/models/entities/password-reset-request.ts index ab0bccbbef..4833519607 100644 --- a/packages/backend/src/models/entities/password-reset-request.ts +++ b/packages/backend/src/models/entities/password-reset-request.ts @@ -1,10 +1,10 @@ import { - PrimaryColumn, + Column, Entity, Index, - Column, - ManyToOne, JoinColumn, + ManyToOne, + PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; import { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/poll-vote.ts b/packages/backend/src/models/entities/poll-vote.ts index d59a720c37..e14734a77a 100644 --- a/packages/backend/src/models/entities/poll-vote.ts +++ b/packages/backend/src/models/entities/poll-vote.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { Note } from "./note.js"; import { id } from "../id.js"; +import { Note } from "./note.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "noteId", "choice"], { unique: true }) diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index c117d4e733..ae6be59987 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -1,15 +1,15 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, OneToOne, + PrimaryColumn, } from "typeorm"; +import { noteVisibilities } from "../../types.js"; import { id } from "../id.js"; import { Note } from "./note.js"; import type { User } from "./user.js"; -import { noteVisibilities } from "../../types.js"; @Entity() export class Poll { diff --git a/packages/backend/src/models/entities/promo-note.ts b/packages/backend/src/models/entities/promo-note.ts index caa64927e9..142634c2e2 100644 --- a/packages/backend/src/models/entities/promo-note.ts +++ b/packages/backend/src/models/entities/promo-note.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, OneToOne, + PrimaryColumn, } from "typeorm"; +import { id } from "../id.js"; import { Note } from "./note.js"; import type { User } from "./user.js"; -import { id } from "../id.js"; @Entity() export class PromoNote { diff --git a/packages/backend/src/models/entities/promo-read.ts b/packages/backend/src/models/entities/promo-read.ts index b31877dc34..a5a54af4bf 100644 --- a/packages/backend/src/models/entities/promo-read.ts +++ b/packages/backend/src/models/entities/promo-read.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; +import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; -import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/registration-tickets.ts b/packages/backend/src/models/entities/registration-tickets.ts index 549f05d07a..cb4547fb8b 100644 --- a/packages/backend/src/models/entities/registration-tickets.ts +++ b/packages/backend/src/models/entities/registration-tickets.ts @@ -1,4 +1,4 @@ -import { PrimaryColumn, Entity, Index, Column } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/registry-item.ts b/packages/backend/src/models/entities/registry-item.ts index d044222e6e..d2c70f7ba7 100644 --- a/packages/backend/src/models/entities/registry-item.ts +++ b/packages/backend/src/models/entities/registry-item.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; // TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい @Entity() diff --git a/packages/backend/src/models/entities/relay.ts b/packages/backend/src/models/entities/relay.ts index c7509dcf41..5b3ebef55f 100644 --- a/packages/backend/src/models/entities/relay.ts +++ b/packages/backend/src/models/entities/relay.ts @@ -1,4 +1,4 @@ -import { PrimaryColumn, Entity, Index, Column } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/renote-muting.ts b/packages/backend/src/models/entities/renote-muting.ts index e8856492f1..793c39df64 100644 --- a/packages/backend/src/models/entities/renote-muting.ts +++ b/packages/backend/src/models/entities/renote-muting.ts @@ -1,10 +1,10 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; import { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/signin.ts b/packages/backend/src/models/entities/signin.ts index 517e71c8fd..6ecb452ebf 100644 --- a/packages/backend/src/models/entities/signin.ts +++ b/packages/backend/src/models/entities/signin.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class Signin { diff --git a/packages/backend/src/models/entities/sw-subscription.ts b/packages/backend/src/models/entities/sw-subscription.ts index f7823fbaaa..9e65fff537 100644 --- a/packages/backend/src/models/entities/sw-subscription.ts +++ b/packages/backend/src/models/entities/sw-subscription.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class SwSubscription { diff --git a/packages/backend/src/models/entities/used-username.ts b/packages/backend/src/models/entities/used-username.ts index d00a25991e..b7937f648e 100644 --- a/packages/backend/src/models/entities/used-username.ts +++ b/packages/backend/src/models/entities/used-username.ts @@ -1,4 +1,4 @@ -import { PrimaryColumn, Entity, Column } from "typeorm"; +import { Column, Entity, PrimaryColumn } from "typeorm"; @Entity() export class UsedUsername { diff --git a/packages/backend/src/models/entities/user-group-invitation.ts b/packages/backend/src/models/entities/user-group-invitation.ts index fa2655ab67..7af3ad6142 100644 --- a/packages/backend/src/models/entities/user-group-invitation.ts +++ b/packages/backend/src/models/entities/user-group-invitation.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { UserGroup } from "./user-group.js"; import { id } from "../id.js"; +import { UserGroup } from "./user-group.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "userGroupId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-group-joining.ts b/packages/backend/src/models/entities/user-group-joining.ts index 78f820d0e8..a60d6f0397 100644 --- a/packages/backend/src/models/entities/user-group-joining.ts +++ b/packages/backend/src/models/entities/user-group-joining.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { UserGroup } from "./user-group.js"; import { id } from "../id.js"; +import { UserGroup } from "./user-group.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "userGroupId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-group.ts b/packages/backend/src/models/entities/user-group.ts index 23876ec8b8..9e374858ca 100644 --- a/packages/backend/src/models/entities/user-group.ts +++ b/packages/backend/src/models/entities/user-group.ts @@ -1,13 +1,13 @@ import { + Column, Entity, Index, JoinColumn, - Column, - PrimaryColumn, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class UserGroup { diff --git a/packages/backend/src/models/entities/user-ip.ts b/packages/backend/src/models/entities/user-ip.ts index adef48e4c4..b7226c52e1 100644 --- a/packages/backend/src/models/entities/user-ip.ts +++ b/packages/backend/src/models/entities/user-ip.ts @@ -1,4 +1,4 @@ -import { Entity, Index, Column, PrimaryGeneratedColumn } from "typeorm"; +import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm"; import { id } from "../id.js"; import type { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/user-keypair.ts b/packages/backend/src/models/entities/user-keypair.ts index f98384f538..eb0e259326 100644 --- a/packages/backend/src/models/entities/user-keypair.ts +++ b/packages/backend/src/models/entities/user-keypair.ts @@ -1,6 +1,6 @@ -import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from "typeorm"; -import { User } from "./user.js"; +import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class UserKeypair { diff --git a/packages/backend/src/models/entities/user-list-joining.ts b/packages/backend/src/models/entities/user-list-joining.ts index 4caa71ad32..a692deca7e 100644 --- a/packages/backend/src/models/entities/user-list-joining.ts +++ b/packages/backend/src/models/entities/user-list-joining.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; -import { UserList } from "./user-list.js"; import { id } from "../id.js"; +import { UserList } from "./user-list.js"; +import { User } from "./user.js"; @Entity() @Index(["userId", "userListId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-list.ts b/packages/backend/src/models/entities/user-list.ts index 3c95d44d6b..add0454a41 100644 --- a/packages/backend/src/models/entities/user-list.ts +++ b/packages/backend/src/models/entities/user-list.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class UserList { diff --git a/packages/backend/src/models/entities/user-note-pining.ts b/packages/backend/src/models/entities/user-note-pining.ts index c30fe1e028..2417f73a4b 100644 --- a/packages/backend/src/models/entities/user-note-pining.ts +++ b/packages/backend/src/models/entities/user-note-pining.ts @@ -1,14 +1,14 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; +import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; -import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-pending.ts b/packages/backend/src/models/entities/user-pending.ts index 18ae5ad993..f36decc174 100644 --- a/packages/backend/src/models/entities/user-pending.ts +++ b/packages/backend/src/models/entities/user-pending.ts @@ -1,4 +1,4 @@ -import { PrimaryColumn, Entity, Index, Column } from "typeorm"; +import { Column, Entity, Index, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index a4c2e09754..7f6bafedc8 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -1,15 +1,15 @@ +import { ffVisibility, notificationTypes } from "@/types.js"; import { - Entity, Column, + Entity, Index, - OneToOne, JoinColumn, + OneToOne, PrimaryColumn, } from "typeorm"; -import { ffVisibility, notificationTypes } from "@/types.js"; import { id } from "../id.js"; -import { User } from "./user.js"; import { Page } from "./page.js"; +import { User } from "./user.js"; // TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも // ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン diff --git a/packages/backend/src/models/entities/user-publickey.ts b/packages/backend/src/models/entities/user-publickey.ts index e39b084d32..ea13e049f2 100644 --- a/packages/backend/src/models/entities/user-publickey.ts +++ b/packages/backend/src/models/entities/user-publickey.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, OneToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class UserPublickey { diff --git a/packages/backend/src/models/entities/user-security-key.ts b/packages/backend/src/models/entities/user-security-key.ts index 511cab4ae4..ae721d7e38 100644 --- a/packages/backend/src/models/entities/user-security-key.ts +++ b/packages/backend/src/models/entities/user-security-key.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, - Entity, - JoinColumn, Column, - ManyToOne, + Entity, Index, + JoinColumn, + ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; @Entity() export class UserSecurityKey { diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index 2d5e5dca3e..c5e633766e 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -1,9 +1,9 @@ import { - Entity, Column, + Entity, Index, - OneToOne, JoinColumn, + OneToOne, PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; diff --git a/packages/backend/src/models/entities/webhook.ts b/packages/backend/src/models/entities/webhook.ts index 47fd79966d..fa8b61457e 100644 --- a/packages/backend/src/models/entities/webhook.ts +++ b/packages/backend/src/models/entities/webhook.ts @@ -1,13 +1,13 @@ import { - PrimaryColumn, + Column, Entity, Index, JoinColumn, - Column, ManyToOne, + PrimaryColumn, } from "typeorm"; -import { User } from "./user.js"; import { id } from "../id.js"; +import { User } from "./user.js"; export const webhookEventTypes = [ "mention", diff --git a/packages/backend/src/models/index.ts b/packages/backend/src/models/index.ts index c1f37cf6d4..f842f024c3 100644 --- a/packages/backend/src/models/index.ts +++ b/packages/backend/src/models/index.ts @@ -1,70 +1,70 @@ import { db } from "@/db/postgre.js"; -import { Announcement } from "./entities/announcement.js"; -import { AnnouncementRead } from "./entities/announcement-read.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 { NoteThreadMuting } from "./entities/note-thread-muting.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 { 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 { 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 { RenoteMutingRepository } from "./repositories/renote-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 { 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 { Ad } from "./entities/ad.js"; +import { AnnouncementRead } from "./entities/announcement-read.js"; +import { Announcement } from "./entities/announcement.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 { 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"; -import { UserPending } from "./entities/user-pending.js"; -import { InstanceRepository } from "./repositories/instance.js"; -import { Webhook } from "./entities/webhook.js"; -import { UserIp } from "./entities/user-ip.js"; +import { ClipNote } from "./entities/clip-note.js"; +import { Meta } from "./entities/meta.js"; +import { MutedNote } from "./entities/muted-note.js"; import { NoteEdit } from "./entities/note-edit.js"; +import { NoteThreadMuting } from "./entities/note-thread-muting.js"; +import { NoteUnread } from "./entities/note-unread.js"; +import { NoteWatching } from "./entities/note-watching.js"; +import { PasswordResetRequest } from "./entities/password-reset-request.js"; +import { PollVote } from "./entities/poll-vote.js"; +import { Poll } from "./entities/poll.js"; +import { PromoNote } from "./entities/promo-note.js"; +import { PromoRead } from "./entities/promo-read.js"; +import { RegistrationTicket } from "./entities/registration-tickets.js"; +import { RegistryItem } from "./entities/registry-item.js"; +import { SwSubscription } from "./entities/sw-subscription.js"; +import { UsedUsername } from "./entities/used-username.js"; +import { UserGroupJoining } from "./entities/user-group-joining.js"; +import { UserIp } from "./entities/user-ip.js"; +import { UserKeypair } from "./entities/user-keypair.js"; +import { UserListJoining } from "./entities/user-list-joining.js"; +import { UserNotePining } from "./entities/user-note-pining.js"; +import { UserPending } from "./entities/user-pending.js"; +import { UserProfile } from "./entities/user-profile.js"; +import { UserPublickey } from "./entities/user-publickey.js"; +import { UserSecurityKey } from "./entities/user-security-key.js"; +import { Webhook } from "./entities/webhook.js"; +import { AbuseUserReportRepository } from "./repositories/abuse-user-report.js"; +import { AntennaRepository } from "./repositories/antenna.js"; +import { AppRepository } from "./repositories/app.js"; +import { AuthSessionRepository } from "./repositories/auth-session.js"; +import { BlockingRepository } from "./repositories/blocking.js"; +import { ChannelRepository } from "./repositories/channel.js"; +import { ClipRepository } from "./repositories/clip.js"; +import { DriveFileRepository } from "./repositories/drive-file.js"; +import { DriveFolderRepository } from "./repositories/drive-folder.js"; +import { EmojiRepository } from "./repositories/emoji.js"; +import { FollowRequestRepository } from "./repositories/follow-request.js"; +import { FollowingRepository } from "./repositories/following.js"; +import { GalleryLikeRepository } from "./repositories/gallery-like.js"; +import { GalleryPostRepository } from "./repositories/gallery-post.js"; +import { HashtagRepository } from "./repositories/hashtag.js"; +import { InstanceRepository } from "./repositories/instance.js"; +import { MessagingMessageRepository } from "./repositories/messaging-message.js"; +import { ModerationLogRepository } from "./repositories/moderation-logs.js"; +import { MutingRepository } from "./repositories/muting.js"; +import { NoteFavoriteRepository } from "./repositories/note-favorite.js"; +import { NoteReactionRepository } from "./repositories/note-reaction.js"; +import { NoteRepository } from "./repositories/note.js"; +import { NotificationRepository } from "./repositories/notification.js"; +import { PageLikeRepository } from "./repositories/page-like.js"; +import { PageRepository } from "./repositories/page.js"; +import { RelayRepository } from "./repositories/relay.js"; +import { RenoteMutingRepository } from "./repositories/renote-muting.js"; +import { SigninRepository } from "./repositories/signin.js"; +import { UserGroupInvitationRepository } from "./repositories/user-group-invitation.js"; +import { UserGroupRepository } from "./repositories/user-group.js"; +import { UserListRepository } from "./repositories/user-list.js"; +import { UserRepository } from "./repositories/user.js"; export const Announcements = db.getRepository(Announcement); export const AnnouncementReads = db.getRepository(AnnouncementRead); diff --git a/packages/backend/src/models/repositories/abuse-user-report.ts b/packages/backend/src/models/repositories/abuse-user-report.ts index 07afef48c4..071c399ac0 100644 --- a/packages/backend/src/models/repositories/abuse-user-report.ts +++ b/packages/backend/src/models/repositories/abuse-user-report.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; -import { Users } from "../index.js"; import { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; export const AbuseUserReportRepository = db .getRepository(AbuseUserReport) diff --git a/packages/backend/src/models/repositories/app.ts b/packages/backend/src/models/repositories/app.ts index af3dfb81a1..abad561f66 100644 --- a/packages/backend/src/models/repositories/app.ts +++ b/packages/backend/src/models/repositories/app.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { App } from "@/models/entities/app.js"; -import { AccessTokens } from "../index.js"; import type { Packed } from "@/misc/schema.js"; +import { App } from "@/models/entities/app.js"; import type { User } from "../entities/user.js"; +import { AccessTokens } from "../index.js"; export const AppRepository = db.getRepository(App).extend({ async pack( diff --git a/packages/backend/src/models/repositories/auth-session.ts b/packages/backend/src/models/repositories/auth-session.ts index d3e1d45d6d..c129f734fc 100644 --- a/packages/backend/src/models/repositories/auth-session.ts +++ b/packages/backend/src/models/repositories/auth-session.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { Apps } from "../index.js"; import { AuthSession } from "@/models/entities/auth-session.js"; -import { awaitAll } from "@/prelude/await-all.js"; import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { Apps } from "../index.js"; export const AuthSessionRepository = db.getRepository(AuthSession).extend({ async pack( diff --git a/packages/backend/src/models/repositories/blocking.ts b/packages/backend/src/models/repositories/blocking.ts index 3dfa74e763..280631e705 100644 --- a/packages/backend/src/models/repositories/blocking.ts +++ b/packages/backend/src/models/repositories/blocking.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { Users } from "../index.js"; -import { Blocking } from "@/models/entities/blocking.js"; -import { awaitAll } from "@/prelude/await-all.js"; import type { Packed } from "@/misc/schema.js"; +import { Blocking } from "@/models/entities/blocking.js"; import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; export const BlockingRepository = db.getRepository(Blocking).extend({ async pack( diff --git a/packages/backend/src/models/repositories/channel.ts b/packages/backend/src/models/repositories/channel.ts index 7800a65940..9012c5e650 100644 --- a/packages/backend/src/models/repositories/channel.ts +++ b/packages/backend/src/models/repositories/channel.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { Channel } from "@/models/entities/channel.js"; import type { Packed } from "@/misc/schema.js"; -import { DriveFiles, ChannelFollowings, NoteUnreads } from "../index.js"; +import { Channel } from "@/models/entities/channel.js"; import type { User } from "@/models/entities/user.js"; +import { ChannelFollowings, DriveFiles, NoteUnreads } from "../index.js"; export const ChannelRepository = db.getRepository(Channel).extend({ async pack( diff --git a/packages/backend/src/models/repositories/clip.ts b/packages/backend/src/models/repositories/clip.ts index 0c21691bff..87c796aedb 100644 --- a/packages/backend/src/models/repositories/clip.ts +++ b/packages/backend/src/models/repositories/clip.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { Clip } from "@/models/entities/clip.js"; import type { Packed } from "@/misc/schema.js"; -import { Users } from "../index.js"; +import { Clip } from "@/models/entities/clip.js"; import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; export const ClipRepository = db.getRepository(Clip).extend({ async pack(src: Clip["id"] | Clip): Promise> { diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index 1b4f477d33..2de8d7fa8a 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -1,13 +1,13 @@ +import config from "@/config/index.js"; import { db } from "@/db/postgre.js"; +import { deepClone } from "@/misc/clone.js"; +import { toPuny } from "@/misc/convert-host.js"; +import type { Packed } from "@/misc/schema.js"; import { DriveFile } from "@/models/entities/drive-file.js"; import type { User } from "@/models/entities/user.js"; -import { toPuny } from "@/misc/convert-host.js"; import { awaitAll } from "@/prelude/await-all.js"; -import type { Packed } from "@/misc/schema.js"; -import config from "@/config/index.js"; -import { query, appendQuery } from "@/prelude/url.js"; -import { Users, DriveFolders } from "../index.js"; -import { deepClone } from "@/misc/clone.js"; +import { appendQuery, query } from "@/prelude/url.js"; +import { DriveFolders, Users } from "../index.js"; type PackOptions = { detail?: boolean; diff --git a/packages/backend/src/models/repositories/drive-folder.ts b/packages/backend/src/models/repositories/drive-folder.ts index 9823561d0b..7c73d2617a 100644 --- a/packages/backend/src/models/repositories/drive-folder.ts +++ b/packages/backend/src/models/repositories/drive-folder.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { DriveFolders, DriveFiles } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; import { DriveFolder } from "@/models/entities/drive-folder.js"; import { awaitAll } from "@/prelude/await-all.js"; -import type { Packed } from "@/misc/schema.js"; +import { DriveFiles, DriveFolders } from "../index.js"; export const DriveFolderRepository = db.getRepository(DriveFolder).extend({ async pack( diff --git a/packages/backend/src/models/repositories/emoji.ts b/packages/backend/src/models/repositories/emoji.ts index e9a940f958..0589097a64 100644 --- a/packages/backend/src/models/repositories/emoji.ts +++ b/packages/backend/src/models/repositories/emoji.ts @@ -1,6 +1,6 @@ import { db } from "@/db/postgre.js"; -import { Emoji } from "@/models/entities/emoji.js"; import type { Packed } from "@/misc/schema.js"; +import { Emoji } from "@/models/entities/emoji.js"; export const EmojiRepository = db.getRepository(Emoji).extend({ async pack(src: Emoji["id"] | Emoji): Promise> { diff --git a/packages/backend/src/models/repositories/follow-request.ts b/packages/backend/src/models/repositories/follow-request.ts index cef6ea7228..17100c157c 100644 --- a/packages/backend/src/models/repositories/follow-request.ts +++ b/packages/backend/src/models/repositories/follow-request.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; import { FollowRequest } from "@/models/entities/follow-request.js"; -import { Users } from "../index.js"; import type { User } from "@/models/entities/user.js"; +import { Users } from "../index.js"; export const FollowRequestRepository = db.getRepository(FollowRequest).extend({ async pack( diff --git a/packages/backend/src/models/repositories/following.ts b/packages/backend/src/models/repositories/following.ts index b102365e09..12e5380ce7 100644 --- a/packages/backend/src/models/repositories/following.ts +++ b/packages/backend/src/models/repositories/following.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { Users } from "../index.js"; -import { Following } from "@/models/entities/following.js"; -import { awaitAll } from "@/prelude/await-all.js"; import type { Packed } from "@/misc/schema.js"; +import { Following } from "@/models/entities/following.js"; import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; type LocalFollowerFollowing = Following & { followerHost: null; diff --git a/packages/backend/src/models/repositories/gallery-post.ts b/packages/backend/src/models/repositories/gallery-post.ts index b4206b0bf4..3d91d47ce2 100644 --- a/packages/backend/src/models/repositories/gallery-post.ts +++ b/packages/backend/src/models/repositories/gallery-post.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; import type { Packed } from "@/misc/schema.js"; -import { Users, DriveFiles, GalleryLikes } from "../index.js"; -import { awaitAll } from "@/prelude/await-all.js"; +import { GalleryPost } from "@/models/entities/gallery-post.js"; import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { DriveFiles, GalleryLikes, Users } from "../index.js"; export const GalleryPostRepository = db.getRepository(GalleryPost).extend({ async pack( diff --git a/packages/backend/src/models/repositories/hashtag.ts b/packages/backend/src/models/repositories/hashtag.ts index 7bd76c1c70..e3b90c1536 100644 --- a/packages/backend/src/models/repositories/hashtag.ts +++ b/packages/backend/src/models/repositories/hashtag.ts @@ -1,6 +1,6 @@ import { db } from "@/db/postgre.js"; -import { Hashtag } from "@/models/entities/hashtag.js"; import type { Packed } from "@/misc/schema.js"; +import { Hashtag } from "@/models/entities/hashtag.js"; export const HashtagRepository = db.getRepository(Hashtag).extend({ async pack(src: Hashtag): Promise> { diff --git a/packages/backend/src/models/repositories/instance.ts b/packages/backend/src/models/repositories/instance.ts index 667ec948de..f2cce2ac5d 100644 --- a/packages/backend/src/models/repositories/instance.ts +++ b/packages/backend/src/models/repositories/instance.ts @@ -1,10 +1,10 @@ import { db } from "@/db/postgre.js"; -import { Instance } from "@/models/entities/instance.js"; import type { Packed } from "@/misc/schema.js"; import { shouldBlockInstance, shouldSilenceInstance, } from "@/misc/should-block-instance.js"; +import { Instance } from "@/models/entities/instance.js"; export const InstanceRepository = db.getRepository(Instance).extend({ async pack(instance: Instance): Promise> { diff --git a/packages/backend/src/models/repositories/messaging-message.ts b/packages/backend/src/models/repositories/messaging-message.ts index 6c0987bf08..85d2053a66 100644 --- a/packages/backend/src/models/repositories/messaging-message.ts +++ b/packages/backend/src/models/repositories/messaging-message.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { MessagingMessage } from "@/models/entities/messaging-message.js"; -import { Users, DriveFiles, UserGroups } from "../index.js"; import type { Packed } from "@/misc/schema.js"; +import { MessagingMessage } from "@/models/entities/messaging-message.js"; import type { User } from "@/models/entities/user.js"; +import { DriveFiles, UserGroups, Users } from "../index.js"; export const MessagingMessageRepository = db .getRepository(MessagingMessage) diff --git a/packages/backend/src/models/repositories/moderation-logs.ts b/packages/backend/src/models/repositories/moderation-logs.ts index 3858b9509b..03f91c6f8e 100644 --- a/packages/backend/src/models/repositories/moderation-logs.ts +++ b/packages/backend/src/models/repositories/moderation-logs.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; -import { Users } from "../index.js"; import { ModerationLog } from "@/models/entities/moderation-log.js"; import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; export const ModerationLogRepository = db.getRepository(ModerationLog).extend({ async pack(src: ModerationLog["id"] | ModerationLog) { diff --git a/packages/backend/src/models/repositories/muting.ts b/packages/backend/src/models/repositories/muting.ts index 4d0201d5a0..29686c337d 100644 --- a/packages/backend/src/models/repositories/muting.ts +++ b/packages/backend/src/models/repositories/muting.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { Users } from "../index.js"; -import { Muting } from "@/models/entities/muting.js"; -import { awaitAll } from "@/prelude/await-all.js"; import type { Packed } from "@/misc/schema.js"; +import { Muting } from "@/models/entities/muting.js"; import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { Users } from "../index.js"; export const MutingRepository = db.getRepository(Muting).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note-favorite.ts b/packages/backend/src/models/repositories/note-favorite.ts index ba43e3c3b4..a472fb9367 100644 --- a/packages/backend/src/models/repositories/note-favorite.ts +++ b/packages/backend/src/models/repositories/note-favorite.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; import { NoteFavorite } from "@/models/entities/note-favorite.js"; -import { Notes } from "../index.js"; import type { User } from "@/models/entities/user.js"; +import { Notes } from "../index.js"; export const NoteFavoriteRepository = db.getRepository(NoteFavorite).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note-reaction.ts b/packages/backend/src/models/repositories/note-reaction.ts index 4075c7d43a..4c182b2438 100644 --- a/packages/backend/src/models/repositories/note-reaction.ts +++ b/packages/backend/src/models/repositories/note-reaction.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { NoteReaction } from "@/models/entities/note-reaction.js"; -import { Notes, Users } from "../index.js"; -import type { Packed } from "@/misc/schema.js"; import { decodeReaction } from "@/misc/reaction-lib.js"; +import type { Packed } from "@/misc/schema.js"; +import { NoteReaction } from "@/models/entities/note-reaction.js"; import type { User } from "@/models/entities/user.js"; +import { Notes, Users } from "../index.js"; export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 60e5a8d5ca..e946c30e04 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -1,28 +1,28 @@ -import { In } from "typeorm"; -import * as mfm from "mfm-js"; -import { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; -import { - Users, - PollVotes, - DriveFiles, - NoteReactions, - Followings, - Polls, - Channels, -} from "../index.js"; -import type { Packed } from "@/misc/schema.js"; +import { db } from "@/db/postgre.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; import { nyaize } from "@/misc/nyaize.js"; -import { awaitAll } from "@/prelude/await-all.js"; -import { convertReactions, decodeReaction } from "@/misc/reaction-lib.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; import { aggregateNoteEmojis, populateEmojis, prefetchEmojis, } from "@/misc/populate-emojis.js"; -import { db } from "@/db/postgre.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { convertReactions, decodeReaction } from "@/misc/reaction-lib.js"; +import type { Packed } from "@/misc/schema.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import { Note } from "@/models/entities/note.js"; +import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import * as mfm from "mfm-js"; +import { In } from "typeorm"; +import { + Channels, + DriveFiles, + Followings, + NoteReactions, + PollVotes, + Polls, + Users, +} from "../index.js"; export async function populatePoll(note: Note, meId: User["id"] | null) { const poll = await Polls.findOneByOrFail({ noteId: note.id }); diff --git a/packages/backend/src/models/repositories/notification.ts b/packages/backend/src/models/repositories/notification.ts index 90dfbd7397..9dd4934215 100644 --- a/packages/backend/src/models/repositories/notification.ts +++ b/packages/backend/src/models/repositories/notification.ts @@ -1,18 +1,18 @@ -import { In } from "typeorm"; -import { Notification } from "@/models/entities/notification.js"; -import { awaitAll } from "@/prelude/await-all.js"; -import type { Packed } from "@/misc/schema.js"; -import type { Note } from "@/models/entities/note.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import type { User } from "@/models/entities/user.js"; -import { aggregateNoteEmojis, prefetchEmojis } from "@/misc/populate-emojis.js"; import { db } from "@/db/postgre.js"; +import { aggregateNoteEmojis, prefetchEmojis } from "@/misc/populate-emojis.js"; +import type { Packed } from "@/misc/schema.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import type { Note } from "@/models/entities/note.js"; +import { Notification } from "@/models/entities/notification.js"; +import type { User } from "@/models/entities/user.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { In } from "typeorm"; import { - Users, - Notes, - UserGroupInvitations, AccessTokens, NoteReactions, + Notes, + UserGroupInvitations, + Users, } from "../index.js"; export const NotificationRepository = db.getRepository(Notification).extend({ diff --git a/packages/backend/src/models/repositories/page.ts b/packages/backend/src/models/repositories/page.ts index d9241c3629..0f335164bc 100644 --- a/packages/backend/src/models/repositories/page.ts +++ b/packages/backend/src/models/repositories/page.ts @@ -1,10 +1,10 @@ import { db } from "@/db/postgre.js"; -import { Page } from "@/models/entities/page.js"; import type { Packed } from "@/misc/schema.js"; -import { awaitAll } from "@/prelude/await-all.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; +import { Page } from "@/models/entities/page.js"; import type { User } from "@/models/entities/user.js"; -import { Users, DriveFiles, PageLikes } from "../index.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { DriveFiles, PageLikes, Users } from "../index.js"; export const PageRepository = db.getRepository(Page).extend({ async pack( diff --git a/packages/backend/src/models/repositories/user-group.ts b/packages/backend/src/models/repositories/user-group.ts index daec94490e..6a70f83d90 100644 --- a/packages/backend/src/models/repositories/user-group.ts +++ b/packages/backend/src/models/repositories/user-group.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; +import type { Packed } from "@/misc/schema.js"; import { UserGroup } from "@/models/entities/user-group.js"; import { UserGroupJoinings } from "../index.js"; -import type { Packed } from "@/misc/schema.js"; export const UserGroupRepository = db.getRepository(UserGroup).extend({ async pack(src: UserGroup["id"] | UserGroup): Promise> { diff --git a/packages/backend/src/models/repositories/user-list.ts b/packages/backend/src/models/repositories/user-list.ts index e3abeac3f6..33133a05d8 100644 --- a/packages/backend/src/models/repositories/user-list.ts +++ b/packages/backend/src/models/repositories/user-list.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; +import type { Packed } from "@/misc/schema.js"; import { UserList } from "@/models/entities/user-list.js"; import { UserListJoinings } from "../index.js"; -import type { Packed } from "@/misc/schema.js"; export const UserListRepository = db.getRepository(UserList).extend({ async pack(src: UserList["id"] | UserList): Promise> { diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index be1dbc4531..5061797767 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -1,41 +1,41 @@ -import { In, Not } from "typeorm"; -import Ajv from "ajv"; +import config from "@/config/index.js"; +import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "@/const.js"; +import { db } from "@/db/postgre.js"; +import { Cache } from "@/misc/cache.js"; +import { populateEmojis } from "@/misc/populate-emojis.js"; +import type { Packed } from "@/misc/schema.js"; import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; import { User } from "@/models/entities/user.js"; -import config from "@/config/index.js"; -import type { Packed } from "@/misc/schema.js"; import type { Promiseable } from "@/prelude/await-all.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { populateEmojis } from "@/misc/populate-emojis.js"; -import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "@/const.js"; -import { Cache } from "@/misc/cache.js"; -import { db } from "@/db/postgre.js"; -import { isActor, getApId } from "@/remote/activitypub/type.js"; import DbResolver from "@/remote/activitypub/db-resolver.js"; -import Resolver from "@/remote/activitypub/resolver.js"; import { createPerson } from "@/remote/activitypub/models/person.js"; +import Resolver from "@/remote/activitypub/resolver.js"; +import { getApId, isActor } from "@/remote/activitypub/type.js"; +import Ajv from "ajv"; +import { In, Not } from "typeorm"; +import type { Instance } from "../entities/instance.js"; import { AnnouncementReads, Announcements, Blockings, ChannelFollowings, DriveFiles, - Followings, FollowRequests, + Followings, Instances, MessagingMessages, Mutings, - RenoteMutings, - Notes, NoteUnreads, + Notes, Notifications, Pages, + RenoteMutings, UserGroupJoinings, UserNotePinings, UserProfiles, UserSecurityKeys, } from "../index.js"; -import type { Instance } from "../entities/instance.js"; const userInstanceCache = new Cache( "userInstance", diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index 0500737a48..051dd9681d 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -3,32 +3,32 @@ import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { IActivity } from "@/remote/activitypub/type.js"; import type { Webhook, webhookEventTypes } from "@/models/entities/webhook.js"; +import type { IActivity } from "@/remote/activitypub/type.js"; import { envOption } from "../env.js"; -import processDeliver from "./processors/deliver.js"; -import processInbox from "./processors/inbox.js"; +import { Note } from "@/models/entities/note.js"; +import { getJobInfo } from "./get-job-info.js"; +import { queueLogger } from "./logger.js"; +import processBackground from "./processors/background/index.js"; import processDb from "./processors/db/index.js"; +import processDeliver from "./processors/deliver.js"; +import { endedPollNotification } from "./processors/ended-poll-notification.js"; +import processInbox from "./processors/inbox.js"; import processObjectStorage from "./processors/object-storage/index.js"; import processSystemQueue from "./processors/system/index.js"; import processWebhookDeliver from "./processors/webhook-deliver.js"; -import processBackground from "./processors/background/index.js"; -import { endedPollNotification } from "./processors/ended-poll-notification.js"; -import { queueLogger } from "./logger.js"; -import { getJobInfo } from "./get-job-info.js"; import { - systemQueue, + backgroundQueue, dbQueue, deliverQueue, + endedPollNotificationQueue, inboxQueue, objectStorageQueue, - endedPollNotificationQueue, + systemQueue, webhookDeliverQueue, - backgroundQueue, } from "./queues.js"; import type { ThinUser } from "./types.js"; -import { Note } from "@/models/entities/note.js"; function renderError(e: Error): any { return { diff --git a/packages/backend/src/queue/initialize.ts b/packages/backend/src/queue/initialize.ts index 16e623d137..a85ab3963d 100644 --- a/packages/backend/src/queue/initialize.ts +++ b/packages/backend/src/queue/initialize.ts @@ -1,5 +1,5 @@ -import Bull from "bull"; import config from "@/config/index.js"; +import Bull from "bull"; export function initialize(name: string, limitPerSec = -1) { return new Bull(name, { diff --git a/packages/backend/src/queue/processors/background/index-all-notes.ts b/packages/backend/src/queue/processors/background/index-all-notes.ts index 262724cbd6..07a7b756d8 100644 --- a/packages/backend/src/queue/processors/background/index-all-notes.ts +++ b/packages/backend/src/queue/processors/background/index-all-notes.ts @@ -1,12 +1,12 @@ import type Bull from "bull"; import type { DoneCallback } from "bull"; -import { queueLogger } from "../../logger.js"; -import { Notes } from "@/models/index.js"; -import { MoreThan } from "typeorm"; -import { index } from "@/services/note/create.js"; -import { Note } from "@/models/entities/note.js"; import meilisearch from "@/db/meilisearch.js"; +import { Note } from "@/models/entities/note.js"; +import { Notes } from "@/models/index.js"; +import { index } from "@/services/note/create.js"; +import { MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("index-all-notes"); diff --git a/packages/backend/src/queue/processors/db/delete-account.ts b/packages/backend/src/queue/processors/db/delete-account.ts index adb93484bd..336db43322 100644 --- a/packages/backend/src/queue/processors/db/delete-account.ts +++ b/packages/backend/src/queue/processors/db/delete-account.ts @@ -1,13 +1,13 @@ -import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; +import meilisearch from "@/db/meilisearch.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Note } from "@/models/entities/note.js"; import { DriveFiles, Notes, UserProfiles, Users } from "@/models/index.js"; import type { DbUserDeleteJobData } from "@/queue/types.js"; -import type { Note } from "@/models/entities/note.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { MoreThan } from "typeorm"; import { deleteFileSync } from "@/services/drive/delete-file.js"; import { sendEmail } from "@/services/send-email.js"; -import meilisearch from "@/db/meilisearch.js"; +import type Bull from "bull"; +import { MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("delete-account"); diff --git a/packages/backend/src/queue/processors/db/delete-drive-files.ts b/packages/backend/src/queue/processors/db/delete-drive-files.ts index 28e4771329..8bff6382f8 100644 --- a/packages/backend/src/queue/processors/db/delete-drive-files.ts +++ b/packages/backend/src/queue/processors/db/delete-drive-files.ts @@ -1,10 +1,10 @@ import type Bull from "bull"; -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 { DriveFiles, Users } from "@/models/index.js"; import type { DbUserJobData } from "@/queue/types.js"; +import { deleteFileSync } from "@/services/drive/delete-file.js"; +import { MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("delete-drive-files"); diff --git a/packages/backend/src/queue/processors/db/export-blocking.ts b/packages/backend/src/queue/processors/db/export-blocking.ts index 90da76b872..75ba44d36c 100644 --- a/packages/backend/src/queue/processors/db/export-blocking.ts +++ b/packages/backend/src/queue/processors/db/export-blocking.ts @@ -1,14 +1,14 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; import { getFullApAccount } from "@/misc/convert-host.js"; import { createTemp } from "@/misc/create-temp.js"; -import { Users, Blockings } from "@/models/index.js"; -import { MoreThan } from "typeorm"; +import { Blockings, Users } from "@/models/index.js"; import type { DbUserJobData } from "@/queue/types.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-blocking"); diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index 86de43af42..a664bc59bc 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -1,16 +1,16 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import mime from "mime-types"; -import archiver from "archiver"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; -import { Users, Emojis } from "@/models/index.js"; +import config from "@/config/index.js"; import { createTemp, createTempDir } from "@/misc/create-temp.js"; import { downloadUrl } from "@/misc/download-url.js"; -import config from "@/config/index.js"; +import { Emojis, Users } from "@/models/index.js"; +import { addFile } from "@/services/drive/add-file.js"; +import archiver from "archiver"; +import { format as dateFormat } from "date-fns"; +import mime from "mime-types"; import { IsNull } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-custom-emojis"); diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index 80e8e6b925..0c8e432a67 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -1,15 +1,15 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; import { getFullApAccount } from "@/misc/convert-host.js"; import { createTemp } from "@/misc/create-temp.js"; -import { Users, Followings, Mutings } from "@/models/index.js"; -import { In, MoreThan, Not } from "typeorm"; -import type { DbUserJobData } from "@/queue/types.js"; import type { Following } from "@/models/entities/following.js"; +import { Followings, Mutings, Users } from "@/models/index.js"; +import type { DbUserJobData } from "@/queue/types.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { In, MoreThan, Not } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-following"); diff --git a/packages/backend/src/queue/processors/db/export-mute.ts b/packages/backend/src/queue/processors/db/export-mute.ts index 87b140b762..a0be219ad6 100644 --- a/packages/backend/src/queue/processors/db/export-mute.ts +++ b/packages/backend/src/queue/processors/db/export-mute.ts @@ -1,14 +1,14 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; import { getFullApAccount } from "@/misc/convert-host.js"; import { createTemp } from "@/misc/create-temp.js"; -import { Users, Mutings } from "@/models/index.js"; -import { IsNull, MoreThan } from "typeorm"; +import { Mutings, Users } from "@/models/index.js"; import type { DbUserJobData } from "@/queue/types.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { IsNull, MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-mute"); diff --git a/packages/backend/src/queue/processors/db/export-notes.ts b/packages/backend/src/queue/processors/db/export-notes.ts index bf53f83603..fb2e282cb3 100644 --- a/packages/backend/src/queue/processors/db/export-notes.ts +++ b/packages/backend/src/queue/processors/db/export-notes.ts @@ -1,15 +1,15 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; -import { Users, Notes, Polls, DriveFiles } from "@/models/index.js"; -import { MoreThan } from "typeorm"; +import { createTemp } from "@/misc/create-temp.js"; import type { Note } from "@/models/entities/note.js"; import type { Poll } from "@/models/entities/poll.js"; +import { DriveFiles, Notes, Polls, Users } from "@/models/index.js"; import type { DbUserJobData } from "@/queue/types.js"; -import { createTemp } from "@/misc/create-temp.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { MoreThan } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-notes"); diff --git a/packages/backend/src/queue/processors/db/export-user-lists.ts b/packages/backend/src/queue/processors/db/export-user-lists.ts index e0c9cd8f3f..860170065a 100644 --- a/packages/backend/src/queue/processors/db/export-user-lists.ts +++ b/packages/backend/src/queue/processors/db/export-user-lists.ts @@ -1,14 +1,14 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { addFile } from "@/services/drive/add-file.js"; -import { format as dateFormat } from "date-fns"; import { getFullApAccount } from "@/misc/convert-host.js"; import { createTemp } from "@/misc/create-temp.js"; -import { Users, UserLists, UserListJoinings } from "@/models/index.js"; -import { In } from "typeorm"; +import { UserListJoinings, UserLists, Users } from "@/models/index.js"; import type { DbUserJobData } from "@/queue/types.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { In } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-user-lists"); diff --git a/packages/backend/src/queue/processors/db/import-blocking.ts b/packages/backend/src/queue/processors/db/import-blocking.ts index 290c9dbceb..ff07ed1217 100644 --- a/packages/backend/src/queue/processors/db/import-blocking.ts +++ b/packages/backend/src/queue/processors/db/import-blocking.ts @@ -1,14 +1,14 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import * as Acct 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 { downloadTextFile } from "@/misc/download-text-file.js"; +import { DriveFiles, Users } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; +import { resolveUser } from "@/remote/resolve-user.js"; import block from "@/services/blocking/create.js"; import { IsNull } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-blocking"); diff --git a/packages/backend/src/queue/processors/db/import-custom-emojis.ts b/packages/backend/src/queue/processors/db/import-custom-emojis.ts index 9e8b3b174e..4f46f49c96 100644 --- a/packages/backend/src/queue/processors/db/import-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/import-custom-emojis.ts @@ -1,17 +1,17 @@ -import type Bull from "bull"; import * as fs from "node:fs"; import AdmZip from "adm-zip"; +import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; +import * as path from "path"; +import { db } from "@/db/postgre.js"; import { createTempDir } from "@/misc/create-temp.js"; import { downloadUrl } from "@/misc/download-url.js"; +import { genId } from "@/misc/gen-id.js"; import { DriveFiles, Emojis } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; import { addFile } from "@/services/drive/add-file.js"; -import { genId } from "@/misc/gen-id.js"; -import { db } from "@/db/postgre.js"; import probeImageSize from "probe-image-size"; -import * as path from "path"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-custom-emojis"); @@ -92,7 +92,7 @@ export async function importCustomEmojis( } else { logger.info("starting emoji import without metadata"); // Since we lack metadata, we import into a randomized category name instead - let categoryName = genId(); + const categoryName = genId(); let containedEmojis = fs.readdirSync(outputPath); diff --git a/packages/backend/src/queue/processors/db/import-firefish-post.ts b/packages/backend/src/queue/processors/db/import-firefish-post.ts index 4ec88d32cc..2c71c3d9f8 100644 --- a/packages/backend/src/queue/processors/db/import-firefish-post.ts +++ b/packages/backend/src/queue/processors/db/import-firefish-post.ts @@ -1,15 +1,15 @@ -import * as Post from "@/misc/post.js"; -import create from "@/services/note/create.js"; -import { Users } from "@/models/index.js"; -import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; -import { queueLogger } from "../../logger.js"; -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type Bull from "bull"; -import { createImportCkPostJob } from "@/queue/index.js"; -import { Notes, NoteEdits } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; import { genId } from "@/misc/gen-id.js"; +import * as Post from "@/misc/post.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Note } from "@/models/entities/note.js"; +import { Users } from "@/models/index.js"; +import { NoteEdits, Notes } from "@/models/index.js"; +import { createImportCkPostJob } from "@/queue/index.js"; +import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; +import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import create from "@/services/note/create.js"; +import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-firefish-post"); @@ -39,7 +39,7 @@ export async function importCkPost( */ const urls = (post.files || []) .map((x: any) => x.url) - .filter((x: String) => x.startsWith("http")); + .filter((x: string) => x.startsWith("http")); const files: DriveFile[] = []; for (const url of urls) { try { diff --git a/packages/backend/src/queue/processors/db/import-following.ts b/packages/backend/src/queue/processors/db/import-following.ts index b1a7cd2c9b..1789c8e9b7 100644 --- a/packages/backend/src/queue/processors/db/import-following.ts +++ b/packages/backend/src/queue/processors/db/import-following.ts @@ -1,14 +1,14 @@ -import { IsNull } from "typeorm"; import follow from "@/services/following/create.js"; +import { IsNull } from "typeorm"; import * as Acct 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 { downloadTextFile } from "@/misc/download-text-file.js"; +import { DriveFiles, Users } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; -import { queueLogger } from "../../logger.js"; +import { resolveUser } from "@/remote/resolve-user.js"; import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-following"); diff --git a/packages/backend/src/queue/processors/db/import-masto-post.ts b/packages/backend/src/queue/processors/db/import-masto-post.ts index c484ac0e17..f775e388f2 100644 --- a/packages/backend/src/queue/processors/db/import-masto-post.ts +++ b/packages/backend/src/queue/processors/db/import-masto-post.ts @@ -1,15 +1,15 @@ -import create from "@/services/note/create.js"; +import { genId } from "@/misc/gen-id.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Note } from "@/models/entities/note.js"; import { Users } from "@/models/index.js"; +import { NoteEdits, Notes } from "@/models/index.js"; import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; -import { queueLogger } from "../../logger.js"; -import type Bull from "bull"; import { htmlToMfm } from "@/remote/activitypub/misc/html-to-mfm.js"; import { resolveNote } from "@/remote/activitypub/models/note.js"; import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { Notes, NoteEdits } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; -import { genId } from "@/misc/gen-id.js"; +import create from "@/services/note/create.js"; +import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-masto-post"); @@ -55,7 +55,7 @@ export async function importMastoPost( if (files.length == 0) { const urls = post.object.attachment .map((x: any) => x.url) - .filter((x: String) => x.startsWith("http")); + .filter((x: string) => x.startsWith("http")); files = []; for (const url of urls) { try { diff --git a/packages/backend/src/queue/processors/db/import-muting.ts b/packages/backend/src/queue/processors/db/import-muting.ts index 80e0567397..7ff4fad96f 100644 --- a/packages/backend/src/queue/processors/db/import-muting.ts +++ b/packages/backend/src/queue/processors/db/import-muting.ts @@ -1,15 +1,15 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import * as Acct 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, Mutings } from "@/models/index.js"; -import type { DbUserImportJobData } from "@/queue/types.js"; -import type { User } from "@/models/entities/user.js"; +import { downloadTextFile } from "@/misc/download-text-file.js"; import { genId } from "@/misc/gen-id.js"; +import type { User } from "@/models/entities/user.js"; +import { DriveFiles, Mutings, Users } from "@/models/index.js"; +import type { DbUserImportJobData } from "@/queue/types.js"; +import { resolveUser } from "@/remote/resolve-user.js"; import { IsNull } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-muting"); diff --git a/packages/backend/src/queue/processors/db/import-posts.ts b/packages/backend/src/queue/processors/db/import-posts.ts index 526489c634..273b61778c 100644 --- a/packages/backend/src/queue/processors/db/import-posts.ts +++ b/packages/backend/src/queue/processors/db/import-posts.ts @@ -1,13 +1,13 @@ import { downloadTextFile } from "@/misc/download-text-file.js"; import { processMastoNotes } from "@/misc/process-masto-notes.js"; -import { Users, DriveFiles } from "@/models/index.js"; -import type { DbUserImportPostsJobData } from "@/queue/types.js"; -import { queueLogger } from "../../logger.js"; -import type Bull from "bull"; +import { DriveFiles, Users } from "@/models/index.js"; import { createImportCkPostJob, createImportMastoPostJob, } from "@/queue/index.js"; +import type { DbUserImportPostsJobData } from "@/queue/types.js"; +import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-posts"); diff --git a/packages/backend/src/queue/processors/db/import-user-lists.ts b/packages/backend/src/queue/processors/db/import-user-lists.ts index 0c23f06991..4ba5d8a63e 100644 --- a/packages/backend/src/queue/processors/db/import-user-lists.ts +++ b/packages/backend/src/queue/processors/db/import-user-lists.ts @@ -1,20 +1,20 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import * as Acct 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 { downloadTextFile } from "@/misc/download-text-file.js"; +import { genId } from "@/misc/gen-id.js"; import { DriveFiles, - Users, - UserLists, UserListJoinings, + UserLists, + Users, } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; import type { DbUserImportJobData } from "@/queue/types.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { pushUserToUserList } from "@/services/user-list/push.js"; import { IsNull } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-user-lists"); diff --git a/packages/backend/src/queue/processors/db/index.ts b/packages/backend/src/queue/processors/db/index.ts index d20fc2c71a..1245e08c7f 100644 --- a/packages/backend/src/queue/processors/db/index.ts +++ b/packages/backend/src/queue/processors/db/index.ts @@ -1,21 +1,21 @@ -import type Bull from "bull"; import type { DbJobData } from "@/queue/types.js"; +import type Bull from "bull"; +import { deleteAccount } from "./delete-account.js"; import { deleteDriveFiles } from "./delete-drive-files.js"; +import { exportBlocking } from "./export-blocking.js"; import { exportCustomEmojis } from "./export-custom-emojis.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 { exportNotes } from "./export-notes.js"; import { exportUserLists } from "./export-user-lists.js"; -import { importFollowing } from "./import-following.js"; -import { importUserLists } from "./import-user-lists.js"; -import { deleteAccount } from "./delete-account.js"; -import { importMuting } from "./import-muting.js"; -import { importPosts } from "./import-posts.js"; -import { importMastoPost } from "./import-masto-post.js"; -import { importCkPost } from "./import-firefish-post.js"; import { importBlocking } from "./import-blocking.js"; import { importCustomEmojis } from "./import-custom-emojis.js"; +import { importCkPost } from "./import-firefish-post.js"; +import { importFollowing } from "./import-following.js"; +import { importMastoPost } from "./import-masto-post.js"; +import { importMuting } from "./import-muting.js"; +import { importPosts } from "./import-posts.js"; +import { importUserLists } from "./import-user-lists.js"; const jobs = { deleteDriveFiles, diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index 65471a559f..5d2a7e49af 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -1,18 +1,18 @@ import { URL } from "node:url"; -import request from "@/remote/activitypub/request.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import Logger from "@/services/logger.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { StatusError } from "@/misc/fetch.js"; +import { shouldSkipInstance } from "@/misc/skipped-instances.js"; import { Instances } from "@/models/index.js"; +import type { DeliverJobData } from "@/queue/types.js"; +import request from "@/remote/activitypub/request.js"; import { apRequestChart, federationChart, instanceChart, } from "@/services/chart/index.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; -import { toPuny } from "@/misc/convert-host.js"; -import { StatusError } from "@/misc/fetch.js"; -import { shouldSkipInstance } from "@/misc/skipped-instances.js"; -import type { DeliverJobData } from "@/queue/types.js"; +import Logger from "@/services/logger.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import type Bull from "bull"; const logger = new Logger("deliver"); diff --git a/packages/backend/src/queue/processors/ended-poll-notification.ts b/packages/backend/src/queue/processors/ended-poll-notification.ts index f93b067b8a..140b315e87 100644 --- a/packages/backend/src/queue/processors/ended-poll-notification.ts +++ b/packages/backend/src/queue/processors/ended-poll-notification.ts @@ -1,9 +1,9 @@ -import type Bull from "bull"; import { Notes, PollVotes } from "@/models/index.js"; // import { queueLogger } from "../logger.js"; import type { EndedPollNotificationJobData } from "@/queue/types.js"; import { createNotification } from "@/services/create-notification.js"; import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; +import type Bull from "bull"; // unused // const logger = queueLogger.createSubLogger("ended-poll-notification"); diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index 116f279ac3..71cf7d458a 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -1,28 +1,28 @@ import { URL } from "node:url"; -import type Bull from "bull"; -import httpSignature from "@peertube/http-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 { extractDbHost, toPuny } from "@/misc/convert-host.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { StatusError } from "@/misc/fetch.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Instances } from "@/models/index.js"; +import { verifySignature } from "@/remote/activitypub/check-fetch.js"; +import DbResolver from "@/remote/activitypub/db-resolver.js"; +import { LdSignature } from "@/remote/activitypub/misc/ld-signature.js"; +import { resolvePerson } from "@/remote/activitypub/models/person.js"; +import perform from "@/remote/activitypub/perform.js"; +import { getApId } from "@/remote/activitypub/type.js"; import { apRequestChart, federationChart, 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 Logger from "@/services/logger.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import httpSignature from "@peertube/http-signature"; +import type Bull from "bull"; import type { 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"; -import { StatusError } from "@/misc/fetch.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import { verifySignature } from "@/remote/activitypub/check-fetch.js"; const logger = new Logger("inbox"); diff --git a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts index 14ad1b1014..6d9ef9557d 100644 --- a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts +++ b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts @@ -1,9 +1,9 @@ import type Bull from "bull"; -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"; +import { deleteFileSync } from "@/services/drive/delete-file.js"; +import { IsNull, MoreThan, Not } from "typeorm"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("clean-remote-files"); diff --git a/packages/backend/src/queue/processors/object-storage/delete-file.ts b/packages/backend/src/queue/processors/object-storage/delete-file.ts index 174aa1906c..761c83cab6 100644 --- a/packages/backend/src/queue/processors/object-storage/delete-file.ts +++ b/packages/backend/src/queue/processors/object-storage/delete-file.ts @@ -1,6 +1,6 @@ import type { ObjectStorageFileJobData } from "@/queue/types.js"; -import type Bull from "bull"; import { deleteObjectStorageFile } from "@/services/drive/delete-file.js"; +import type Bull from "bull"; export default async (job: Bull.Job) => { const key: string = job.data.key; diff --git a/packages/backend/src/queue/processors/object-storage/index.ts b/packages/backend/src/queue/processors/object-storage/index.ts index 5f90d4cd09..255ff9f251 100644 --- a/packages/backend/src/queue/processors/object-storage/index.ts +++ b/packages/backend/src/queue/processors/object-storage/index.ts @@ -1,7 +1,7 @@ -import type Bull from "bull"; import type { ObjectStorageJobData } from "@/queue/types.js"; -import deleteFile from "./delete-file.js"; +import type Bull from "bull"; import cleanRemoteFiles from "./clean-remote-files.js"; +import deleteFile from "./delete-file.js"; const jobs = { deleteFile, diff --git a/packages/backend/src/queue/processors/system/check-expired-mutings.ts b/packages/backend/src/queue/processors/system/check-expired-mutings.ts index a482d0218a..17715fb4e1 100644 --- a/packages/backend/src/queue/processors/system/check-expired-mutings.ts +++ b/packages/backend/src/queue/processors/system/check-expired-mutings.ts @@ -1,8 +1,8 @@ +import { Mutings } from "@/models/index.js"; +import { publishUserEvent } from "@/services/stream.js"; import type Bull from "bull"; import { In } from "typeorm"; -import { Mutings } from "@/models/index.js"; import { queueLogger } from "../../logger.js"; -import { publishUserEvent } from "@/services/stream.js"; const logger = queueLogger.createSubLogger("check-expired-mutings"); diff --git a/packages/backend/src/queue/processors/system/clean-charts.ts b/packages/backend/src/queue/processors/system/clean-charts.ts index dde5d95fe3..318a0ead33 100644 --- a/packages/backend/src/queue/processors/system/clean-charts.ts +++ b/packages/backend/src/queue/processors/system/clean-charts.ts @@ -1,8 +1,8 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import { activeUsersChart, + apRequestChart, driveChart, federationChart, hashtagChart, @@ -13,8 +13,8 @@ import { perUserNotesChart, perUserReactionsChart, usersChart, - apRequestChart, } from "@/services/chart/index.js"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("clean-charts"); diff --git a/packages/backend/src/queue/processors/system/clean.ts b/packages/backend/src/queue/processors/system/clean.ts index fbd45b0bb9..8f46c43f45 100644 --- a/packages/backend/src/queue/processors/system/clean.ts +++ b/packages/backend/src/queue/processors/system/clean.ts @@ -1,6 +1,6 @@ +import { UserIps } from "@/models/index.js"; import type Bull from "bull"; import { LessThan } from "typeorm"; -import { UserIps } from "@/models/index.js"; import { queueLogger } from "../../logger.js"; diff --git a/packages/backend/src/queue/processors/system/index.ts b/packages/backend/src/queue/processors/system/index.ts index 697d24d067..207a2ed6d1 100644 --- a/packages/backend/src/queue/processors/system/index.ts +++ b/packages/backend/src/queue/processors/system/index.ts @@ -1,10 +1,10 @@ import type Bull from "bull"; -import { tickCharts } from "./tick-charts.js"; -import { resyncCharts } from "./resync-charts.js"; -import { cleanCharts } from "./clean-charts.js"; import { checkExpiredMutings } from "./check-expired-mutings.js"; +import { cleanCharts } from "./clean-charts.js"; import { clean } from "./clean.js"; import { setLocalEmojiSizes } from "./local-emoji-size.js"; +import { resyncCharts } from "./resync-charts.js"; +import { tickCharts } from "./tick-charts.js"; import { verifyLinks } from "./verify-links.js"; const jobs = { diff --git a/packages/backend/src/queue/processors/system/local-emoji-size.ts b/packages/backend/src/queue/processors/system/local-emoji-size.ts index d696bbd863..94f1693e56 100644 --- a/packages/backend/src/queue/processors/system/local-emoji-size.ts +++ b/packages/backend/src/queue/processors/system/local-emoji-size.ts @@ -1,9 +1,9 @@ +import { Emojis } from "@/models/index.js"; import type Bull from "bull"; import { IsNull } from "typeorm"; -import { Emojis } from "@/models/index.js"; -import { queueLogger } from "../../logger.js"; import { getEmojiSize } from "@/misc/emoji-meta.js"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("local-emoji-size"); diff --git a/packages/backend/src/queue/processors/system/resync-charts.ts b/packages/backend/src/queue/processors/system/resync-charts.ts index dbea0df733..bba1472d48 100644 --- a/packages/backend/src/queue/processors/system/resync-charts.ts +++ b/packages/backend/src/queue/processors/system/resync-charts.ts @@ -1,7 +1,7 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import { driveChart, notesChart, usersChart } from "@/services/chart/index.js"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("resync-charts"); diff --git a/packages/backend/src/queue/processors/system/tick-charts.ts b/packages/backend/src/queue/processors/system/tick-charts.ts index 33eed8a596..901bda8881 100644 --- a/packages/backend/src/queue/processors/system/tick-charts.ts +++ b/packages/backend/src/queue/processors/system/tick-charts.ts @@ -1,8 +1,8 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; import { activeUsersChart, + apRequestChart, driveChart, federationChart, hashtagChart, @@ -13,8 +13,8 @@ import { perUserNotesChart, perUserReactionsChart, usersChart, - apRequestChart, } from "@/services/chart/index.js"; +import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("tick-charts"); diff --git a/packages/backend/src/queue/processors/system/verify-links.ts b/packages/backend/src/queue/processors/system/verify-links.ts index 4ee88c6310..b2c1d65b82 100644 --- a/packages/backend/src/queue/processors/system/verify-links.ts +++ b/packages/backend/src/queue/processors/system/verify-links.ts @@ -1,9 +1,9 @@ import type Bull from "bull"; import { UserProfiles } from "@/models/index.js"; +import { verifyLink } from "@/services/fetch-rel-me.js"; import { Not } from "typeorm"; import { queueLogger } from "../../logger.js"; -import { verifyLink } from "@/services/fetch-rel-me.js"; const logger = queueLogger.createSubLogger("verify-links"); diff --git a/packages/backend/src/queue/processors/webhook-deliver.ts b/packages/backend/src/queue/processors/webhook-deliver.ts index 12c9a05498..19f0aec3c5 100644 --- a/packages/backend/src/queue/processors/webhook-deliver.ts +++ b/packages/backend/src/queue/processors/webhook-deliver.ts @@ -1,9 +1,9 @@ -import type Bull from "bull"; -import Logger from "@/services/logger.js"; -import type { WebhookDeliverJobData } from "../types.js"; -import { getResponse, StatusError } from "@/misc/fetch.js"; -import { Webhooks } from "@/models/index.js"; import config from "@/config/index.js"; +import { StatusError, getResponse } from "@/misc/fetch.js"; +import { Webhooks } from "@/models/index.js"; +import Logger from "@/services/logger.js"; +import type Bull from "bull"; +import type { WebhookDeliverJobData } from "../types.js"; const logger = new Logger("webhook"); diff --git a/packages/backend/src/queue/queues.ts b/packages/backend/src/queue/queues.ts index 6b0eb2de42..174a67af3c 100644 --- a/packages/backend/src/queue/queues.ts +++ b/packages/backend/src/queue/queues.ts @@ -1,11 +1,11 @@ import config from "@/config/index.js"; import { initialize as initializeQueue } from "./initialize.js"; import type { - DeliverJobData, - InboxJobData, DbJobData, - ObjectStorageJobData, + DeliverJobData, EndedPollNotificationJobData, + InboxJobData, + ObjectStorageJobData, WebhookDeliverJobData, } from "./types.js"; diff --git a/packages/backend/src/remote/activitypub/audience.ts b/packages/backend/src/remote/activitypub/audience.ts index 9d840bc574..6a45581e66 100644 --- a/packages/backend/src/remote/activitypub/audience.ts +++ b/packages/backend/src/remote/activitypub/audience.ts @@ -1,13 +1,13 @@ -import type { ApObject } from "./type.js"; -import { getApIds } from "./type.js"; -import type Resolver from "./resolver.js"; -import { resolvePerson } from "./models/person.js"; -import { unique, concat } from "@/prelude/array.js"; -import promiseLimit from "promise-limit"; import type { CacheableRemoteUser, CacheableUser, } from "@/models/entities/user.js"; +import { concat, unique } from "@/prelude/array.js"; +import promiseLimit from "promise-limit"; +import { resolvePerson } from "./models/person.js"; +import type Resolver from "./resolver.js"; +import type { ApObject } from "./type.js"; +import { getApIds } from "./type.js"; type Visibility = "public" | "home" | "followers" | "specified"; diff --git a/packages/backend/src/remote/activitypub/check-fetch.ts b/packages/backend/src/remote/activitypub/check-fetch.ts index ab46d97f85..77ba795253 100644 --- a/packages/backend/src/remote/activitypub/check-fetch.ts +++ b/packages/backend/src/remote/activitypub/check-fetch.ts @@ -1,17 +1,17 @@ +import type { IncomingMessage } from "http"; +import { verify } from "node:crypto"; +import { createHash } from "node:crypto"; import { URL } from "url"; -import httpSignature, { IParsedSignature } from "@peertube/http-signature"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { toPuny } from "@/misc/convert-host.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { toSingle } from "@/prelude/array.js"; import DbResolver from "@/remote/activitypub/db-resolver.js"; import { getApId } from "@/remote/activitypub/type.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import type { IncomingMessage } from "http"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; -import { verify } from "node:crypto"; -import { toSingle } from "@/prelude/array.js"; -import { createHash } from "node:crypto"; +import httpSignature, { IParsedSignature } from "@peertube/http-signature"; export async function hasSignature(req: IncomingMessage): Promise { const meta = await fetchMeta(); diff --git a/packages/backend/src/remote/activitypub/db-resolver.ts b/packages/backend/src/remote/activitypub/db-resolver.ts index a753606a14..a25662b672 100644 --- a/packages/backend/src/remote/activitypub/db-resolver.ts +++ b/packages/backend/src/remote/activitypub/db-resolver.ts @@ -1,23 +1,23 @@ -import escapeRegexp from "escape-regexp"; import config from "@/config/index.js"; +import { Cache } from "@/misc/cache.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import type { Note } from "@/models/entities/note.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; import type { CacheableRemoteUser, CacheableUser, } from "@/models/entities/user.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { - Notes, - Users, - UserPublickeys, MessagingMessages, + Notes, + UserPublickeys, + Users, } from "@/models/index.js"; -import { Cache } from "@/misc/cache.js"; import { uriPersonCache, userByIdCache } from "@/services/user-cache.js"; +import escapeRegexp from "escape-regexp"; +import { resolvePerson, updatePerson } from "./models/person.js"; import type { IObject } from "./type.js"; import { getApId } from "./type.js"; -import { resolvePerson, updatePerson } from "./models/person.js"; const publicKeyCache = new Cache("publicKey", 60 * 30); const publicKeyByUserIdCache = new Cache( diff --git a/packages/backend/src/remote/activitypub/deliver-manager.ts b/packages/backend/src/remote/activitypub/deliver-manager.ts index c97d1c99ae..023a2774fa 100644 --- a/packages/backend/src/remote/activitypub/deliver-manager.ts +++ b/packages/backend/src/remote/activitypub/deliver-manager.ts @@ -1,8 +1,8 @@ -import { IsNull, Not } from "typeorm"; -import { Users, Followings } from "@/models/index.js"; -import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; -import { deliver } from "@/queue/index.js"; import { skippedInstances } from "@/misc/skipped-instances.js"; +import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { Followings, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import { IsNull, Not } from "typeorm"; //#region types interface IRecipe { diff --git a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts index e430bbf576..fc9a475546 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import accept from "@/services/following/requests/accept.js"; -import type { IFollow } from "../../type.js"; -import DbResolver from "../../db-resolver.js"; import { relayAccepted } from "@/services/relay.js"; +import DbResolver from "../../db-resolver.js"; +import type { IFollow } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/accept/index.ts b/packages/backend/src/remote/activitypub/kernel/accept/index.ts index 5c73760ff3..42c4dcb3a0 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/index.ts @@ -1,9 +1,9 @@ -import Resolver from "../../resolver.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import acceptFollow from "./follow.js"; -import type { IAccept } from "../../type.js"; -import { isFollow, getApType } from "../../type.js"; import { apLogger } from "../../logger.js"; +import Resolver from "../../resolver.js"; +import type { IAccept } from "../../type.js"; +import { getApType, isFollow } from "../../type.js"; +import acceptFollow from "./follow.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/add/index.ts b/packages/backend/src/remote/activitypub/kernel/add/index.ts index b3606e5d93..1ef49ed77a 100644 --- a/packages/backend/src/remote/activitypub/kernel/add/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/add/index.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { IAdd } from "../../type.js"; -import { resolveNote } from "../../models/note.js"; import { addPinned } from "@/services/i/pin.js"; +import { resolveNote } from "../../models/note.js"; +import type { IAdd } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/announce/index.ts b/packages/backend/src/remote/activitypub/kernel/announce/index.ts index 975e070f92..f3e85135d8 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/index.ts @@ -1,9 +1,9 @@ -import Resolver from "../../resolver.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import announceNote from "./note.js"; +import { apLogger } from "../../logger.js"; +import Resolver from "../../resolver.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; -import { apLogger } from "../../logger.js"; +import announceNote from "./note.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index 50b59932cf..e62cdd204d 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -1,16 +1,16 @@ -import type Resolver from "../../resolver.js"; -import post from "@/services/note/create.js"; +import { getApLock } from "@/misc/app-lock.js"; +import { extractDbHost } from "@/misc/convert-host.js"; +import { StatusError } from "@/misc/fetch.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { Notes } from "@/models/index.js"; +import post from "@/services/note/create.js"; +import { parseAudience } from "../../audience.js"; +import { apLogger } from "../../logger.js"; +import { fetchNote, resolveNote } from "../../models/note.js"; +import type Resolver from "../../resolver.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; -import { fetchNote, resolveNote } from "../../models/note.js"; -import { apLogger } from "../../logger.js"; -import { extractDbHost } from "@/misc/convert-host.js"; -import { getApLock } from "@/misc/app-lock.js"; -import { parseAudience } from "../../audience.js"; -import { StatusError } from "@/misc/fetch.js"; -import { Notes } from "@/models/index.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/block/index.ts b/packages/backend/src/remote/activitypub/kernel/block/index.ts index 4dc868ba10..96d11c1a1a 100644 --- a/packages/backend/src/remote/activitypub/kernel/block/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/block/index.ts @@ -1,8 +1,8 @@ -import type { IBlock } from "../../type.js"; -import block from "@/services/blocking/create.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import DbResolver from "../../db-resolver.js"; import { Users } from "@/models/index.js"; +import block from "@/services/blocking/create.js"; +import DbResolver from "../../db-resolver.js"; +import type { IBlock } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/create/index.ts b/packages/backend/src/remote/activitypub/kernel/create/index.ts index 3dcf648247..96dfd6761c 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/index.ts @@ -1,10 +1,10 @@ -import Resolver from "../../resolver.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import createNote from "./note.js"; -import type { ICreate } from "../../type.js"; -import { getApId, isPost, getApType } from "../../type.js"; +import { concat, toArray, unique } from "@/prelude/array.js"; import { apLogger } from "../../logger.js"; -import { toArray, concat, unique } from "@/prelude/array.js"; +import Resolver from "../../resolver.js"; +import type { ICreate } from "../../type.js"; +import { getApId, getApType, isPost } from "../../type.js"; +import createNote from "./note.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index 92b0ffb1e0..f0b3d177a7 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -1,11 +1,11 @@ -import type Resolver from "../../resolver.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { createNote, fetchNote } from "../../models/note.js"; -import type { IObject, ICreate } from "../../type.js"; -import { getApId } from "../../type.js"; import { getApLock } from "@/misc/app-lock.js"; import { extractDbHost } from "@/misc/convert-host.js"; import { StatusError } from "@/misc/fetch.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { createNote, fetchNote } from "../../models/note.js"; +import type Resolver from "../../resolver.js"; +import type { ICreate, IObject } from "../../type.js"; +import { getApId } from "../../type.js"; /** * Handle post creation activity diff --git a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts index 83c6442dde..da8965415e 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts @@ -1,7 +1,7 @@ -import { apLogger } from "../../logger.js"; -import { createDeleteAccountJob } from "@/queue/index.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import { createDeleteAccountJob } from "@/queue/index.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/delete/index.ts b/packages/backend/src/remote/activitypub/kernel/delete/index.ts index f9ad52de54..54cc691bdc 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/index.ts @@ -1,9 +1,9 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { toSingle } from "@/prelude/array.js"; -import { getApId, isTombstone, validPost, validActor } from "../../type.js"; -import deleteNote from "./note.js"; -import { deleteActor } from "./actor.js"; +import { getApId, isTombstone, validActor, validPost } from "../../type.js"; import type { IDelete, IObject } from "../../type.js"; +import { deleteActor } from "./actor.js"; +import deleteNote from "./note.js"; /** * Handle delete activity diff --git a/packages/backend/src/remote/activitypub/kernel/delete/note.ts b/packages/backend/src/remote/activitypub/kernel/delete/note.ts index 4656480c2f..273be837b8 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/note.ts @@ -1,9 +1,9 @@ -import type { CacheableRemoteUser } 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 type { CacheableRemoteUser } from "@/models/entities/user.js"; import { deleteMessage } from "@/services/messages/delete.js"; +import deleteNode from "@/services/note/delete.js"; +import DbResolver from "../../db-resolver.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/flag/index.ts b/packages/backend/src/remote/activitypub/kernel/flag/index.ts index 39ba8b3f4f..6e9452d01a 100644 --- a/packages/backend/src/remote/activitypub/kernel/flag/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/flag/index.ts @@ -1,10 +1,10 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; import config from "@/config/index.js"; -import type { IFlag } from "../../type.js"; -import { getApIds } from "../../type.js"; +import { genId } from "@/misc/gen-id.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { AbuseUserReports, Users } from "@/models/index.js"; import { In } from "typeorm"; -import { genId } from "@/misc/gen-id.js"; +import type { IFlag } from "../../type.js"; +import { getApIds } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/follow.ts b/packages/backend/src/remote/activitypub/kernel/follow.ts index 1c1ef36cfa..610608b541 100644 --- a/packages/backend/src/remote/activitypub/kernel/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/follow.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import follow from "@/services/following/create.js"; -import type { IFollow } from "../type.js"; import DbResolver from "../db-resolver.js"; +import type { IFollow } from "../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/index.ts b/packages/backend/src/remote/activitypub/kernel/index.ts index a90ac02345..225c57d4ff 100644 --- a/packages/backend/src/remote/activitypub/kernel/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/index.ts @@ -1,45 +1,45 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { toArray } from "@/prelude/array.js"; -import { - isCreate, - isDelete, - isUpdate, - isRead, - isFollow, - isAccept, - isReject, - isAdd, - isRemove, - isAnnounce, - isLike, - isUndo, - isBlock, - isCollectionOrOrderedCollection, - isCollection, - isFlag, - isMove, - getApId, -} from "../type.js"; -import { apLogger } from "../logger.js"; -import Resolver from "../resolver.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 move from "./move/index.js"; -import type { IObject, IActivity } from "../type.js"; import { extractDbHost } from "@/misc/convert-host.js"; import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { toArray } from "@/prelude/array.js"; +import { apLogger } from "../logger.js"; +import Resolver from "../resolver.js"; +import { + getApId, + isAccept, + isAdd, + isAnnounce, + isBlock, + isCollection, + isCollectionOrOrderedCollection, + isCreate, + isDelete, + isFlag, + isFollow, + isLike, + isMove, + isRead, + isReject, + isRemove, + isUndo, + isUpdate, +} from "../type.js"; +import type { IActivity, IObject } from "../type.js"; +import accept from "./accept/index.js"; +import add from "./add/index.js"; +import announce from "./announce/index.js"; +import block from "./block/index.js"; +import create from "./create/index.js"; +import performDeleteActivity from "./delete/index.js"; +import flag from "./flag/index.js"; +import follow from "./follow.js"; +import like from "./like.js"; +import move from "./move/index.js"; +import { performReadActivity } from "./read.js"; +import reject from "./reject/index.js"; +import remove from "./remove/index.js"; +import undo from "./undo/index.js"; +import performUpdateActivity from "./update/index.js"; export async function performActivity( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/like.ts b/packages/backend/src/remote/activitypub/kernel/like.ts index 7b30d1cd54..e4dfe80eef 100644 --- a/packages/backend/src/remote/activitypub/kernel/like.ts +++ b/packages/backend/src/remote/activitypub/kernel/like.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import create from "@/services/note/reaction/create.js"; +import { extractEmojis, fetchNote } from "../models/note.js"; import type { ILike } from "../type.js"; import { getApId } from "../type.js"; -import create from "@/services/note/reaction/create.js"; -import { fetchNote, extractEmojis } from "../models/note.js"; export default async (actor: CacheableRemoteUser, activity: ILike) => { const targetUri = getApId(activity.object); diff --git a/packages/backend/src/remote/activitypub/kernel/read.ts b/packages/backend/src/remote/activitypub/kernel/read.ts index 53fa7fe63b..91f3276ec7 100644 --- a/packages/backend/src/remote/activitypub/kernel/read.ts +++ b/packages/backend/src/remote/activitypub/kernel/read.ts @@ -1,9 +1,9 @@ +import { extractDbHost, isSelfHost } from "@/misc/convert-host.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { IRead } from "../type.js"; -import { 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"; +import type { IRead } from "../type.js"; +import { getApId } from "../type.js"; export const performReadActivity = async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/reject/follow.ts b/packages/backend/src/remote/activitypub/kernel/reject/follow.ts index 670c1556fd..9943844257 100644 --- a/packages/backend/src/remote/activitypub/kernel/reject/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/reject/follow.ts @@ -1,9 +1,9 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { remoteReject } from "@/services/following/reject.js"; -import type { IFollow } from "../../type.js"; -import DbResolver from "../../db-resolver.js"; -import { relayRejected } from "@/services/relay.js"; import { Users } from "@/models/index.js"; +import { remoteReject } from "@/services/following/reject.js"; +import { relayRejected } from "@/services/relay.js"; +import DbResolver from "../../db-resolver.js"; +import type { IFollow } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/reject/index.ts b/packages/backend/src/remote/activitypub/kernel/reject/index.ts index 10edb0f7a2..dd5465b0c6 100644 --- a/packages/backend/src/remote/activitypub/kernel/reject/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/reject/index.ts @@ -1,9 +1,9 @@ -import Resolver from "../../resolver.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import rejectFollow from "./follow.js"; -import type { IReject } from "../../type.js"; -import { isFollow, getApType } from "../../type.js"; import { apLogger } from "../../logger.js"; +import Resolver from "../../resolver.js"; +import type { IReject } from "../../type.js"; +import { getApType, isFollow } from "../../type.js"; +import rejectFollow from "./follow.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/remove/index.ts b/packages/backend/src/remote/activitypub/kernel/remove/index.ts index 0b4be6b5f2..f8478b7c72 100644 --- a/packages/backend/src/remote/activitypub/kernel/remove/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/remove/index.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { IRemove } from "../../type.js"; -import { resolveNote } from "../../models/note.js"; import { removePinned } from "@/services/i/pin.js"; +import { resolveNote } from "../../models/note.js"; +import type { IRemove } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts index 7cf457046a..6e33661961 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts @@ -1,8 +1,8 @@ -import unfollow from "@/services/following/delete.js"; -import type { IAccept } from "../../type.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Followings } from "@/models/index.js"; +import unfollow from "@/services/following/delete.js"; import DbResolver from "../../db-resolver.js"; +import type { IAccept } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts index a6e9c88c61..121e73ceb4 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts @@ -1,8 +1,8 @@ -import { Notes } from "@/models/index.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { Notes } from "@/models/index.js"; +import deleteNote from "@/services/note/delete.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; -import deleteNote from "@/services/note/delete.js"; export const undoAnnounce = async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/block.ts b/packages/backend/src/remote/activitypub/kernel/undo/block.ts index b4e1d8ee43..302edbad9e 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/block.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/block.ts @@ -1,8 +1,8 @@ -import type { IBlock } from "../../type.js"; -import unblock from "@/services/blocking/delete.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import DbResolver from "../../db-resolver.js"; import { Users } from "@/models/index.js"; +import unblock from "@/services/blocking/delete.js"; +import DbResolver from "../../db-resolver.js"; +import type { IBlock } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts index 1c4648cf90..9bc7728679 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts @@ -1,9 +1,9 @@ -import unfollow from "@/services/following/delete.js"; -import cancelRequest from "@/services/following/requests/cancel.js"; -import type { IFollow } from "../../type.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { FollowRequests, Followings } from "@/models/index.js"; +import unfollow from "@/services/following/delete.js"; +import cancelRequest from "@/services/following/requests/cancel.js"; import DbResolver from "../../db-resolver.js"; +import type { IFollow } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/index.ts b/packages/backend/src/remote/activitypub/kernel/undo/index.ts index f0e2316fab..b8f1db9bdc 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/index.ts @@ -1,20 +1,20 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { apLogger } from "../../logger.js"; +import Resolver from "../../resolver.js"; import type { IUndo } from "../../type.js"; import { - isFollow, - isBlock, - isLike, - isAnnounce, getApType, isAccept, + isAnnounce, + isBlock, + isFollow, + isLike, } from "../../type.js"; -import unfollow from "./follow.js"; -import unblock from "./block.js"; -import undoLike from "./like.js"; import undoAccept from "./accept.js"; import { undoAnnounce } from "./announce.js"; -import Resolver from "../../resolver.js"; -import { apLogger } from "../../logger.js"; +import unblock from "./block.js"; +import unfollow from "./follow.js"; +import undoLike from "./like.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/undo/like.ts b/packages/backend/src/remote/activitypub/kernel/undo/like.ts index 90220e203d..b32983beeb 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/like.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/like.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { ILike } from "../../type.js"; -import { getApId } from "../../type.js"; import deleteReaction from "@/services/note/reaction/delete.js"; import { fetchNote } from "../../models/note.js"; +import type { ILike } from "../../type.js"; +import { getApId } from "../../type.js"; /** * Process Undo.Like activity diff --git a/packages/backend/src/remote/activitypub/kernel/update/index.ts b/packages/backend/src/remote/activitypub/kernel/update/index.ts index 558a20ce0f..7c0b2f602c 100644 --- a/packages/backend/src/remote/activitypub/kernel/update/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/update/index.ts @@ -1,10 +1,10 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import type { IUpdate } from "../../type.js"; -import { getApType, isActor } from "../../type.js"; import { apLogger } from "../../logger.js"; import { updateNote } from "../../models/note.js"; -import Resolver from "../../resolver.js"; import { updatePerson } from "../../models/person.js"; +import Resolver from "../../resolver.js"; +import type { IUpdate } from "../../type.js"; +import { getApType, isActor } from "../../type.js"; /** * Handler for the Update activity diff --git a/packages/backend/src/remote/activitypub/misc/get-note-html.ts b/packages/backend/src/remote/activitypub/misc/get-note-html.ts index 7521d12131..2c04fca9d1 100644 --- a/packages/backend/src/remote/activitypub/misc/get-note-html.ts +++ b/packages/backend/src/remote/activitypub/misc/get-note-html.ts @@ -1,6 +1,6 @@ -import * as mfm from "mfm-js"; -import type { Note } from "@/models/entities/note.js"; import { toHtml } from "@/mfm/to-html.js"; +import type { Note } from "@/models/entities/note.js"; +import * as mfm from "mfm-js"; export default function (note: Note) { if (!note.text) return ""; diff --git a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts index f18958f70d..80669fead8 100644 --- a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts +++ b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts @@ -1,6 +1,6 @@ -import type { IObject } from "../type.js"; -import { extractApHashtagObjects } from "../models/tag.js"; import { fromHtml } from "@/mfm/from-html.js"; +import { extractApHashtagObjects } from "../models/tag.js"; +import type { IObject } from "../type.js"; export function htmlToMfm(html: string, tag?: IObject | IObject[]) { const hashtagNames = extractApHashtagObjects(tag) diff --git a/packages/backend/src/remote/activitypub/misc/ld-signature.ts b/packages/backend/src/remote/activitypub/misc/ld-signature.ts index 62707624be..f2ebfec175 100644 --- a/packages/backend/src/remote/activitypub/misc/ld-signature.ts +++ b/packages/backend/src/remote/activitypub/misc/ld-signature.ts @@ -1,8 +1,8 @@ import * as crypto from "node:crypto"; -import jsonld from "jsonld"; -import { CONTEXTS } from "./contexts.js"; -import fetch from "node-fetch"; import { httpAgent, httpsAgent } from "@/misc/fetch.js"; +import jsonld from "jsonld"; +import fetch from "node-fetch"; +import { CONTEXTS } from "./contexts.js"; // RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017 diff --git a/packages/backend/src/remote/activitypub/models/image.ts b/packages/backend/src/remote/activitypub/models/image.ts index 2cf0c6c152..36eeda36c5 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -1,12 +1,12 @@ -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import Resolver from "../resolver.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { apLogger } from "../logger.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles } from "@/models/index.js"; -import { truncate } from "@/misc/truncate.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { truncate } from "@/misc/truncate.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { DriveFiles } from "@/models/index.js"; +import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import { apLogger } from "../logger.js"; +import Resolver from "../resolver.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/models/mention.ts b/packages/backend/src/remote/activitypub/models/mention.ts index e9f80bc43f..4f7ff66903 100644 --- a/packages/backend/src/remote/activitypub/models/mention.ts +++ b/packages/backend/src/remote/activitypub/models/mention.ts @@ -1,9 +1,9 @@ -import promiseLimit from "promise-limit"; -import { toArray, unique } from "@/prelude/array.js"; import type { CacheableUser } from "@/models/entities/user.js"; -import type { IObject, IApMention } from "../type.js"; -import { isMention } from "../type.js"; +import { toArray, unique } from "@/prelude/array.js"; +import promiseLimit from "promise-limit"; import Resolver from "../resolver.js"; +import type { IApMention, IObject } from "../type.js"; +import { isMention } from "../type.js"; import { resolvePerson } from "./person.js"; export async function extractApMentions( diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index d9eedb3058..c70d1acfb7 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -1,55 +1,55 @@ -import promiseLimit from "promise-limit"; -import * as mfm from "mfm-js"; import config from "@/config/index.js"; -import Resolver from "../resolver.js"; +import { getApLock } from "@/misc/app-lock.js"; +import { extractDbHost, toPuny } from "@/misc/convert-host.js"; +import { type Size, getEmojiSize } from "@/misc/emoji-meta.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import { StatusError } from "@/misc/fetch.js"; +import { genId } from "@/misc/gen-id.js"; +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { langmap } from "@/misc/langmap.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import { truncate } from "@/misc/truncate.js"; +import { DriveFile } from "@/models/entities/drive-file.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { + DriveFiles, + Emojis, + MessagingMessages, + NoteEdits, + Notes, + Polls, +} from "@/models/index.js"; +import { UserProfiles } from "@/models/index.js"; +import { toArray, toSingle, unique } from "@/prelude/array.js"; +import { createMessage } from "@/services/messages/create.js"; import post from "@/services/note/create.js"; import { extractMentionedUsers } from "@/services/note/create.js"; -import { resolvePerson } from "./person.js"; -import { resolveImage } from "./image.js"; -import type { CacheableRemoteUser } 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 { publishNoteStream } from "@/services/stream.js"; +import * as mfm from "mfm-js"; +import promiseLimit from "promise-limit"; +import { In } from "typeorm"; +import { parseAudience } from "../audience.js"; +import DbResolver from "../db-resolver.js"; import { apLogger } from "../logger.js"; -import { DriveFile } from "@/models/entities/drive-file.js"; -import { extractDbHost, toPuny } from "@/misc/convert-host.js"; -import { - Emojis, - Polls, - MessagingMessages, - Notes, - NoteEdits, - DriveFiles, -} from "@/models/index.js"; -import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; +import { htmlToMfm } from "../misc/html-to-mfm.js"; +import Resolver from "../resolver.js"; import type { IObject, IPost } from "../type.js"; import { - getOneApId, getApId, - getOneApHrefNullable, - validPost, - isEmoji, getApType, + getOneApHrefNullable, + getOneApId, + isEmoji, + validPost, } from "../type.js"; -import type { Emoji } from "@/models/entities/emoji.js"; -import { genId } from "@/misc/gen-id.js"; -import { getApLock } from "@/misc/app-lock.js"; -import { createMessage } from "@/services/messages/create.js"; -import { parseAudience } from "../audience.js"; +import { resolveImage } from "./image.js"; import { extractApMentions } from "./mention.js"; -import DbResolver from "../db-resolver.js"; -import { StatusError } from "@/misc/fetch.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import { publishNoteStream } from "@/services/stream.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { UserProfiles } from "@/models/index.js"; -import { In } from "typeorm"; -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; -import { truncate } from "@/misc/truncate.js"; -import { type Size, getEmojiSize } from "@/misc/emoji-meta.js"; -import { langmap } from "@/misc/langmap.js"; +import { resolvePerson } from "./person.js"; +import { extractPollFromQuestion } from "./question.js"; +import { extractApHashtags } from "./tag.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 15083fa877..afd91e4e7f 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -2,51 +2,51 @@ import { URL } from "node:url"; import promiseLimit from "promise-limit"; import config from "@/config/index.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import type { Note } from "@/models/entities/note.js"; -import { updateUsertags } from "@/services/update-hashtag.js"; -import { - Users, - Instances, - Followings, - UserProfiles, - UserPublickeys, -} from "@/models/index.js"; -import type { IRemoteUser, CacheableUser } from "@/models/entities/user.js"; -import { User } from "@/models/entities/user.js"; -import type { 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 { db } from "@/db/postgre.js"; +import { fromHtml } from "@/mfm/from-html.js"; import { toPuny } from "@/misc/convert-host.js"; -import { UserProfile } from "@/models/entities/user-profile.js"; -import { toArray } from "@/prelude/array.js"; -import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; +import { StatusError } from "@/misc/fetch.js"; +import { genId } from "@/misc/gen-id.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; import { normalizeForSearch } from "@/misc/normalize-for-search.js"; import { truncate } from "@/misc/truncate.js"; -import { StatusError } from "@/misc/fetch.js"; -import { uriPersonCache } from "@/services/user-cache.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import type { Note } from "@/models/entities/note.js"; +import { UserNotePining } from "@/models/entities/user-note-pining.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { UserPublickey } from "@/models/entities/user-publickey.js"; +import type { CacheableUser, IRemoteUser } from "@/models/entities/user.js"; +import { User } from "@/models/entities/user.js"; +import { + Followings, + Instances, + UserProfiles, + UserPublickeys, + Users, +} from "@/models/index.js"; +import { toArray } from "@/prelude/array.js"; +import { instanceChart, usersChart } from "@/services/chart/index.js"; +import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import { publishInternalEvent } from "@/services/stream.js"; -import { db } from "@/db/postgre.js"; +import { updateUsertags } from "@/services/update-hashtag.js"; +import { uriPersonCache } from "@/services/user-cache.js"; import { apLogger } from "../logger.js"; import { htmlToMfm } from "../misc/html-to-mfm.js"; -import { fromHtml } from "@/mfm/from-html.js"; +import Resolver from "../resolver.js"; import type { IActor, IObject } from "../type.js"; import { - isCollectionOrOrderedCollection, - isCollection, getApId, - getOneApHrefNullable, - isPropertyValue, getApType, + getOneApHrefNullable, isActor, + isCollection, + isCollectionOrOrderedCollection, + isPropertyValue, } from "../type.js"; -import Resolver from "../resolver.js"; -import { extractApHashtags } from "./tag.js"; -import { resolveNote, extractEmojis } from "./note.js"; import { resolveImage } from "./image.js"; +import { extractEmojis, resolveNote } from "./note.js"; +import { extractApHashtags } from "./tag.js"; const logger = apLogger; @@ -475,10 +475,10 @@ export async function updatePerson( if (typeof person.followers === "string") { try { - let data = await fetch(person.followers, { + const data = await fetch(person.followers, { headers: { Accept: "application/json" }, }); - let json_data = JSON.parse(await data.text()); + const json_data = JSON.parse(await data.text()); followersCount = json_data.totalItems; } catch { @@ -490,10 +490,10 @@ export async function updatePerson( if (typeof person.following === "string") { try { - let data = await fetch(person.following, { + const data = await fetch(person.following, { headers: { Accept: "application/json" }, }); - let json_data = JSON.parse(await data.text()); + const json_data = JSON.parse(await data.text()); followingCount = json_data.totalItems; } catch { @@ -505,10 +505,10 @@ export async function updatePerson( if (typeof person.outbox === "string") { try { - let data = await fetch(person.outbox, { + const data = await fetch(person.outbox, { headers: { Accept: "application/json" }, }); - let json_data = JSON.parse(await data.text()); + const json_data = JSON.parse(await data.text()); notesCount = json_data.totalItems; } catch (e) { diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index f5855c3e7c..187b58d905 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -1,10 +1,10 @@ import config from "@/config/index.js"; +import type { IPoll } from "@/models/entities/poll.js"; +import { Notes, Polls } from "@/models/index.js"; +import { apLogger } from "../logger.js"; import Resolver from "../resolver.js"; import type { IObject, IQuestion } from "../type.js"; import { getApId, isQuestion } from "../type.js"; -import { apLogger } from "../logger.js"; -import { Notes, Polls } from "@/models/index.js"; -import type { IPoll } from "@/models/entities/poll.js"; export async function extractPollFromQuestion( source: string | IObject, diff --git a/packages/backend/src/remote/activitypub/models/tag.ts b/packages/backend/src/remote/activitypub/models/tag.ts index 537cdecbd5..2a8cbef38f 100644 --- a/packages/backend/src/remote/activitypub/models/tag.ts +++ b/packages/backend/src/remote/activitypub/models/tag.ts @@ -1,5 +1,5 @@ import { toArray } from "@/prelude/array.js"; -import type { IObject, IApHashtag } from "../type.js"; +import type { IApHashtag, IObject } from "../type.js"; import { isHashtag } from "../type.js"; export function extractApHashtags( diff --git a/packages/backend/src/remote/activitypub/perform.ts b/packages/backend/src/remote/activitypub/perform.ts index 0d2cdb4a5e..9bb231b96a 100644 --- a/packages/backend/src/remote/activitypub/perform.ts +++ b/packages/backend/src/remote/activitypub/perform.ts @@ -1,7 +1,7 @@ -import type { IObject } from "./type.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { performActivity } from "./kernel/index.js"; import { updatePerson } from "./models/person.js"; +import type { IObject } from "./type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/renderer/follow-user.ts b/packages/backend/src/remote/activitypub/renderer/follow-user.ts index 22ee429ff6..e99eb28393 100644 --- a/packages/backend/src/remote/activitypub/renderer/follow-user.ts +++ b/packages/backend/src/remote/activitypub/renderer/follow-user.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; -import { Users } from "@/models/index.js"; import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; /** * Convert (local|remote)(Follower|Followee)ID to URL diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index c60a1f4cdb..16d36bb911 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -1,7 +1,7 @@ -import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; import { getUserKeypair } from "@/misc/keypair-store.js"; import type { User } from "@/models/entities/user.js"; +import { v4 as uuid } from "uuid"; import { LdSignature } from "../misc/ld-signature.js"; import type { IActivity } from "../type.js"; diff --git a/packages/backend/src/remote/activitypub/renderer/key.ts b/packages/backend/src/remote/activitypub/renderer/key.ts index 084bb5361a..3a1b4794b2 100644 --- a/packages/backend/src/remote/activitypub/renderer/key.ts +++ b/packages/backend/src/remote/activitypub/renderer/key.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import type { UserKeypair } from "@/models/entities/user-keypair.js"; import { createPublicKey } from "node:crypto"; +import config from "@/config/index.js"; +import type { UserKeypair } from "@/models/entities/user-keypair.js"; +import type { ILocalUser } from "@/models/entities/user.js"; export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({ id: `${config.url}/users/${user.id}${postfix || "/publickey"}`, diff --git a/packages/backend/src/remote/activitypub/renderer/like.ts b/packages/backend/src/remote/activitypub/renderer/like.ts index 53c66c5c92..4190ae3275 100644 --- a/packages/backend/src/remote/activitypub/renderer/like.ts +++ b/packages/backend/src/remote/activitypub/renderer/like.ts @@ -1,10 +1,10 @@ -import { IsNull } from "typeorm"; import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import type { NoteReaction } from "@/models/entities/note-reaction.js"; import type { Note } from "@/models/entities/note.js"; import { Emojis } from "@/models/index.js"; +import { IsNull } from "typeorm"; import renderEmoji from "./emoji.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; diff --git a/packages/backend/src/remote/activitypub/renderer/mention.ts b/packages/backend/src/remote/activitypub/renderer/mention.ts index e7f0435c16..a598b804ee 100644 --- a/packages/backend/src/remote/activitypub/renderer/mention.ts +++ b/packages/backend/src/remote/activitypub/renderer/mention.ts @@ -1,5 +1,5 @@ import config from "@/config/index.js"; -import type { User, ILocalUser } from "@/models/entities/user.js"; +import type { ILocalUser, User } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; export default (mention: User) => ({ diff --git a/packages/backend/src/remote/activitypub/renderer/note.ts b/packages/backend/src/remote/activitypub/renderer/note.ts index b840e2d6f1..a63118ad4e 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -1,16 +1,16 @@ -import { In, IsNull } from "typeorm"; import config from "@/config/index.js"; -import type { Note, IMentionedRemoteUsers } from "@/models/entities/note.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles, Notes, Users, Emojis, Polls } from "@/models/index.js"; -import type { Emoji } from "@/models/entities/emoji.js"; -import type { Poll } from "@/models/entities/poll.js"; -import toHtml from "@/remote/activitypub/misc/get-note-html.js"; import detectLanguage from "@/misc/detect-language.js"; -import renderEmoji from "./emoji.js"; -import renderMention from "./mention.js"; -import renderHashtag from "./hashtag.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; +import type { Poll } from "@/models/entities/poll.js"; +import { DriveFiles, Emojis, Notes, Polls, Users } from "@/models/index.js"; +import toHtml from "@/remote/activitypub/misc/get-note-html.js"; +import { In, IsNull } from "typeorm"; import renderDocument from "./document.js"; +import renderEmoji from "./emoji.js"; +import renderHashtag from "./hashtag.js"; +import renderMention from "./mention.js"; export default async function renderNote( note: Note, diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index db176a0dde..637693e073 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -1,16 +1,16 @@ import { URL } from "node:url"; -import * as mfm from "mfm-js"; import config from "@/config/index.js"; +import { getUserKeypair } from "@/misc/keypair-store.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { DriveFiles, UserProfiles } from "@/models/index.js"; -import { getUserKeypair } from "@/misc/keypair-store.js"; +import * as mfm from "mfm-js"; import { toHtml } from "../../../mfm/to-html.js"; +import type { IIdentifier } from "../models/identifier.js"; +import renderEmoji from "./emoji.js"; +import renderHashtag from "./hashtag.js"; import renderImage from "./image.js"; import renderKey from "./key.js"; import { getEmojis } from "./note.js"; -import renderEmoji from "./emoji.js"; -import renderHashtag from "./hashtag.js"; -import type { IIdentifier } from "../models/identifier.js"; export async function renderPerson(user: ILocalUser) { const id = `${config.url}/users/${user.id}`; diff --git a/packages/backend/src/remote/activitypub/renderer/question.ts b/packages/backend/src/remote/activitypub/renderer/question.ts index cb89aa7583..7ca995872a 100644 --- a/packages/backend/src/remote/activitypub/renderer/question.ts +++ b/packages/backend/src/remote/activitypub/renderer/question.ts @@ -1,7 +1,7 @@ import config from "@/config/index.js"; -import type { User } from "@/models/entities/user.js"; import type { Note } from "@/models/entities/note.js"; import type { Poll } from "@/models/entities/poll.js"; +import type { User } from "@/models/entities/user.js"; export default async function renderQuestion( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/renderer/read.ts b/packages/backend/src/remote/activitypub/renderer/read.ts index 212e7e8ddf..cc90ecc777 100644 --- a/packages/backend/src/remote/activitypub/renderer/read.ts +++ b/packages/backend/src/remote/activitypub/renderer/read.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; -import type { User } from "@/models/entities/user.js"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import type { User } from "@/models/entities/user.js"; export const renderReadActivity = ( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/renderer/vote.ts b/packages/backend/src/remote/activitypub/renderer/vote.ts index 21234a112d..491a8ffaf0 100644 --- a/packages/backend/src/remote/activitypub/renderer/vote.ts +++ b/packages/backend/src/remote/activitypub/renderer/vote.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; import type { Note } from "@/models/entities/note.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; import type { PollVote } from "@/models/entities/poll-vote.js"; import type { Poll } from "@/models/entities/poll.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; export default async function renderVote( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/request.ts b/packages/backend/src/remote/activitypub/request.ts index 69c97a445d..0dce4a21c7 100644 --- a/packages/backend/src/remote/activitypub/request.ts +++ b/packages/backend/src/remote/activitypub/request.ts @@ -1,9 +1,9 @@ import config from "@/config/index.js"; import { getUserKeypair } from "@/misc/keypair-store.js"; import type { User } from "@/models/entities/user.js"; -import { getResponse } from "../../misc/fetch.js"; -import { createSignedPost, createSignedGet } from "./ap-request.js"; import { apLogger } from "@/remote/activitypub/logger.js"; +import { getResponse } from "../../misc/fetch.js"; +import { createSignedGet, createSignedPost } from "./ap-request.js"; export default async (user: { id: User["id"] }, url: string, object: any) => { const body = JSON.stringify(object); diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index c4bee109d2..e487f5ff97 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -1,23 +1,23 @@ import config from "@/config/index.js"; -import { getJson } from "@/misc/fetch.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import { getInstanceActor } from "@/services/instance-actor.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { extractDbHost, isSelfHost } from "@/misc/convert-host.js"; -import { signedGet } from "./request.js"; -import type { IObject, ICollection, IOrderedCollection } from "./type.js"; -import { isCollectionOrOrderedCollection, getApId } from "./type.js"; -import { Notes, NoteReactions, Polls, Users } from "@/models/index.js"; -import { parseUri } from "./db-resolver.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getJson } from "@/misc/fetch.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import type { ILocalUser } from "@/models/entities/user.js"; +import { NoteReactions, Notes, Polls, Users } from "@/models/index.js"; +import { apLogger } from "@/remote/activitypub/logger.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { renderLike } from "@/remote/activitypub/renderer/like.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; import { renderPerson } from "@/remote/activitypub/renderer/person.js"; import renderQuestion from "@/remote/activitypub/renderer/question.js"; -import renderCreate from "@/remote/activitypub/renderer/create.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import { apLogger } from "@/remote/activitypub/logger.js"; +import { getInstanceActor } from "@/services/instance-actor.js"; +import { parseUri } from "./db-resolver.js"; +import { signedGet } from "./request.js"; +import type { ICollection, IObject, IOrderedCollection } from "./type.js"; +import { getApId, isCollectionOrOrderedCollection } from "./type.js"; export default class Resolver { private history: Set; diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index a6c1e399a5..4d74418c5e 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -1,13 +1,13 @@ import { URL } from "node:url"; +import config from "@/config/index.js"; +import { toPuny } from "@/misc/convert-host.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; import chalk from "chalk"; import { IsNull } from "typeorm"; -import config from "@/config/index.js"; -import type { User, IRemoteUser } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import { toPuny } from "@/misc/convert-host.js"; -import webFinger from "./webfinger.js"; import { createPerson, updatePerson } from "./activitypub/models/person.js"; import { remoteLogger } from "./logger.js"; +import webFinger from "./webfinger.js"; const logger = remoteLogger.createSubLogger("resolve-user"); diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index c9c05adacd..e8f32c772a 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -1,40 +1,40 @@ import Router from "@koa/router"; -import bodyParser from "koa-bodyparser"; import httpSignature from "@peertube/http-signature"; +import bodyParser from "koa-bodyparser"; -import { In, IsNull, Not } from "typeorm"; -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 { inbox as processInbox } from "@/queue/index.js"; +import config from "@/config/index.js"; import { isSelfHost } from "@/misc/convert-host.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getUserKeypair } from "@/misc/keypair-store.js"; +import type { ILocalUser, User } from "@/models/entities/user.js"; import { + Emojis, + FollowRequests, + NoteReactions, Notes, Users, - Emojis, - NoteReactions, - FollowRequests, } from "@/models/index.js"; -import type { ILocalUser, User } from "@/models/entities/user.js"; -import { renderLike } from "@/remote/activitypub/renderer/like.js"; -import { getUserKeypair } from "@/misc/keypair-store.js"; +import { inbox as processInbox } from "@/queue/index.js"; import { checkFetch, getSignatureUser, verifyDigest, } from "@/remote/activitypub/check-fetch.js"; -import { getInstanceActor } from "@/services/instance-actor.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; +import renderEmoji from "@/remote/activitypub/renderer/emoji.js"; import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderKey from "@/remote/activitypub/renderer/key.js"; +import { renderLike } from "@/remote/activitypub/renderer/like.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import { renderPerson } from "@/remote/activitypub/renderer/person.js"; +import { getInstanceActor } from "@/services/instance-actor.js"; +import Koa from "koa"; +import { In, IsNull, Not } from "typeorm"; import Featured from "./activitypub/featured.js"; -import Following from "./activitypub/following.js"; import Followers from "./activitypub/followers.js"; +import Following from "./activitypub/following.js"; import Outbox, { packActivity } from "./activitypub/outbox.js"; import { serverLogger } from "./index.js"; -import config from "@/config/index.js"; -import Koa from "koa"; // Init router const router = new Router(); diff --git a/packages/backend/src/server/activitypub/featured.ts b/packages/backend/src/server/activitypub/featured.ts index 82bb19fa12..a5131777de 100644 --- a/packages/backend/src/server/activitypub/featured.ts +++ b/packages/backend/src/server/activitypub/featured.ts @@ -1,13 +1,13 @@ -import { IsNull } from "typeorm"; import config from "@/config/index.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import { Users, Notes, UserNotePinings } from "@/models/index.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { setResponseType } from "../activitypub.js"; +import { Notes, UserNotePinings, Users } from "@/models/index.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; import type Router from "@koa/router"; +import { IsNull } from "typeorm"; +import { setResponseType } from "../activitypub.js"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/followers.ts b/packages/backend/src/server/activitypub/followers.ts index 146ca51928..ff5106efe0 100644 --- a/packages/backend/src/server/activitypub/followers.ts +++ b/packages/backend/src/server/activitypub/followers.ts @@ -1,17 +1,17 @@ -import { IsNull, LessThan } from "typeorm"; import config from "@/config/index.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 { Users, Followings, UserProfiles } from "@/models/index.js"; -import type { Following } from "@/models/entities/following.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { setResponseType } from "../activitypub.js"; -import type { FindOptionsWhere } from "typeorm"; +import type { Following } from "@/models/entities/following.js"; +import { Followings, UserProfiles, Users } from "@/models/index.js"; +import * as url from "@/prelude/url.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; import type Router from "@koa/router"; +import { IsNull, LessThan } from "typeorm"; +import type { FindOptionsWhere } from "typeorm"; +import { setResponseType } from "../activitypub.js"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/following.ts b/packages/backend/src/server/activitypub/following.ts index eab513ce64..542925d696 100644 --- a/packages/backend/src/server/activitypub/following.ts +++ b/packages/backend/src/server/activitypub/following.ts @@ -1,17 +1,17 @@ -import { LessThan, IsNull } from "typeorm"; import config from "@/config/index.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 { Users, Followings, UserProfiles } from "@/models/index.js"; -import type { Following } from "@/models/entities/following.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { setResponseType } from "../activitypub.js"; -import type { FindOptionsWhere } from "typeorm"; +import type { Following } from "@/models/entities/following.js"; +import { Followings, UserProfiles, Users } from "@/models/index.js"; +import * as url from "@/prelude/url.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; import type Router from "@koa/router"; +import { IsNull, LessThan } from "typeorm"; +import type { FindOptionsWhere } from "typeorm"; +import { setResponseType } from "../activitypub.js"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/outbox.ts b/packages/backend/src/server/activitypub/outbox.ts index e0a380ffb6..a0262e6141 100644 --- a/packages/backend/src/server/activitypub/outbox.ts +++ b/packages/backend/src/server/activitypub/outbox.ts @@ -1,20 +1,20 @@ -import { Brackets, IsNull } from "typeorm"; import config from "@/config/index.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 renderNote from "@/remote/activitypub/renderer/note.js"; -import renderCreate from "@/remote/activitypub/renderer/create.js"; -import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import type { Note } from "@/models/entities/note.js"; +import { Notes, Users } from "@/models/index.js"; import { countIf } from "@/prelude/array.js"; import * as url from "@/prelude/url.js"; -import { Users, Notes } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; import { checkFetch } from "@/remote/activitypub/check-fetch.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { makePaginationQuery } from "../api/common/make-pagination-query.js"; -import { setResponseType } from "../activitypub.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; import type Router from "@koa/router"; +import { Brackets, IsNull } from "typeorm"; +import { setResponseType } from "../activitypub.js"; +import { makePaginationQuery } from "../api/common/make-pagination-query.js"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/api/2fa.ts b/packages/backend/src/server/api/2fa.ts index 7318f0f433..2fd2148c51 100644 --- a/packages/backend/src/server/api/2fa.ts +++ b/packages/backend/src/server/api/2fa.ts @@ -1,6 +1,6 @@ import * as crypto from "node:crypto"; -import * as jsrsasign from "jsrsasign"; import config from "@/config/index.js"; +import * as jsrsasign from "jsrsasign"; const ECC_PRELUDE = Buffer.from([0x04]); const NULL_BYTE = Buffer.from([0]); diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 48a33dfc6e..5c64e6a15b 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -1,11 +1,11 @@ import type Koa from "koa"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import type { User } from "@/models/entities/user.js"; import { UserIps } from "@/models/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { IEndpoint } from "./endpoints.js"; import authenticate, { AuthenticationError } from "./authenticate.js"; import call from "./call.js"; +import type { IEndpoint } from "./endpoints.js"; import { ApiError } from "./error.js"; const userIpHistories = new Map>(); diff --git a/packages/backend/src/server/api/authenticate.ts b/packages/backend/src/server/api/authenticate.ts index 460a0ce84b..4267755c4b 100644 --- a/packages/backend/src/server/api/authenticate.ts +++ b/packages/backend/src/server/api/authenticate.ts @@ -1,13 +1,13 @@ -import isNativeToken from "./common/is-native-token.js"; -import type { CacheableLocalUser, ILocalUser } from "@/models/entities/user.js"; -import { Users, AccessTokens, Apps } from "@/models/index.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; import { Cache } from "@/misc/cache.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; import type { App } from "@/models/entities/app.js"; +import type { CacheableLocalUser, ILocalUser } from "@/models/entities/user.js"; +import { AccessTokens, Apps, Users } from "@/models/index.js"; import { localUserByIdCache, localUserByNativeTokenCache, } from "@/services/user-cache.js"; +import isNativeToken from "./common/is-native-token.js"; const appCache = new Cache("app", 60 * 30); diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index 2132edd0f5..5048e70af0 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -1,15 +1,15 @@ -import { performance } from "perf_hooks"; -import type Koa from "koa"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { getIpHash } from "@/misc/get-ip-hash.js"; -import { limiter } from "./limiter.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; +import type { CacheableLocalUser } from "@/models/entities/user.js"; +import type Koa from "koa"; +import { performance } from "perf_hooks"; +import compatibility from "./compatibility.js"; import type { IEndpointMeta } from "./endpoints.js"; import endpoints from "./endpoints.js"; -import compatibility from "./compatibility.js"; import { ApiError } from "./error.js"; +import { limiter } from "./limiter.js"; import { apiLogger } from "./logger.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; const accessDenied = { message: "Access denied.", diff --git a/packages/backend/src/server/api/common/generate-muted-user-query.ts b/packages/backend/src/server/api/common/generate-muted-user-query.ts index 3538fbf0af..78db2078b4 100644 --- a/packages/backend/src/server/api/common/generate-muted-user-query.ts +++ b/packages/backend/src/server/api/common/generate-muted-user-query.ts @@ -1,7 +1,7 @@ -import type { SelectQueryBuilder } from "typeorm"; -import { Brackets } from "typeorm"; import type { User } from "@/models/entities/user.js"; import { Mutings, UserProfiles } from "@/models/index.js"; +import type { SelectQueryBuilder } from "typeorm"; +import { Brackets } from "typeorm"; export function generateMutedUserQuery( q: SelectQueryBuilder, diff --git a/packages/backend/src/server/api/common/generated-muted-renote-query.ts b/packages/backend/src/server/api/common/generated-muted-renote-query.ts index 3fcd9b28e8..3e26d4fa4d 100644 --- a/packages/backend/src/server/api/common/generated-muted-renote-query.ts +++ b/packages/backend/src/server/api/common/generated-muted-renote-query.ts @@ -1,6 +1,6 @@ -import { Brackets, SelectQueryBuilder } from "typeorm"; import { User } from "@/models/entities/user.js"; import { RenoteMutings } from "@/models/index.js"; +import { Brackets, SelectQueryBuilder } from "typeorm"; export function generateMutedUserRenotesQueryForNotes( q: SelectQueryBuilder, diff --git a/packages/backend/src/server/api/common/getters.ts b/packages/backend/src/server/api/common/getters.ts index fd7580775a..9849f7835b 100644 --- a/packages/backend/src/server/api/common/getters.ts +++ b/packages/backend/src/server/api/common/getters.ts @@ -1,6 +1,6 @@ import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { User } from "@/models/entities/user.js"; import type { Note } from "@/models/entities/note.js"; +import type { User } from "@/models/entities/user.js"; import { Notes, Users } from "@/models/index.js"; import { generateVisibilityQuery } from "./generate-visibility-query.js"; diff --git a/packages/backend/src/server/api/common/inject-featured.ts b/packages/backend/src/server/api/common/inject-featured.ts index 30ba3eca93..3d5b08ad7e 100644 --- a/packages/backend/src/server/api/common/inject-featured.ts +++ b/packages/backend/src/server/api/common/inject-featured.ts @@ -1,9 +1,9 @@ -import rndstr from "rndstr"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; -import { Notes, UserProfiles, NoteReactions } from "@/models/index.js"; -import { generateMutedUserQuery } from "./generate-muted-user-query.js"; +import { NoteReactions, Notes, UserProfiles } from "@/models/index.js"; +import rndstr from "rndstr"; import { generateBlockedUserQuery } from "./generate-block-query.js"; +import { generateMutedUserQuery } from "./generate-muted-user-query.js"; // TODO: リアクション、Renote、返信などをしたノートは除外する diff --git a/packages/backend/src/server/api/common/inject-promo.ts b/packages/backend/src/server/api/common/inject-promo.ts index dcc4e5f3fa..774542b968 100644 --- a/packages/backend/src/server/api/common/inject-promo.ts +++ b/packages/backend/src/server/api/common/inject-promo.ts @@ -1,7 +1,7 @@ -import rndstr from "rndstr"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; -import { PromoReads, PromoNotes, Notes, Users } from "@/models/index.js"; +import { Notes, PromoNotes, PromoReads, Users } from "@/models/index.js"; +import rndstr from "rndstr"; export async function injectPromo(timeline: Note[], user?: User | null) { if (timeline.length < 5) return; diff --git a/packages/backend/src/server/api/common/read-messaging-message.ts b/packages/backend/src/server/api/common/read-messaging-message.ts index fc22c843af..47391867c8 100644 --- a/packages/backend/src/server/api/common/read-messaging-message.ts +++ b/packages/backend/src/server/api/common/read-messaging-message.ts @@ -1,21 +1,21 @@ +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; +import { toArray } from "@/prelude/array.js"; +import { deliver } from "@/queue/index.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import orderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; +import { renderReadActivity } from "@/remote/activitypub/renderer/read.js"; +import { pushNotification } from "@/services/push-notification.js"; import { - publishMainStream, publishGroupMessagingStream, + publishMainStream, } from "@/services/stream.js"; import { publishMessagingStream } from "@/services/stream.js"; import { publishMessagingIndexStream } from "@/services/stream.js"; -import { pushNotification } from "@/services/push-notification.js"; -import type { User, IRemoteUser } from "@/models/entities/user.js"; -import type { 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.js"; -import type { 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/packages/backend/src/server/api/common/read-notification.ts b/packages/backend/src/server/api/common/read-notification.ts index 1fb1d642fe..ab30c5bbd4 100644 --- a/packages/backend/src/server/api/common/read-notification.ts +++ b/packages/backend/src/server/api/common/read-notification.ts @@ -1,9 +1,9 @@ -import { In } from "typeorm"; -import { publishMainStream } from "@/services/stream.js"; -import { pushNotification } from "@/services/push-notification.js"; -import type { User } from "@/models/entities/user.js"; import type { Notification } from "@/models/entities/notification.js"; +import type { User } from "@/models/entities/user.js"; import { Notifications, Users } from "@/models/index.js"; +import { pushNotification } from "@/services/push-notification.js"; +import { publishMainStream } from "@/services/stream.js"; +import { In } from "typeorm"; export async function readNotification( userId: User["id"], diff --git a/packages/backend/src/server/api/common/signin.ts b/packages/backend/src/server/api/common/signin.ts index a8a435843f..478407deb2 100644 --- a/packages/backend/src/server/api/common/signin.ts +++ b/packages/backend/src/server/api/common/signin.ts @@ -1,9 +1,9 @@ import type Koa from "koa"; import config from "@/config/index.js"; +import { genId } from "@/misc/gen-id.js"; import type { 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) { diff --git a/packages/backend/src/server/api/common/signup.ts b/packages/backend/src/server/api/common/signup.ts index 6beae2c782..58b06efc57 100644 --- a/packages/backend/src/server/api/common/signup.ts +++ b/packages/backend/src/server/api/common/signup.ts @@ -1,17 +1,17 @@ import { generateKeyPair } from "node:crypto"; -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 { IsNull } from "typeorm"; -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"; -import { db } from "@/db/postgre.js"; import config from "@/config/index.js"; +import { db } from "@/db/postgre.js"; +import { toPunyNullable } from "@/misc/convert-host.js"; +import { genId } from "@/misc/gen-id.js"; import { hashPassword } from "@/misc/password.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { User } from "@/models/entities/user.js"; +import { UsedUsernames, Users } from "@/models/index.js"; +import { usersChart } from "@/services/chart/index.js"; +import { IsNull } from "typeorm"; +import generateUserToken from "./generate-native-user-token.js"; export async function signup(opts: { username: User["username"]; diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 946f86a63f..83ba31c367 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,8 +1,8 @@ import * as fs from "node:fs"; -import Ajv from "ajv"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; import type { Schema, SchemaType } from "@/misc/schema.js"; import type { AccessToken } from "@/models/entities/access-token.js"; +import type { CacheableLocalUser } from "@/models/entities/user.js"; +import Ajv from "ajv"; import type { IEndpointMeta } from "./endpoints.js"; import { ApiError } from "./error.js"; diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 8cc4fb2d77..f79ad01ff2 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -1,6 +1,5 @@ import type { Schema } from "@/misc/schema.js"; -import * as ep___admin_meta from "./endpoints/admin/meta.js"; import * as ep___admin_abuseUserReports from "./endpoints/admin/abuse-user-reports.js"; import * as ep___admin_accounts_create from "./endpoints/admin/accounts/create.js"; import * as ep___admin_accounts_delete from "./endpoints/admin/accounts/delete.js"; @@ -13,7 +12,11 @@ import * as ep___admin_announcements_create from "./endpoints/admin/announcement import * as ep___admin_announcements_delete from "./endpoints/admin/announcements/delete.js"; import * as ep___admin_announcements_list from "./endpoints/admin/announcements/list.js"; import * as ep___admin_announcements_update from "./endpoints/admin/announcements/update.js"; +import * as ep___admin_delete2fa from "./endpoints/admin/delete-2fa.js"; +import * as ep___admin_deleteAccount from "./endpoints/admin/delete-account.js"; import * as ep___admin_deleteAllFilesOfAUser from "./endpoints/admin/delete-all-files-of-a-user.js"; +import * as ep___admin_deletePasskeys from "./endpoints/admin/delete-passkeys.js"; +import * as ep___admin_driveCapOverride from "./endpoints/admin/drive-capacity-override.js"; import * as ep___admin_drive_cleanRemoteFiles from "./endpoints/admin/drive/clean-remote-files.js"; import * as ep___admin_drive_cleanup from "./endpoints/admin/drive/cleanup.js"; import * as ep___admin_drive_files from "./endpoints/admin/drive/files.js"; @@ -39,6 +42,7 @@ import * as ep___admin_getIndexStats from "./endpoints/admin/get-index-stats.js" import * as ep___admin_getTableStats from "./endpoints/admin/get-table-stats.js"; import * as ep___admin_getUserIps from "./endpoints/admin/get-user-ips.js"; import * as ep___admin_invite from "./endpoints/admin/invite.js"; +import * as ep___admin_meta from "./endpoints/admin/meta.js"; import * as ep___admin_moderators_add from "./endpoints/admin/moderators/add.js"; import * as ep___admin_moderators_remove from "./endpoints/admin/moderators/remove.js"; import * as ep___admin_promo_create from "./endpoints/admin/promo/create.js"; @@ -63,11 +67,8 @@ import * as ep___admin_suspendUser from "./endpoints/admin/suspend-user.js"; import * as ep___admin_unsilenceUser from "./endpoints/admin/unsilence-user.js"; import * as ep___admin_unsuspendUser from "./endpoints/admin/unsuspend-user.js"; import * as ep___admin_updateMeta from "./endpoints/admin/update-meta.js"; -import * as ep___admin_vacuum from "./endpoints/admin/vacuum.js"; -import * as ep___admin_deleteAccount from "./endpoints/admin/delete-account.js"; -import * as ep___admin_delete2fa from "./endpoints/admin/delete-2fa.js"; -import * as ep___admin_deletePasskeys from "./endpoints/admin/delete-passkeys.js"; import * as ep___admin_updateUserNote from "./endpoints/admin/update-user-note.js"; +import * as ep___admin_vacuum from "./endpoints/admin/vacuum.js"; import * as ep___announcements from "./endpoints/announcements.js"; import * as ep___antennas_create from "./endpoints/antennas/create.js"; import * as ep___antennas_delete from "./endpoints/antennas/delete.js"; @@ -110,18 +111,20 @@ import * as ep___charts_user_notes from "./endpoints/charts/user/notes.js"; import * as ep___charts_user_reactions from "./endpoints/charts/user/reactions.js"; import * as ep___charts_users from "./endpoints/charts/users.js"; import * as ep___clips_addNote from "./endpoints/clips/add-note.js"; -import * as ep___clips_removeNote from "./endpoints/clips/remove-note.js"; import * as ep___clips_create from "./endpoints/clips/create.js"; import * as ep___clips_delete from "./endpoints/clips/delete.js"; import * as ep___clips_list from "./endpoints/clips/list.js"; import * as ep___clips_notes from "./endpoints/clips/notes.js"; +import * as ep___clips_removeNote from "./endpoints/clips/remove-note.js"; import * as ep___clips_show from "./endpoints/clips/show.js"; import * as ep___clips_update from "./endpoints/clips/update.js"; +import * as ep___customMOTD from "./endpoints/custom-motd.js"; +import * as ep___customSplashIcons from "./endpoints/custom-splash-icons.js"; import * as ep___drive from "./endpoints/drive.js"; import * as ep___drive_files from "./endpoints/drive/files.js"; import * as ep___drive_files_attachedNotes from "./endpoints/drive/files/attached-notes.js"; -import * as ep___drive_files_checkExistence from "./endpoints/drive/files/check-existence.js"; import * as ep___drive_files_captionImage from "./endpoints/drive/files/caption-image.js"; +import * as ep___drive_files_checkExistence from "./endpoints/drive/files/check-existence.js"; import * as ep___drive_files_create from "./endpoints/drive/files/create.js"; import * as ep___drive_files_delete from "./endpoints/drive/files/delete.js"; import * as ep___drive_files_findByHash from "./endpoints/drive/files/find-by-hash.js"; @@ -145,9 +148,10 @@ import * as ep___federation_followers from "./endpoints/federation/followers.js" import * as ep___federation_following from "./endpoints/federation/following.js"; import * as ep___federation_instances from "./endpoints/federation/instances.js"; import * as ep___federation_showInstance from "./endpoints/federation/show-instance.js"; +import * as ep___federation_stats from "./endpoints/federation/stats.js"; import * as ep___federation_updateRemoteUser from "./endpoints/federation/update-remote-user.js"; import * as ep___federation_users from "./endpoints/federation/users.js"; -import * as ep___federation_stats from "./endpoints/federation/stats.js"; +import * as ep___fetchRss from "./endpoints/fetch-rss.js"; import * as ep___following_create from "./endpoints/following/create.js"; import * as ep___following_delete from "./endpoints/following/delete.js"; import * as ep___following_invalidate from "./endpoints/following/invalidate.js"; @@ -165,6 +169,7 @@ import * as ep___gallery_posts_show from "./endpoints/gallery/posts/show.js"; import * as ep___gallery_posts_unlike from "./endpoints/gallery/posts/unlike.js"; import * as ep___gallery_posts_update from "./endpoints/gallery/posts/update.js"; import * as ep___getOnlineUsersCount from "./endpoints/get-online-users-count.js"; +import * as ep___sounds from "./endpoints/get-sounds.js"; import * as ep___hashtags_list from "./endpoints/hashtags/list.js"; import * as ep___hashtags_search from "./endpoints/hashtags/search.js"; import * as ep___hashtags_show from "./endpoints/hashtags/show.js"; @@ -176,9 +181,9 @@ import * as ep___i_2fa_keyDone from "./endpoints/i/2fa/key-done.js"; import * as ep___i_2fa_passwordLess from "./endpoints/i/2fa/password-less.js"; import * as ep___i_2fa_registerKey from "./endpoints/i/2fa/register-key.js"; import * as ep___i_2fa_register from "./endpoints/i/2fa/register.js"; -import * as ep___i_2fa_updateKey from "./endpoints/i/2fa/update-key.js"; import * as ep___i_2fa_removeKey from "./endpoints/i/2fa/remove-key.js"; import * as ep___i_2fa_unregister from "./endpoints/i/2fa/unregister.js"; +import * as ep___i_2fa_updateKey from "./endpoints/i/2fa/update-key.js"; import * as ep___i_apps from "./endpoints/i/apps.js"; import * as ep___i_authorizedApps from "./endpoints/i/authorized-apps.js"; import * as ep___i_changePassword from "./endpoints/i/change-password.js"; @@ -187,7 +192,6 @@ import * as ep___i_exportBlocking from "./endpoints/i/export-blocking.js"; import * as ep___i_exportFollowing from "./endpoints/i/export-following.js"; import * as ep___i_exportMute from "./endpoints/i/export-mute.js"; import * as ep___i_exportNotes from "./endpoints/i/export-notes.js"; -import * as ep___i_importPosts from "./endpoints/i/import-posts.js"; import * as ep___i_exportUserLists from "./endpoints/i/export-user-lists.js"; import * as ep___i_favorites from "./endpoints/i/favorites.js"; import * as ep___i_gallery_likes from "./endpoints/i/gallery/likes.js"; @@ -196,6 +200,7 @@ import * as ep___i_getWordMutedNotesCount from "./endpoints/i/get-word-muted-not import * as ep___i_importBlocking from "./endpoints/i/import-blocking.js"; import * as ep___i_importFollowing from "./endpoints/i/import-following.js"; import * as ep___i_importMuting from "./endpoints/i/import-muting.js"; +import * as ep___i_importPosts from "./endpoints/i/import-posts.js"; import * as ep___i_importUserLists from "./endpoints/i/import-user-lists.js"; import * as ep___i_notifications from "./endpoints/i/notifications.js"; import * as ep___i_pageLikes from "./endpoints/i/page-likes.js"; @@ -221,24 +226,21 @@ import * as ep___i_updateEmail from "./endpoints/i/update-email.js"; import * as ep___i_update from "./endpoints/i/update.js"; import * as ep___i_userGroupInvites from "./endpoints/i/user-group-invites.js"; import * as ep___i_webhooks_create from "./endpoints/i/webhooks/create.js"; -import * as ep___i_webhooks_show from "./endpoints/i/webhooks/show.js"; -import * as ep___i_webhooks_list from "./endpoints/i/webhooks/list.js"; -import * as ep___i_webhooks_update from "./endpoints/i/webhooks/update.js"; import * as ep___i_webhooks_delete from "./endpoints/i/webhooks/delete.js"; +import * as ep___i_webhooks_list from "./endpoints/i/webhooks/list.js"; +import * as ep___i_webhooks_show from "./endpoints/i/webhooks/show.js"; +import * as ep___i_webhooks_update from "./endpoints/i/webhooks/update.js"; +import * as ep___latestVersion from "./endpoints/latest-version.js"; import * as ep___messaging_history from "./endpoints/messaging/history.js"; import * as ep___messaging_messages from "./endpoints/messaging/messages.js"; import * as ep___messaging_messages_create from "./endpoints/messaging/messages/create.js"; import * as ep___messaging_messages_delete from "./endpoints/messaging/messages/delete.js"; import * as ep___messaging_messages_read from "./endpoints/messaging/messages/read.js"; import * as ep___meta from "./endpoints/meta.js"; -import * as ep___sounds from "./endpoints/get-sounds.js"; import * as ep___miauth_genToken from "./endpoints/miauth/gen-token.js"; import * as ep___mute_create from "./endpoints/mute/create.js"; import * as ep___mute_delete from "./endpoints/mute/delete.js"; import * as ep___mute_list from "./endpoints/mute/list.js"; -import * as ep___renote_mute_create from "./endpoints/renote-mute/create.js"; -import * as ep___renote_mute_delete from "./endpoints/renote-mute/delete.js"; -import * as ep___renote_mute_list from "./endpoints/renote-mute/list.js"; import * as ep___my_apps from "./endpoints/my/apps.js"; import * as ep___notes from "./endpoints/notes.js"; import * as ep___notes_children from "./endpoints/notes/children.js"; @@ -253,13 +255,13 @@ import * as ep___notes_featured from "./endpoints/notes/featured.js"; import * as ep___notes_globalTimeline from "./endpoints/notes/global-timeline.js"; import * as ep___notes_hybridTimeline from "./endpoints/notes/hybrid-timeline.js"; import * as ep___notes_localTimeline from "./endpoints/notes/local-timeline.js"; -import * as ep___notes_recommendedTimeline from "./endpoints/notes/recommended-timeline.js"; import * as ep___notes_mentions from "./endpoints/notes/mentions.js"; import * as ep___notes_polls_recommendation from "./endpoints/notes/polls/recommendation.js"; import * as ep___notes_polls_vote from "./endpoints/notes/polls/vote.js"; import * as ep___notes_reactions from "./endpoints/notes/reactions.js"; import * as ep___notes_reactions_create from "./endpoints/notes/reactions/create.js"; import * as ep___notes_reactions_delete from "./endpoints/notes/reactions/delete.js"; +import * as ep___notes_recommendedTimeline from "./endpoints/notes/recommended-timeline.js"; import * as ep___notes_renotes from "./endpoints/notes/renotes.js"; import * as ep___notes_replies from "./endpoints/notes/replies.js"; import * as ep___notes_searchByTag from "./endpoints/notes/search-by-tag.js"; @@ -285,24 +287,24 @@ import * as ep___pages_like from "./endpoints/pages/like.js"; import * as ep___pages_show from "./endpoints/pages/show.js"; import * as ep___pages_unlike from "./endpoints/pages/unlike.js"; import * as ep___pages_update from "./endpoints/pages/update.js"; -import * as ep___ping from "./endpoints/ping.js"; -import * as ep___recommendedInstances from "./endpoints/recommended-instances.js"; -import * as ep___pinnedUsers from "./endpoints/pinned-users.js"; -import * as ep___customMOTD from "./endpoints/custom-motd.js"; -import * as ep___customSplashIcons from "./endpoints/custom-splash-icons.js"; -import * as ep___latestVersion from "./endpoints/latest-version.js"; import * as ep___patrons from "./endpoints/patrons.js"; -import * as ep___release from "./endpoints/release.js"; +import * as ep___ping from "./endpoints/ping.js"; +import * as ep___pinnedUsers from "./endpoints/pinned-users.js"; import * as ep___promo_read from "./endpoints/promo/read.js"; +import * as ep___recommendedInstances from "./endpoints/recommended-instances.js"; +import * as ep___release from "./endpoints/release.js"; +import * as ep___renote_mute_create from "./endpoints/renote-mute/create.js"; +import * as ep___renote_mute_delete from "./endpoints/renote-mute/delete.js"; +import * as ep___renote_mute_list from "./endpoints/renote-mute/list.js"; import * as ep___requestResetPassword from "./endpoints/request-reset-password.js"; import * as ep___resetDb from "./endpoints/reset-db.js"; import * as ep___resetPassword from "./endpoints/reset-password.js"; import * as ep___serverInfo from "./endpoints/server-info.js"; import * as ep___stats from "./endpoints/stats.js"; -import * as ep___sw_show_registration from "./endpoints/sw/show-registration.js"; -import * as ep___sw_update_registration from "./endpoints/sw/update-registration.js"; import * as ep___sw_register from "./endpoints/sw/register.js"; +import * as ep___sw_show_registration from "./endpoints/sw/show-registration.js"; import * as ep___sw_unregister from "./endpoints/sw/unregister.js"; +import * as ep___sw_update_registration from "./endpoints/sw/update-registration.js"; import * as ep___test from "./endpoints/test.js"; import * as ep___username_available from "./endpoints/username/available.js"; import * as ep___users from "./endpoints/users.js"; @@ -324,8 +326,8 @@ import * as ep___users_groups_show from "./endpoints/users/groups/show.js"; import * as ep___users_groups_transfer from "./endpoints/users/groups/transfer.js"; import * as ep___users_groups_update from "./endpoints/users/groups/update.js"; import * as ep___users_lists_create from "./endpoints/users/lists/create.js"; -import * as ep___users_lists_delete from "./endpoints/users/lists/delete.js"; import * as ep___users_lists_delete_all from "./endpoints/users/lists/delete-all.js"; +import * as ep___users_lists_delete from "./endpoints/users/lists/delete.js"; import * as ep___users_lists_list from "./endpoints/users/lists/list.js"; import * as ep___users_lists_pull from "./endpoints/users/lists/pull.js"; import * as ep___users_lists_push from "./endpoints/users/lists/push.js"; @@ -341,12 +343,10 @@ import * as ep___users_searchByUsernameAndHost from "./endpoints/users/search-by import * as ep___users_search from "./endpoints/users/search.js"; import * as ep___users_show from "./endpoints/users/show.js"; import * as ep___users_stats from "./endpoints/users/stats.js"; -import * as ep___fetchRss from "./endpoints/fetch-rss.js"; -import * as ep___admin_driveCapOverride from "./endpoints/admin/drive-capacity-override.js"; +import * as ep___i_known_as from "./endpoints/i/known-as.js"; //Firefish Move import * as ep___i_move from "./endpoints/i/move.js"; -import * as ep___i_known_as from "./endpoints/i/known-as.js"; const eps = [ ["admin/meta", ep___admin_meta], diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index 78034917f0..c2ff716c98 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { AbuseUserReports } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index e5972173c9..a75c9b5f98 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; import { signup } from "@/server/api/common/signup.js"; +import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 4235180838..b912ad6ade 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; -import { doPostSuspend } from "@/services/suspend-user.js"; -import { publishUserEvent } from "@/services/stream.js"; import { createDeleteAccountJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { publishUserEvent } from "@/services/stream.js"; +import { doPostSuspend } from "@/services/suspend-user.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts b/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts index 601cd95003..f698788645 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; -import { Meta } from "@/models/entities/meta.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { db } from "@/db/postgre.js"; +import { Meta } from "@/models/entities/meta.js"; import define from "@/server/api/define.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index bfe4d54461..cd23afd83b 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Ads } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { Ads } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index 802eb5ef6b..3ebb88041c 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Ads } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 1f39e73e5e..14c3f6ce68 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Ads } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index 52f31a3ce0..d1c5bb3ba6 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Ads } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 8af778486c..611f7de6fc 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Announcements } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { Announcements } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index 8b2326cdaf..b847c246f3 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Announcements } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index a13fabd602..f1da1a3018 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -1,7 +1,7 @@ -import { Announcements, AnnouncementReads } from "@/models/index.js"; import type { Announcement } from "@/models/entities/announcement.js"; -import define from "@/server/api/define.js"; +import { AnnouncementReads, Announcements } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index 03af414737..32cef004ee 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Announcements } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts b/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts index 1cf60d9c52..38e8f0dcd1 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts @@ -1,6 +1,6 @@ -import { Users, UserProfiles } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; +import { UserProfiles, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-account.ts b/packages/backend/src/server/api/endpoints/admin/delete-account.ts index 1b6dc31a2c..2decb30d54 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-account.ts @@ -1,6 +1,6 @@ import { Users } from "@/models/index.js"; -import { deleteAccount } from "@/services/delete-account.js"; import define from "@/server/api/define.js"; +import { deleteAccount } from "@/services/delete-account.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index b52f609804..0dd52068dd 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -1,6 +1,6 @@ +import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; -import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts b/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts index 7a54f5d99f..773aa698bd 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts @@ -1,6 +1,6 @@ -import { Users, UserProfiles, UserSecurityKeys } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; +import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts b/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts index d4bb3045c6..2f7e2db0eb 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 84c04793e3..11fce08f25 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { createCleanRemoteFilesJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index e56c027ff2..8ba8ae29c5 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -1,7 +1,7 @@ -import { IsNull } from "typeorm"; +import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; -import { DriveFiles } from "@/models/index.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index e068f1dc9b..861c7bc963 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -1,6 +1,6 @@ import { DriveFiles } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index 02b3877b87..1684a42b55 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 8d156e6f71..2e84cd4d5a 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -1,12 +1,12 @@ -import define from "@/server/api/define.js"; -import { Emojis, DriveFiles } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { ApiError } from "@/server/api/error.js"; -import rndstr from "rndstr"; -import { publishBroadcastStream } from "@/services/stream.js"; import { db } from "@/db/postgre.js"; import { getEmojiSize } from "@/misc/emoji-meta.js"; +import { genId } from "@/misc/gen-id.js"; +import { DriveFiles, Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { publishBroadcastStream } from "@/services/stream.js"; +import rndstr from "rndstr"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index 29b1d82125..80ffd5cdf9 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -1,12 +1,12 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { ApiError } from "@/server/api/error.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import { publishBroadcastStream } from "@/services/stream.js"; import { db } from "@/db/postgre.js"; import { getEmojiSize } from "@/misc/emoji-meta.js"; +import { genId } from "@/misc/gen-id.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import { publishBroadcastStream } from "@/services/stream.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts index a5c4c8bcc5..2c78fb67c5 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts index 726f90396b..d717918227 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { ApiError } from "@/server/api/error.js"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts index 4b49e45dd9..70d17c7dd3 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { createImportCustomEmojisJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index c6246c48c7..3038650590 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; import { toPuny } from "@/misc/convert-host.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Emojis } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 12de0b1817..3dcc20434a 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.js"; import type { Emoji } from "@/models/entities/emoji.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { makePaginationQuery } from "../../../common/make-pagination-query.js"; //import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts index 49d31805f0..41d56dfbac 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts index 72d7fab804..d292c50666 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts index 89e68aa4c1..de78bab8e4 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts index e4500e02a2..a8ebda961e 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { In } from "typeorm"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index 6fedf86204..2d79918beb 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Emojis } from "@/models/index.js"; -import { ApiError } from "@/server/api/error.js"; import { db } from "@/db/postgre.js"; +import { Emojis } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index d1a7fb6957..714cbc46f0 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -1,6 +1,6 @@ +import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; -import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index bf71cd2503..9127df49af 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Instances } from "@/models/index.js"; import { toPuny } from "@/misc/convert-host.js"; +import { Instances } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index a2ce44bd5d..ffd8ec67fd 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -1,6 +1,6 @@ +import { Followings, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import deleteFollowing from "@/services/following/delete.js"; -import { Followings, Users } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 653d187c2d..7893cb403f 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Instances } from "@/models/index.js"; import { toPuny } from "@/misc/convert-host.js"; +import { Instances } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts index 98f1f024bc..f50697a41f 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { db } from "@/db/postgre.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index ebc523d418..ce543719c3 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -1,7 +1,7 @@ -import rndstr from "rndstr"; -import define from "@/server/api/define.js"; -import { RegistrationTickets } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { RegistrationTickets } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import rndstr from "rndstr"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 6f23ef181b..64fd38eeb2 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; +import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index c8b53088cd..a4b90cacca 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index e2af1ca374..6e4dadb9da 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index 55038fc89b..e93c66599e 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -1,7 +1,7 @@ +import { PromoNotes } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; -import { PromoNotes } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index 9895f34b40..9d83eda460 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { destroy } from "@/queue/index.js"; +import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index ea8c505695..8222b067b9 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -1,5 +1,5 @@ -import { deliverQueue } from "@/queue/queues.js"; import { URL } from "node:url"; +import { deliverQueue } from "@/queue/queues.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index d4f44e3072..bfa2bb08ce 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -1,6 +1,6 @@ import { URL } from "node:url"; -import define from "@/server/api/define.js"; import { inboxQueue } from "@/queue/queues.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index f51c1e6d46..c8459d807f 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -1,9 +1,9 @@ import { + backgroundQueue, + dbQueue, deliverQueue, inboxQueue, - dbQueue, objectStorageQueue, - backgroundQueue, } from "@/queue/queues.js"; import define from "@/server/api/define.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index ac0084860c..16272e4a80 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -1,7 +1,7 @@ import { URL } from "node:url"; import define from "@/server/api/define.js"; -import { addRelay } from "@/services/relay.js"; import { ApiError } from "@/server/api/error.js"; +import { addRelay } from "@/services/relay.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index 5fbed130e6..245945dd42 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -1,8 +1,8 @@ +import { hashPassword } from "@/misc/password.js"; +import { UserProfiles, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; // import bcrypt from "bcryptjs"; import rndstr from "rndstr"; -import { Users, UserProfiles } from "@/models/index.js"; -import { hashPassword } from "@/misc/password.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index a94687cf40..ae2b5c952d 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -1,9 +1,9 @@ -import define from "@/server/api/define.js"; import { AbuseUserReports, Users } from "@/models/index.js"; -import { getInstanceActor } from "@/services/instance-actor.js"; import { deliver } from "@/queue/index.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { renderFlag } from "@/remote/activitypub/renderer/flag.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import define from "@/server/api/define.js"; +import { getInstanceActor } from "@/services/instance-actor.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/search/index-all.ts b/packages/backend/src/server/api/endpoints/admin/search/index-all.ts index 531428849b..065fa04b85 100644 --- a/packages/backend/src/server/api/endpoints/admin/search/index-all.ts +++ b/packages/backend/src/server/api/endpoints/admin/search/index-all.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { createIndexAllNotesJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts index 5dcbaf2e8d..2c532af463 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts @@ -1,9 +1,9 @@ -import sanitizeHtml from "sanitize-html"; +import { UserProfiles, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { Users, UserProfiles } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; -import { sendEmail } from "@/services/send-email.js"; import { createNotification } from "@/services/create-notification.js"; +import { sendEmail } from "@/services/send-email.js"; +import sanitizeHtml from "sanitize-html"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index ff46919694..002d590dd8 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -1,8 +1,8 @@ import * as os from "node:os"; -import si from "systeminformation"; -import define from "@/server/api/define.js"; -import { redisClient } from "@/db/redis.js"; import { db } from "@/db/postgre.js"; +import { redisClient } from "@/db/redis.js"; +import define from "@/server/api/define.js"; +import si from "systeminformation"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index adceda4162..ed8c67617f 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { ModerationLogs } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index 1e6ebeda93..9997db04ae 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -1,6 +1,6 @@ +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index 8d9dcac681..758fa8034e 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index c6d6f47bc6..600fe08563 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -1,10 +1,10 @@ +import type { User } from "@/models/entities/user.js"; +import { Followings, Notifications, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import deleteFollowing from "@/services/following/delete.js"; -import { Users, Followings, Notifications } from "@/models/index.js"; -import type { 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"; +import { doPostSuspend } from "@/services/suspend-user.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index 6592bf443c..0e6ea19f0f 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index 3289fb570c..bf0a709a3f 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { doPostUnsuspend } from "@/services/unsuspend-user.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 422cf49f74..47786bae2f 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -1,7 +1,7 @@ -import { Meta } from "@/models/entities/meta.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { db } from "@/db/postgre.js"; +import { Meta } from "@/models/entities/meta.js"; import define from "@/server/api/define.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index d5b086bb4b..3a3ba35226 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -1,6 +1,6 @@ +import { db } from "@/db/postgre.js"; import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index 504eb30e23..bc2f197b77 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -1,6 +1,6 @@ -import { Announcements, AnnouncementReads } from "@/models/index.js"; -import define from "@/server/api/define.js"; +import { AnnouncementReads, Announcements } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 46df3aa813..52ed628257 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { genId } from "@/misc/gen-id.js"; -import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js"; +import { Antennas, UserGroupJoinings, UserLists } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index e5a372f193..e2380f23b3 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -1,6 +1,6 @@ +import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Antennas } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index 2726ecc8f7..91ef9942b8 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Antennas } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/markread.ts b/packages/backend/src/server/api/endpoints/antennas/markread.ts index bb5b5b77fe..f552f3450c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/markread.ts +++ b/packages/backend/src/server/api/endpoints/antennas/markread.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Antennas } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 1512cb9281..d57534681a 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -1,13 +1,13 @@ -import define from "@/server/api/define.js"; -import readNote from "@/services/note/read.js"; -import { Antennas, Notes } from "@/models/index.js"; import { redisClient } from "@/db/redis.js"; import { getTimestamp } from "@/misc/gen-id.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { ApiError } from "@/server/api/error.js"; +import { Antennas, Notes } from "@/models/index.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import readNote from "@/services/note/read.js"; export const meta = { tags: ["antennas", "account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index 3700052f5a..c7f8e99cd3 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -1,6 +1,6 @@ +import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Antennas } from "@/models/index.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 9a71a8f9ff..a946076179 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -1,6 +1,6 @@ +import { Antennas, UserGroupJoinings, UserLists } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index 5159ce3b4a..3d2cceb4b0 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import Resolver from "@/remote/activitypub/resolver.js"; import { HOUR } from "@/const.js"; +import Resolver from "@/remote/activitypub/resolver.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 50eb7e9c6c..e3ffc7fa2b 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -1,20 +1,20 @@ -import define from "@/server/api/define.js"; -import { createPerson } from "@/remote/activitypub/models/person.js"; -import { createNote } from "@/remote/activitypub/models/note.js"; -import DbResolver from "@/remote/activitypub/db-resolver.js"; -import Resolver from "@/remote/activitypub/resolver.js"; -import { ApiError } from "@/server/api/error.js"; +import { MINUTE } from "@/const.js"; +import { redisClient } from "@/db/redis.js"; import { extractDbHost } from "@/misc/convert-host.js"; -import { Users, Notes } from "@/models/index.js"; +import type { SchemaType } from "@/misc/schema.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; import type { Note } from "@/models/entities/note.js"; import type { CacheableLocalUser, User } from "@/models/entities/user.js"; -import { isActor, isPost, getApId } from "@/remote/activitypub/type.js"; -import type { SchemaType } from "@/misc/schema.js"; -import { MINUTE } from "@/const.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import { updateQuestion } from "@/remote/activitypub/models/question.js"; +import { Notes, Users } from "@/models/index.js"; import { populatePoll } from "@/models/repositories/note.js"; -import { redisClient } from "@/db/redis.js"; +import DbResolver from "@/remote/activitypub/db-resolver.js"; +import { createNote } from "@/remote/activitypub/models/note.js"; +import { createPerson } from "@/remote/activitypub/models/person.js"; +import { updateQuestion } from "@/remote/activitypub/models/question.js"; +import Resolver from "@/remote/activitypub/resolver.js"; +import { getApId, isActor, isPost } from "@/remote/activitypub/type.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index e32edf1293..82e0375403 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/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"; +import { Apps } from "@/models/index.js"; +import { unique } from "@/prelude/array.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["app"], diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index d6f38428c1..5cd17cb409 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -1,6 +1,6 @@ +import { Apps } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Apps } from "@/models/index.js"; export const meta = { tags: ["app"], diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index 088de7863b..40b9841aaf 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -1,9 +1,9 @@ import * as crypto from "node:crypto"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { AuthSessions, AccessTokens, Apps } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import { secureRndstr } from "@/misc/secure-rndstr.js"; +import { AccessTokens, Apps, AuthSessions } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index bd17211044..b95256eba8 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -1,9 +1,9 @@ -import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { Apps, AuthSessions } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Apps, AuthSessions } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; +import { v4 as uuid } from "uuid"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index 70c6d54cd2..4e511d50d6 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -1,6 +1,6 @@ +import { AuthSessions } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { AuthSessions } from "@/models/index.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index 394681516b..ab17f78224 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -1,6 +1,6 @@ +import { AccessTokens, Apps, AuthSessions, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Apps, AuthSessions, AccessTokens, Users } from "@/models/index.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 50154dd6cc..bbf941aea4 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -1,9 +1,9 @@ -import create from "@/services/blocking/create.js"; +import { HOUR } from "@/const.js"; +import { Blockings, NoteWatchings, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Blockings, NoteWatchings, Users } from "@/models/index.js"; -import { HOUR } from "@/const.js"; +import create from "@/services/blocking/create.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index addf4bbd19..6f23bba2ce 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -1,9 +1,9 @@ -import deleteBlocking from "@/services/blocking/delete.js"; +import { HOUR } from "@/const.js"; +import { Blockings, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Blockings, Users } from "@/models/index.js"; -import { HOUR } from "@/const.js"; +import deleteBlocking from "@/services/blocking/delete.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index 6f51a6458d..cd04b20eac 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Blockings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 177492ed29..18630846ee 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -1,8 +1,8 @@ +import { genId } from "@/misc/gen-id.js"; +import type { Channel } from "@/models/entities/channel.js"; +import { Channels, DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Channels, DriveFiles } from "@/models/index.js"; -import type { Channel } from "@/models/entities/channel.js"; -import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index e0575af262..b5fb5e20da 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Channels } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index 878339827a..4debfb0817 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -1,7 +1,7 @@ +import { genId } from "@/misc/gen-id.js"; +import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/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 = { diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index 94374f6be0..524952c61e 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -1,5 +1,5 @@ +import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { Channels, ChannelFollowings } from "@/models/index.js"; export const meta = { tags: ["channels", "account"], diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index 23607b024c..c1e969df81 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Channels } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["channels", "account"], diff --git a/packages/backend/src/server/api/endpoints/channels/search.ts b/packages/backend/src/server/api/endpoints/channels/search.ts index b2fab701c5..f6e0f4d271 100644 --- a/packages/backend/src/server/api/endpoints/channels/search.ts +++ b/packages/backend/src/server/api/endpoints/channels/search.ts @@ -1,8 +1,8 @@ +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Channels } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { Brackets } from "typeorm"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { Channels } from "@/models/index.js"; -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index c5c1b65773..cf1d32adaa 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -1,6 +1,6 @@ +import { Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Channels } from "@/models/index.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index f061acab02..93c28be22d 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -1,7 +1,7 @@ +import { Channels, Notes } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Notes, Channels } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { activeUsersChart } from "@/services/chart/index.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index 3371000394..4a7a8f0739 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -1,6 +1,6 @@ +import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Channels, ChannelFollowings } from "@/models/index.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 0de7a837a1..bdd29488db 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -1,6 +1,6 @@ +import { Channels, DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Channels, DriveFiles } from "@/models/index.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/charts/active-users.ts b/packages/backend/src/server/api/endpoints/charts/active-users.ts index d5c3c4eb83..7e705d24b7 100644 --- a/packages/backend/src/server/api/endpoints/charts/active-users.ts +++ b/packages/backend/src/server/api/endpoints/charts/active-users.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { activeUsersChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users"], diff --git a/packages/backend/src/server/api/endpoints/charts/ap-request.ts b/packages/backend/src/server/api/endpoints/charts/ap-request.ts index bbf72030a4..c4450d54d7 100644 --- a/packages/backend/src/server/api/endpoints/charts/ap-request.ts +++ b/packages/backend/src/server/api/endpoints/charts/ap-request.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { apRequestChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/drive.ts b/packages/backend/src/server/api/endpoints/charts/drive.ts index 0a5354743c..0d772fc543 100644 --- a/packages/backend/src/server/api/endpoints/charts/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/drive.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { driveChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "drive"], diff --git a/packages/backend/src/server/api/endpoints/charts/federation.ts b/packages/backend/src/server/api/endpoints/charts/federation.ts index f9c75d5ecb..29ba32160e 100644 --- a/packages/backend/src/server/api/endpoints/charts/federation.ts +++ b/packages/backend/src/server/api/endpoints/charts/federation.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { federationChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/hashtag.ts b/packages/backend/src/server/api/endpoints/charts/hashtag.ts index bbd1b70b07..28826e187f 100644 --- a/packages/backend/src/server/api/endpoints/charts/hashtag.ts +++ b/packages/backend/src/server/api/endpoints/charts/hashtag.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { hashtagChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "hashtags"], diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index 4d746ec0b5..da3cc71866 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { instanceChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/notes.ts b/packages/backend/src/server/api/endpoints/charts/notes.ts index b2a1b93fd9..ca8cd2a971 100644 --- a/packages/backend/src/server/api/endpoints/charts/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/notes.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { notesChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "notes"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index c2745c860c..a1796f6995 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserDriveChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "drive", "users"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index 4a398d4dd6..bffd38a1e6 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserNotesChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users", "notes"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index fc75d40baf..a99952cdc9 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserReactionsChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users", "reactions"], diff --git a/packages/backend/src/server/api/endpoints/charts/users.ts b/packages/backend/src/server/api/endpoints/charts/users.ts index 0dc5f3580a..882579455c 100644 --- a/packages/backend/src/server/api/endpoints/charts/users.ts +++ b/packages/backend/src/server/api/endpoints/charts/users.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { usersChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users"], diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index 887c8af083..22d40bca5c 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { ClipNotes, Clips } from "@/models/index.js"; -import { ApiError } from "@/server/api/error.js"; import { genId } from "@/misc/gen-id.js"; +import { ClipNotes, Clips } from "@/models/index.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index df03b87b04..92860944d4 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { genId } from "@/misc/gen-id.js"; import { Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index 02d95b315e..7455a2362f 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -1,6 +1,6 @@ +import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index d276224366..f77b50612e 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["clips", "account"], diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index 13d8310e62..741c89edc6 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -1,10 +1,10 @@ -import define from "@/server/api/define.js"; import { ClipNotes, Clips, Notes } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { ApiError } from "@/server/api/error.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/remove-note.ts b/packages/backend/src/server/api/endpoints/clips/remove-note.ts index c081a87abd..70eb23b79d 100644 --- a/packages/backend/src/server/api/endpoints/clips/remove-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/remove-note.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; import { ClipNotes, Clips } from "@/models/index.js"; -import { ApiError } from "@/server/api/error.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 8218a4fb75..51ed8b81a7 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -1,6 +1,6 @@ +import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips", "account"], diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index fc88548b95..f2666a4213 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -1,6 +1,6 @@ +import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts b/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts index f6c5573af7..62fa842950 100644 --- a/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts @@ -1,8 +1,8 @@ -import { Emojis } from "@/models/index.js"; -import type { Emoji } from "@/models/entities/emoji.js"; -import { IsNull, In } from "typeorm"; import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { In, IsNull } from "typeorm"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index d5dae8767e..aa318fafda 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 5f821fa72a..8c15e55862 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -1,6 +1,6 @@ +import { DriveFiles, Notes } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFiles, Notes } from "@/models/index.js"; export const meta = { tags: ["drive", "notes"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index 2ce9fa4700..0711ade02c 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index 54ca5f8d1b..0e20ab6315 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -1,12 +1,12 @@ -import { addFile } from "@/services/drive/add-file.js"; -import { DriveFiles } from "@/models/index.js"; +import { MINUTE } from "@/const.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { MINUTE } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { apiLogger } from "@/server/api/logger.js"; import { ApiError } from "@/server/api/error.js"; +import { apiLogger } from "@/server/api/logger.js"; +import { addFile } from "@/services/drive/add-file.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 062b69b9c5..245c380ec6 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -1,8 +1,8 @@ -import { deleteFile } from "@/services/drive/delete-file.js"; -import { publishDriveStream } from "@/services/stream.js"; +import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; +import { deleteFile } from "@/services/drive/delete-file.js"; +import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index 5a243de89b..80b2f6addd 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index bde81e007e..1a14cc53d3 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -1,8 +1,8 @@ -import { publishDriveStream } from "@/services/stream.js"; -import { DriveFiles, DriveFolders, Users } from "@/models/index.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { DriveFiles, DriveFolders, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index cdfcb03089..172182f1cf 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -1,8 +1,8 @@ -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import define from "@/server/api/define.js"; -import { DriveFiles } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; import { HOUR } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index d02b4fac66..c587f80405 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { DriveFolders } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index 554e61ec97..0df87debb0 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -1,8 +1,8 @@ -import { publishDriveStream } from "@/services/stream.js"; +import { genId } from "@/misc/gen-id.js"; +import { DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFolders } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; +import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index 1954b43361..e5372bb54c 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -1,7 +1,7 @@ +import { DriveFiles, DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { publishDriveStream } from "@/services/stream.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFolders, DriveFiles } from "@/models/index.js"; +import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index d29015e785..46f741d9f8 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { DriveFolders } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index 611724ae44..2968e61d06 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -1,6 +1,6 @@ +import { DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFolders } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index 5bd880da84..04b37c595a 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -1,7 +1,7 @@ -import { publishDriveStream } from "@/services/stream.js"; +import { DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { DriveFolders } from "@/models/index.js"; +import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index cbd7860175..1c92e30c7b 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/emoji.ts b/packages/backend/src/server/api/endpoints/emoji.ts index 2675ba7bdc..384c38452f 100644 --- a/packages/backend/src/server/api/endpoints/emoji.ts +++ b/packages/backend/src/server/api/endpoints/emoji.ts @@ -1,7 +1,7 @@ -import { IsNull } from "typeorm"; import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts index ca013314e1..d1e1d9dc49 100644 --- a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -1,6 +1,6 @@ +import { HOUR } from "@/const.js"; import { createExportCustomEmojisJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; -import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index 2a88d27ae5..e7117349ea 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Followings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index c13ee8b199..3d177b925c 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Followings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 27a6dabb49..6f9b6c9bdd 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { Instances } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Instances } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index c4a6304d05..7d90a4f5af 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Instances } from "@/models/index.js"; import { toPuny } from "@/misc/convert-host.js"; +import { Instances } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/stats.ts b/packages/backend/src/server/api/endpoints/federation/stats.ts index 6702eeff5f..9d9b86b424 100644 --- a/packages/backend/src/server/api/endpoints/federation/stats.ts +++ b/packages/backend/src/server/api/endpoints/federation/stats.ts @@ -1,7 +1,7 @@ -import { IsNull, MoreThan, Not } from "typeorm"; import { Followings, Instances } from "@/models/index.js"; import { awaitAll } from "@/prelude/await-all.js"; import define from "@/server/api/define.js"; +import { IsNull, MoreThan, Not } from "typeorm"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index e8ada9e622..cecd1109bb 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { getRemoteUser } from "@/server/api/common/getters.js"; import { updatePerson } from "@/remote/activitypub/models/person.js"; +import { getRemoteUser } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 4e925a29e2..7960f4dd34 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/fetch-rss.ts b/packages/backend/src/server/api/endpoints/fetch-rss.ts index bda3c455d1..0e7f9a378e 100644 --- a/packages/backend/src/server/api/endpoints/fetch-rss.ts +++ b/packages/backend/src/server/api/endpoints/fetch-rss.ts @@ -1,7 +1,7 @@ -import Parser from "rss-parser"; -import { getResponse } from "@/misc/fetch.js"; import config from "@/config/index.js"; +import { getResponse } from "@/misc/fetch.js"; import define from "@/server/api/define.js"; +import Parser from "rss-parser"; const rssParser = new Parser(); diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index f6e341ad73..764331068d 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -1,10 +1,10 @@ -import create from "@/services/following/create.js"; +import { HOUR } from "@/const.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { Followings, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { HOUR } from "@/const.js"; +import create from "@/services/following/create.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index 3ef031eb20..d382f1a90f 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -1,9 +1,9 @@ -import deleteFollowing from "@/services/following/delete.js"; +import { HOUR } from "@/const.js"; +import { Followings, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import { HOUR } from "@/const.js"; +import deleteFollowing from "@/services/following/delete.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 7559062c0f..63d55e8bdb 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -1,9 +1,9 @@ -import deleteFollowing from "@/services/following/delete.js"; +import { HOUR } from "@/const.js"; +import { Followings, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import { HOUR } from "@/const.js"; +import deleteFollowing from "@/services/following/delete.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index cb6b010726..1296384d3e 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -1,7 +1,7 @@ -import acceptFollowRequest from "@/services/following/requests/accept.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; +import acceptFollowRequest from "@/services/following/requests/accept.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index 7acb0f948b..b3e469483a 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -1,9 +1,9 @@ -import cancelFollowRequest from "@/services/following/requests/cancel.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Users } from "@/models/index.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; +import cancelFollowRequest from "@/services/following/requests/cancel.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index 97f52d4ac2..c6021cafdc 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { FollowRequests } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index 37e7bc0abc..f374c93270 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -1,7 +1,7 @@ -import { rejectFollowRequest } from "@/services/following/reject.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { rejectFollowRequest } from "@/services/following/reject.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index e20e4ab20b..6fb706498e 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 805307e459..69333e8de8 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index 0dd02b930d..69f9929d59 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { GalleryPosts } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index a74f2165c2..dad880cf86 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -1,9 +1,9 @@ -import define from "@/server/api/define.js"; +import { HOUR } from "@/const.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { GalleryPost } from "@/models/entities/gallery-post.js"; import { DriveFiles, GalleryPosts } from "@/models/index.js"; import { genId } from "@/server/api/../../misc/gen-id.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { HOUR } from "@/const.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 360ca8c5ad..8969082872 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -1,6 +1,6 @@ +import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index f5ccc5bc68..d3d0add75f 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -1,7 +1,7 @@ +import { genId } from "@/misc/gen-id.js"; +import { GalleryLikes, GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { GalleryPosts, GalleryLikes } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 7e172da45e..00c0bdd549 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -1,6 +1,6 @@ +import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index f37456a626..bfc4432ee0 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -1,6 +1,6 @@ +import { GalleryLikes, GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { GalleryPosts, GalleryLikes } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index 16c629706c..0493d02d1f 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { DriveFiles, GalleryPosts } from "@/models/index.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; import { HOUR } from "@/const.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { DriveFiles, GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 633e75335a..030ca14102 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -1,7 +1,7 @@ -import { MoreThan } from "typeorm"; import { USER_ONLINE_THRESHOLD } from "@/const.js"; import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { MoreThan } from "typeorm"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/get-sounds.ts b/packages/backend/src/server/api/endpoints/get-sounds.ts index 4fd1498bd8..119ca16795 100644 --- a/packages/backend/src/server/api/endpoints/get-sounds.ts +++ b/packages/backend/src/server/api/endpoints/get-sounds.ts @@ -1,5 +1,5 @@ -import { readdir } from "fs/promises"; import define from "@/server/api/define.js"; +import { readdir } from "fs/promises"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 6e8016f64b..a19ccfa1c8 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Hashtags } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 1dc1fb4922..4709ccc7a8 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Hashtags } from "@/models/index.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Hashtags } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index 09849dbd36..136f358040 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -1,7 +1,7 @@ +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { Hashtags } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Hashtags } from "@/models/index.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index fe8bba95fd..6c41f8b828 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -1,10 +1,10 @@ -import { Brackets } from "typeorm"; -import define from "@/server/api/define.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Notes } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; -import { safeForSql } from "@/misc/safe-for-sql.js"; import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { safeForSql } from "@/misc/safe-for-sql.js"; +import type { Note } from "@/models/entities/note.js"; +import { Notes } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { Brackets } from "typeorm"; /* トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要 diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index ccb70a0596..1513703239 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { Users } from "@/models/index.js"; import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index c1a7b16a84..f10b74efec 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -1,7 +1,7 @@ +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; import * as OTPAuth from "otpauth"; -import define from "@/server/api/define.js"; -import { Users, UserProfiles } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index b8104e318f..99f6994ea1 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -1,15 +1,15 @@ -import { decode } from "cbor-x"; -import define from "@/server/api/define.js"; +import config from "@/config/index.js"; +import { comparePassword } from "@/misc/password.js"; import { + AttestationChallenges, UserProfiles, UserSecurityKeys, - AttestationChallenges, Users, } from "@/models/index.js"; -import config from "@/config/index.js"; -import { procedures, hash } from "@/server/api/2fa.js"; +import { hash, procedures } from "@/server/api/2fa.js"; +import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; -import { comparePassword } from "@/misc/password.js"; +import { decode } from "cbor-x"; const rpIdHashReal = hash(Buffer.from(config.hostname, "utf-8")); @@ -79,7 +79,7 @@ export default define(meta, paramDef, async (ps, user) => { const credentialIdLength = authData.readUInt16BE(53); const credentialId = authData.slice(55, 55 + credentialIdLength); const publicKeyData = authData.slice(55 + credentialIdLength); - const publicKey: Map = new Map( + const publicKey: Map = new Map( Object.entries(decode(publicKeyData)).map(([key, value]) => [ Number(key), value, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index 8125f817a0..aee935eb54 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -1,7 +1,7 @@ +import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { Users, UserProfiles, UserSecurityKeys } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; import { ApiError } from "@/server/api/error.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index 8080c9390f..f6d58c2788 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -1,10 +1,10 @@ -import define from "@/server/api/define.js"; -import { UserProfiles, AttestationChallenges } from "@/models/index.js"; -import { promisify } from "node:util"; import * as crypto from "node:crypto"; +import { promisify } from "node:util"; import { genId } from "@/misc/gen-id.js"; -import { hash } from "@/server/api/2fa.js"; import { comparePassword } from "@/misc/password.js"; +import { AttestationChallenges, UserProfiles } from "@/models/index.js"; +import { hash } from "@/server/api/2fa.js"; +import define from "@/server/api/define.js"; const randomBytes = promisify(crypto.randomBytes); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index 52e1df39f4..ba0220b104 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -1,9 +1,9 @@ -import * as OTPAuth from "otpauth"; -import * as QRCode from "qrcode"; import config from "@/config/index.js"; +import { comparePassword } from "@/misc/password.js"; import { UserProfiles } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { comparePassword } from "@/misc/password.js"; +import * as OTPAuth from "otpauth"; +import * as QRCode from "qrcode"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index b3bc5bdfac..cba8b431a3 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -1,6 +1,6 @@ import { comparePassword } from "@/misc/password.js"; -import define from "@/server/api/define.js"; import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index c4e78eecb5..3923504233 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from "@/services/stream.js"; -import define from "@/server/api/define.js"; -import { Users, UserProfiles } from "@/models/index.js"; import { comparePassword } from "@/misc/password.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts index d77ecc88e8..0a55937dd4 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from "@/services/stream.js"; +import { UserSecurityKeys, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { Users, UserSecurityKeys } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index 7e7574ec91..9669d22c6b 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { AccessTokens } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index ad66fe1fd3..145052289c 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { AccessTokens, Apps } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index b0dc8bba60..cef86a6bb5 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; +import { comparePassword, hashPassword } from "@/misc/password.js"; import { UserProfiles } from "@/models/index.js"; -import { hashPassword, comparePassword } from "@/misc/password.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 606cde82e1..9e6ce15cd9 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -1,7 +1,7 @@ -import { UserProfiles, Users } from "@/models/index.js"; -import { deleteAccount } from "@/services/delete-account.js"; -import define from "@/server/api/define.js"; import { comparePassword } from "@/misc/password.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { deleteAccount } from "@/services/delete-account.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-blocking.ts b/packages/backend/src/server/api/endpoints/i/export-blocking.ts index 30e74ab2f5..664689d005 100644 --- a/packages/backend/src/server/api/endpoints/i/export-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/export-blocking.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { createExportBlockingJob } from "@/queue/index.js"; import { HOUR } from "@/const.js"; +import { createExportBlockingJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index 07d2997a18..6f574f8bff 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { createExportFollowingJob } from "@/queue/index.js"; import { HOUR } from "@/const.js"; +import { createExportFollowingJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-mute.ts b/packages/backend/src/server/api/endpoints/i/export-mute.ts index 7d22a073e6..e572297840 100644 --- a/packages/backend/src/server/api/endpoints/i/export-mute.ts +++ b/packages/backend/src/server/api/endpoints/i/export-mute.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { createExportMuteJob } from "@/queue/index.js"; import { HOUR } from "@/const.js"; +import { createExportMuteJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-notes.ts b/packages/backend/src/server/api/endpoints/i/export-notes.ts index f167bb83cb..393ab01eb3 100644 --- a/packages/backend/src/server/api/endpoints/i/export-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/export-notes.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { createExportNotesJob } from "@/queue/index.js"; import { DAY } from "@/const.js"; +import { createExportNotesJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts index b68d889dcd..c77e46878a 100644 --- a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { createExportUserListsJob } from "@/queue/index.js"; import { MINUTE } from "@/const.js"; +import { createExportUserListsJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index f0961ea236..1e34f13705 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { NoteFavorites } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index 80c90e684d..42fd9ad8c4 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { GalleryLikes } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index 054784842d..c654bfc316 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -1,6 +1,6 @@ import { GalleryPosts } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index 39cc45e822..f987a58ace 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { MutedNotes } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index 58314aced3..9672663e1c 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { createImportBlockingJob } from "@/queue/index.js"; -import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; import { HOUR } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; +import { createImportBlockingJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index b7c475698c..a40b010c01 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { createImportFollowingJob } from "@/queue/index.js"; -import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; import { HOUR } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; +import { createImportFollowingJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index 494fb0d420..750d23ec7c 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { createImportMutingJob } from "@/queue/index.js"; -import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; import { HOUR } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; +import { createImportMutingJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-posts.ts b/packages/backend/src/server/api/endpoints/i/import-posts.ts index b8b52be98f..582807aa08 100644 --- a/packages/backend/src/server/api/endpoints/i/import-posts.ts +++ b/packages/backend/src/server/api/endpoints/i/import-posts.ts @@ -1,9 +1,9 @@ -import define from "@/server/api/define.js"; -import { createImportPostsJob } from "@/queue/index.js"; -import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; import { DAY } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import { DriveFiles } from "@/models/index.js"; +import { createImportPostsJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index ed82a96054..10ce72e758 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { createImportUserListsJob } from "@/queue/index.js"; -import { ApiError } from "@/server/api/error.js"; -import { DriveFiles } from "@/models/index.js"; import { HOUR } from "@/const.js"; +import { DriveFiles } from "@/models/index.js"; +import { createImportUserListsJob } from "@/queue/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/known-as.ts b/packages/backend/src/server/api/endpoints/i/known-as.ts index 39bf6fff83..d6d44bf948 100644 --- a/packages/backend/src/server/api/endpoints/i/known-as.ts +++ b/packages/backend/src/server/api/endpoints/i/known-as.ts @@ -1,14 +1,14 @@ +import { DAY } from "@/const.js"; +import { parse } from "@/misc/acct.js"; import type { User } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; import { resolveUser } from "@/remote/resolve-user.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { apiLogger } from "@/server/api/logger.js"; import acceptAllFollowRequests from "@/services/following/requests/accept-all.js"; import { publishToFollowers } from "@/services/i/update.js"; import { publishMainStream } from "@/services/stream.js"; -import { DAY } from "@/const.js"; -import { apiLogger } from "@/server/api/logger.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { parse } from "@/misc/acct.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index c6d1205f98..db0d3dfc2f 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -1,18 +1,18 @@ -import type { User } from "@/models/entities/user.js"; -import { resolveUser } from "@/remote/resolve-user.js"; +import config from "@/config/index.js"; import { DAY } from "@/const.js"; +import { parse } from "@/misc/acct.js"; +import type { User } from "@/models/entities/user.js"; +import { Followings, Users } from "@/models/index.js"; import DeliverManager from "@/remote/activitypub/deliver-manager.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { apiLogger } from "@/server/api/logger.js"; -import deleteFollowing from "@/services/following/delete.js"; import create from "@/services/following/create.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import config from "@/config/index.js"; +import deleteFollowing from "@/services/following/delete.js"; import { publishMainStream } from "@/services/stream.js"; -import { parse } from "@/misc/acct.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index b07247dd83..2f9043f162 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -1,16 +1,16 @@ -import { Brackets } from "typeorm"; import { - Notifications, Followings, Mutings, - Users, + Notifications, UserProfiles, + Users, } from "@/models/index.js"; -import { notificationTypes } from "@/types.js"; -import read from "@/services/note/read.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { readNotification } from "@/server/api/common/read-notification.js"; import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import read from "@/services/note/read.js"; +import { notificationTypes } from "@/types.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["account", "notifications"], diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 289d072670..6cf7a8c066 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -1,6 +1,6 @@ import { PageLikes } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "pages"], diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index 1177d2e664..f2912a6c98 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -1,6 +1,6 @@ import { Pages } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "pages"], diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index 4291541ea2..106342b6df 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -1,7 +1,7 @@ -import { addPinned } from "@/services/i/pin.js"; +import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Users } from "@/models/index.js"; +import { addPinned } from "@/services/i/pin.js"; export const meta = { tags: ["account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index 505c424edb..0dcd89fa89 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from "@/services/stream.js"; -import define from "@/server/api/define.js"; import { MessagingMessages, UserGroupJoinings } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["account", "messaging"], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 6f70e55a1a..32439f544b 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from "@/services/stream.js"; -import define from "@/server/api/define.js"; import { NoteUnreads } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index a59d15b994..98da5576b9 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { genId } from "@/misc/gen-id.js"; import { AnnouncementReads, Announcements, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import { publishMainStream } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index c1b4325adb..348167aeaf 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -1,12 +1,12 @@ +import { comparePassword } from "@/misc/password.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import generateUserToken from "@/server/api/common/generate-native-user-token.js"; +import define from "@/server/api/define.js"; import { publishInternalEvent, publishMainStream, publishUserEvent, } from "@/services/stream.js"; -import generateUserToken from "@/server/api/common/generate-native-user-token.js"; -import define from "@/server/api/define.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import { comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index c267bb144e..b3edd0f959 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index 57db3c7144..d7f269ec2e 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts index ac37beea54..dd2ef8c9d8 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts @@ -1,6 +1,6 @@ -import { ApiError } from "@/server/api/error.js"; -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index d25047e009..96ae834d19 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index f691552bce..e261f8eedd 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index 186e744bd1..bc89e33a38 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index aa459952ee..bef2d7b2b8 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index e235ef67f0..53d8113c05 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index 7a1f8ab5f7..0e61ef78c0 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from "@/services/stream.js"; -import define from "@/server/api/define.js"; -import { RegistryItems } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { RegistryItems } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index f3e8116944..4a86b86135 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { AccessTokens } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 14d303089e..17802b7455 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { Signins } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index 9aee1dfea8..bba01786cd 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -1,7 +1,7 @@ -import { removePinned } from "@/services/i/pin.js"; +import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Users } from "@/models/index.js"; +import { removePinned } from "@/services/i/pin.js"; export const meta = { tags: ["account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index a48252ed1a..494f35ddab 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -1,13 +1,13 @@ -import { publishMainStream } from "@/services/stream.js"; -import define from "@/server/api/define.js"; -import rndstr from "rndstr"; import config from "@/config/index.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import { sendEmail } from "@/services/send-email.js"; -import { ApiError } from "@/server/api/error.js"; -import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; import { HOUR } from "@/const.js"; import { comparePassword } from "@/misc/password.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { sendEmail } from "@/services/send-email.js"; +import { publishMainStream } from "@/services/stream.js"; +import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; +import rndstr from "rndstr"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 082108383e..d352db7241 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -1,20 +1,20 @@ -import RE2 from "re2"; -import * as mfm from "mfm-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 { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { updateUsertags } from "@/services/update-hashtag.js"; -import { Users, DriveFiles, UserProfiles, Pages } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import { notificationTypes } from "@/types.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; import { langmap } from "@/misc/langmap.js"; -import { verifyLink } from "@/services/fetch-rel-me.js"; -import { ApiError } from "@/server/api/error.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import type { User } from "@/models/entities/user.js"; +import { DriveFiles, Pages, UserProfiles, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { verifyLink } from "@/services/fetch-rel-me.js"; +import acceptAllFollowRequests from "@/services/following/requests/accept-all.js"; +import { publishToFollowers } from "@/services/i/update.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { updateUsertags } from "@/services/update-hashtag.js"; +import { notificationTypes } from "@/types.js"; +import * as mfm from "mfm-js"; +import RE2 from "re2"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 99e8209a37..19cab832ca 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { UserGroupInvitations } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "groups"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts index ee38b76372..161a4a0564 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; import { genId } from "@/misc/gen-id.js"; -import { Webhooks } from "@/models/index.js"; -import { publishInternalEvent } from "@/services/stream.js"; import { webhookEventTypes } from "@/models/entities/webhook.js"; +import { Webhooks } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { publishInternalEvent } from "@/services/stream.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts index a92ed179d0..a9df7a94d4 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts @@ -1,6 +1,6 @@ +import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Webhooks } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts index f937e560c5..da98cb81d2 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Webhooks } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["webhooks", "account"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts index b24850f5e5..158d71b00a 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts @@ -1,6 +1,6 @@ +import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Webhooks } from "@/models/index.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts index 4a211b915f..f2656bbf9e 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts @@ -1,8 +1,8 @@ +import { webhookEventTypes } from "@/models/entities/webhook.js"; +import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Webhooks } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; -import { webhookEventTypes } from "@/models/entities/webhook.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 25418a17a6..f9e00aa79f 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -1,4 +1,3 @@ -import { Brackets } from "typeorm"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { MessagingMessages, @@ -6,6 +5,7 @@ import { UserGroupJoinings, } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index 01f7028673..dde4c9a0d0 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -1,19 +1,19 @@ -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; import { MessagingMessages, - UserGroups, UserGroupJoinings, + UserGroups, Users, } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { Brackets } from "typeorm"; import { - readUserMessagingMessage, - readGroupMessagingMessage, deliverReadActivity, + readGroupMessagingMessage, + readUserMessagingMessage, } from "@/server/api/common/read-messaging-message.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 6fd38eff79..654bd75f93 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -1,14 +1,14 @@ +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { User } from "@/models/entities/user.js"; +import { + Blockings, + DriveFiles, + UserGroupJoinings, + UserGroups, +} from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { - DriveFiles, - UserGroups, - UserGroupJoinings, - Blockings, -} from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import { createMessage } from "@/services/messages/create.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index 76691dd34d..dd8471aeec 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -1,8 +1,8 @@ +import { HOUR, SECOND } from "@/const.js"; +import { MessagingMessages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { MessagingMessages } from "@/models/index.js"; import { deleteMessage } from "@/services/messages/delete.js"; -import { SECOND, HOUR } from "@/const.js"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index 5aa50155ca..1b4cc4d706 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -1,10 +1,10 @@ -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { MessagingMessages } from "@/models/index.js"; import { - readUserMessagingMessage, readGroupMessagingMessage, + readUserMessagingMessage, } from "@/server/api/common/read-messaging-message.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 9dffad780f..0cb137b8d1 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -1,10 +1,10 @@ -import JSON5 from "json5"; -import { IsNull, MoreThan } from "typeorm"; import config from "@/config/index.js"; +import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Ads, Emojis, Users } from "@/models/index.js"; -import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; import define from "@/server/api/define.js"; +import JSON5 from "json5"; +import { IsNull, MoreThan } from "typeorm"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index bca09d3f07..35f18c0e47 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -1,7 +1,7 @@ -import define from "@/server/api/define.js"; -import { AccessTokens } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import { secureRndstr } from "@/misc/secure-rndstr.js"; +import { AccessTokens } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 2eb935198e..0ff1721d69 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -1,9 +1,9 @@ +import { genId } from "@/misc/gen-id.js"; +import type { Muting } from "@/models/entities/muting.js"; +import { Mutings, NoteWatchings } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { genId } from "@/misc/gen-id.js"; -import { Mutings, NoteWatchings } from "@/models/index.js"; -import type { Muting } from "@/models/entities/muting.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 8058e9a612..104bc49450 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -1,7 +1,7 @@ +import { Mutings } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { Mutings } from "@/models/index.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index 9619457cd7..a0126468e6 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { Mutings } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index bc75b38e58..1147c22fab 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { Apps } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account", "app"], diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index 6e2d3b4f3b..a63f597fa5 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -1,6 +1,6 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index d76771c34c..afdd9c414f 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -1,9 +1,9 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index 430ed02ec6..f649ae4599 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -1,8 +1,8 @@ -import { In } from "typeorm"; import { ClipNotes, Clips } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { In } from "typeorm"; export const meta = { tags: ["clips", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index 9939740874..fdb45430a4 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -1,8 +1,8 @@ import type { Note } from "@/models/entities/note.js"; import { Notes } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 0465d09ec4..426b6904a0 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -1,22 +1,22 @@ -import { In } from "typeorm"; -import create from "@/services/note/create.js"; -import type { User } from "@/models/entities/user.js"; -import { - Users, - DriveFiles, - Notes, - Channels, - Blockings, -} from "@/models/index.js"; +import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; +import { HOUR } from "@/const.js"; +import type { Channel } from "@/models/entities/channel.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; import type { Note } from "@/models/entities/note.js"; -import type { Channel } from "@/models/entities/channel.js"; -import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { noteVisibilities } from "@/types.js"; -import { ApiError } from "@/server/api/error.js"; -import define from "@/server/api/define.js"; -import { HOUR } from "@/const.js"; +import type { User } from "@/models/entities/user.js"; +import { + Blockings, + Channels, + DriveFiles, + Notes, + Users, +} from "@/models/index.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import create from "@/services/note/create.js"; +import { noteVisibilities } from "@/types.js"; +import { In } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 54aad1ebad..32a64661de 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -1,9 +1,9 @@ -import deleteNote from "@/services/note/delete.js"; +import { HOUR, SECOND } from "@/const.js"; import { Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { SECOND, HOUR } from "@/const.js"; +import deleteNote from "@/services/note/delete.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index a0869e4104..9e9fdd9e5b 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -1,41 +1,41 @@ -import { In } from "typeorm"; -import { index } from "@/services/note/create.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { - Users, - DriveFiles, - Notes, - Channels, - Blockings, - UserProfiles, - Polls, - NoteEdits, -} from "@/models/index.js"; +import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; +import { HOUR } from "@/const.js"; +import detectLanguage from "@/misc/detect-language.js"; +import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import { genId } from "@/misc/gen-id.js"; +// import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; +import { langmap } from "@/misc/langmap.js"; +import type { Channel } from "@/models/entities/channel.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; -import type { Channel } from "@/models/entities/channel.js"; -import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { noteVisibilities } from "@/types.js"; -import { ApiError } from "@/server/api/error.js"; -import define from "@/server/api/define.js"; -import { HOUR } from "@/const.js"; -import { getNote } from "@/server/api/common/getters.js"; import { Poll } from "@/models/entities/poll.js"; -import * as mfm from "mfm-js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { + Blockings, + Channels, + DriveFiles, + NoteEdits, + Notes, + Polls, + UserProfiles, + Users, +} from "@/models/index.js"; import { concat } from "@/prelude/array.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import { extractMentionedUsers } from "@/services/note/create.js"; -import { genId } from "@/misc/gen-id.js"; -import { publishNoteStream } from "@/services/stream.js"; import DeliverManager from "@/remote/activitypub/deliver-manager.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderNote from "@/remote/activitypub/renderer/note.js"; import renderUpdate from "@/remote/activitypub/renderer/update.js"; +import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { index } from "@/services/note/create.js"; +import { extractMentionedUsers } from "@/services/note/create.js"; import { deliverToRelays } from "@/services/relay.js"; -// import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; -import { langmap } from "@/misc/langmap.js"; -import detectLanguage from "@/misc/detect-language.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { noteVisibilities } from "@/types.js"; +import * as mfm from "mfm-js"; +import { In } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 8b2c7ad3a4..16cf51c279 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -1,8 +1,8 @@ -import { NoteFavorites } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { NoteFavorites } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index 018ef91bca..b2b0ad6b0f 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -1,7 +1,7 @@ import { NoteFavorites } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 4f90145ec3..3c15d70502 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -1,7 +1,7 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index fee660ddb2..d8e49f06e0 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -1,14 +1,14 @@ import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { activeUsersChart } from "@/services/chart/index.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index c573a0c865..4639b97ec3 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -1,17 +1,17 @@ -import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Followings, Notes } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index c89b8f8710..5deaeb00ae 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -1,17 +1,17 @@ -import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 44ee90938b..1b606087f5 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -1,12 +1,12 @@ -import { Brackets } from "typeorm"; -import read from "@/services/note/read.js"; -import { Notes, Followings } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { Followings, Notes } from "@/models/index.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; import { generateMutedNoteThreadQuery } from "@/server/api/common/generate-muted-note-thread-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import read from "@/services/note/read.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index ca0d0f03dd..a792b75e9a 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -1,6 +1,6 @@ -import { Brackets, In } from "typeorm"; -import { Polls, Mutings, Notes, PollVotes } from "@/models/index.js"; +import { Mutings, Notes, PollVotes, Polls } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Brackets, In } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 1680eca640..45916e721e 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -1,21 +1,21 @@ -import { Not } from "typeorm"; -import { publishNoteStream } from "@/services/stream.js"; -import { createNotification } from "@/services/create-notification.js"; +import { genId } from "@/misc/gen-id.js"; +import type { IRemoteUser } from "@/models/entities/user.js"; +import { + Blockings, + NoteWatchings, + PollVotes, + Polls, + Users, +} from "@/models/index.js"; import { deliver } from "@/queue/index.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderVote from "@/remote/activitypub/renderer/vote.js"; -import { - PollVotes, - NoteWatchings, - Users, - Polls, - Blockings, -} from "@/models/index.js"; -import type { IRemoteUser } from "@/models/entities/user.js"; -import { genId } from "@/misc/gen-id.js"; import { getNote } from "@/server/api/common/getters.js"; -import { ApiError } from "@/server/api/error.js"; import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { createNotification } from "@/services/create-notification.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { Not } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index 386a3a08df..ed38b1af14 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -1,9 +1,9 @@ -import type { FindOptionsWhere } from "typeorm"; -import { NoteReactions } from "@/models/index.js"; import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import { NoteReactions } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; +import type { FindOptionsWhere } from "typeorm"; export const meta = { tags: ["notes", "reactions"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index c49a957da1..36c70c34dd 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -1,7 +1,7 @@ -import createReaction from "@/services/note/reaction/create.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import createReaction from "@/services/note/reaction/create.js"; export const meta = { tags: ["reactions", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index f135bd7ffa..503015fda4 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -1,8 +1,8 @@ -import deleteReaction from "@/services/note/reaction/delete.js"; -import define from "@/server/api/define.js"; +import { HOUR, SECOND } from "@/const.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { SECOND, HOUR } from "@/const.js"; +import deleteReaction from "@/services/note/reaction/delete.js"; export const meta = { tags: ["reactions", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index 53ac1288a8..ae8c8bd000 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -1,17 +1,17 @@ -import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index 683004ebe8..7b7d88cda6 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -1,11 +1,11 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { getNote } from "@/server/api/common/getters.js"; -import { ApiError } from "@/server/api/error.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["notes"], @@ -53,7 +53,7 @@ export default define(meta, paramDef, async (ps, user) => { throw err; }); - let query = makePaginationQuery( + const query = makePaginationQuery( Notes.createQueryBuilder("note"), ps.sinceId, ps.untilId, diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index e4341ebce0..8da59ea850 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -1,9 +1,9 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index e87725e342..6ede52a181 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -1,12 +1,12 @@ -import { Brackets } from "typeorm"; -import { Notes } from "@/models/index.js"; -import { safeForSql } from "@/misc/safe-for-sql.js"; import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { safeForSql } from "@/misc/safe-for-sql.js"; +import { Notes } from "@/models/index.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes", "hashtags"], diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 4ddcf11abf..9bd33c1603 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -1,16 +1,16 @@ -import { FindManyOptions, In } from "typeorm"; -import { Notes } from "@/models/index.js"; -import { Note } from "@/models/entities/note.js"; import config from "@/config/index.js"; import es from "@/db/elasticsearch.js"; -import sonic from "@/db/sonic.js"; import meilisearch, { MeilisearchNote } from "@/db/meilisearch.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import sonic from "@/db/sonic.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Note } from "@/models/entities/note.js"; +import { Notes } from "@/models/index.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; +import { FindManyOptions, In } from "typeorm"; export const meta = { tags: ["notes"], @@ -243,7 +243,7 @@ export default define(meta, paramDef, async (ps, me) => { while (found.length < ps.limit && start < noteIDs.length) { const chunk = noteIDs.slice(start, start + chunkSize); - let query: FindManyOptions = { + const query: FindManyOptions = { where: { id: In(chunk), }, diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index 1319e47d93..7cbb6b3f6f 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -1,6 +1,6 @@ import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 7c40a45923..9dd3c53a04 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -1,9 +1,9 @@ -import { Notes, NoteThreadMutings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import readNote from "@/services/note/read.js"; -import define from "@/server/api/define.js"; +import { NoteThreadMutings, Notes } from "@/models/index.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import readNote from "@/services/note/read.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index 62766bedc6..dc18876584 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -1,6 +1,6 @@ import { NoteThreadMutings } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index 0f8da62e2d..8512149ec1 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -1,16 +1,16 @@ -import { Brackets } from "typeorm"; -import { Notes, Followings } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { Followings, Notes } from "@/models/index.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index d1de399936..61f7041d1e 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -1,12 +1,12 @@ import { URLSearchParams } from "node:url"; -import fetch from "node-fetch"; import config from "@/config/index.js"; -import { Converter } from "opencc-js"; -import { getAgentByUrl } from "@/misc/fetch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { ApiError } from "@/server/api/error.js"; +import { getAgentByUrl } from "@/misc/fetch.js"; import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import fetch from "node-fetch"; +import { Converter } from "opencc-js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index 4a3966123e..18e49574f3 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -1,9 +1,9 @@ -import deleteNote from "@/services/note/delete.js"; +import { HOUR, SECOND } from "@/const.js"; import { Notes, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { SECOND, HOUR } from "@/const.js"; +import deleteNote from "@/services/note/delete.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 3a87ed647c..d52f10ad09 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -1,10 +1,10 @@ -import { Brackets } from "typeorm"; -import { UserLists, UserListJoinings, Notes } from "@/models/index.js"; -import { activeUsersChart } from "@/services/chart/index.js"; +import { Notes, UserListJoinings, UserLists } from "@/models/index.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["notes", "lists"], diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index ec13f5aa2a..f5faf5adac 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -1,7 +1,7 @@ -import watch from "@/services/note/watch.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import watch from "@/services/note/watch.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index 18994fa80c..f4bea44108 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -1,7 +1,7 @@ -import unwatch from "@/services/note/unwatch.js"; -import define from "@/server/api/define.js"; import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import unwatch from "@/services/note/unwatch.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index 2077cceba4..f29a30ac36 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -1,5 +1,5 @@ -import { createNotification } from "@/services/create-notification.js"; import define from "@/server/api/define.js"; +import { createNotification } from "@/services/create-notification.js"; export const meta = { tags: ["notifications"], diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 568036380a..06539dd155 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from "@/services/stream.js"; -import { pushNotification } from "@/services/push-notification.js"; import { Notifications } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { pushNotification } from "@/services/push-notification.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["notifications", "account"], diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 358ca062fe..534d3f78ed 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { readNotification } from "@/server/api/common/read-notification.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notifications", "account"], diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index 1f87372d61..194129e438 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from "@/services/stream.js"; -import { Users, Pages } from "@/models/index.js"; +import { Pages, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index ea0f8ba83e..cac0fd3b18 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -1,9 +1,9 @@ -import { Pages, DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; import { genId } from "@/misc/gen-id.js"; import { Page } from "@/models/entities/page.js"; +import { DriveFiles, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { HOUR } from "@/const.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index ab64b9b93e..4a396786db 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -1,5 +1,5 @@ -import { Pages, PageLikes } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { PageLikes, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index ac347cf139..54b6b3ccc8 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -1,8 +1,8 @@ -import { IsNull } from "typeorm"; -import { Pages, Users } from "@/models/index.js"; import type { Page } from "@/models/entities/page.js"; +import { Pages, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index 428f984582..3b020709ed 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -1,4 +1,4 @@ -import { Pages, PageLikes } from "@/models/index.js"; +import { PageLikes, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 5f434d02e1..3189c140ab 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -1,8 +1,8 @@ -import { Not } from "typeorm"; -import { Pages, DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; +import { DriveFiles, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { HOUR } from "@/const.js"; +import { Not } from "typeorm"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/patrons.ts b/packages/backend/src/server/api/endpoints/patrons.ts index 12a41742b0..cb939caa51 100644 --- a/packages/backend/src/server/api/endpoints/patrons.ts +++ b/packages/backend/src/server/api/endpoints/patrons.ts @@ -1,8 +1,8 @@ -import define from "@/server/api/define.js"; -import { redisClient } from "@/db/redis.js"; import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import { redisClient } from "@/db/redis.js"; +import define from "@/server/api/define.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index b327378700..b75eb3f215 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -1,9 +1,9 @@ -import { IsNull } from "typeorm"; -import { Users } from "@/models/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import * as Acct from "@/misc/acct.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index 4b41467906..eb1cc12854 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -1,8 +1,8 @@ -import { PromoReads } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; +import { PromoReads } from "@/models/index.js"; +import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/create.ts b/packages/backend/src/server/api/endpoints/renote-mute/create.ts index afe23f38da..6b020c2a2c 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/create.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/create.ts @@ -1,9 +1,9 @@ import { genId } from "@/misc/gen-id.js"; -import { RenoteMutings } from "@/models/index.js"; import { RenoteMuting } from "@/models/entities/renote-muting.js"; +import { RenoteMutings } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts index 6a824881b0..436ff8a8e5 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts @@ -1,7 +1,7 @@ import { RenoteMutings } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/list.ts b/packages/backend/src/server/api/endpoints/renote-mute/list.ts index b19452714d..9dbea92416 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/list.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/list.ts @@ -1,6 +1,6 @@ import { RenoteMutings } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index 3c78058af2..802b882edc 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -1,11 +1,11 @@ +import config from "@/config/index.js"; +import { HOUR } from "@/const.js"; +import { genId } from "@/misc/gen-id.js"; +import { PasswordResetRequests, UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { sendEmail } from "@/services/send-email.js"; import rndstr from "rndstr"; import { IsNull } from "typeorm"; -import config from "@/config/index.js"; -import { Users, UserProfiles, PasswordResetRequests } from "@/models/index.js"; -import { sendEmail } from "@/services/send-email.js"; -import { genId } from "@/misc/gen-id.js"; -import define from "@/server/api/define.js"; -import { HOUR } from "@/const.js"; export const meta = { tags: ["reset password"], diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index ff5c8d987f..8f642f8845 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -1,6 +1,6 @@ -import { UserProfiles, PasswordResetRequests } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { hashPassword } from "@/misc/password.js"; +import { PasswordResetRequests, UserProfiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["reset password"], diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index ff3bfcd100..dd9ff1627e 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -1,8 +1,8 @@ import * as os from "node:os"; -import si from "systeminformation"; -import define from "@/server/api/define.js"; import meilisearch from "@/db/meilisearch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import define from "@/server/api/define.js"; +import si from "systeminformation"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index cd634a798a..88c5964bce 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -1,7 +1,7 @@ -import { IsNull } from "typeorm"; -import { Users, UsedUsernames } from "@/models/index.js"; import config from "@/config/index.js"; +import { UsedUsernames, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 20371fce9f..f8a24c2901 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -1,7 +1,7 @@ import { Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; import { generateBlockQueryForUsers } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index 132e190bb6..f57c3cfd1a 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -1,6 +1,6 @@ import { Clips } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users", "clips"], diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index f57983d4b9..05847a10aa 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -1,9 +1,9 @@ -import { IsNull } from "typeorm"; -import { Users, Followings, UserProfiles } from "@/models/index.js"; import { toPunyNullable } from "@/misc/convert-host.js"; +import { Followings, UserProfiles, Users } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 84eb7cccc5..12f4e794b7 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -1,9 +1,9 @@ -import { IsNull } from "typeorm"; -import { Users, Followings, UserProfiles } from "@/models/index.js"; import { toPunyNullable } from "@/misc/convert-host.js"; +import { Followings, UserProfiles, Users } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { IsNull } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index e2edbee86a..dad29f4357 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { GalleryPosts } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index 0694bd6632..3a4caf9833 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -1,9 +1,9 @@ -import { Not, In, IsNull } from "typeorm"; -import { maximum } from "@/prelude/array.js"; import { Notes, Users } from "@/models/index.js"; +import { maximum } from "@/prelude/array.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { In, IsNull, Not } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index 1cfb223013..797906e798 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -1,7 +1,7 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import type { UserGroupJoining } from "@/models/entities/user-group-joining.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index a483ccd184..dc739da5d1 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -1,8 +1,8 @@ -import { UserGroupJoinings, UserGroupInvitations } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserGroupJoining } from "@/models/entities/user-group-joining.js"; -import { ApiError } from "@/server/api/error.js"; +import { UserGroupInvitations, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index 8a1e6b31ed..bdc5f2a8e5 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -1,14 +1,14 @@ -import { - UserGroups, - UserGroupJoinings, - UserGroupInvitations, -} from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserGroupInvitation } from "@/models/entities/user-group-invitation.js"; -import { createNotification } from "@/services/create-notification.js"; +import { + UserGroupInvitations, + UserGroupJoinings, + UserGroups, +} from "@/models/index.js"; import { getUser } from "@/server/api/common/getters.js"; -import { ApiError } from "@/server/api/error.js"; import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { createNotification } from "@/services/create-notification.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index 5d50b5e33c..aa9df7f917 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -1,6 +1,6 @@ -import { Not, In } from "typeorm"; -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { In, Not } from "typeorm"; export const meta = { tags: ["groups", "account"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index 8165b1d988..e01b8e1686 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -1,4 +1,4 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index 5e7f91d70a..a20ac7331a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -1,7 +1,7 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index 0cd5a92331..20c7f0e877 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -1,4 +1,4 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index b58ea57b7f..e742365c0c 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -1,7 +1,7 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index c23e8f6f53..d506b49afc 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -1,6 +1,6 @@ -import { UserLists } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserList } from "@/models/entities/user-list.js"; +import { UserLists } from "@/models/index.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index ffca5b205a..69dc272706 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -1,8 +1,8 @@ -import { publishUserListStream } from "@/services/stream.js"; -import { UserLists, UserListJoinings, Users } from "@/models/index.js"; +import { UserListJoinings, UserLists, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { publishUserListStream } from "@/services/stream.js"; export const meta = { tags: ["lists", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 8dd4442d00..2aa8c425e7 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -1,8 +1,8 @@ -import { pushUserToUserList } from "@/services/user-list/push.js"; -import { UserLists, UserListJoinings, Blockings } from "@/models/index.js"; +import { Blockings, UserListJoinings, UserLists } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { pushUserToUserList } from "@/services/user-list/push.js"; export const meta = { tags: ["lists", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 1485dfa6c5..63a74276bc 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -1,12 +1,12 @@ -import { Brackets } from "typeorm"; import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { getUser } from "@/server/api/common/getters.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["users", "notes"], diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 1af50e78a9..774e48716b 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -1,6 +1,6 @@ import { Pages } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users", "pages"], diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 483a78865f..3a41c671b5 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -1,7 +1,7 @@ import { NoteReactions, UserProfiles } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 4ea0d618ed..6b65d92e3c 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -1,11 +1,11 @@ -import { Users, Followings } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; -import { - generateBlockedUserQuery, - generateBlockQueryForUsers, -} from "@/server/api/common/generate-block-query.js"; import { DAY } from "@/const.js"; +import { Followings, Users } from "@/models/index.js"; +import { + generateBlockQueryForUsers, + generateBlockedUserQuery, +} from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index 7e9ba7238c..988dfa9dab 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -1,14 +1,14 @@ +import { toHtml } from "@/mfm/to-html.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { genId } from "@/misc/gen-id.js"; +import { AbuseUserReports, UserProfiles, Users } from "@/models/index.js"; +import { getUser } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { sendEmail } from "@/services/send-email.js"; +import { publishAdminStream } from "@/services/stream.js"; import * as mfm from "mfm-js"; import sanitizeHtml from "sanitize-html"; -import { publishAdminStream } from "@/services/stream.js"; -import { AbuseUserReports, UserProfiles, Users } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { sendEmail } from "@/services/send-email.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { ApiError } from "@/server/api/error.js"; -import define from "@/server/api/define.js"; -import { toHtml } from "@/mfm/to-html.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 517ef615b1..44a10ec681 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -1,8 +1,8 @@ -import { Brackets } from "typeorm"; -import { Followings, Users } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; -import define from "@/server/api/define.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import type { User } from "@/models/entities/user.js"; +import { Followings, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 3aef6dc901..bfb1560a7e 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -1,8 +1,8 @@ -import { Brackets } from "typeorm"; -import { UserProfiles, Users } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; -import define from "@/server/api/define.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import type { User } from "@/models/entities/user.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { Brackets } from "typeorm"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index 61812a0189..a7704a85be 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -1,11 +1,11 @@ +import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { apiLogger } from "@/server/api/logger.js"; import type { FindOptionsWhere } from "typeorm"; import { In, IsNull } from "typeorm"; -import { resolveUser } from "@/remote/resolve-user.js"; -import { Users } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; -import define from "@/server/api/define.js"; -import { apiLogger } from "@/server/api/logger.js"; -import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index a5970d5843..edce9be2be 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -2,31 +2,31 @@ * API Server */ -import Koa from "koa"; -import Router from "@koa/router"; -import multer from "@koa/multer"; -import bodyParser from "koa-bodyparser"; +import config from "@/config/index.js"; +import { AccessTokens, Users } from "@/models/index.js"; import cors from "@koa/cors"; +import multer from "@koa/multer"; +import Router from "@koa/router"; +import Koa from "koa"; +import { koaBody } from "koa-body"; +import bodyParser from "koa-bodyparser"; +import handler from "./api-handler.js"; +import compatibility from "./compatibility.js"; +import endpoints from "./endpoints.js"; import { apiMastodonCompatible, getClient, } from "./mastodon/ApiMastodonCompatibleService.js"; -import { AccessTokens, Users } from "@/models/index.js"; -import config from "@/config/index.js"; -import endpoints from "./endpoints.js"; -import compatibility from "./compatibility.js"; -import handler from "./api-handler.js"; -import signup from "./private/signup.js"; +import { convertAttachment } from "./mastodon/converters.js"; import signin from "./private/signin.js"; import signupPending from "./private/signup-pending.js"; +import signup from "./private/signup.js"; import verifyEmail from "./private/verify-email.js"; -import { koaBody } from "koa-body"; -import { convertAttachment } from "./mastodon/converters.js"; // TODO?: should we avoid importing things from built directory? import { - convertId, IdConvertType as IdType, + convertId, } from "native-utils/built/index.js"; // re-export native rust id conversion (function and enum) diff --git a/packages/backend/src/server/api/limiter.ts b/packages/backend/src/server/api/limiter.ts index f03f8754cf..edaed8f2d8 100644 --- a/packages/backend/src/server/api/limiter.ts +++ b/packages/backend/src/server/api/limiter.ts @@ -1,8 +1,8 @@ -import Limiter from "ratelimiter"; -import Logger from "@/services/logger.js"; import { redisClient } from "@/db/redis.js"; -import type { IEndpointMeta } from "./endpoints.js"; import { convertMilliseconds } from "@/misc/convert-milliseconds.js"; +import Logger from "@/services/logger.js"; +import Limiter from "ratelimiter"; +import type { IEndpointMeta } from "./endpoints.js"; const logger = new Logger("limiter"); diff --git a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts index e029bc604e..c58709eac0 100644 --- a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts +++ b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts @@ -1,21 +1,21 @@ +import { Users } from "@/models/index.js"; +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import megalodon, { MegalodonInterface } from "megalodon"; -import { apiAuthMastodon } from "./endpoints/auth.js"; -import { apiAccountMastodon } from "./endpoints/account.js"; -import { apiStatusMastodon } from "./endpoints/status.js"; -import { apiFilterMastodon } from "./endpoints/filter.js"; -import { apiTimelineMastodon } from "./endpoints/timeline.js"; -import { apiNotificationsMastodon } from "./endpoints/notifications.js"; -import { apiSearchMastodon } from "./endpoints/search.js"; -import { getInstance } from "./endpoints/meta.js"; +import { IsNull } from "typeorm"; import { convertAccount, convertAnnouncement, convertFilter, } from "./converters.js"; -import { convertId, IdType } from "@/server/api/index.js"; -import { Users } from "@/models/index.js"; -import { IsNull } from "typeorm"; +import { apiAccountMastodon } from "./endpoints/account.js"; +import { apiAuthMastodon } from "./endpoints/auth.js"; +import { apiFilterMastodon } from "./endpoints/filter.js"; +import { getInstance } from "./endpoints/meta.js"; +import { apiNotificationsMastodon } from "./endpoints/notifications.js"; +import { apiSearchMastodon } from "./endpoints/search.js"; +import { apiStatusMastodon } from "./endpoints/status.js"; +import { apiTimelineMastodon } from "./endpoints/timeline.js"; export function getClient( BASE_URL: string, diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 30506d9c51..03217d800d 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -1,5 +1,5 @@ +import { IdType, convertId } from "@/server/api/index.js"; import { Entity } from "megalodon"; -import { convertId, IdType } from "@/server/api/index.js"; function simpleConvert(data: any) { // copy the object to bypass weird pass by reference bugs diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 76c3af378d..9d9c2c54fa 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -1,7 +1,6 @@ +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; -import { convertId, IdType } from "@/server/api/index.js"; import { convertAccount, convertFeaturedTag, @@ -9,6 +8,7 @@ import { convertRelationship, convertStatus, } from "../converters.js"; +import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; const relationshipModel = { id: "", @@ -34,7 +34,7 @@ export function apiAccountMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); try { const data = await client.verifyAccountCredentials(); - let acct = data.data; + const acct = data.data; acct.id = convertId(acct.id, IdType.MastodonId); acct.display_name = acct.display_name || acct.username; acct.url = `${BASE_URL}/@${acct.url}`; @@ -109,7 +109,7 @@ export function apiAccountMastodon(router: Router): void { return; } - let reqIds = []; + const reqIds = []; for (let i = 0; i < ids.length; i++) { reqIds.push(convertId(ids[i], IdType.FirefishId)); } @@ -120,7 +120,7 @@ export function apiAccountMastodon(router: Router): void { ); } catch (e: any) { console.error(e); - let data = e.response.data; + const data = e.response.data; data.users = users; console.error(data); ctx.status = 401; @@ -250,7 +250,7 @@ export function apiAccountMastodon(router: Router): void { const data = await client.followAccount( convertId(ctx.params.id, IdType.FirefishId), ); - let acct = convertRelationship(data.data); + const acct = convertRelationship(data.data); acct.following = true; ctx.body = acct; } catch (e: any) { @@ -271,7 +271,7 @@ export function apiAccountMastodon(router: Router): void { const data = await client.unfollowAccount( convertId(ctx.params.id, IdType.FirefishId), ); - let acct = convertRelationship(data.data); + const acct = convertRelationship(data.data); acct.following = false; ctx.body = acct; } catch (e: any) { diff --git a/packages/backend/src/server/api/mastodon/endpoints/filter.ts b/packages/backend/src/server/api/mastodon/endpoints/filter.ts index 6524fd2f6e..a3a6c33c36 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/filter.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/filter.ts @@ -1,6 +1,6 @@ +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { IdType, convertId } from "@/server/api/index.js"; import { convertFilter } from "../converters.js"; export function apiFilterMastodon(router: Router): void { diff --git a/packages/backend/src/server/api/mastodon/endpoints/meta.ts b/packages/backend/src/server/api/mastodon/endpoints/meta.ts index c458798d5f..52e43ff8c3 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/meta.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/meta.ts @@ -1,7 +1,7 @@ -import { Entity } from "megalodon"; import config from "@/config/index.js"; +import { FILE_TYPE_BROWSERSAFE, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js"; +import { Entity } from "megalodon"; export async function getInstance( response: Entity.Instance, diff --git a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts index 9628eccdde..da59004673 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts @@ -1,8 +1,8 @@ +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; -import { convertId, IdType } from "@/server/api/index.js"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { convertTimelinesArgsId } from "./timeline.js"; import { convertNotification } from "../converters.js"; +import { convertTimelinesArgsId } from "./timeline.js"; function toLimitToInt(q: any) { if (q.limit) if (typeof q.limit === "string") q.limit = parseInt(q.limit, 10); return q; diff --git a/packages/backend/src/server/api/mastodon/endpoints/search.ts b/packages/backend/src/server/api/mastodon/endpoints/search.ts index c9bbab0a4f..d6ef388b64 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/search.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts @@ -1,9 +1,9 @@ import Router from "@koa/router"; -import { getClient } from "../ApiMastodonCompatibleService.js"; import axios from "axios"; import { Converter } from "megalodon"; -import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; +import { getClient } from "../ApiMastodonCompatibleService.js"; import { convertAccount, convertStatus } from "../converters.js"; +import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; export function apiSearchMastodon(router: Router): void { router.get("/v1/search", async (ctx) => { diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index ac1cbe602d..6c6c0211cc 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -1,17 +1,17 @@ -import Router from "@koa/router"; -import { getClient } from "../ApiMastodonCompatibleService.js"; -import { emojiRegexAtStartToEnd } from "@/misc/emoji-regex.js"; import querystring from "node:querystring"; +import { emojiRegexAtStartToEnd } from "@/misc/emoji-regex.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { IdType, convertId } from "@/server/api/index.js"; +import Router from "@koa/router"; import qs from "qs"; -import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; -import { convertId, IdType } from "@/server/api/index.js"; +import { getClient } from "../ApiMastodonCompatibleService.js"; import { convertAccount, convertAttachment, convertPoll, convertStatus, } from "../converters.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; +import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; function normalizeQuery(data: any) { const str = querystring.stringify(data); diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 05741c4cef..747afc089a 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts @@ -1,16 +1,16 @@ +import { ParsedUrlQuery } from "querystring"; +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { ParsedUrlQuery } from "querystring"; import { convertAccount, convertConversation, convertList, convertStatus, } from "../converters.js"; -import { convertId, IdType } from "@/server/api/index.js"; export function limitToInt(q: ParsedUrlQuery) { - let object: any = q; + const object: any = q; if (q.limit) if (typeof q.limit === "string") object.limit = parseInt(q.limit, 10); if (q.offset) @@ -27,7 +27,7 @@ export function argsToBools(q: ParsedUrlQuery) { // - https://docs.joinmastodon.org/methods/accounts/#statuses // - https://docs.joinmastodon.org/methods/timelines/#public // - https://docs.joinmastodon.org/methods/timelines/#tag - let object: any = q; + const object: any = q; if (q.only_media) if (typeof q.only_media === "string") object.only_media = toBoolean(q.only_media); diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index ec8c1ca036..02164e87fc 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -1,7 +1,7 @@ -import endpoints from "@/server/api/endpoints.js"; import config from "@/config/index.js"; +import endpoints from "@/server/api/endpoints.js"; import { errors as basicErrors } from "./errors.js"; -import { schemas, convertSchemaToOpenApiSchema } from "./schemas.js"; +import { convertSchemaToOpenApiSchema, schemas } from "./schemas.js"; export function genOpenapiSpec() { const spec = { diff --git a/packages/backend/src/server/api/private/signin.ts b/packages/backend/src/server/api/private/signin.ts index 3e70d80fe2..8db5c95fff 100644 --- a/packages/backend/src/server/api/private/signin.ts +++ b/packages/backend/src/server/api/private/signin.ts @@ -1,26 +1,26 @@ -import type Koa from "koa"; -import * as OTPAuth from "otpauth"; -import signin from "@/server/api/common/signin.js"; +import { randomBytes } from "node:crypto"; import config from "@/config/index.js"; -import { - Users, - Signins, - UserProfiles, - UserSecurityKeys, - AttestationChallenges, -} from "@/models/index.js"; -import type { ILocalUser } from "@/models/entities/user.js"; import { genId } from "@/misc/gen-id.js"; +import { getIpHash } from "@/misc/get-ip-hash.js"; import { comparePassword, hashPassword, isOldAlgorithm, } from "@/misc/password.js"; -import { verifyLogin, hash } from "@/server/api/2fa.js"; -import { randomBytes } from "node:crypto"; -import { IsNull } from "typeorm"; +import type { ILocalUser } from "@/models/entities/user.js"; +import { + AttestationChallenges, + Signins, + UserProfiles, + UserSecurityKeys, + Users, +} from "@/models/index.js"; +import { hash, verifyLogin } from "@/server/api/2fa.js"; +import signin from "@/server/api/common/signin.js"; import { limiter } from "@/server/api/limiter.js"; -import { getIpHash } from "@/misc/get-ip-hash.js"; +import type Koa from "koa"; +import * as OTPAuth from "otpauth"; +import { IsNull } from "typeorm"; export default async (ctx: Koa.Context) => { ctx.set("Access-Control-Allow-Origin", config.url); diff --git a/packages/backend/src/server/api/private/signup-pending.ts b/packages/backend/src/server/api/private/signup-pending.ts index b92fb90b37..3a422c91c4 100644 --- a/packages/backend/src/server/api/private/signup-pending.ts +++ b/packages/backend/src/server/api/private/signup-pending.ts @@ -1,7 +1,7 @@ -import type Koa from "koa"; import { UserPendings, UserProfiles } from "@/models/index.js"; -import { signup } from "@/server/api/common/signup.js"; import signin from "@/server/api/common/signin.js"; +import { signup } from "@/server/api/common/signup.js"; +import type Koa from "koa"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/private/signup.ts b/packages/backend/src/server/api/private/signup.ts index d60e5a1910..511c34ff32 100644 --- a/packages/backend/src/server/api/private/signup.ts +++ b/packages/backend/src/server/api/private/signup.ts @@ -1,14 +1,14 @@ +import config from "@/config/index.js"; +import { verifyHcaptcha, verifyRecaptcha } from "@/misc/captcha.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { genId } from "@/misc/gen-id.js"; +import { hashPassword } from "@/misc/password.js"; +import { RegistrationTickets, UserPendings, Users } from "@/models/index.js"; +import { signup } from "@/server/api/common/signup.js"; +import { sendEmail } from "@/services/send-email.js"; +import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; import type Koa from "koa"; import rndstr from "rndstr"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { verifyHcaptcha, verifyRecaptcha } from "@/misc/captcha.js"; -import { Users, RegistrationTickets, UserPendings } from "@/models/index.js"; -import { signup } from "@/server/api/common/signup.js"; -import config from "@/config/index.js"; -import { sendEmail } from "@/services/send-email.js"; -import { genId } from "@/misc/gen-id.js"; -import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; -import { hashPassword } from "@/misc/password.js"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/private/verify-email.ts b/packages/backend/src/server/api/private/verify-email.ts index e6c8295d18..b480b38785 100644 --- a/packages/backend/src/server/api/private/verify-email.ts +++ b/packages/backend/src/server/api/private/verify-email.ts @@ -1,6 +1,6 @@ -import type Koa from "koa"; -import { Users, UserProfiles } from "@/models/index.js"; +import { UserProfiles, Users } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; +import type Koa from "koa"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index fc8e0ce35e..67681b993e 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -1,8 +1,8 @@ -import type Connection from "."; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { Packed } from "@/misc/schema.js"; import type { Note } from "@/models/entities/note.js"; import { Notes } from "@/models/index.js"; -import type { Packed } from "@/misc/schema.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type Connection from "."; /** * Stream channel diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts index ec5a8b175f..6aae49d150 100644 --- a/packages/backend/src/server/api/stream/channels/antenna.ts +++ b/packages/backend/src/server/api/stream/channels/antenna.ts @@ -1,8 +1,8 @@ -import Channel from "../channel.js"; -import { Notes } from "@/models/index.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; -import type { StreamMessages } from "../types.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import { Notes } from "@/models/index.js"; +import Channel from "../channel.js"; +import type { StreamMessages } from "../types.js"; export default class extends Channel { public readonly chName = "antenna"; diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 2ff4e08209..b668544b84 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -1,9 +1,9 @@ -import Channel from "../channel.js"; -import { Users } from "@/models/index.js"; import { isUserRelated } from "@/misc/is-user-related.js"; -import type { User } from "@/models/entities/user.js"; -import type { StreamMessages } from "../types.js"; import type { Packed } from "@/misc/schema.js"; +import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; +import Channel from "../channel.js"; +import type { StreamMessages } from "../types.js"; export default class extends Channel { public readonly chName = "channel"; diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index e750ac92b1..a5af7038d0 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -1,9 +1,9 @@ -import Channel from "../channel.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { isInstanceMuted } from "@/misc/is-instance-muted.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "globalTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index 011bb0889d..d44fef1105 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -1,7 +1,7 @@ -import Channel from "../channel.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; import { isUserRelated } from "@/misc/is-user-related.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "hashtag"; diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 5aafe865b3..0136d3e7ae 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -1,8 +1,8 @@ -import Channel from "../channel.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "homeTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 2ec53a3fa9..cfca4cec53 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -1,9 +1,9 @@ -import Channel from "../channel.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "hybridTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/index.ts b/packages/backend/src/server/api/stream/channels/index.ts index d1127be47c..60d703e52c 100644 --- a/packages/backend/src/server/api/stream/channels/index.ts +++ b/packages/backend/src/server/api/stream/channels/index.ts @@ -1,19 +1,19 @@ -import main from "./main.js"; -import homeTimeline from "./home-timeline.js"; -import localTimeline from "./local-timeline.js"; -import hybridTimeline from "./hybrid-timeline.js"; -import recommendedTimeline from "./recommended-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 antenna from "./antenna.js"; +import channel from "./channel.js"; +import drive from "./drive.js"; +import globalTimeline from "./global-timeline.js"; +import hashtag from "./hashtag.js"; +import homeTimeline from "./home-timeline.js"; +import hybridTimeline from "./hybrid-timeline.js"; +import localTimeline from "./local-timeline.js"; +import main from "./main.js"; +import messagingIndex from "./messaging-index.js"; +import messaging from "./messaging.js"; +import queueStats from "./queue-stats.js"; +import recommendedTimeline from "./recommended-timeline.js"; +import serverStats from "./server-stats.js"; +import userList from "./user-list.js"; export default { main, diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 40e38c24f0..3cbac3b88e 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -1,8 +1,8 @@ -import Channel from "../channel.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "localTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index b8c72442ff..2eb1d02a26 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -1,8 +1,8 @@ -import Channel from "../channel.js"; import { isInstanceMuted, isUserFromMutedInstance, } from "@/misc/is-instance-muted.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "main"; diff --git a/packages/backend/src/server/api/stream/channels/messaging.ts b/packages/backend/src/server/api/stream/channels/messaging.ts index a650db8b9b..f7746fe78c 100644 --- a/packages/backend/src/server/api/stream/channels/messaging.ts +++ b/packages/backend/src/server/api/stream/channels/messaging.ts @@ -1,12 +1,12 @@ +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; import { - readUserMessagingMessage, - readGroupMessagingMessage, deliverReadActivity, + readGroupMessagingMessage, + readUserMessagingMessage, } from "@/server/api/common/read-messaging-message.js"; import Channel from "../channel.js"; -import { UserGroupJoinings, Users, MessagingMessages } from "@/models/index.js"; -import type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import type { StreamMessages } from "../types.js"; export default class extends Channel { diff --git a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts index bbbc4e7a9a..1b1a618f01 100644 --- a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts @@ -1,9 +1,9 @@ -import Channel from "../channel.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "recommendedTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index d140319503..752dfa258d 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -1,8 +1,8 @@ -import Channel from "../channel.js"; -import { UserListJoinings, UserLists } from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; +import type { User } from "@/models/entities/user.js"; +import { UserListJoinings, UserLists } from "@/models/index.js"; +import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "userList"; diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index 86408a03d0..750a7ae9f9 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -1,32 +1,32 @@ import type { EventEmitter } from "events"; -import type * as websocket from "websocket"; -import readNote from "@/services/note/read.js"; -import type { User } from "@/models/entities/user.js"; +import type { Packed } from "@/misc/schema.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; import type { Channel as ChannelModel } from "@/models/entities/channel.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import type { User } from "@/models/entities/user.js"; import { - Users, + Blockings, + ChannelFollowings, Followings, Mutings, RenoteMutings, UserProfiles, - ChannelFollowings, - Blockings, + Users, } from "@/models/index.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; +import { readNotification } from "@/server/api/common/read-notification.js"; +import { getClient } from "@/server/api/mastodon/ApiMastodonCompatibleService.js"; +import readNote from "@/services/note/read.js"; import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream, } from "@/services/stream.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { Packed } from "@/misc/schema.js"; -import { readNotification } from "@/server/api/common/read-notification.js"; -import channels from "./channels/index.js"; -import type Channel from "./channel.js"; -import type { StreamEventEmitter, StreamMessages } from "./types.js"; import { Converter } from "megalodon"; -import { getClient } from "@/server/api/mastodon/ApiMastodonCompatibleService.js"; +import type * as websocket from "websocket"; +import type Channel from "./channel.js"; +import channels from "./channels/index.js"; +import type { StreamEventEmitter, StreamMessages } from "./types.js"; /** * Main stream connection @@ -159,7 +159,7 @@ export default class Connection { // is Mastodon Compatible this.isMastodonCompatible = true; if (simpleObj.type === "subscribe") { - let forSubscribe = []; + const forSubscribe = []; if (simpleObj.stream === "user") { this.currentSubscribe.push(["user"]); objs = [ diff --git a/packages/backend/src/server/api/stream/types.ts b/packages/backend/src/server/api/stream/types.ts index 91095a46d3..07c9202a6c 100644 --- a/packages/backend/src/server/api/stream/types.ts +++ b/packages/backend/src/server/api/stream/types.ts @@ -1,20 +1,20 @@ import type { EventEmitter } from "events"; -import type Emitter from "strict-event-emitter-types"; -import type { Channel } from "@/models/entities/channel.js"; -import type { User } from "@/models/entities/user.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import type { Note } from "@/models/entities/note.js"; +import type { Packed } from "@/misc/schema.js"; +import type { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; import type { Antenna } from "@/models/entities/antenna.js"; +import type { Channel } from "@/models/entities/channel.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; import type { DriveFolder } from "@/models/entities/drive-folder.js"; -import type { UserList } from "@/models/entities/user-list.js"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; -import type { Signin } from "@/models/entities/signin.js"; +import type { Note } from "@/models/entities/note.js"; import type { Page } from "@/models/entities/page.js"; -import type { Packed } from "@/misc/schema.js"; +import type { Signin } from "@/models/entities/signin.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { UserList } from "@/models/entities/user-list.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import type { User } from "@/models/entities/user.js"; import type { Webhook } from "@/models/entities/webhook"; +import type Emitter from "strict-event-emitter-types"; //#region Stream type-body definitions export interface InternalStreamTypes { diff --git a/packages/backend/src/server/api/streaming.ts b/packages/backend/src/server/api/streaming.ts index 14e07b7487..96ee49ce1b 100644 --- a/packages/backend/src/server/api/streaming.ts +++ b/packages/backend/src/server/api/streaming.ts @@ -1,12 +1,12 @@ -import type * as http from "node:http"; import { EventEmitter } from "events"; +import type * as http from "node:http"; import type { ParsedUrlQuery } from "querystring"; import * as websocket from "websocket"; import { subscriber as redisClient } from "@/db/redis.js"; import { Users } from "@/models/index.js"; -import MainStreamConnection from "./stream/index.js"; import authenticate from "./authenticate.js"; +import MainStreamConnection from "./stream/index.js"; export const initializeStreamingServer = (server: http.Server) => { // Init websocket server diff --git a/packages/backend/src/server/file/byte-range-readable.ts b/packages/backend/src/server/file/byte-range-readable.ts index 96dcbc4a52..04d9b4ee65 100644 --- a/packages/backend/src/server/file/byte-range-readable.ts +++ b/packages/backend/src/server/file/byte-range-readable.ts @@ -1,6 +1,6 @@ -import { Readable, ReadableOptions } from "node:stream"; import { Buffer } from "node:buffer"; import * as fs from "node:fs"; +import { Readable, ReadableOptions } from "node:stream"; interface ByteRange { start: bigint; @@ -82,7 +82,7 @@ function extractRanges( } function createBoundary(len: number): string { - let chars = []; + const chars = []; for (let i = 0; i < len; i = i + 1) { chars[i] = BOUNDARY_CHARS.charAt( Math.floor(Math.random() * BOUNDARY_CHARS.length), diff --git a/packages/backend/src/server/file/index.ts b/packages/backend/src/server/file/index.ts index 26df1de51d..1b1e81a21e 100644 --- a/packages/backend/src/server/file/index.ts +++ b/packages/backend/src/server/file/index.ts @@ -3,11 +3,11 @@ */ import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; -import Koa from "koa"; +import { fileURLToPath } from "node:url"; import cors from "@koa/cors"; import Router from "@koa/router"; +import Koa from "koa"; import sendDriveFile from "./send-drive-file.js"; const _filename = fileURLToPath(import.meta.url); diff --git a/packages/backend/src/server/file/send-drive-file.ts b/packages/backend/src/server/file/send-drive-file.ts index 1c4d4136b5..88c29b6697 100644 --- a/packages/backend/src/server/file/send-drive-file.ts +++ b/packages/backend/src/server/file/send-drive-file.ts @@ -1,21 +1,21 @@ import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; +import { contentDisposition } from "@/misc/content-disposition.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { downloadUrl } from "@/misc/download-url.js"; +import { StatusError } from "@/misc/fetch.js"; +import { detectType } from "@/misc/get-file-info.js"; +import { DriveFiles } from "@/models/index.js"; +import { GenerateVideoThumbnail } from "@/services/drive/generate-video-thumbnail.js"; +import { convertToWebp } from "@/services/drive/image-processor.js"; +import { InternalStorage } from "@/services/drive/internal-storage.js"; import type Koa from "koa"; import send from "koa-send"; import rename from "rename"; 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 { createTemp } from "@/misc/create-temp.js"; -import { downloadUrl } from "@/misc/download-url.js"; -import { detectType } from "@/misc/get-file-info.js"; -import { convertToWebp } from "@/services/drive/image-processor.js"; -import { GenerateVideoThumbnail } from "@/services/drive/generate-video-thumbnail.js"; -import { StatusError } from "@/misc/fetch.js"; import { ByteRangeReadable } from "./byte-range-readable.js"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 3a9f62f337..883314d778 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -5,34 +5,34 @@ import cluster from "node:cluster"; import * as fs from "node:fs"; import * as http from "node:http"; -import Koa from "koa"; -import Router from "@koa/router"; import cors from "@koa/cors"; -import mount from "koa-mount"; +import Router from "@koa/router"; +import Koa from "koa"; import koaLogger from "koa-logger"; +import mount from "koa-mount"; import * as slow from "koa-slow"; -import { IsNull } from "typeorm"; import config from "@/config/index.js"; -import Logger from "@/services/logger.js"; -import { Users } from "@/models/index.js"; +import { envOption } from "@/env.js"; +import * as Acct from "@/misc/acct.js"; +import { createTemp } from "@/misc/create-temp.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { genIdenticon } from "@/misc/gen-identicon.js"; -import { createTemp } from "@/misc/create-temp.js"; -import * as Acct from "@/misc/acct.js"; -import { envOption } from "@/env.js"; -import megalodon, { MegalodonInterface } from "megalodon"; -import activityPub from "./activitypub.js"; -import nodeinfo from "./nodeinfo.js"; -import wellKnown from "./well-known.js"; -import apiServer from "./api/index.js"; -import fileServer from "./file/index.js"; -import proxyServer from "./proxy/index.js"; -import webServer from "./web/index.js"; -import { initializeStreamingServer } from "./api/streaming.js"; +import { Users } from "@/models/index.js"; +import Logger from "@/services/logger.js"; import { koaBody } from "koa-body"; import removeTrailingSlash from "koa-remove-trailing-slashes"; +import megalodon, { MegalodonInterface } from "megalodon"; +import { IsNull } from "typeorm"; import { v4 as uuid } from "uuid"; +import activityPub from "./activitypub.js"; +import apiServer from "./api/index.js"; +import { initializeStreamingServer } from "./api/streaming.js"; +import fileServer from "./file/index.js"; +import nodeinfo from "./nodeinfo.js"; +import proxyServer from "./proxy/index.js"; +import webServer from "./web/index.js"; +import wellKnown from "./well-known.js"; export const serverLogger = new Logger("server", "gray", false); diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index a1d519f3e2..665636dc97 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -1,10 +1,10 @@ -import Router from "@koa/router"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Users, Notes } from "@/models/index.js"; -import { IsNull, MoreThan } from "typeorm"; -import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; +import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { Cache } from "@/misc/cache.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Notes, Users } from "@/models/index.js"; +import Router from "@koa/router"; +import { IsNull, MoreThan } from "typeorm"; const router = new Router(); diff --git a/packages/backend/src/server/proxy/index.ts b/packages/backend/src/server/proxy/index.ts index 004b3779fb..4cc656916e 100644 --- a/packages/backend/src/server/proxy/index.ts +++ b/packages/backend/src/server/proxy/index.ts @@ -2,9 +2,9 @@ * Media Proxy */ -import Koa from "koa"; import cors from "@koa/cors"; import Router from "@koa/router"; +import Koa from "koa"; import { proxyMedia } from "./proxy-media.js"; // Init app diff --git a/packages/backend/src/server/proxy/proxy-media.ts b/packages/backend/src/server/proxy/proxy-media.ts index ed607daa0e..1a8626bbcf 100644 --- a/packages/backend/src/server/proxy/proxy-media.ts +++ b/packages/backend/src/server/proxy/proxy-media.ts @@ -1,17 +1,17 @@ +import { promises } from "node:dns"; import * as fs from "node:fs"; import net from "node:net"; -import { promises } from "node:dns"; -import type Koa from "koa"; -import sharp from "sharp"; -import type { IImage } from "@/services/drive/image-processor.js"; -import { convertToWebp } from "@/services/drive/image-processor.js"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; import { createTemp } from "@/misc/create-temp.js"; import { downloadUrl } from "@/misc/download-url.js"; -import { detectType } from "@/misc/get-file-info.js"; import { StatusError } from "@/misc/fetch.js"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { serverLogger } from "../index.js"; +import { detectType } from "@/misc/get-file-info.js"; import { isMimeImage } from "@/misc/is-mime-image.js"; +import type { IImage } from "@/services/drive/image-processor.js"; +import { convertToWebp } from "@/services/drive/image-processor.js"; +import type Koa from "koa"; +import sharp from "sharp"; +import { serverLogger } from "../index.js"; export async function proxyMedia(ctx: Koa.Context) { let url = "url" in ctx.query ? ctx.query.url : `https://${ctx.params.url}`; diff --git a/packages/backend/src/server/web/feed.ts b/packages/backend/src/server/web/feed.ts index 50e6bfc325..e29528d267 100644 --- a/packages/backend/src/server/web/feed.ts +++ b/packages/backend/src/server/web/feed.ts @@ -1,8 +1,8 @@ -import { Feed } from "feed"; -import { In, IsNull } from "typeorm"; import config from "@/config/index.js"; import type { User } from "@/models/entities/user.js"; -import { Notes, DriveFiles, UserProfiles, Users } from "@/models/index.js"; +import { DriveFiles, Notes, UserProfiles, Users } from "@/models/index.js"; +import { Feed } from "feed"; +import { In, IsNull } from "typeorm"; export default async function ( user: User, diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 3981d57667..4b10a768ab 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -2,39 +2,39 @@ * Web Client Server */ +import { readFileSync } from "node:fs"; import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; -import { readFileSync } from "node:fs"; -import Koa from "koa"; -import Router from "@koa/router"; -import send from "koa-send"; -import favicon from "koa-favicon"; -import views from "@ladjs/koa-views"; -import sharp from "sharp"; import { createBullBoard } from "@bull-board/api"; import { BullAdapter } from "@bull-board/api/bullAdapter.js"; import { KoaAdapter } from "@bull-board/koa"; +import Router from "@koa/router"; +import views from "@ladjs/koa-views"; +import Koa from "koa"; +import favicon from "koa-favicon"; +import send from "koa-send"; +import sharp from "sharp"; -import { In, IsNull } from "typeorm"; -import { fetchMeta, metaToPugArgs } from "@/misc/fetch-meta.js"; import config from "@/config/index.js"; +import { DAY, MINUTE } from "@/const.js"; +import * as Acct from "@/misc/acct.js"; +import { fetchMeta, metaToPugArgs } from "@/misc/fetch-meta.js"; +import { getNoteSummary } from "@/misc/get-note-summary.js"; import { - Users, - Notes, - UserProfiles, - Pages, Channels, Clips, GalleryPosts, + Notes, + Pages, + UserProfiles, + Users, } from "@/models/index.js"; -import * as Acct from "@/misc/acct.js"; -import { getNoteSummary } from "@/misc/get-note-summary.js"; import { queues } from "@/queue/queues.js"; +import { In, IsNull } from "typeorm"; import { genOpenapiSpec } from "../api/openapi/gen-spec.js"; -import { urlPreviewHandler } from "./url-preview.js"; -import { manifestHandler } from "./manifest.js"; import packFeed from "./feed.js"; -import { MINUTE, DAY } from "@/const.js"; +import { manifestHandler } from "./manifest.js"; +import { urlPreviewHandler } from "./url-preview.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index bbcf639ffe..38cb6755f2 100644 --- a/packages/backend/src/server/web/manifest.ts +++ b/packages/backend/src/server/web/manifest.ts @@ -1,6 +1,6 @@ -import type Koa from "koa"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import type Koa from "koa"; import manifest from "./manifest.json" assert { type: "json" }; export const manifestHandler = async (ctx: Koa.Context) => { diff --git a/packages/backend/src/server/web/url-preview.ts b/packages/backend/src/server/web/url-preview.ts index c9f3b6cac9..e8362670ec 100644 --- a/packages/backend/src/server/web/url-preview.ts +++ b/packages/backend/src/server/web/url-preview.ts @@ -1,10 +1,10 @@ +import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getJson } from "@/misc/fetch.js"; +import { query } from "@/prelude/url.js"; +import Logger from "@/services/logger.js"; import type Koa from "koa"; import summaly from "summaly"; -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/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index 5af3b2c84b..c70861c6ce 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -2,12 +2,12 @@ import Router from "@koa/router"; import config from "@/config/index.js"; import * as Acct from "@/misc/acct.js"; -import { links } from "./nodeinfo.js"; -import { escapeAttribute, escapeValue } from "@/prelude/xml.js"; -import { Users } from "@/models/index.js"; import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; +import { escapeAttribute, escapeValue } from "@/prelude/xml.js"; import type { FindOptionsWhere } from "typeorm"; import { IsNull } from "typeorm"; +import { links } from "./nodeinfo.js"; // Init router const router = new Router(); diff --git a/packages/backend/src/services/add-note-to-antenna.ts b/packages/backend/src/services/add-note-to-antenna.ts index 499418000d..b9c40e1d2b 100644 --- a/packages/backend/src/services/add-note-to-antenna.ts +++ b/packages/backend/src/services/add-note-to-antenna.ts @@ -1,9 +1,9 @@ +import { redisClient } from "@/db/redis.js"; +import { getTimestamp } from "@/misc/gen-id.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; -import { getTimestamp } from "@/misc/gen-id.js"; -import { redisClient } from "@/db/redis.js"; -import { publishAntennaStream } from "@/services/stream.js"; import type { User } from "@/models/entities/user.js"; +import { publishAntennaStream } from "@/services/stream.js"; export async function addNoteToAntenna( antenna: Antenna, diff --git a/packages/backend/src/services/blocking/create.ts b/packages/backend/src/services/blocking/create.ts index 321f5c8ea5..0ed96e5c6f 100644 --- a/packages/backend/src/services/blocking/create.ts +++ b/packages/backend/src/services/blocking/create.ts @@ -1,24 +1,24 @@ -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 { genId } from "@/misc/gen-id.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; import type { Blocking } from "@/models/entities/blocking.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, - Users, FollowRequests, Followings, UserListJoinings, UserLists, + Users, } from "@/models/index.js"; -import { perUserFollowingChart } from "@/services/chart/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { deliver } from "@/queue/index.js"; import { webhookDeliver } from "@/queue/index.js"; +import { renderBlock } from "@/remote/activitypub/renderer/block.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { perUserFollowingChart } from "@/services/chart/index.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; export default async function (blocker: User, blockee: User) { await Promise.all([ diff --git a/packages/backend/src/services/blocking/delete.ts b/packages/backend/src/services/blocking/delete.ts index 271883fe89..2e57525a61 100644 --- a/packages/backend/src/services/blocking/delete.ts +++ b/packages/backend/src/services/blocking/delete.ts @@ -1,10 +1,10 @@ -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 "@/services/logger.js"; import type { CacheableUser } from "@/models/entities/user.js"; import { Blockings, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import { renderBlock } from "@/remote/activitypub/renderer/block.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import Logger from "@/services/logger.js"; const logger = new Logger("blocking/delete"); diff --git a/packages/backend/src/services/chart/charts/active-users.ts b/packages/backend/src/services/chart/charts/active-users.ts index b88fc22828..a9e4cab57f 100644 --- a/packages/backend/src/services/chart/charts/active-users.ts +++ b/packages/backend/src/services/chart/charts/active-users.ts @@ -1,6 +1,6 @@ +import type { User } from "@/models/entities/user.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/active-users.js"; const week = 1000 * 60 * 60 * 24 * 7; diff --git a/packages/backend/src/services/chart/charts/drive.ts b/packages/backend/src/services/chart/charts/drive.ts index d94c8cce71..0c69049468 100644 --- a/packages/backend/src/services/chart/charts/drive.ts +++ b/packages/backend/src/services/chart/charts/drive.ts @@ -1,6 +1,6 @@ +import type { DriveFile } from "@/models/entities/drive-file.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; import { name, schema } from "./entities/drive.js"; /** diff --git a/packages/backend/src/services/chart/charts/federation.ts b/packages/backend/src/services/chart/charts/federation.ts index 1a03d574df..6d62979f38 100644 --- a/packages/backend/src/services/chart/charts/federation.ts +++ b/packages/backend/src/services/chart/charts/federation.ts @@ -1,8 +1,8 @@ +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Followings, Instances } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { Followings, Instances } from "@/models/index.js"; import { name, schema } from "./entities/federation.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; /** * フェデレーションに関するチャート diff --git a/packages/backend/src/services/chart/charts/hashtag.ts b/packages/backend/src/services/chart/charts/hashtag.ts index 0211df857f..d1079d1ccd 100644 --- a/packages/backend/src/services/chart/charts/hashtag.ts +++ b/packages/backend/src/services/chart/charts/hashtag.ts @@ -1,7 +1,7 @@ -import type { KVs } from "../core.js"; -import Chart from "../core.js"; import type { User } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import type { KVs } from "../core.js"; +import Chart from "../core.js"; import { name, schema } from "./entities/hashtag.js"; /** diff --git a/packages/backend/src/services/chart/charts/instance.ts b/packages/backend/src/services/chart/charts/instance.ts index d6e3483d8e..fc3d2139fc 100644 --- a/packages/backend/src/services/chart/charts/instance.ts +++ b/packages/backend/src/services/chart/charts/instance.ts @@ -1,9 +1,9 @@ -import type { KVs } from "../core.js"; -import Chart from "../core.js"; -import { DriveFiles, Followings, Users, Notes } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; import type { Note } from "@/models/entities/note.js"; -import { toPuny } from "@/misc/convert-host.js"; +import { DriveFiles, Followings, Notes, Users } from "@/models/index.js"; +import type { KVs } from "../core.js"; +import Chart from "../core.js"; import { name, schema } from "./entities/instance.js"; /** diff --git a/packages/backend/src/services/chart/charts/notes.ts b/packages/backend/src/services/chart/charts/notes.ts index 42db60d0cf..8ade08cda2 100644 --- a/packages/backend/src/services/chart/charts/notes.ts +++ b/packages/backend/src/services/chart/charts/notes.ts @@ -1,8 +1,8 @@ +import type { Note } from "@/models/entities/note.js"; +import { Notes } from "@/models/index.js"; +import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { Notes } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; -import type { Note } from "@/models/entities/note.js"; import { name, schema } from "./entities/notes.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-drive.ts b/packages/backend/src/services/chart/charts/per-user-drive.ts index 18589bb84a..c1f6197ccb 100644 --- a/packages/backend/src/services/chart/charts/per-user-drive.ts +++ b/packages/backend/src/services/chart/charts/per-user-drive.ts @@ -1,7 +1,7 @@ +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { DriveFiles } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { DriveFiles } from "@/models/index.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; import { name, schema } from "./entities/per-user-drive.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-following.ts b/packages/backend/src/services/chart/charts/per-user-following.ts index 3e8b576f20..017b9fa4da 100644 --- a/packages/backend/src/services/chart/charts/per-user-following.ts +++ b/packages/backend/src/services/chart/charts/per-user-following.ts @@ -1,8 +1,8 @@ +import type { User } from "@/models/entities/user.js"; +import { Followings, Users } from "@/models/index.js"; +import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { Followings, Users } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; -import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/per-user-following.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-notes.ts b/packages/backend/src/services/chart/charts/per-user-notes.ts index 22f3fddb77..6b25d8ee69 100644 --- a/packages/backend/src/services/chart/charts/per-user-notes.ts +++ b/packages/backend/src/services/chart/charts/per-user-notes.ts @@ -1,8 +1,8 @@ -import type { KVs } from "../core.js"; -import Chart from "../core.js"; +import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { Notes } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; +import type { KVs } from "../core.js"; +import Chart from "../core.js"; import { name, schema } from "./entities/per-user-notes.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-reactions.ts b/packages/backend/src/services/chart/charts/per-user-reactions.ts index 75def3de04..093660bd5c 100644 --- a/packages/backend/src/services/chart/charts/per-user-reactions.ts +++ b/packages/backend/src/services/chart/charts/per-user-reactions.ts @@ -1,8 +1,8 @@ +import type { Note } from "@/models/entities/note.js"; +import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import type { User } from "@/models/entities/user.js"; -import type { Note } from "@/models/entities/note.js"; -import { Users } from "@/models/index.js"; import { name, schema } from "./entities/per-user-reactions.js"; /** diff --git a/packages/backend/src/services/chart/charts/users.ts b/packages/backend/src/services/chart/charts/users.ts index 6fef9ecf7b..0c8ea58314 100644 --- a/packages/backend/src/services/chart/charts/users.ts +++ b/packages/backend/src/services/chart/charts/users.ts @@ -1,8 +1,8 @@ +import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; +import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { Users } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; -import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/users.js"; /** diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index d7a524d488..d14ef1792e 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -4,20 +4,20 @@ * Tests located in test/chart */ -import * as nestedProperty from "nested-property"; -import Logger from "../logger.js"; -import type { Repository } from "typeorm"; -import { EntitySchema, LessThan, Between } from "typeorm"; -import { - dateUTC, - isTimeSame, - isTimeBefore, - subtractTime, - addTime, -} from "@/prelude/time.js"; -import { getChartInsertLock } from "@/misc/app-lock.js"; import { db } from "@/db/postgre.js"; +import { getChartInsertLock } from "@/misc/app-lock.js"; +import { + addTime, + dateUTC, + isTimeBefore, + isTimeSame, + subtractTime, +} from "@/prelude/time.js"; +import * as nestedProperty from "nested-property"; import promiseLimit from "promise-limit"; +import type { Repository } from "typeorm"; +import { Between, EntitySchema, LessThan } from "typeorm"; +import Logger from "../logger.js"; const logger = new Logger("chart", "white", process.env.NODE_ENV !== "test"); diff --git a/packages/backend/src/services/chart/entities.ts b/packages/backend/src/services/chart/entities.ts index e203dffdff..e67d1abc2d 100644 --- a/packages/backend/src/services/chart/entities.ts +++ b/packages/backend/src/services/chart/entities.ts @@ -1,20 +1,20 @@ -import { entity as FederationChart } from "./charts/entities/federation.js"; -import { entity as NotesChart } from "./charts/entities/notes.js"; -import { entity as UsersChart } from "./charts/entities/users.js"; import { entity as ActiveUsersChart } from "./charts/entities/active-users.js"; -import { entity as InstanceChart } from "./charts/entities/instance.js"; -import { entity as PerUserNotesChart } from "./charts/entities/per-user-notes.js"; -import { entity as DriveChart } from "./charts/entities/drive.js"; -import { entity as PerUserReactionsChart } from "./charts/entities/per-user-reactions.js"; -import { entity as HashtagChart } from "./charts/entities/hashtag.js"; -import { entity as PerUserFollowingChart } from "./charts/entities/per-user-following.js"; -import { entity as PerUserDriveChart } from "./charts/entities/per-user-drive.js"; import { entity as ApRequestChart } from "./charts/entities/ap-request.js"; +import { entity as DriveChart } from "./charts/entities/drive.js"; +import { entity as FederationChart } from "./charts/entities/federation.js"; +import { entity as HashtagChart } from "./charts/entities/hashtag.js"; +import { entity as InstanceChart } from "./charts/entities/instance.js"; +import { entity as NotesChart } from "./charts/entities/notes.js"; +import { entity as PerUserDriveChart } from "./charts/entities/per-user-drive.js"; +import { entity as PerUserFollowingChart } from "./charts/entities/per-user-following.js"; +import { entity as PerUserNotesChart } from "./charts/entities/per-user-notes.js"; +import { entity as PerUserReactionsChart } from "./charts/entities/per-user-reactions.js"; +import { entity as UsersChart } from "./charts/entities/users.js"; -import { entity as TestChart } from "./charts/entities/test.js"; import { entity as TestGroupedChart } from "./charts/entities/test-grouped.js"; -import { entity as TestUniqueChart } from "./charts/entities/test-unique.js"; import { entity as TestIntersectionChart } from "./charts/entities/test-intersection.js"; +import { entity as TestUniqueChart } from "./charts/entities/test-unique.js"; +import { entity as TestChart } from "./charts/entities/test.js"; export const entities = [ FederationChart.hour, diff --git a/packages/backend/src/services/chart/index.ts b/packages/backend/src/services/chart/index.ts index 969cdab6d7..e45a113bb1 100644 --- a/packages/backend/src/services/chart/index.ts +++ b/packages/backend/src/services/chart/index.ts @@ -1,17 +1,17 @@ import { beforeShutdown } from "@/misc/before-shutdown.js"; -import FederationChart from "./charts/federation.js"; -import NotesChart from "./charts/notes.js"; -import UsersChart from "./charts/users.js"; import ActiveUsersChart from "./charts/active-users.js"; -import InstanceChart from "./charts/instance.js"; -import PerUserNotesChart from "./charts/per-user-notes.js"; -import DriveChart from "./charts/drive.js"; -import PerUserReactionsChart from "./charts/per-user-reactions.js"; -import HashtagChart from "./charts/hashtag.js"; -import PerUserFollowingChart from "./charts/per-user-following.js"; -import PerUserDriveChart from "./charts/per-user-drive.js"; import ApRequestChart from "./charts/ap-request.js"; +import DriveChart from "./charts/drive.js"; +import FederationChart from "./charts/federation.js"; +import HashtagChart from "./charts/hashtag.js"; +import InstanceChart from "./charts/instance.js"; +import NotesChart from "./charts/notes.js"; +import PerUserDriveChart from "./charts/per-user-drive.js"; +import PerUserFollowingChart from "./charts/per-user-following.js"; +import PerUserNotesChart from "./charts/per-user-notes.js"; +import PerUserReactionsChart from "./charts/per-user-reactions.js"; +import UsersChart from "./charts/users.js"; export const federationChart = new FederationChart(); export const notesChart = new NotesChart(); diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index 9bfd1a7bfa..d537fcd799 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -1,18 +1,18 @@ -import { publishMainStream } from "@/services/stream.js"; -import { pushNotification } from "@/services/push-notification.js"; +import { genId } from "@/misc/gen-id.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; +import type { Notification } from "@/models/entities/notification.js"; +import type { User } from "@/models/entities/user.js"; import { - Notifications, + Followings, Mutings, NoteThreadMutings, + Notifications, UserProfiles, Users, - Followings, } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import type { User } from "@/models/entities/user.js"; -import type { Notification } from "@/models/entities/notification.js"; +import { pushNotification } from "@/services/push-notification.js"; +import { publishMainStream } from "@/services/stream.js"; import { sendEmailNotification } from "./send-email-notification.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; export async function createNotification( notifieeId: User["id"], diff --git a/packages/backend/src/services/create-system-user.ts b/packages/backend/src/services/create-system-user.ts index 0ebd1142f1..6ed53535d4 100644 --- a/packages/backend/src/services/create-system-user.ts +++ b/packages/backend/src/services/create-system-user.ts @@ -1,14 +1,14 @@ -import { v4 as uuid } from "uuid"; -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 { IsNull } from "typeorm"; -import { genId } from "@/misc/gen-id.js"; -import { UserKeypair } from "@/models/entities/user-keypair.js"; -import { UsedUsername } from "@/models/entities/used-username.js"; import { db } from "@/db/postgre.js"; +import { genId } from "@/misc/gen-id.js"; +import { genRsaKeyPair } from "@/misc/gen-key-pair.js"; import { hashPassword } from "@/misc/password.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { User } from "@/models/entities/user.js"; +import generateNativeUserToken from "@/server/api/common/generate-native-user-token.js"; +import { IsNull } from "typeorm"; +import { v4 as uuid } from "uuid"; export async function createSystemUser(username: string) { const password = uuid(); diff --git a/packages/backend/src/services/detect-sensitive.ts b/packages/backend/src/services/detect-sensitive.ts index df695e86da..289e2dfcff 100644 --- a/packages/backend/src/services/detect-sensitive.ts +++ b/packages/backend/src/services/detect-sensitive.ts @@ -1,6 +1,6 @@ import * as fs from "node:fs"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import * as nsfw from "nsfwjs"; import si from "systeminformation"; diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index 2f3d3c6e1e..faab329107 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -2,37 +2,37 @@ import * as fs from "node:fs"; import { v4 as uuid } from "uuid"; -import type S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 -import sharp from "sharp"; -import { IsNull } from "typeorm"; -import { publishMainStream, publishDriveStream } from "@/services/stream.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; import { contentDisposition } from "@/misc/content-disposition.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { genId } from "@/misc/gen-id.js"; import { getFileInfo } from "@/misc/get-file-info.js"; -import { - DriveFiles, - DriveFolders, - Users, - UserProfiles, -} from "@/models/index.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; import { DriveFile } from "@/models/entities/drive-file.js"; import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { + DriveFiles, + DriveFolders, + UserProfiles, + Users, +} from "@/models/index.js"; import { driveChart, - perUserDriveChart, instanceChart, + perUserDriveChart, } from "@/services/chart/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { getS3 } from "./s3.js"; -import { InternalStorage } from "./internal-storage.js"; +import { publishDriveStream, publishMainStream } from "@/services/stream.js"; +import type S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 +import sharp from "sharp"; +import { IsNull } from "typeorm"; +import { deleteFile } from "./delete-file.js"; +import { GenerateVideoThumbnail } from "./generate-video-thumbnail.js"; import type { IImage } from "./image-processor.js"; import { convertSharpToWebp } from "./image-processor.js"; +import { InternalStorage } from "./internal-storage.js"; import { driveLogger } from "./logger.js"; -import { GenerateVideoThumbnail } from "./generate-video-thumbnail.js"; -import { deleteFile } from "./delete-file.js"; +import { getS3 } from "./s3.js"; const logger = driveLogger.createSubLogger("register", "yellow"); diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index 515c1d1c65..101933e508 100644 --- a/packages/backend/src/services/drive/delete-file.ts +++ b/packages/backend/src/services/drive/delete-file.ts @@ -1,15 +1,15 @@ +import { fetchMeta } from "@/misc/fetch-meta.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; -import { InternalStorage } from "./internal-storage.js"; import { DriveFiles } from "@/models/index.js"; +import { createDeleteObjectStorageFileJob } from "@/queue/index.js"; import { driveChart, - perUserDriveChart, instanceChart, + perUserDriveChart, } 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 { InternalStorage } from "./internal-storage.js"; +import { getS3 } from "./s3.js"; export async function deleteFile(file: DriveFile, isExpired = false) { if (file.storedInternal) { diff --git a/packages/backend/src/services/drive/generate-video-thumbnail.ts b/packages/backend/src/services/drive/generate-video-thumbnail.ts index 0e3f0db58e..694a79656a 100644 --- a/packages/backend/src/services/drive/generate-video-thumbnail.ts +++ b/packages/backend/src/services/drive/generate-video-thumbnail.ts @@ -1,7 +1,7 @@ import { createTempDir } from "@/misc/create-temp.js"; +import FFmpeg from "fluent-ffmpeg"; import type { IImage } from "./image-processor.js"; import { convertToWebp } from "./image-processor.js"; -import FFmpeg from "fluent-ffmpeg"; export async function GenerateVideoThumbnail(source: string): Promise { const [dir, cleanup] = await createTempDir(); diff --git a/packages/backend/src/services/drive/internal-storage.ts b/packages/backend/src/services/drive/internal-storage.ts index b2a663b3ea..560c272dfd 100644 --- a/packages/backend/src/services/drive/internal-storage.ts +++ b/packages/backend/src/services/drive/internal-storage.ts @@ -1,8 +1,8 @@ import * as fs from "node:fs"; import * as fsPromises from "node:fs/promises"; import * as Path from "node:path"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import config from "@/config/index.js"; const _filename = fileURLToPath(import.meta.url); diff --git a/packages/backend/src/services/drive/s3.ts b/packages/backend/src/services/drive/s3.ts index d01f89cbbf..f7a4a57ee5 100644 --- a/packages/backend/src/services/drive/s3.ts +++ b/packages/backend/src/services/drive/s3.ts @@ -1,7 +1,7 @@ import { URL } from "node:url"; -import S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 -import type { Meta } from "@/models/entities/meta.js"; import { getAgentByUrl } from "@/misc/fetch.js"; +import type { Meta } from "@/models/entities/meta.js"; +import S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 export function getS3(meta: Meta) { const u = diff --git a/packages/backend/src/services/drive/upload-from-url.ts b/packages/backend/src/services/drive/upload-from-url.ts index 0638bcab89..2afa1458b0 100644 --- a/packages/backend/src/services/drive/upload-from-url.ts +++ b/packages/backend/src/services/drive/upload-from-url.ts @@ -1,12 +1,12 @@ import { URL } from "node:url"; -import type { User } from "@/models/entities/user.js"; import { createTemp } from "@/misc/create-temp.js"; import { downloadUrl, isPrivateIp } from "@/misc/download-url.js"; -import type { DriveFolder } from "@/models/entities/drive-folder.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { DriveFolder } from "@/models/entities/drive-folder.js"; +import type { User } from "@/models/entities/user.js"; import { DriveFiles } from "@/models/index.js"; -import { driveLogger } from "./logger.js"; import { addFile } from "./add-file.js"; +import { driveLogger } from "./logger.js"; const logger = driveLogger.createSubLogger("downloader"); diff --git a/packages/backend/src/services/fetch-instance-metadata.ts b/packages/backend/src/services/fetch-instance-metadata.ts index a4cc33bca5..b399df24ad 100644 --- a/packages/backend/src/services/fetch-instance-metadata.ts +++ b/packages/backend/src/services/fetch-instance-metadata.ts @@ -1,12 +1,12 @@ import { URL } from "node:url"; +import { getFetchInstanceMetadataLock } from "@/misc/app-lock.js"; +import { getAgentByUrl, getJson } from "@/misc/fetch.js"; +import type { Instance } from "@/models/entities/instance.js"; +import { Instances } from "@/models/index.js"; +import Logger from "@/services/logger.js"; import { Window } from "happy-dom"; import fetch from "node-fetch"; import tinycolor from "tinycolor2"; -import { getJson, getAgentByUrl } from "@/misc/fetch.js"; -import type { Instance } from "@/models/entities/instance.js"; -import { Instances } from "@/models/index.js"; -import { getFetchInstanceMetadataLock } from "@/misc/app-lock.js"; -import Logger from "@/services/logger.js"; const logger = new Logger("metadata", "cyan"); diff --git a/packages/backend/src/services/fetch-rel-me.ts b/packages/backend/src/services/fetch-rel-me.ts index c9a37d1c88..0bb340db45 100644 --- a/packages/backend/src/services/fetch-rel-me.ts +++ b/packages/backend/src/services/fetch-rel-me.ts @@ -1,5 +1,5 @@ -import { Window } from "happy-dom"; import config from "@/config/index.js"; +import { Window } from "happy-dom"; async function getRelMeLinks(url: string): Promise { try { diff --git a/packages/backend/src/services/following/create.ts b/packages/backend/src/services/following/create.ts index 934b235bbc..562867e19d 100644 --- a/packages/backend/src/services/following/create.ts +++ b/packages/backend/src/services/following/create.ts @@ -1,33 +1,33 @@ -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 "@/services/register-or-fetch-instance-doc.js"; -import Logger from "../logger.js"; +import { genId } from "@/misc/gen-id.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import type { Packed } from "@/misc/schema.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; import type { User } from "@/models/entities/user.js"; import { - Followings, - Users, - FollowRequests, Blockings, + FollowRequests, + Followings, Instances, UserProfiles, + Users, } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import { webhookDeliver } from "@/queue/index.js"; +import renderAccept from "@/remote/activitypub/renderer/accept.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; import { instanceChart, perUserFollowingChart, } from "@/services/chart/index.js"; -import { genId } from "@/misc/gen-id.js"; import { createNotification } from "@/services/create-notification.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import type { Packed } from "@/misc/schema.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; -import { webhookDeliver } from "@/queue/index.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import Logger from "../logger.js"; +import createFollowRequest from "./requests/create.js"; const logger = new Logger("following/create"); diff --git a/packages/backend/src/services/following/delete.ts b/packages/backend/src/services/following/delete.ts index 8a07244da5..55cd1fc810 100644 --- a/packages/backend/src/services/following/delete.ts +++ b/packages/backend/src/services/following/delete.ts @@ -1,18 +1,18 @@ -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 renderReject from "@/remote/activitypub/renderer/reject.js"; -import { deliver, webhookDeliver } from "@/queue/index.js"; -import Logger from "../logger.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; import type { User } from "@/models/entities/user.js"; -import { Followings, Users, Instances } from "@/models/index.js"; +import { Followings, Instances, Users } from "@/models/index.js"; +import { deliver, webhookDeliver } from "@/queue/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; import { instanceChart, perUserFollowingChart, } from "@/services/chart/index.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import Logger from "../logger.js"; const logger = new Logger("following/delete"); diff --git a/packages/backend/src/services/following/reject.ts b/packages/backend/src/services/following/reject.ts index 3f461268dd..16e46b1578 100644 --- a/packages/backend/src/services/following/reject.ts +++ b/packages/backend/src/services/following/reject.ts @@ -1,12 +1,12 @@ -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, webhookDeliver } from "@/queue/index.js"; -import { publishMainStream, publishUserEvent } from "@/services/stream.js"; -import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; -import { Users, FollowRequests, Followings } from "@/models/index.js"; -import { decrementFollowing } from "./delete.js"; import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; +import { FollowRequests, Followings, Users } from "@/models/index.js"; +import { deliver, webhookDeliver } from "@/queue/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { decrementFollowing } from "./delete.js"; type Local = | ILocalUser diff --git a/packages/backend/src/services/following/requests/accept-all.ts b/packages/backend/src/services/following/requests/accept-all.ts index 2692433799..1808bff2bc 100644 --- a/packages/backend/src/services/following/requests/accept-all.ts +++ b/packages/backend/src/services/following/requests/accept-all.ts @@ -1,6 +1,6 @@ -import accept from "./accept.js"; import type { User } from "@/models/entities/user.js"; import { FollowRequests, Users } from "@/models/index.js"; +import accept from "./accept.js"; /** * Approve all follow requests for the specified user diff --git a/packages/backend/src/services/following/requests/accept.ts b/packages/backend/src/services/following/requests/accept.ts index 1bc10f6082..2a7c03ba19 100644 --- a/packages/backend/src/services/following/requests/accept.ts +++ b/packages/backend/src/services/following/requests/accept.ts @@ -1,12 +1,12 @@ -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 { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { CacheableUser, User } from "@/models/entities/user.js"; +import { FollowRequests, Users } from "@/models/index.js"; import { deliver } from "@/queue/index.js"; +import renderAccept from "@/remote/activitypub/renderer/accept.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { publishMainStream } from "@/services/stream.js"; import { insertFollowingDoc } from "../create.js"; -import type { User, CacheableUser } from "@/models/entities/user.js"; -import { FollowRequests, Users } from "@/models/index.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; export default async function ( followee: { diff --git a/packages/backend/src/services/following/requests/cancel.ts b/packages/backend/src/services/following/requests/cancel.ts index 45b8ee0639..1b9758c5bd 100644 --- a/packages/backend/src/services/following/requests/cancel.ts +++ b/packages/backend/src/services/following/requests/cancel.ts @@ -1,11 +1,11 @@ -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 type { User } from "@/models/entities/user.js"; -import { Users, FollowRequests } from "@/models/index.js"; +import { FollowRequests, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { publishMainStream } from "@/services/stream.js"; export default async function ( followee: { diff --git a/packages/backend/src/services/following/requests/create.ts b/packages/backend/src/services/following/requests/create.ts index 12dfddf302..a3ed22f83c 100644 --- a/packages/backend/src/services/following/requests/create.ts +++ b/packages/backend/src/services/following/requests/create.ts @@ -1,12 +1,12 @@ -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 config from "@/config/index.js"; +import { genId } from "@/misc/gen-id.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, FollowRequests, Users } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; +import { deliver } from "@/queue/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { createNotification } from "@/services/create-notification.js"; -import config from "@/config/index.js"; +import { publishMainStream } from "@/services/stream.js"; export default async function ( follower: { diff --git a/packages/backend/src/services/i/pin.ts b/packages/backend/src/services/i/pin.ts index 8cb1bf518e..e23f669f12 100644 --- a/packages/backend/src/services/i/pin.ts +++ b/packages/backend/src/services/i/pin.ts @@ -1,14 +1,14 @@ 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 type { User } from "@/models/entities/user.js"; -import type { Note } from "@/models/entities/note.js"; -import { Notes, UserNotePinings, Users } from "@/models/index.js"; -import type { UserNotePining } from "@/models/entities/user-note-pining.js"; import { genId } from "@/misc/gen-id.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { Note } from "@/models/entities/note.js"; +import type { UserNotePining } from "@/models/entities/user-note-pining.js"; +import type { User } from "@/models/entities/user.js"; +import { Notes, UserNotePinings, Users } from "@/models/index.js"; import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; +import renderAdd from "@/remote/activitypub/renderer/add.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderRemove from "@/remote/activitypub/renderer/remove.js"; import { deliverToRelays } from "@/services/relay.js"; /** diff --git a/packages/backend/src/services/i/update.ts b/packages/backend/src/services/i/update.ts index 21b03d9821..ec22907bf5 100644 --- a/packages/backend/src/services/i/update.ts +++ b/packages/backend/src/services/i/update.ts @@ -1,9 +1,9 @@ -import renderUpdate from "@/remote/activitypub/renderer/update.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { Users } from "@/models/index.js"; import type { User } from "@/models/entities/user.js"; -import { renderPerson } from "@/remote/activitypub/renderer/person.js"; +import { Users } from "@/models/index.js"; import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { renderPerson } from "@/remote/activitypub/renderer/person.js"; +import renderUpdate from "@/remote/activitypub/renderer/update.js"; import { deliverToRelays } from "@/services/relay.js"; export async function publishToFollowers(userId: User["id"]) { diff --git a/packages/backend/src/services/insert-moderation-log.ts b/packages/backend/src/services/insert-moderation-log.ts index 8e2c5b78a1..9e45ece682 100644 --- a/packages/backend/src/services/insert-moderation-log.ts +++ b/packages/backend/src/services/insert-moderation-log.ts @@ -1,6 +1,6 @@ -import { ModerationLogs } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { User } from "@/models/entities/user.js"; +import { ModerationLogs } from "@/models/index.js"; export async function insertModerationLog( moderator: { id: User["id"] }, diff --git a/packages/backend/src/services/instance-actor.ts b/packages/backend/src/services/instance-actor.ts index a8b34ea57b..6f21107eb3 100644 --- a/packages/backend/src/services/instance-actor.ts +++ b/packages/backend/src/services/instance-actor.ts @@ -1,8 +1,8 @@ -import { createSystemUser } from "./create-system-user.js"; +import { Cache } from "@/misc/cache.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; -import { Cache } from "@/misc/cache.js"; import { IsNull } from "typeorm"; +import { createSystemUser } from "./create-system-user.js"; const ACTOR_USERNAME = "instance.actor" as const; diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index df4c2e3564..54a0440d45 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -1,9 +1,9 @@ import cluster from "node:cluster"; +import config from "@/config/index.js"; +import { envOption } from "@/env.js"; import chalk from "chalk"; import { default as convertColor } from "color-convert"; import { format as dateFormat } from "date-fns"; -import { envOption } from "@/env.js"; -import config from "@/config/index.js"; import * as SyslogPro from "syslog-pro"; diff --git a/packages/backend/src/services/messages/create.ts b/packages/backend/src/services/messages/create.ts index 506f299966..ed5e014945 100644 --- a/packages/backend/src/services/messages/create.ts +++ b/packages/backend/src/services/messages/create.ts @@ -1,27 +1,27 @@ -import type { CacheableUser, User } from "@/models/entities/user.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; +import { genId } from "@/misc/gen-id.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import type { Note } from "@/models/entities/note.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { CacheableUser, User } from "@/models/entities/user.js"; import { MessagingMessages, - UserGroupJoinings, Mutings, + UserGroupJoinings, Users, } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; -import { - publishMessagingStream, - publishMessagingIndexStream, - publishMainStream, - publishGroupMessagingStream, -} from "@/services/stream.js"; -import { pushNotification } from "@/services/push-notification.js"; -import { Not } from "typeorm"; -import type { Note } from "@/models/entities/note.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; +import { deliver } from "@/queue/index.js"; import renderCreate from "@/remote/activitypub/renderer/create.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { deliver } from "@/queue/index.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import { pushNotification } from "@/services/push-notification.js"; +import { + publishGroupMessagingStream, + publishMainStream, + publishMessagingIndexStream, + publishMessagingStream, +} from "@/services/stream.js"; +import { Not } from "typeorm"; export async function createMessage( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/messages/delete.ts b/packages/backend/src/services/messages/delete.ts index 77caba80ce..adc3652239 100644 --- a/packages/backend/src/services/messages/delete.ts +++ b/packages/backend/src/services/messages/delete.ts @@ -1,14 +1,14 @@ import config from "@/config/index.js"; -import { MessagingMessages, Users } from "@/models/index.js"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { MessagingMessages, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderTombstone from "@/remote/activitypub/renderer/tombstone.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/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index 8670f6275d..8e496928c2 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -1,74 +1,74 @@ -import * as mfm from "mfm-js"; -import es from "@/db/elasticsearch.js"; -import sonic from "@/db/sonic.js"; -import { - publishMainStream, - publishNotesStream, - publishNoteStream, -} 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 "@/services/update-hashtag.js"; -import { concat } from "@/prelude/array.js"; -import { insertNoteUnread } from "@/services/note/unread.js"; -import { registerOrFetchInstanceDoc } from "@/services/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 type { IMentionedRemoteUsers } from "@/models/entities/note.js"; -import { Note } from "@/models/entities/note.js"; -import { - Mutings, - Users, - NoteWatchings, - Notes, - Instances, - UserProfiles, - MutedNotes, - Channels, - ChannelFollowings, - NoteThreadMutings, -} from "@/models/index.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { App } from "@/models/entities/app.js"; -import { Not, In } from "typeorm"; -import type { 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 type { IPoll } from "@/models/entities/poll.js"; -import { Poll } from "@/models/entities/poll.js"; -import { createNotification } from "@/services/create-notification.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import es from "@/db/elasticsearch.js"; +import meilisearch from "@/db/meilisearch.js"; +import { db } from "@/db/postgre.js"; +import { redisClient } from "@/db/redis.js"; +import sonic from "@/db/sonic.js"; +import { getAntennas } from "@/misc/antenna-cache.js"; +import { Cache } from "@/misc/cache.js"; import { checkHitAntenna } from "@/misc/check-hit-antenna.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { addNoteToAntenna } from "@/services/add-note-to-antenna.js"; import { countSameRenotes } from "@/misc/count-same-renotes.js"; -import { deliverToRelays, getCachedRelays } from "../relay.js"; -import type { Channel } from "@/models/entities/channel.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { getAntennas } from "@/misc/antenna-cache.js"; -import { endedPollNotificationQueue } from "@/queue/queues.js"; -import { webhookDeliver } from "@/queue/index.js"; -import { Cache } from "@/misc/cache.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import { db } from "@/db/postgre.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; -import meilisearch from "@/db/meilisearch.js"; -import { redisClient } from "@/db/redis.js"; -import { Mutex } from "redis-semaphore"; -import { langmap } from "@/misc/langmap.js"; import detectLanguage from "@/misc/detect-language.js"; +import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import { extractMentions } from "@/misc/extract-mentions.js"; +import { genId } from "@/misc/gen-id.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import { langmap } from "@/misc/langmap.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import type { App } from "@/models/entities/app.js"; +import type { Channel } from "@/models/entities/channel.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; +import { Note } from "@/models/entities/note.js"; +import type { IPoll } from "@/models/entities/poll.js"; +import { Poll } from "@/models/entities/poll.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { + ChannelFollowings, + Channels, + Instances, + MutedNotes, + Mutings, + NoteThreadMutings, + NoteWatchings, + Notes, + UserProfiles, + Users, +} from "@/models/index.js"; +import { concat } from "@/prelude/array.js"; +import { webhookDeliver } from "@/queue/index.js"; +import { endedPollNotificationQueue } from "@/queue/queues.js"; +import DeliverManager from "@/remote/activitypub/deliver-manager.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { addNoteToAntenna } from "@/services/add-note-to-antenna.js"; +import { + activeUsersChart, + instanceChart, + notesChart, + perUserNotesChart, +} from "@/services/chart/index.js"; +import { createNotification } from "@/services/create-notification.js"; +import { insertNoteUnread } from "@/services/note/unread.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { + publishMainStream, + publishNoteStream, + publishNotesStream, +} from "@/services/stream.js"; +import { updateHashtags } from "@/services/update-hashtag.js"; +import * as mfm from "mfm-js"; +import { Mutex } from "redis-semaphore"; +import { In, Not } from "typeorm"; +import { deliverToRelays, getCachedRelays } from "../relay.js"; const mutedWordsCache = new Cache< { userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[] diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index 8a75825809..0ec818a290 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -1,27 +1,27 @@ -import { Brackets, In } from "typeorm"; -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 type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js"; -import type { 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 meilisearch from "@/db/meilisearch.js"; +import { countSameRenotes } from "@/misc/count-same-renotes.js"; +import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; +import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { Instances, Notes, Users } from "@/models/index.js"; import { deliverToFollowers, deliverToUser, } from "@/remote/activitypub/deliver-manager.js"; -import { countSameRenotes } from "@/misc/count-same-renotes.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderTombstone from "@/remote/activitypub/renderer/tombstone.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { + instanceChart, + notesChart, + perUserNotesChart, +} from "@/services/chart/index.js"; import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import { deliverToRelays } from "@/services/relay.js"; -import meilisearch from "@/db/meilisearch.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { Brackets, In } from "typeorm"; /** * 投稿を削除します。 diff --git a/packages/backend/src/services/note/polls/update.ts b/packages/backend/src/services/note/polls/update.ts index 270b4d9bf2..073980226c 100644 --- a/packages/backend/src/services/note/polls/update.ts +++ b/packages/backend/src/services/note/polls/update.ts @@ -1,9 +1,9 @@ -import renderUpdate from "@/remote/activitypub/renderer/update.js"; +import type { Note } from "@/models/entities/note.js"; +import { Notes, Users } from "@/models/index.js"; +import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.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 type { Note } from "@/models/entities/note.js"; -import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; +import renderUpdate from "@/remote/activitypub/renderer/update.js"; import { deliverToRelays } from "@/services/relay.js"; export async function deliverQuestionUpdate(noteId: Note["id"]) { diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index 6ade899726..ebffed0d9d 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -1,10 +1,10 @@ -import { publishNoteStream } from "@/services/stream.js"; -import type { CacheableUser } from "@/models/entities/user.js"; -import type { 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.js"; +import type { Note } from "@/models/entities/note.js"; +import type { CacheableUser } from "@/models/entities/user.js"; +import { Blockings, NoteWatchings, PollVotes, Polls } from "@/models/index.js"; import { createNotification } from "@/services/create-notification.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { Not } from "typeorm"; export default async function ( user: CacheableUser, diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 123356515d..ed265be8af 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -1,26 +1,26 @@ -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 type { User, IRemoteUser } from "@/models/entities/user.js"; +import { genId } from "@/misc/gen-id.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import { decodeReaction, toDbReaction } from "@/misc/reaction-lib.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; import type { Note } from "@/models/entities/note.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; import { + Blockings, + Emojis, NoteReactions, - Users, NoteWatchings, Notes, - Emojis, - Blockings, + Users, } from "@/models/index.js"; -import { IsNull, Not } from "typeorm"; +import DeliverManager from "@/remote/activitypub/deliver-manager.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { renderLike } from "@/remote/activitypub/renderer/like.js"; import { perUserReactionsChart } from "@/services/chart/index.js"; -import { genId } from "@/misc/gen-id.js"; import { createNotification } from "@/services/create-notification.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { IsNull, Not } from "typeorm"; import deleteReaction from "./delete.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; export default async ( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/note/reaction/delete.ts b/packages/backend/src/services/note/reaction/delete.ts index 15c6d1cf62..159d86f4a8 100644 --- a/packages/backend/src/services/note/reaction/delete.ts +++ b/packages/backend/src/services/note/reaction/delete.ts @@ -1,13 +1,13 @@ -import { publishNoteStream } from "@/services/stream.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { decodeReaction } from "@/misc/reaction-lib.js"; +import type { Note } from "@/models/entities/note.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { NoteReactions, Notes, Users } from "@/models/index.js"; +import DeliverManager from "@/remote/activitypub/deliver-manager.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.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 type { User, IRemoteUser } from "@/models/entities/user.js"; -import type { Note } from "@/models/entities/note.js"; -import { NoteReactions, Users, Notes } from "@/models/index.js"; -import { decodeReaction } from "@/misc/reaction-lib.js"; +import { publishNoteStream } from "@/services/stream.js"; export default async ( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/note/read.ts b/packages/backend/src/services/note/read.ts index 07d277d84f..b127e88369 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -1,16 +1,16 @@ -import { publishMainStream } from "@/services/stream.js"; +import type { Packed } from "@/misc/schema.js"; +import type { Channel } from "@/models/entities/channel.js"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { + ChannelFollowings, + Followings, NoteUnreads, Users, - Followings, - ChannelFollowings, } from "@/models/index.js"; -import { Not, IsNull, In } from "typeorm"; -import type { Channel } from "@/models/entities/channel.js"; import { readNotificationByQuery } from "@/server/api/common/read-notification.js"; -import type { Packed } from "@/misc/schema.js"; +import { publishMainStream } from "@/services/stream.js"; +import { In, IsNull, Not } from "typeorm"; /** * Mark notes as read diff --git a/packages/backend/src/services/note/unread.ts b/packages/backend/src/services/note/unread.ts index cb87abe0e6..6825ee7c96 100644 --- a/packages/backend/src/services/note/unread.ts +++ b/packages/backend/src/services/note/unread.ts @@ -1,8 +1,8 @@ +import { genId } from "@/misc/gen-id.js"; import type { Note } from "@/models/entities/note.js"; -import { publishMainStream } from "@/services/stream.js"; import type { User } from "@/models/entities/user.js"; import { Mutings, NoteThreadMutings, NoteUnreads } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; +import { publishMainStream } from "@/services/stream.js"; export async function insertNoteUnread( userId: User["id"], diff --git a/packages/backend/src/services/note/unwatch.ts b/packages/backend/src/services/note/unwatch.ts index b4da5e86da..0b2e42281a 100644 --- a/packages/backend/src/services/note/unwatch.ts +++ b/packages/backend/src/services/note/unwatch.ts @@ -1,6 +1,6 @@ +import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { NoteWatchings } from "@/models/index.js"; -import type { Note } from "@/models/entities/note.js"; export default async (me: User["id"], note: Note) => { await NoteWatchings.delete({ diff --git a/packages/backend/src/services/note/watch.ts b/packages/backend/src/services/note/watch.ts index 2a99dd6949..c69efe68a3 100644 --- a/packages/backend/src/services/note/watch.ts +++ b/packages/backend/src/services/note/watch.ts @@ -1,8 +1,8 @@ -import type { User } from "@/models/entities/user.js"; -import type { Note } from "@/models/entities/note.js"; -import { NoteWatchings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { NoteWatching } from "@/models/entities/note-watching.js"; +import type { Note } from "@/models/entities/note.js"; +import type { User } from "@/models/entities/user.js"; +import { NoteWatchings } from "@/models/index.js"; export default async (me: User["id"], note: Note) => { // 自分の投稿はwatchできない diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index a207fae391..1e0486ff38 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -1,9 +1,9 @@ -import push from "web-push"; import config from "@/config/index.js"; -import { SwSubscriptions } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { Packed } from "@/misc/schema.js"; import { getNoteSummary } from "@/misc/get-note-summary.js"; +import type { Packed } from "@/misc/schema.js"; +import { SwSubscriptions } from "@/models/index.js"; +import push from "web-push"; // Defined also packages/sw/types.ts#L14-L21 type pushNotificationsTypes = { diff --git a/packages/backend/src/services/register-or-fetch-instance-doc.ts b/packages/backend/src/services/register-or-fetch-instance-doc.ts index c0ead08190..c56e609e53 100644 --- a/packages/backend/src/services/register-or-fetch-instance-doc.ts +++ b/packages/backend/src/services/register-or-fetch-instance-doc.ts @@ -1,8 +1,8 @@ +import { Cache } from "@/misc/cache.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { genId } from "@/misc/gen-id.js"; import type { Instance } from "@/models/entities/instance.js"; import { Instances } from "@/models/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("registerOrFetchInstanceDoc", 60 * 60); diff --git a/packages/backend/src/services/relay.ts b/packages/backend/src/services/relay.ts index fdc42616ea..20d9380868 100644 --- a/packages/backend/src/services/relay.ts +++ b/packages/backend/src/services/relay.ts @@ -1,17 +1,17 @@ -import { IsNull } from "typeorm"; +import { Cache } from "@/misc/cache.js"; +import { genId } from "@/misc/gen-id.js"; +import type { Relay } from "@/models/entities/relay.js"; +import type { ILocalUser, User } from "@/models/entities/user.js"; +import { Relays, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; import { renderFollowRelay } from "@/remote/activitypub/renderer/follow-relay.js"; import { - renderActivity, attachLdSignature, + renderActivity, } from "@/remote/activitypub/renderer/index.js"; import renderUndo from "@/remote/activitypub/renderer/undo.js"; -import { deliver } from "@/queue/index.js"; -import type { ILocalUser, User } from "@/models/entities/user.js"; -import { Users, Relays } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { Cache } from "@/misc/cache.js"; -import type { Relay } from "@/models/entities/relay.js"; import { createSystemUser } from "@/services/create-system-user.js"; +import { IsNull } from "typeorm"; const ACTOR_USERNAME = "relay.actor" as const; diff --git a/packages/backend/src/services/send-email.ts b/packages/backend/src/services/send-email.ts index ccc6b365d9..7874af136f 100644 --- a/packages/backend/src/services/send-email.ts +++ b/packages/backend/src/services/send-email.ts @@ -1,7 +1,7 @@ -import * as nodemailer from "nodemailer"; +import config from "@/config/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import Logger from "@/services/logger.js"; -import config from "@/config/index.js"; +import * as nodemailer from "nodemailer"; export const logger = new Logger("email"); diff --git a/packages/backend/src/services/stream.ts b/packages/backend/src/services/stream.ts index f59674ad6a..518f35359b 100644 --- a/packages/backend/src/services/stream.ts +++ b/packages/backend/src/services/stream.ts @@ -1,13 +1,12 @@ -import { redisClient } from "@/db/redis.js"; -import type { User } from "@/models/entities/user.js"; -import type { Note } from "@/models/entities/note.js"; -import type { UserList } from "@/models/entities/user-list.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import config from "@/config/index.js"; +import { redisClient } from "@/db/redis.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Channel } from "@/models/entities/channel.js"; +import type { Note } from "@/models/entities/note.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { UserList } from "@/models/entities/user-list.js"; +import type { User } from "@/models/entities/user.js"; import type { - StreamChannels, AdminStreamTypes, AntennaStreamTypes, BroadcastTypes, @@ -19,6 +18,7 @@ import type { MessagingIndexStreamTypes, MessagingStreamTypes, NoteStreamTypes, + StreamChannels, UserListStreamTypes, UserStreamTypes, } from "@/server/api/stream/types.js"; diff --git a/packages/backend/src/services/suspend-user.ts b/packages/backend/src/services/suspend-user.ts index f72b8ffcb1..919f6d0abe 100644 --- a/packages/backend/src/services/suspend-user.ts +++ b/packages/backend/src/services/suspend-user.ts @@ -1,11 +1,11 @@ -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 type { User } from "@/models/entities/user.js"; -import { Users, Followings } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; +import { Followings, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { publishInternalEvent } from "@/services/stream.js"; +import { IsNull, Not } from "typeorm"; export async function doPostSuspend(user: { id: User["id"]; diff --git a/packages/backend/src/services/unsuspend-user.ts b/packages/backend/src/services/unsuspend-user.ts index 69447a4a26..944ef18bed 100644 --- a/packages/backend/src/services/unsuspend-user.ts +++ b/packages/backend/src/services/unsuspend-user.ts @@ -1,12 +1,12 @@ -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 type { User } from "@/models/entities/user.js"; -import { Users, Followings } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; +import { Followings, Users } from "@/models/index.js"; +import { deliver } from "@/queue/index.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; import { publishInternalEvent } from "@/services/stream.js"; +import { IsNull, Not } from "typeorm"; export async function doPostUnsuspend(user: User) { publishInternalEvent("userChangeSuspendedState", { diff --git a/packages/backend/src/services/update-hashtag.ts b/packages/backend/src/services/update-hashtag.ts index 0c65b08f0a..db08bd1485 100644 --- a/packages/backend/src/services/update-hashtag.ts +++ b/packages/backend/src/services/update-hashtag.ts @@ -1,9 +1,9 @@ +import { genId } from "@/misc/gen-id.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import type { Hashtag } from "@/models/entities/hashtag.js"; import type { 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 type { 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"] }, diff --git a/packages/backend/src/services/user-cache.ts b/packages/backend/src/services/user-cache.ts index ed700185df..699d5edde1 100644 --- a/packages/backend/src/services/user-cache.ts +++ b/packages/backend/src/services/user-cache.ts @@ -1,11 +1,11 @@ +import { redisClient, subscriber } from "@/db/redis.js"; +import { Cache } from "@/misc/cache.js"; import type { CacheableLocalUser, CacheableUser, ILocalUser, } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; -import { Cache } from "@/misc/cache.js"; -import { redisClient, subscriber } from "@/db/redis.js"; export const userByIdCache = new Cache("userById", 60 * 30); export const localUserByNativeTokenCache = new Cache( diff --git a/packages/backend/src/services/user-list/push.ts b/packages/backend/src/services/user-list/push.ts index db01b0a900..77181bf7b4 100644 --- a/packages/backend/src/services/user-list/push.ts +++ b/packages/backend/src/services/user-list/push.ts @@ -1,11 +1,11 @@ -import { publishUserListStream } from "@/services/stream.js"; -import type { User } from "@/models/entities/user.js"; -import type { UserList } from "@/models/entities/user-list.js"; -import { UserListJoinings, Users } from "@/models/index.js"; -import type { UserListJoining } from "@/models/entities/user-list-joining.js"; -import { genId } from "@/misc/gen-id.js"; import { fetchProxyAccount } from "@/misc/fetch-proxy-account.js"; +import { genId } from "@/misc/gen-id.js"; +import type { UserListJoining } from "@/models/entities/user-list-joining.js"; +import type { UserList } from "@/models/entities/user-list.js"; +import type { User } from "@/models/entities/user.js"; +import { UserListJoinings, Users } from "@/models/index.js"; import createFollowing from "@/services/following/create.js"; +import { publishUserListStream } from "@/services/stream.js"; export async function pushUserToUserList(target: User, list: UserList) { await UserListJoinings.insert({ diff --git a/packages/backend/src/services/validate-email-for-account.ts b/packages/backend/src/services/validate-email-for-account.ts index 2bb5e93e7e..419203f536 100644 --- a/packages/backend/src/services/validate-email-for-account.ts +++ b/packages/backend/src/services/validate-email-for-account.ts @@ -1,6 +1,6 @@ -import { validate as validateEmail } from "deep-email-validator"; -import { UserProfiles } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import { UserProfiles } from "@/models/index.js"; +import { validate as validateEmail } from "deep-email-validator"; export async function validateEmailForAccount(emailAddress: string): Promise<{ available: boolean;