chore (backend): organize imports

This commit is contained in:
naskya 2024-05-11 04:52:59 +09:00
parent d1b33ad76f
commit 8f8d62aa58
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
18 changed files with 37 additions and 37 deletions

View file

@ -8,9 +8,12 @@ import chalkTemplate from "chalk-template";
import semver from "semver";
import Logger from "@/services/logger.js";
import type { Config } from "backend-rs";
import { initializeRustLogger } from "backend-rs";
import { fetchMeta, removeOldAttestationChallenges } from "backend-rs";
import {
fetchMeta,
initializeRustLogger,
removeOldAttestationChallenges,
type Config,
} from "backend-rs";
import { config, envOption } from "@/config.js";
import { showMachineInfo } from "@/misc/show-machine-info.js";
import { db, initDb } from "@/db/postgre.js";

View file

@ -1,8 +1,7 @@
import { Brackets } from "typeorm";
import { isBlockedServer } from "backend-rs";
import { isBlockedServer, DAY } from "backend-rs";
import { Instances } from "@/models/index.js";
import type { Instance } from "@/models/entities/instance.js";
import { DAY } from "backend-rs";
// Threshold from last contact after which an instance will be considered
// "dead" and should no longer get activities delivered to it.

View file

@ -5,8 +5,12 @@ import perform from "@/remote/activitypub/perform.js";
import Logger from "@/services/logger.js";
import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js";
import { Instances } from "@/models/index.js";
import { isAllowedServer, isBlockedServer } from "backend-rs";
import { toPuny, extractHost } from "backend-rs";
import {
extractHost,
isAllowedServer,
isBlockedServer,
toPuny,
} from "backend-rs";
import { getApId } from "@/remote/activitypub/type.js";
import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js";
import type { InboxJobData } from "../types.js";

View file

@ -1,11 +1,15 @@
import { URL } from "url";
import { URL } from "node:url";
import httpSignature, { type IParsedSignature } from "@peertube/http-signature";
import { config } from "@/config.js";
import { fetchMeta, isAllowedServer, isBlockedServer } from "backend-rs";
import { toPuny } from "backend-rs";
import {
fetchMeta,
isAllowedServer,
isBlockedServer,
toPuny,
} from "backend-rs";
import DbResolver from "@/remote/activitypub/db-resolver.js";
import { getApId } from "@/remote/activitypub/type.js";
import type { IncomingMessage } from "http";
import type { IncomingMessage } from "node:http";
import type { CacheableRemoteUser } from "@/models/entities/user.js";
import type { UserPublickey } from "@/models/entities/user-publickey.js";
import { verify } from "node:crypto";

View file

@ -5,12 +5,11 @@ import type { IAnnounce } from "../../type.js";
import { getApId } from "../../type.js";
import { fetchNote, resolveNote } from "../../models/note.js";
import { apLogger } from "../../logger.js";
import { extractHost } from "backend-rs";
import { extractHost, isBlockedServer } from "backend-rs";
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 { isBlockedServer } from "backend-rs";
import { inspect } from "node:util";
/**

View file

@ -16,7 +16,9 @@ import type { DriveFile } from "@/models/entities/drive-file.js";
import {
type ImageSize,
extractHost,
genId,
getImageSizeFromUrl,
isBlockedServer,
isSameOrigin,
toPuny,
} from "backend-rs";
@ -39,7 +41,6 @@ import {
getApType,
} from "../type.js";
import type { Emoji } from "@/models/entities/emoji.js";
import { genId, isBlockedServer } from "backend-rs";
import { getApLock } from "@/misc/app-lock.js";
import { createMessage } from "@/services/messages/create.js";
import { parseAudience } from "../audience.js";

View file

@ -16,10 +16,9 @@ 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 "backend-rs";
import { genId, isSameOrigin, toPuny } from "backend-rs";
import { UserPublickey } from "@/models/entities/user-publickey.js";
import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js";
import { isSameOrigin, toPuny } from "backend-rs";
import { UserProfile } from "@/models/entities/user-profile.js";
import { toArray } from "@/prelude/array.js";
import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js";

View file

@ -1,4 +1,4 @@
import { readdir } from "fs/promises";
import { readdir } from "node:fs/promises";
import define from "@/server/api/define.js";
export const meta = {

View file

@ -2,8 +2,7 @@ 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 "backend-rs";
import { fetchMeta } from "backend-rs";
import { fetchMeta, DAY } from "backend-rs";
export const meta = {
secure: true,

View file

@ -4,11 +4,10 @@ import { resolveUser } from "@/remote/resolve-user.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 "backend-rs";
import { stringToAcct, DAY } from "backend-rs";
import { apiLogger } from "@/server/api/logger.js";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { stringToAcct } from "backend-rs";
import { inspect } from "node:util";
export const meta = {

View file

@ -1,6 +1,6 @@
import type { User } from "@/models/entities/user.js";
import { resolveUser } from "@/remote/resolve-user.js";
import { DAY } from "backend-rs";
import { stringToAcct, DAY } from "backend-rs";
import DeliverManager from "@/remote/activitypub/deliver-manager.js";
import { renderActivity } from "@/remote/activitypub/renderer/index.js";
import define from "@/server/api/define.js";
@ -12,7 +12,6 @@ import { getUser } from "@/server/api/common/getters.js";
import { Followings, Users } from "@/models/index.js";
import { config } from "@/config.js";
import { publishMainStream } from "@/services/stream.js";
import { stringToAcct } from "backend-rs";
import { inspect } from "node:util";
export const meta = {

View file

@ -18,7 +18,7 @@ import { config } from "@/config.js";
import { noteVisibilities } from "@/types.js";
import { ApiError } from "@/server/api/error.js";
import define from "@/server/api/define.js";
import { HOUR } from "backend-rs";
import { genId, HOUR } from "backend-rs";
import { getNote } from "@/server/api/common/getters.js";
import { Poll } from "@/models/entities/poll.js";
import * as mfm from "mfm-js";
@ -26,7 +26,6 @@ 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 "backend-rs";
import { publishNoteStream } from "@/services/stream.js";
import DeliverManager from "@/remote/activitypub/deliver-manager.js";
import { renderActivity } from "@/remote/activitypub/renderer/index.js";

View file

@ -1,9 +1,8 @@
import { Pages, DriveFiles } from "@/models/index.js";
import { genId } from "backend-rs";
import { genId, HOUR } from "backend-rs";
import { Page } from "@/models/entities/page.js";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { HOUR } from "backend-rs";
export const meta = {
tags: ["pages"],

View file

@ -1,7 +1,6 @@
import { IsNull } from "typeorm";
import { Users } from "@/models/index.js";
import { fetchMeta } from "backend-rs";
import { stringToAcct } from "backend-rs";
import { fetchMeta, stringToAcct } from "backend-rs";
import type { User } from "@/models/entities/user.js";
import define from "@/server/api/define.js";

View file

@ -1,5 +1,4 @@
import { fetchMeta } from "backend-rs";
import { genId } from "backend-rs";
import { fetchMeta, genId } from "backend-rs";
import { SwSubscriptions } from "@/models/index.js";
import define from "@/server/api/define.js";

View file

@ -1,6 +1,6 @@
import Router from "@koa/router";
import type Router from "@koa/router";
import { getClient } from "../ApiMastodonCompatibleService.js";
import { ParsedUrlQuery } from "querystring";
import type { ParsedUrlQuery } from "node:querystring";
import {
convertAccount,
convertConversation,

View file

@ -16,10 +16,9 @@ import { IsNull } from "typeorm";
import { config, envOption } from "@/config.js";
import Logger from "@/services/logger.js";
import { Users } from "@/models/index.js";
import { fetchMeta } from "backend-rs";
import { fetchMeta, stringToAcct } from "backend-rs";
import { genIdenticon } from "@/misc/gen-identicon.js";
import { createTemp } from "@/misc/create-temp.js";
import { stringToAcct } from "backend-rs";
import megalodon, { type MegalodonInterface } from "megalodon";
import activityPub from "./activitypub.js";
import nodeinfo from "./nodeinfo.js";

View file

@ -3,8 +3,7 @@ import {
MAX_LENGTH_INSTANCE,
} from "@/models/entities/instance.js";
import { Instances } from "@/models/index.js";
import { genId } from "backend-rs";
import { toPuny } from "backend-rs";
import { genId, toPuny } from "backend-rs";
import { Cache } from "@/misc/cache.js";
import Logger from "@/services/logger.js";