From f1e1f9e5b06b386661edabe6977470a94878e3c7 Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 23 Jan 2024 02:16:52 +0900 Subject: [PATCH] refactor: stop importing stuff from backend-rs/built --- packages/backend/package.json | 2 +- packages/backend/src/misc/backend-rs.ts | 2 +- packages/backend/src/misc/check-hit-antenna.ts | 2 +- packages/backend/src/misc/gen-id.ts | 2 +- packages/backend/src/misc/populate-emojis.ts | 2 +- packages/backend/src/misc/reaction-lib.ts | 2 +- packages/backend/src/models/repositories/drive-file.ts | 2 +- packages/backend/src/queue/processors/db/export-blocking.ts | 2 +- packages/backend/src/queue/processors/db/export-following.ts | 2 +- packages/backend/src/queue/processors/db/export-mute.ts | 2 +- packages/backend/src/queue/processors/db/export-user-lists.ts | 2 +- packages/backend/src/queue/processors/db/import-blocking.ts | 2 +- .../backend/src/queue/processors/db/import-firefish-post.ts | 2 +- packages/backend/src/queue/processors/db/import-following.ts | 2 +- packages/backend/src/queue/processors/db/import-muting.ts | 2 +- packages/backend/src/queue/processors/db/import-user-lists.ts | 2 +- packages/backend/src/queue/processors/deliver.ts | 2 +- packages/backend/src/queue/processors/inbox.ts | 2 +- packages/backend/src/remote/activitypub/check-fetch.ts | 2 +- .../backend/src/remote/activitypub/kernel/announce/note.ts | 2 +- packages/backend/src/remote/activitypub/kernel/create/note.ts | 2 +- packages/backend/src/remote/activitypub/kernel/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/read.ts | 2 +- packages/backend/src/remote/activitypub/models/note.ts | 2 +- packages/backend/src/remote/activitypub/models/person.ts | 2 +- packages/backend/src/remote/activitypub/resolver.ts | 2 +- packages/backend/src/remote/resolve-user.ts | 2 +- .../src/server/api/common/generate-native-user-token.ts | 2 +- packages/backend/src/server/api/common/signup.ts | 2 +- .../src/server/api/endpoints/admin/emoji/list-remote.ts | 2 +- packages/backend/src/server/api/endpoints/admin/emoji/list.ts | 2 +- .../admin/federation/refresh-remote-instance-metadata.ts | 2 +- .../server/api/endpoints/admin/federation/update-instance.ts | 2 +- packages/backend/src/server/api/endpoints/admin/show-users.ts | 2 +- packages/backend/src/server/api/endpoints/ap/show.ts | 2 +- packages/backend/src/server/api/endpoints/app/create.ts | 2 +- packages/backend/src/server/api/endpoints/auth/accept.ts | 2 +- packages/backend/src/server/api/endpoints/channels/search.ts | 2 +- .../backend/src/server/api/endpoints/federation/instances.ts | 2 +- .../src/server/api/endpoints/federation/show-instance.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/search.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/trend.ts | 2 +- packages/backend/src/server/api/endpoints/i/known-as.ts | 2 +- packages/backend/src/server/api/endpoints/i/move.ts | 2 +- packages/backend/src/server/api/endpoints/miauth/gen-token.ts | 2 +- .../backend/src/server/api/endpoints/notes/search-by-tag.ts | 2 +- packages/backend/src/server/api/endpoints/notes/search.ts | 2 +- packages/backend/src/server/api/endpoints/pinned-users.ts | 2 +- packages/backend/src/server/api/endpoints/users/followers.ts | 2 +- packages/backend/src/server/api/endpoints/users/following.ts | 2 +- .../server/api/endpoints/users/search-by-username-and-host.ts | 2 +- packages/backend/src/server/api/endpoints/users/search.ts | 2 +- packages/backend/src/server/api/index.ts | 2 +- packages/backend/src/server/api/limiter.ts | 2 +- packages/backend/src/server/index.ts | 2 +- packages/backend/src/server/web/index.ts | 2 +- packages/backend/src/server/well-known.ts | 4 ++-- packages/backend/src/services/messages/create.ts | 2 +- .../backend/src/services/register-or-fetch-instance-doc.ts | 2 +- packages/backend/src/services/send-email-notification.ts | 2 +- pnpm-lock.yaml | 4 ++-- 61 files changed, 63 insertions(+), 63 deletions(-) diff --git a/packages/backend/package.json b/packages/backend/package.json index 0e51911d..e7fdd386 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -37,6 +37,7 @@ "argon2": "^0.31.2", "aws-sdk": "2.1540.0", "axios": "1.6.5", + "backend-rs": "workspace:*", "bcryptjs": "2.4.3", "blurhash": "2.0.5", "bull": "4.12.2", @@ -82,7 +83,6 @@ "mime-types": "2.1.35", "msgpackr": "1.10.1", "multer": "1.4.5-lts.1", - "backend-rs": "link:backend-rs", "nested-property": "4.0.0", "node-fetch": "3.3.2", "nodemailer": "6.9.8", diff --git a/packages/backend/src/misc/backend-rs.ts b/packages/backend/src/misc/backend-rs.ts index 295e4048..80fb979b 100644 --- a/packages/backend/src/misc/backend-rs.ts +++ b/packages/backend/src/misc/backend-rs.ts @@ -3,7 +3,7 @@ import { readEnvironmentConfig, getFullApAccount as getFullApAccountImpl, isSelfHost as isSelfHostImpl, -} from "backend-rs/built/index.js"; +} from "backend-rs"; export const serverConfig = readServerConfig(); export const envConfig = readEnvironmentConfig(); diff --git a/packages/backend/src/misc/check-hit-antenna.ts b/packages/backend/src/misc/check-hit-antenna.ts index 849cb452..de254068 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -3,7 +3,7 @@ import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, Followings, UserProfiles } from "@/models/index.js"; import { getFullApAccount } from "@/misc/backend-rs.js"; -import { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; import type { Packed } from "@/misc/schema.js"; import { Cache } from "@/misc/cache.js"; import { getWordHardMute } from "@/misc/check-word-mute.js"; diff --git a/packages/backend/src/misc/gen-id.ts b/packages/backend/src/misc/gen-id.ts index cf3f4f08..e2d9b020 100644 --- a/packages/backend/src/misc/gen-id.ts +++ b/packages/backend/src/misc/gen-id.ts @@ -3,7 +3,7 @@ import { nativeCreateId, nativeInitIdGenerator, nativeGetTimestamp, -} from "backend-rs/built/index.js"; +} from "backend-rs"; const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24); const fingerprint = config.cuid?.fingerprint ?? ""; diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 7d915248..741904de 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -3,7 +3,7 @@ import { Emojis } from "@/models/index.js"; import type { Emoji } from "@/models/entities/emoji.js"; import type { Note } from "@/models/entities/note.js"; import { Cache } from "./cache.js"; -import { toPunyOptional } from "backend-rs/built/index.js"; +import { toPunyOptional } from "backend-rs"; import { isSelfHost } from "@/misc/backend-rs.js"; import { decodeReaction } from "./reaction-lib.js"; import config from "@/config/index.js"; diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index 3ded952e..85c9d150 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -1,7 +1,7 @@ import { emojiRegex } from "./emoji-regex.js"; import { fetchMeta } from "./fetch-meta.js"; import { Emojis } from "@/models/index.js"; -import { toPunyOptional } from "backend-rs/built/index.js"; +import { toPunyOptional } from "backend-rs"; import { IsNull } from "typeorm"; export function convertReactions(reactions: Record) { diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index c186fa2d..c0c797ae 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; import { DriveFile } from "@/models/entities/drive-file.js"; import type { User } from "@/models/entities/user.js"; -import { toPuny } from "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import { awaitAll } from "@/prelude/await-all.js"; import type { Packed } from "@/misc/schema.js"; import config from "@/config/index.js"; diff --git a/packages/backend/src/queue/processors/db/export-blocking.ts b/packages/backend/src/queue/processors/db/export-blocking.ts index 521d18f0..2d5d58ce 100644 --- a/packages/backend/src/queue/processors/db/export-blocking.ts +++ b/packages/backend/src/queue/processors/db/export-blocking.ts @@ -4,7 +4,7 @@ import * as fs from "node:fs"; import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; -import { getFullApAccount } from "native-utils/built/index.js"; +import { getFullApAccount } from "backend-rs"; import { createTemp } from "@/misc/create-temp.js"; import { Users, Blockings } from "@/models/index.js"; import { MoreThan } from "typeorm"; diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index e3020bbf..16b034f1 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -4,7 +4,7 @@ import * as fs from "node:fs"; import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; -import { getFullApAccount } from "native-utils/built/index.js"; +import { getFullApAccount } from "backend-rs"; import { createTemp } from "@/misc/create-temp.js"; import { Users, Followings, Mutings } from "@/models/index.js"; import { In, MoreThan, Not } from "typeorm"; diff --git a/packages/backend/src/queue/processors/db/export-mute.ts b/packages/backend/src/queue/processors/db/export-mute.ts index 39ce3771..0f851152 100644 --- a/packages/backend/src/queue/processors/db/export-mute.ts +++ b/packages/backend/src/queue/processors/db/export-mute.ts @@ -4,7 +4,7 @@ import * as fs from "node:fs"; import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; -import { getFullApAccount } from "native-utils/built/index.js"; +import { getFullApAccount } from "backend-rs"; import { createTemp } from "@/misc/create-temp.js"; import { Users, Mutings } from "@/models/index.js"; import { IsNull, MoreThan } from "typeorm"; 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 6c32c803..88fa0fd4 100644 --- a/packages/backend/src/queue/processors/db/export-user-lists.ts +++ b/packages/backend/src/queue/processors/db/export-user-lists.ts @@ -4,7 +4,7 @@ import * as fs from "node:fs"; import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; -import { getFullApAccount } from "native-utils/built/index.js"; +import { getFullApAccount } from "backend-rs"; import { createTemp } from "@/misc/create-temp.js"; import { Users, UserLists, UserListJoinings } from "@/models/index.js"; import { In } from "typeorm"; diff --git a/packages/backend/src/queue/processors/db/import-blocking.ts b/packages/backend/src/queue/processors/db/import-blocking.ts index a0bed08a..b081ac04 100644 --- a/packages/backend/src/queue/processors/db/import-blocking.ts +++ b/packages/backend/src/queue/processors/db/import-blocking.ts @@ -3,7 +3,7 @@ import type Bull from "bull"; import { queueLogger } from "../../logger.js"; import { resolveUser } from "@/remote/resolve-user.js"; import { downloadTextFile } from "@/misc/download-text-file.js"; -import { isSelfHost, stringToAcct, toPuny } from "native-utils/built/index.js"; +import { isSelfHost, stringToAcct, toPuny } from "backend-rs"; import { Users, DriveFiles } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; import block from "@/services/blocking/create.js"; 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 5d33488d..018ce74b 100644 --- a/packages/backend/src/queue/processors/db/import-firefish-post.ts +++ b/packages/backend/src/queue/processors/db/import-firefish-post.ts @@ -1,4 +1,4 @@ -import { convertToHiddenPost } from "native-utils/built/index.js"; +import { convertToHiddenPost } from "backend-rs"; import create from "@/services/note/create.js"; import { Users } from "@/models/index.js"; import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; diff --git a/packages/backend/src/queue/processors/db/import-following.ts b/packages/backend/src/queue/processors/db/import-following.ts index 09ee01fa..d8a5ad1f 100644 --- a/packages/backend/src/queue/processors/db/import-following.ts +++ b/packages/backend/src/queue/processors/db/import-following.ts @@ -3,7 +3,7 @@ import follow from "@/services/following/create.js"; import { resolveUser } from "@/remote/resolve-user.js"; import { downloadTextFile } from "@/misc/download-text-file.js"; -import { isSelfHost, stringToAcct, toPuny } from "native-utils/built/index.js"; +import { isSelfHost, stringToAcct, toPuny } from "backend-rs"; import { Users, DriveFiles } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; import { queueLogger } from "../../logger.js"; diff --git a/packages/backend/src/queue/processors/db/import-muting.ts b/packages/backend/src/queue/processors/db/import-muting.ts index fc76bbd9..b27b577a 100644 --- a/packages/backend/src/queue/processors/db/import-muting.ts +++ b/packages/backend/src/queue/processors/db/import-muting.ts @@ -3,7 +3,7 @@ import type Bull from "bull"; import { queueLogger } from "../../logger.js"; import { resolveUser } from "@/remote/resolve-user.js"; import { downloadTextFile } from "@/misc/download-text-file.js"; -import { isSelfHost, stringToAcct, toPuny } from "native-utils/built/index.js"; +import { isSelfHost, stringToAcct, toPuny } from "backend-rs"; import { Users, DriveFiles, Mutings } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; import type { User } from "@/models/entities/user.js"; 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 a9a96a38..f372d812 100644 --- a/packages/backend/src/queue/processors/db/import-user-lists.ts +++ b/packages/backend/src/queue/processors/db/import-user-lists.ts @@ -4,7 +4,7 @@ import { queueLogger } from "../../logger.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, stringToAcct, toPuny } from "native-utils/built/index.js"; +import { isSelfHost, stringToAcct, toPuny } from "backend-rs"; import { DriveFiles, Users, diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index d5016839..2abadeb9 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -4,7 +4,7 @@ import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instanc import Logger from "@/services/logger.js"; import { Instances } from "@/models/index.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; -import { toPuny } from "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import { StatusError } from "@/misc/fetch.js"; import { shouldSkipInstance } from "@/misc/skipped-instances.js"; import type { DeliverJobData } from "@/queue/types.js"; diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index fd550338..3cb3b985 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -6,7 +6,7 @@ import Logger from "@/services/logger.js"; import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import { Instances } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { toPuny, extractHost } from "backend-rs/built/index.js"; +import { toPuny, extractHost } from "backend-rs"; import { getApId } from "@/remote/activitypub/type.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; import type { InboxJobData } from "../types.js"; diff --git a/packages/backend/src/remote/activitypub/check-fetch.ts b/packages/backend/src/remote/activitypub/check-fetch.ts index 51026956..c0d40278 100644 --- a/packages/backend/src/remote/activitypub/check-fetch.ts +++ b/packages/backend/src/remote/activitypub/check-fetch.ts @@ -2,7 +2,7 @@ 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 "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import DbResolver from "@/remote/activitypub/db-resolver.js"; import { getApId } from "@/remote/activitypub/type.js"; import { shouldBlockInstance } from "@/misc/should-block-instance.js"; diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index a56920ea..45344ac2 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -5,7 +5,7 @@ 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/built/index.js"; +import { extractHost } from "backend-rs"; import { getApLock } from "@/misc/app-lock.js"; import { parseAudience } from "../../audience.js"; import { StatusError } from "@/misc/fetch.js"; diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index 17396ea5..512972f6 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -4,7 +4,7 @@ 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 { extractHost } from "backend-rs/built/index.js"; +import { extractHost } from "backend-rs"; import { StatusError } from "@/misc/fetch.js"; /** diff --git a/packages/backend/src/remote/activitypub/kernel/index.ts b/packages/backend/src/remote/activitypub/kernel/index.ts index a531eca6..e38c94c4 100644 --- a/packages/backend/src/remote/activitypub/kernel/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/index.ts @@ -38,7 +38,7 @@ 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 { extractHost } from "backend-rs/built/index.js"; +import { extractHost } from "backend-rs"; import { shouldBlockInstance } from "@/misc/should-block-instance.js"; export async function performActivity( diff --git a/packages/backend/src/remote/activitypub/kernel/read.ts b/packages/backend/src/remote/activitypub/kernel/read.ts index 4b4c39c4..a32c4559 100644 --- a/packages/backend/src/remote/activitypub/kernel/read.ts +++ b/packages/backend/src/remote/activitypub/kernel/read.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import type { IRead } from "../type.js"; import { getApId } from "../type.js"; -import { extractHost } from "backend-rs/built/index.js"; +import { extractHost } from "backend-rs"; import { isSelfHost } from "@/misc/backend-rs.js"; import { MessagingMessages } from "@/models/index.js"; import { readUserMessagingMessage } from "@/server/api/common/read-messaging-message.js"; diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index 51b5b443..fe319bb5 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -14,7 +14,7 @@ import { extractPollFromQuestion } from "./question.js"; import vote from "@/services/note/polls/vote.js"; import { apLogger } from "../logger.js"; import { DriveFile } from "@/models/entities/drive-file.js"; -import { extractHost, toPuny } from "backend-rs/built/index.js"; +import { extractHost, toPuny } from "backend-rs"; import { Emojis, Polls, diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 11d8ac56..234ad382 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -19,7 +19,7 @@ import { UserNotePining } from "@/models/entities/user-note-pining.js"; import { genId } from "@/misc/gen-id.js"; import { UserPublickey } from "@/models/entities/user-publickey.js"; import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { toPuny } from "backend-rs/built/index.js"; +import { 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"; diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index e0eb74e6..c8580b2b 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -3,7 +3,7 @@ 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 { extractHost } from "backend-rs/built/index.js"; +import { extractHost } from "backend-rs"; import { isSelfHost } from "@/misc/backend-rs.js"; import { signedGet } from "./request.js"; import type { IObject, ICollection, IOrderedCollection } from "./type.js"; diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index 34edd03a..938601c9 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -4,7 +4,7 @@ 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 "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import webFinger from "./webfinger.js"; import { createPerson, updatePerson } from "./activitypub/models/person.js"; import { remoteLogger } from "./logger.js"; diff --git a/packages/backend/src/server/api/common/generate-native-user-token.ts b/packages/backend/src/server/api/common/generate-native-user-token.ts index 6ffaac4f..d61dad4b 100644 --- a/packages/backend/src/server/api/common/generate-native-user-token.ts +++ b/packages/backend/src/server/api/common/generate-native-user-token.ts @@ -1,3 +1,3 @@ -import { genString } from "backend-rs/built/index.js"; +import { genString } from "backend-rs"; export default () => genString(16); diff --git a/packages/backend/src/server/api/common/signup.ts b/packages/backend/src/server/api/common/signup.ts index d0ac7733..9a2e141f 100644 --- a/packages/backend/src/server/api/common/signup.ts +++ b/packages/backend/src/server/api/common/signup.ts @@ -5,7 +5,7 @@ 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 { toPunyOptional } from "backend-rs/built/index.js"; +import { toPunyOptional } from "backend-rs"; import { UserKeypair } from "@/models/entities/user-keypair.js"; import { UsedUsername } from "@/models/entities/used-username.js"; import { db } from "@/db/postgre.js"; 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 481deb70..f08effb6 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 @@ -2,7 +2,7 @@ import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { Emojis } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { sqlLikeEscape, toPuny } from "backend-rs/built/index.js"; +import { sqlLikeEscape, toPuny } from "backend-rs"; export const meta = { tags: ["admin", "emoji"], 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 e0444770..a8bfddd5 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -2,7 +2,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 { sqlLikeEscape } from "backend-rs/built/index.js"; +//import { sqlLikeEscape } from "backend-rs"; import { ApiError } from "../../../error.js"; export const meta = { 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 2c191d17..d4fb8c6e 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 "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; export const meta = { 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 dfea5152..2ebad12a 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 "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; 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 8c1188a3..8a892c36 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 { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { sqlLikeEscape } from "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 243af11f..f1d42d8d 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -4,7 +4,7 @@ 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 { extractHost } from "backend-rs/built/index.js"; +import { extractHost } from "backend-rs"; import { Users, Notes } from "@/models/index.js"; import type { Note } from "@/models/entities/note.js"; import type { CacheableLocalUser, User } from "@/models/entities/user.js"; diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index 04df4d41..fd156b1e 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -2,7 +2,7 @@ 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 { genString } from "backend-rs/built/index.js"; +import { genString } from "backend-rs"; 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 921b26b7..d5b83615 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -3,7 +3,7 @@ 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 { genString } from "backend-rs/built/index.js"; +import { genString } from "backend-rs"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/channels/search.ts b/packages/backend/src/server/api/endpoints/channels/search.ts index 5261d684..ed44250a 100644 --- a/packages/backend/src/server/api/endpoints/channels/search.ts +++ b/packages/backend/src/server/api/endpoints/channels/search.ts @@ -2,7 +2,7 @@ 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 "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 8453004e..615920d4 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 "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; 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 d99a4407..809d3ee0 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 "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 19c5173d..8fb5b23f 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 "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; 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 69f9234e..f123131c 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -3,7 +3,7 @@ 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 "backend-rs/built/index.js"; +import { safeForSql } from "backend-rs"; import { normalizeForSearch } from "@/misc/normalize-for-search.js"; /* 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 125955f5..c6dcf3de 100644 --- a/packages/backend/src/server/api/endpoints/i/known-as.ts +++ b/packages/backend/src/server/api/endpoints/i/known-as.ts @@ -8,7 +8,7 @@ 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 { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; 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 9a8410bc..d59c8b56 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -12,7 +12,7 @@ import { getUser } from "@/server/api/common/getters.js"; import { Followings, Users } from "@/models/index.js"; import config from "@/config/index.js"; import { publishMainStream } from "@/services/stream.js"; -import { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; export const meta = { tags: ["users"], 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 610d0b73..6337c952 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 { genString } from "backend-rs/built/index.js"; +import { genString } from "backend-rs"; export const meta = { tags: ["auth"], 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 7857552e..f449ea08 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,6 +1,6 @@ import { Brackets } from "typeorm"; import { Notes } from "@/models/index.js"; -import { safeForSql } from "backend-rs/built/index.js"; +import { safeForSql } from "backend-rs"; 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"; diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 312c3a6d..bc17944b 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -10,7 +10,7 @@ import { makePaginationQuery } from "@/server/api/common/make-pagination-query.j 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 { sqlLikeEscape } from "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index be8bca85..6d6519e4 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -1,7 +1,7 @@ import { IsNull } from "typeorm"; import { Users } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; import type { User } from "@/models/entities/user.js"; import define from "@/server/api/define.js"; diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 3f1d8ce9..f396e907 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -1,6 +1,6 @@ import { IsNull } from "typeorm"; import { Users, Followings, UserProfiles } from "@/models/index.js"; -import { toPunyOptional } from "backend-rs/built/index.js"; +import { toPunyOptional } from "backend-rs"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 5960c126..0bb5e64c 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -1,6 +1,6 @@ import { IsNull } from "typeorm"; import { Users, Followings, UserProfiles } from "@/models/index.js"; -import { toPunyOptional } from "backend-rs/built/index.js"; +import { toPunyOptional } from "backend-rs"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; 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 c0d11c3d..fe15ae18 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 @@ -2,7 +2,7 @@ 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 "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; 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 b902b125..df070170 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -2,7 +2,7 @@ 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 "backend-rs/built/index.js"; +import { sqlLikeEscape } from "backend-rs"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index d82bd283..1eb55a77 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -23,7 +23,7 @@ import verifyEmail from "./private/verify-email.js"; import { koaBody } from "koa-body"; import { convertAttachment } from "./mastodon/converters.js"; -import { convertId, IdConvertType as IdType } from "backend-rs/built/index.js"; +import { convertId, IdConvertType as IdType } from "backend-rs"; // re-export native rust id conversion (function and enum) export { IdType, convertId }; diff --git a/packages/backend/src/server/api/limiter.ts b/packages/backend/src/server/api/limiter.ts index b6642461..d4a9353a 100644 --- a/packages/backend/src/server/api/limiter.ts +++ b/packages/backend/src/server/api/limiter.ts @@ -2,7 +2,7 @@ import Limiter from "ratelimiter"; import Logger from "@/services/logger.js"; import { redisClient } from "@/db/redis.js"; import type { IEndpointMeta } from "./endpoints.js"; -import { formatMilliseconds } from "backend-rs/built/index.js"; +import { formatMilliseconds } from "backend-rs"; const logger = new Logger("limiter"); diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index b08be4e2..e6f01557 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -19,7 +19,7 @@ import { Users } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { genIdenticon } from "@/misc/gen-identicon.js"; import { createTemp } from "@/misc/create-temp.js"; -import { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; import { envConfig } from "@/misc/backend-rs.js"; import megalodon, { MegalodonInterface } from "megalodon"; import activityPub from "./activitypub.js"; diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index a116eca3..03971871 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -28,7 +28,7 @@ import { Emojis, GalleryPosts, } from "@/models/index.js"; -import { stringToAcct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; import { getNoteSummary } from "@/misc/get-note-summary.js"; import { queues } from "@/queue/queues.js"; import { genOpenapiSpec } from "../api/openapi/gen-spec.js"; diff --git a/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index b2a02ef2..9421b9cc 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -1,8 +1,8 @@ import Router from "@koa/router"; import config from "@/config/index.js"; -import { stringToAcct } from "backend-rs/built/index.js"; -import type { Acct } from "backend-rs/built/index.js"; +import { stringToAcct } from "backend-rs"; +import type { Acct } from "backend-rs"; import { links } from "./nodeinfo.js"; import { escapeAttribute, escapeValue } from "@/prelude/xml.js"; import { Users } from "@/models/index.js"; diff --git a/packages/backend/src/services/messages/create.ts b/packages/backend/src/services/messages/create.ts index c02cff66..a28b0380 100644 --- a/packages/backend/src/services/messages/create.ts +++ b/packages/backend/src/services/messages/create.ts @@ -22,7 +22,7 @@ import renderNote from "@/remote/activitypub/renderer/note.js"; import renderCreate from "@/remote/activitypub/renderer/create.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import { deliver } from "@/queue/index.js"; -import { toPuny } from "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import { Instances } from "@/models/index.js"; export async function createMessage( 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 e7607c61..109db37f 100644 --- a/packages/backend/src/services/register-or-fetch-instance-doc.ts +++ b/packages/backend/src/services/register-or-fetch-instance-doc.ts @@ -1,7 +1,7 @@ import type { Instance } from "@/models/entities/instance.js"; import { Instances } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import { toPuny } from "backend-rs/built/index.js"; +import { toPuny } from "backend-rs"; import { Cache } from "@/misc/cache.js"; const cache = new Cache("registerOrFetchInstanceDoc", 60 * 60); diff --git a/packages/backend/src/services/send-email-notification.ts b/packages/backend/src/services/send-email-notification.ts index 6b9e0f6f..0cb7127b 100644 --- a/packages/backend/src/services/send-email-notification.ts +++ b/packages/backend/src/services/send-email-notification.ts @@ -2,7 +2,7 @@ import type { User } from "@/models/entities/user.js"; // import { sendEmail } from "./send-email.js"; // import { I18n } from "@/misc/i18n.js"; -// import { acctToString } from "backend-rs/built/index.js"; +// import { acctToString } from "backend-rs"; // TODO //const locales = await import('../../../../locales/index.js'); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6939eb9c..6db6a0c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -118,8 +118,8 @@ importers: specifier: 1.6.5 version: 1.6.5 backend-rs: - specifier: link:backend-rs - version: link:backend-rs + specifier: workspace:* + version: link:../backend-rs bcryptjs: specifier: 2.4.3 version: 2.4.3