diff --git a/.config/example.yml b/.config/example.yml index 49922d65ae..46efda9142 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -192,6 +192,9 @@ reservedUsernames: [ # Proxy remote files (default: false) #proxyRemoteFiles: true +# Use authorized fetch for outgoing requests +signToActivityPubGet: true + #allowedPrivateNetworks: [ # '127.0.0.1/32' #] diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md index 401688dc61..4c41f88a41 100644 --- a/.gitlab/merge_request_templates/default.md +++ b/.gitlab/merge_request_templates/default.md @@ -9,7 +9,7 @@ By submitting this merge request, you agree to follow our [Contribution Guidelin - [ ] I have made sure to run `pnpm run format` before submitting this pull request If this merge request makes changes to the Firefish API, please update `docs/api-change.md` -- [ ] I updated the documentation +- [ ] I updated the document / This merge request doesn't include API changes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9529ea737..743eaef005 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,9 +94,9 @@ An actual domain will be assigned so you can test the federation. - The tag name must be the version ## Development -During development, it is useful to use the `yarn dev` command. +During development, it is useful to use the `pnpm run dev` command. This command monitors the server-side and client-side source files and automatically builds them if they are modified. -In addition, it will also automatically start the Misskey server process. +In addition, it will also automatically start the Firefish server process. ## Testing - Test codes are located in [`/test`](/test). @@ -119,20 +119,13 @@ yarn test #### Run specify test ``` -TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" yarn dlx mocha test/foo.ts --require ts-node/register +TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" pnpx mocha test/foo.ts --require ts-node/register ``` -### e2e tests -TODO - -## Continuous integration -Misskey uses GitHub Actions for executing automated tests. -Configuration files are located in [`/.github/workflows`](/.github/workflows). - ## Vue -Misskey uses Vue(v3) as its front-end framework. +Firefish uses Vue(v3) as its front-end framework. - Use TypeScript. -- **When creating a new component, please use the Composition API (with [setup sugar](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref sugar](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API.** +- **When creating a new component, please use the Composition API (with [setup syntax](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref syntax](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API.** - Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are also welcome. ## nirax diff --git a/COPYING b/COPYING index 27aeb01ac9..5b35f69f26 100644 --- a/COPYING +++ b/COPYING @@ -28,6 +28,10 @@ Machine learning model for sensitive images by Infinite Red, Inc. License: MIT https://github.com/infinitered/nsfwjs/blob/master/LICENSE +Chiptune2.js by Simon Gündling +License: MIT +https://github.com/deskjet/chiptune2.js#license + Licenses for all softwares and software libraries installed via the Node Package Manager ("npm") can be found by running the following shell command in the root directory of this repository: pnpm licenses list diff --git a/Dockerfile b/Dockerfile index c7d9a95d86..1b94fc9b43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ## Install dev and compilation dependencies, build files -FROM node:latest as build +FROM node:20 as build WORKDIR /firefish # Install compilation dependencies @@ -48,7 +48,7 @@ RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pn RUN pnpm i --prod --frozen-lockfile ## Runtime container -FROM node:latest +FROM node:20 WORKDIR /firefish # Install runtime dependencies diff --git a/README.md b/README.md index aad5b4d8b3..2926f7a63b 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,7 @@ pm2 start "NODE_ENV=production pnpm run start" --name Firefish - When editing the config file, please don't fill out the settings at the bottom. They're designed *only* for managed hosting, not self hosting. Those settings are much better off being set in Firefish's control panel. - Port 3000 (used in the default config) might be already used on your server for something else. To find an open port for Firefish, run `for p in {3000..4000}; do ss -tlnH | tr -s ' ' | cut -d" " -sf4 | grep -q "${p}$" || echo "${p}"; done | head -n 1`. Replace 3000 with the minimum port and 4000 with the maximum port if you need it. - I'd recommend you use a S3 Bucket/CDN for Object Storage, especially if you use Docker. +- When using object storage, setting a proper `Access-Control-Allow-Origin` response header is highly recommended. - I'd ***strongly*** recommend against using CloudFlare, but if you do, make sure to turn code minification off. - For push notifications, run `npx web-push generate-vapid-keys`, then put the public and private keys into Control Panel > General > ServiceWorker. - For translations, make a [DeepL](https://deepl.com) account and generate an API key, then put it into Control Panel > General > DeepL Translation. diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 8b58323865..32a0c28446 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -21,7 +21,7 @@ version: 0.1.2 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "rc" +appVersion: 'v1.0.4-beta31' dependencies: - name: elasticsearch diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index a7b4b9d328..215d209eef 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -98,11 +98,11 @@ url: "https://{{ .Values.firefish.domain }}/" #───┘ Port and TLS settings └─────────────────────────────────── # -# Misskey requires a reverse proxy to support HTTPS connections. +# Firefish requires a reverse proxy to support HTTPS connections. # # +----- https://example.tld/ ------------+ # +------+ |+-------------+ +----------------+| -# | User | ---> || Proxy (443) | ---> | Misskey (3000) || +# | User | ---> || Proxy (443) | ---> | Firefish (3000) || # +------+ |+-------------+ +----------------+| # +---------------------------------------+ # @@ -110,7 +110,7 @@ url: "https://{{ .Values.firefish.domain }}/" # An encrypted connection with HTTPS is highly recommended # because tokens may be transferred in GET requests. -# The port that your Misskey server should listen on. +# The port that your Firefish server should listen on. port: 3000 # ┌──────────────────────────┐ @@ -119,10 +119,10 @@ port: 3000 db: {{- if .Values.postgresql.enabled }} host: {{ template "firefish.postgresql.fullname" . }} - port: '5432' + port: 5432 {{- else }} host: {{ .Values.postgresql.postgresqlHostname }} - port: {{ .Values.postgresql.postgresqlPort | default "5432" | quote }} + port: {{ .Values.postgresql.postgresqlPort | default 5432 }} {{- end }} # Database name @@ -150,13 +150,13 @@ redis: {{- else }} host: {{ required "When the redis chart is disabled .Values.redis.hostname is required" .Values.redis.hostname }} {{- end }} - port: {{ .Values.redis.port | default "6379" | quote }} + port: {{ .Values.redis.port | default 6379 }} #family: 0 # 0=Both, 4=IPv4, 6=IPv6 pass: {{ .Values.redis.auth.password | quote }} #prefix: example-prefix #db: 1 - #user: default - #tls: + #user: default + #tls: # host: localhost # rejectUnauthorized: false @@ -217,8 +217,7 @@ id: 'aid' #maxCaptionLength: 1500 # Reserved usernames that only the administrator can register with -reservedUsernames: -{{ .Values.firefish.reservedUsernames | toYaml }} +reservedUsernames: {{ .Values.firefish.reservedUsernames | toJson }} # Whether disable HSTS #disableHsts: true @@ -265,8 +264,7 @@ reservedUsernames: # Proxy remote files (default: false) #proxyRemoteFiles: true -allowedPrivateNetworks: -{{ .Values.firefish.allowedPrivateNetworks | toYaml }} +allowedPrivateNetworks: {{ .Values.firefish.allowedPrivateNetworks | toJson }} # TWA #twa: diff --git a/custom/assets/badges/error.png b/custom/assets/badges/error.png deleted file mode 100644 index 046f18e149..0000000000 Binary files a/custom/assets/badges/error.png and /dev/null differ diff --git a/custom/assets/badges/error.webp b/custom/assets/badges/error.webp new file mode 100644 index 0000000000..ccdf7ebcbb Binary files /dev/null and b/custom/assets/badges/error.webp differ diff --git a/custom/assets/badges/info.png b/custom/assets/badges/info.png deleted file mode 100644 index c6ab300a72..0000000000 Binary files a/custom/assets/badges/info.png and /dev/null differ diff --git a/custom/assets/badges/info.webp b/custom/assets/badges/info.webp new file mode 100644 index 0000000000..cce0a32d74 Binary files /dev/null and b/custom/assets/badges/info.webp differ diff --git a/custom/assets/badges/not-found.png b/custom/assets/badges/not-found.png deleted file mode 100644 index 63356530ce..0000000000 Binary files a/custom/assets/badges/not-found.png and /dev/null differ diff --git a/custom/assets/badges/not-found.webp b/custom/assets/badges/not-found.webp new file mode 100644 index 0000000000..502f09fa10 Binary files /dev/null and b/custom/assets/badges/not-found.webp differ diff --git a/cypress/e2e/basic.cy.js b/cypress/e2e/basic.cy.js index f73a25efbc..295f419993 100644 --- a/cypress/e2e/basic.cy.js +++ b/cypress/e2e/basic.cy.js @@ -139,10 +139,10 @@ describe("After user singed in", () => { it("note", () => { cy.get("[data-cy-open-post-form]").click(); - cy.get("[data-cy-post-form-text]").type("Hello, Misskey!"); + cy.get("[data-cy-post-form-text]").type("Hello, Firefish!"); cy.get("[data-cy-open-post-form-submit]").click(); - cy.contains("Hello, Misskey!"); + cy.contains("Hello, Firefish!"); }); }); diff --git a/docs/api-change.md b/docs/api-change.md index 4dc631f071..f630552080 100644 --- a/docs/api-change.md +++ b/docs/api-change.md @@ -1,9 +1,36 @@ # Changes to the Firefish API -Breaking changes are indecated by the :warning: icon. +Breaking changes are indicated by the :warning: icon. ## v1.0.5 (unreleased) +### dev21 + +- `admin/update-meta` can now take `moreUrls` parameter, and response of `admin/meta` now includes `moreUrls` + - These URLs are used for the help menu ([related merge request](https://git.joinfirefish.org/firefish/firefish/-/merge_requests/10640)) + +### dev18 + +- :warning: response of `meta` no longer includes the following: + - `enableTwitterIntegration` + - `enableGithubIntegration` + - `enableDiscordIntegration` +- :warning: parameter of `admin/update-meta` and response of `admin/meta` no longer include the following: + - `enableTwitterIntegration` + - `enableGithubIntegration` + - `enableDiscordIntegration` + - `twitterConsumerKey` + - `twitterConsumerSecret` + - `githubClientId` + - `githubClientSecret` + - `discordClientId` + - `discordClientSecret` +- :warning: response of `admin/show-user` no longer includes `integrations`. + +### dev17 + +- Added `lang` parameter to `notes/create` and `notes/edit`. + ### dev11 - :warning: `notes/translate` now requires credentials. diff --git a/docs/docker.md b/docs/docker.md index 02035e045b..29af3c4fe0 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -7,7 +7,7 @@ There is a `docker-compose.yml` in the root of the project that you can use to build the container from source -- .config/docker.env (**db config settings**) +- .config/docker_example.env (**db config settings**) - .config/default.yml (**firefish server settings**) ## Configuring @@ -16,7 +16,7 @@ Rename the files: `cp .config/example.yml .config/default.yml` -`cp .config/example.env .config/docker.env` +`cp .config/docker_example.env .config/docker.env` then edit them according to your environment. You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file: diff --git a/docs/migrate.md b/docs/migrate.md index 6569d419e5..e687b4ee64 100644 --- a/docs/migrate.md +++ b/docs/migrate.md @@ -103,4 +103,4 @@ NODE_ENV=production pnpm run migrate ## Reverse -You ***cannot*** migrate back to Misskey from Firefish due to re-hashing passwords on signin with argon2. You can migrate from Firefish to FoundKey, although this is not recommended due to FoundKey being end-of-life, and may have some problems with alt-text. +You ***cannot*** migrate back to Misskey from Firefish due to re-hashing passwords on signin with argon2. You can migrate to [Sharkey](https://github.com/transfem-org/Sharkey), a soft fork of Misskey that uses argon2 though. You can also migrate from Firefish to FoundKey, although this is not recommended due to FoundKey being end-of-life, and may have some problems with alt-text. diff --git a/gulpfile.js b/gulpfile.js index 7220d8421a..37a8e75b26 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -52,7 +52,7 @@ gulp.task("build:backend:script", () => { "./packages/backend/src/server/web/bios.js", "./packages/backend/src/server/web/cli.js", ]) - .pipe(replace("LANGS", JSON.stringify(Object.keys(locales)))) + .pipe(replace("SUPPORTED_LANGS", JSON.stringify(Object.keys(locales)))) .pipe( terser({ toplevel: true, diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index e1701e9c99..e64bc95e7a 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -312,9 +312,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "الصفحات" -integration: "التكامل" -connectService: "اتصل" -disconnectService: "اقطع الاتصال" enableLocalTimeline: "تفعيل الخيط المحلي" enableGlobalTimeline: "تفعيل الخيط الزمني الشامل" disablingTimelinesInfo: "سيتمكن المديرون والمشرفون من الوصول إلى كل الخيوط الزمنية حتى وإن لم تفعّل." diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml index abafc4953e..10472516dd 100644 --- a/locales/bn-BD.yml +++ b/locales/bn-BD.yml @@ -316,9 +316,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "পৃষ্ঠা" -integration: "ইন্টিগ্রেশন" -connectService: "সংযুক্ত করুন" -disconnectService: "সংযোগ বিচ্ছিন্ন করুন" enableLocalTimeline: "স্থানীয় টাইমলাইন চালু করুন" enableGlobalTimeline: "গ্লোবাল টাইমলাইন চালু করুন" disablingTimelinesInfo: "আপনি এই টাইমলাইনগুলি বন্ধ করলেও প্রশাসক এবং মডারেটররা এই টাইমলাইনগুলি ব্যাবহার করতে পারবে" diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml index 7bbde3807d..80b3e016a0 100644 --- a/locales/ca-ES.yml +++ b/locales/ca-ES.yml @@ -112,7 +112,7 @@ you: "Tu" clickToShow: "Fes clic per a mostrar" sensitive: "NSFW" add: "Afegeix" -reaction: "Reaccions" +reaction: "Reacció" reactionSetting: "Reaccions a mostrar al selector de reaccions" reactionSettingDescription2: "Arrossega per reordenar, fes clic per suprimir, prem \"+\" per afegir." @@ -792,11 +792,11 @@ customEmojis: Emojis personalitzats cacheRemoteFilesDescription: Quan aquesta opció està desactivada, els fitxers remots es carreguen directament del servidor remot. Desactivar-la farà que baixi l'ús d'emmagatzematge, però incrementa el tràfic, perquè les miniatures no es generaran. -flagAsBot: Marca aquest compte com a bot +flagAsBot: Marca aquest compte com automatitzat flagAsBotDescription: Activa aquesta opció si aquest compte és controlat per un programa. Si s'activa, això actuarà com una bandera per a altres desenvolupadors i ajuda a - prevenir cadenes de interaccions infinites amb altres bots a més d'ajustar els sistemes - interns de Firefish per tractar aquest compte com un bot. + prevenir cadenes de interaccions infinites amb altres comptes automatitzats a més + d'ajustar els sistemes interns de Firefish per tractar aquest compte com automatitzat. flagAsCat: Ets un gat? 🐱 flagShowTimelineReplies: Mostra respostes a la línia de temps flagAsCatDescription: Guanyaràs unes orelles de gat i parlares com un gat! @@ -944,7 +944,6 @@ dayX: '{day}' tosUrl: URL de les Condicions d'ús thisYear: Any thisMonth: Mes -integration: Integracions driveCapacityPerRemoteAccount: Capacitat del Disc per usuari remot inMb: En megabytes iconUrl: Adreça URL de la icona @@ -1036,8 +1035,6 @@ accept: Accepta reject: Rebutja yearX: '{year}' pages: Pàgines -disconnectService: Desconnectar -connectService: Connectar enableLocalTimeline: Activa la línea de temps local enableRecommendedTimeline: Activa la línea de temps de recomanacions pinnedClipId: ID del clip que vols fixar @@ -1179,7 +1176,7 @@ emptyToDisableSmtpAuth: Deixa el nom d'usuari i la contrasenya sense emplenar pe desactivar la verificació SMTP smtpSecureInfo: Desactiva això quant facis servir STARTTLS testEmail: Envia un correu electrònic de verificació -wordMute: Silenciar paraules +wordMute: Paraules i llenguatge silenciats regexpError: Error a la Expressió Regular regexpErrorDescription: 'Hi ha un error a la expressió regular a la línea {line} de la teva {tab} de paraules silenciades:' @@ -1441,7 +1438,8 @@ _accountDelete: requestAccountDelete: Sol·licitar la supressió del compte _ad: back: Enrera - reduceFrequencyOfThisAd: Mostrar aquest anunci menys + reduceFrequencyOfThisAd: Mostrar menys aquest anunci + adsBy: Anunci comunitari per {by} _gallery: my: La meva Galeria liked: Publicacions que m'han agradat @@ -1539,8 +1537,8 @@ low: Baixa emailNotConfiguredWarning: L'adreça de correu electrònic no està definida. instanceSecurity: Seguretat del servidor privateMode: Mode Privat -allowedInstances: Servidors a la llista blanca -allowedInstancesDescription: Llista blanca de Hosts amb qui federar, cadascún separat +allowedInstances: Servidors permesos +allowedInstancesDescription: Llista permesa de Hosts amb qui federar, cadascún separat per una línia nova (només s'aplica en mode privat). previewNoteText: Mostra la vista prèvia customCss: CSS personalitzat @@ -1552,7 +1550,7 @@ troubleshooting: Resolució de problemes learnMore: Més informació misskeyUpdated: Firefish s'ha actualitzat! translate: Tradueix -translatedFrom: Traduït per {x} +translatedFrom: Traduït del {x} aiChanMode: Ai-chan a la interfície d'usuari clàssica keepCw: Mantenir els avisos de contingut pubSub: Comptes Pub/Sub @@ -1646,8 +1644,8 @@ customCssWarn: Aquesta configuració només s'ha d'utilitzar si sabeu què fa. L squareAvatars: Mostra avatars quadrats secureModeInfo: Quan es faci una solicitut d'altres servidors no contestar sense una prova. -privateModeInfo: Quan està activat, només els servidors a la llista blanca es poden - federar amb el vostre servidor. Totes les publicacions s'amagaran al públic. +privateModeInfo: Quan està activat, només els servidors a la llista es poden federar + amb el vostre servidor. Totes les publicacions s'amagaran al públic. useBlurEffect: Utilitzeu efectes de desenfocament a la interfície d'usuari accountDeletionInProgress: La supressió del compte està en curs unmuteThread: Desfés el silenci al fil @@ -2040,6 +2038,13 @@ _wordMute: s'afegeixin a la línia de temps. A més, aquestes publicacions no s'afegiran a la línia de temps encara que es modifiquin les condicions. mutedNotes: Publicacions silenciades + muteLangsDescription2: Fes servir el codi del l'idioma. Per exemple en, fr, ja, + zh. + lang: Idioma + langDescription: Amagar les publicacions que coincideixin amb l'idioma a la línia + de temps. + muteLangs: Llenguatges silenciats + muteLangsDescription: Separar amb espais o línies no es per una condició OR. _auth: shareAccessAsk: Estàs segur que vols autoritzar aquesta aplicació per accedir al teu compte? @@ -2122,7 +2127,7 @@ clipsDesc: Els clips són com marcadors categoritzats que es poden compartir. Po selectChannel: Selecciona un canal isLocked: Aquest compte té les següents aprovacions isPatron: Mecenes de Firefish -isBot: Aquest compte és un bot +isBot: Aquest es un compte automatitzat isModerator: Moderador isAdmin: Administrador _filters: @@ -2192,3 +2197,18 @@ indexable: Indexable languageForTranslation: Idioma de traducció d'articles openServerInfo: Mostra la informació del servidor fent clic al símbol del servidor en un missatge +vibrate: Activar vibracions +clickToShowPatterns: Fes clic per veure patrons de mòduls +iconSet: Conjunt d'Icones +_iconSets: + fill: Omplerts + regular: Normals + bold: Negreta + duotone: Bitó + light: Prims +showAttachedNotes: Mostrar publicacions que contenen aquest fitxer +reactions: Reaccions +attachedToNotes: Publicacions que contenen aquest fitxer +replies: Respostes +quotes: Cites +renotes: Impulsos diff --git a/locales/cs-CZ.yml b/locales/cs-CZ.yml index a92f414c40..4fa1133538 100644 --- a/locales/cs-CZ.yml +++ b/locales/cs-CZ.yml @@ -310,9 +310,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Stránky" -integration: "Integrace" -connectService: "Připojit" -disconnectService: "Odpojit" enableLocalTimeline: "Povolit lokální čas" enableGlobalTimeline: "Povolit globální čas" registration: "Registrace" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index 08622ced1b..fa934b0068 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -350,9 +350,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Nutzer-Seiten" -integration: "Integration" -connectService: "Verbinden" -disconnectService: "Trennen" enableLocalTimeline: "Local-Timeline aktivieren" enableGlobalTimeline: "Global-Timeline aktivieren" disablingTimelinesInfo: "Administratoren und Moderatoren haben immer Zugriff auf alle @@ -405,6 +402,8 @@ withReplies: "Antworten beinhalten" connectedTo: "Mit folgenden Nutzerkonten verknüpft" notesAndReplies: "Beiträge und Antworten" withFiles: "Beiträge mit Dateien" +attachedToNotes: "Beiträge mit dieser Datei" +showAttachedNotes: "Zeige Beiträge mit dieser Datei" silence: "stummschalten" silenceConfirm: "Sind Sie sicher, dass Sie diesen Benutzer Stummschalten möchten?" unsilence: "Stummschaltung aufheben" @@ -529,12 +528,12 @@ objectStorageBaseUrl: "Basis-URL" objectStorageBaseUrlDesc: "Die als Referenz verwendete URL. Verwendest du einen CDN oder Proxy, gib dessen URL an. \nFür S3 verwende 'https://.s3.amazonaws.com'. Für GCS o.ä. verwende 'https://storage.googleapis.com/'." -objectStorageBucket: "Eimer" +objectStorageBucket: "Bucket" objectStorageBucketDesc: "Bitte gib den Namen des Buckets an, der bei deinem Anbieter verwendet wird." objectStoragePrefix: "Prefix" objectStoragePrefixDesc: "Dateien werden in Ordnern unter diesem Prefix gespeichert." -objectStorageEndpoint: "Limit" +objectStorageEndpoint: "Endpunkt" objectStorageEndpointDesc: "Im Falle von S3 leerlassen, für andere Anbieter den relevanten Endpoint im Format „“ oder „:“ angeben." objectStorageRegion: "Region" @@ -1037,6 +1036,7 @@ _accountDelete: _ad: back: "Zurück" reduceFrequencyOfThisAd: "Diese Werbeanzeige weniger anzeigen" + adsBy: Community-Banner von {by} _forgotPassword: enterEmail: "Gib die Email-Adresse ein, mit der du dich registriert hast. An diese wird ein Link gesendet, mit dem du dein Passwort zurücksetzen kannst." @@ -1243,6 +1243,7 @@ _wordMute: soft: "Leicht" hard: "Schwer" mutedNotes: "Stummgeschaltete Beiträge" + muteLangs: Stummgeschaltete Sprachen _instanceMute: instanceMuteDescription: "Schaltet alle Beiträge/Boosts stumm, die von den gelisteten Servern stammen, inklusive Antworten von Nutzern an einen Nutzer eines stummgeschalteten @@ -2215,3 +2216,6 @@ indexable: Indexierbar languageForTranslation: Übersetzungssprache veröffentlichen openServerInfo: Anzeigen von Serverinformationen durch Anklicken des Server-Tickers in einem Beitrag +vibrate: Vibrationen abspielen +clickToShowPatterns: Klicken um Modul-Muster anzuzeigen +replies: Antworten diff --git a/locales/el-GR.yml b/locales/el-GR.yml index 68556cb384..5f9f370efd 100644 --- a/locales/el-GR.yml +++ b/locales/el-GR.yml @@ -215,8 +215,6 @@ thisMonth: "Μήνας" today: "Σήμερα" dayX: "{day}" pages: "Σελίδες" -connectService: "Σύνδεση" -disconnectService: "Αποσύνδεση" registration: "Εγγραφή" pinnedPages: "Καρφιτσωμένες Σελίδες" pinnedNotes: "Καρφιτσωμένες δημοσιεύσεις" @@ -730,7 +728,6 @@ lightThemes: Φωτεινά θέματα darkThemes: Σκοτεινά θέματα inputNewFolderName: Πληκτρολογήστε ένα νέο όνομα φακέλου hasChildFilesOrFolders: Εφόσον αυτός ο φάκελος δεν είναι άδειος, δεν μπορεί να διαγραφεί. -integration: Ενσωματώσεις enableRecommendedTimeline: Ενεργοποίηση χρονολογίου προτεινόμενων driveCapacityPerLocalAccount: Μέγεθος Αποθηκευτικού Χώρου ανά τοπικό μέλος driveCapacityPerRemoteAccount: Μέγεθος Αποθηκευτικού Χώρου ανά απομακρυσμένο μέλος diff --git a/locales/en-US.yml b/locales/en-US.yml index 46242d5fc1..64cce811ed 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -58,6 +58,7 @@ sendMessage: "Send a message" copyUsername: "Copy username" searchUser: "Search for a user" reply: "Reply" +replies: "Replies" jumpToPrevious: "Jump to previous" loadMore: "Load more" showMore: "Show more" @@ -83,7 +84,8 @@ exportRequested: "You've requested an export. This may take a while. It will be to your Drive once completed." importRequested: "You've requested an import. This may take a while." lists: "Lists" -listsDesc: "Lists let you create timelines with specified users. They can be accessed from the timelines page." +listsDesc: "Lists let you create timelines with specified users. They can be accessed + from the timelines page." noLists: "You don't have any lists" note: "Post" notes: "Posts" @@ -111,18 +113,21 @@ unfollow: "Unfollow" followRequestPending: "Follow request pending" enterEmoji: "Enter an emoji" renote: "Boost" +renotes: "Boosts" unrenote: "Take back boost" renoted: "Boosted." cantRenote: "This post can't be boosted." cantReRenote: "A boost can't be boosted." quote: "Quote" +quotes: "Quotes" pinnedNote: "Pinned post" pinned: "Pin to profile" you: "You" clickToShow: "Click to show" sensitive: "NSFW" add: "Add" -reaction: "Reactions" +reaction: "Reaction" +reactions: "Reactions" removeReaction: "Remove your reaction" enableEmojiReactions: "Enable emoji reactions" showEmojisInReactionNotifications: "Show emojis in reaction notifications" @@ -132,6 +137,7 @@ rememberNoteVisibility: "Remember post visibility settings" attachCancel: "Remove attachment" markAsSensitive: "Mark as NSFW" unmarkAsSensitive: "Unmark as NSFW" +clickToShowPatterns: "Click to show module patterns" enterFileName: "Enter filename" mute: "Mute" unmute: "Unmute" @@ -162,11 +168,11 @@ cacheRemoteFiles: "Cache remote files" cacheRemoteFilesDescription: "When this setting is disabled, remote files are loaded directly from the remote server. Disabling this will decrease storage usage, but increase traffic, as thumbnails will not be generated." -flagAsBot: "Mark this account as a bot" +flagAsBot: "Mark this account as automated" flagAsBotDescription: "Enable this option if this account is controlled by a program. If enabled, it will act as a flag for other developers to prevent endless interaction - chains with other bots and adjust Firefish's internal systems to treat this account - as a bot." + chains with other automated accounts and adjust Firefish's internal systems to treat this + account as an automated account." flagAsCat: "Are you a cat? 😺" flagAsCatDescription: "You'll get cat ears and speak like a cat!" flagSpeakAsCat: "Speak as a cat" @@ -306,7 +312,7 @@ agreeTo: "I agree to {0}" tos: "Terms of Service" start: "Begin" home: "Home" -remoteUserCaution: "Information from remote users may be incomplete." +remoteUserCaution: "Information from remote users are incomplete." activity: "Activity" images: "Images" birthday: "Birthday" @@ -369,9 +375,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Pages" -integration: "Integrations" -connectService: "Connect" -disconnectService: "Disconnect" enableLocalTimeline: "Enable local timeline" enableGlobalTimeline: "Enable global timeline" enableRecommendedTimeline: "Enable recommended timeline" @@ -407,7 +410,8 @@ avoidMultiCaptchaConfirm: "Using multiple Captcha systems may cause interference them. Would you like to disable the other Captcha systems currently active? If you would like them to stay enabled, press cancel." antennas: "Antennas" -antennasDesc: "Antennas display new posts matching the criteria you set!\n They can be accessed from the timelines page." +antennasDesc: "Antennas display new posts matching the criteria you set!\n They can + be accessed from the timelines page." manageAntennas: "Manage Antennas" name: "Name" antennaSource: "Antenna source" @@ -425,6 +429,8 @@ withReplies: "Include replies" connectedTo: "Following account(s) are connected" notesAndReplies: "Posts and replies" withFiles: "Including files" +attachedToNotes: "Posts with this file" +showAttachedNotes: "Show posts with this file" silence: "Silence" silenceConfirm: "Are you sure that you want to silence this user?" unsilence: "Undo silencing" @@ -602,7 +608,8 @@ output: "Output" script: "Script" disablePagesScript: "Disable AiScript on Pages" expandOnNoteClick: "Open post on click" -expandOnNoteClickDesc: "If disabled, you can still open posts in the right-click menu or by clicking the timestamp." +expandOnNoteClickDesc: "If disabled, you can still open posts in the right-click menu + or by clicking the timestamp." updateRemoteUser: "Update remote user information" deleteAllFiles: "Delete all files" deleteAllFilesConfirm: "Are you sure that you want to delete all files?" @@ -735,6 +742,7 @@ system: "System" switchUi: "Layout" desktop: "Desktop" clip: "Clip" +clips: "Clips" createNew: "Create new" optional: "Optional" createNewClip: "Create new clip" @@ -742,8 +750,8 @@ unclip: "Unclip" confirmToUnclipAlreadyClippedNote: "This post is already part of the \"{name}\" clip. Do you want to remove it from this clip instead?" public: "Public" -i18nInfo: "Firefish is being translated into various languages by volunteers. You can - help at {link}." +i18nInfo: "Firefish is being translated into various languages by volunteers. You + can help at {link}." manageAccessTokens: "Manage access tokens" accountInfo: "Account Info" notesCount: "Number of posts" @@ -777,8 +785,8 @@ pageLikesCount: "Number of liked Pages" pageLikedCount: "Number of received Page likes" contact: "Contact" useSystemFont: "Use the system's default font" -clips: "Clips" -clipsDesc: "Clips are like share-able categorized bookmarks. You can create clips from the menu of individual posts." +clipsDesc: "Clips are like share-able categorized bookmarks. You can create clips + from the menu of individual posts." experimentalFeatures: "Experimental features" developer: "Developer" makeExplorable: "Make account visible in \"Explore\"" @@ -887,10 +895,10 @@ secureMode: "Secure Mode (Authorized Fetch)" instanceSecurity: "Server Security" secureModeInfo: "When requesting from other servers, do not send back without proof." privateMode: "Private Mode" -privateModeInfo: "When enabled, only whitelisted servers can federate with your server. +privateModeInfo: "When enabled, only allowlisted servers can federate with your server. All posts will be hidden from the public." -allowedInstances: "Whitelisted Servers" -allowedInstancesDescription: "Hosts of servers to be whitelisted for federation, each +allowedInstances: "Allowlisted Servers" +allowedInstancesDescription: "Hosts of servers to be allowlisted for federation, each separated by a new line (only applies in private mode)." previewNoteText: "Show preview" customCss: "Custom CSS" @@ -1082,8 +1090,8 @@ license: "License" indexPosts: "Index Posts" indexFrom: "Index from Post ID onwards" indexFromDescription: "Leave blank to index every post" -indexNotice: "Now indexing. This will probably take a while, please don't restart\ - \ your server for at least an hour." +indexNotice: "Now indexing. This will probably take a while, please don't restart + your server for at least an hour." customKaTeXMacro: "Custom KaTeX macros" customKaTeXMacroDescription: "Set up macros to write mathematical expressions easily! The notation conforms to the LaTeX command definitions and is written as \\newcommand{\\ @@ -1109,7 +1117,7 @@ noGraze: "Please disable the \"Graze for Mastodon\" browser extension, as it int with Firefish." silencedWarning: "This page is showing because these users are from servers your admin silenced, so they may potentially be spam." -isBot: "This account is a bot" +isBot: "This account is automated" isLocked: "This account has follow approvals" isModerator: "Moderator" isAdmin: "Administrator" @@ -1131,9 +1139,11 @@ origin: "Origin" delete2fa: "Disable 2FA" deletePasskeys: "Delete passkeys" delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?" -deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?" +deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys + on this account. Proceed?" inputNotMatch: "Input does not match" -addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content warning" +addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content + warning" confirm: "Confirm" importZip: "Import ZIP" exportZip: "Export ZIP" @@ -1141,9 +1151,11 @@ emojiPackCreator: "Emoji pack creator" indexable: "Indexable" indexableDescription: "Allow built-in search to show your public posts" languageForTranslation: "Post translation language" -detectPostLanguage: "Automatically detect the language and show a translate button for posts in foreign languages" +detectPostLanguage: "Automatically detect the language and show a translate button + for posts in foreign languages" vibrate: "Play vibrations" openServerInfo: "Show server information by clicking the server ticker on a post" +iconSet: "Icon set" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing @@ -1185,7 +1197,8 @@ _accountDelete: inProgress: "Deletion is currently in progress" _ad: back: "Back" - reduceFrequencyOfThisAd: "Show this ad less" + adsBy: "Community banner by {by}" + reduceFrequencyOfThisAd: "Show this banner less" _forgotPassword: enterEmail: "Enter the email address you used to register. A link with which you can reset your password will then be sent to it." @@ -1235,8 +1248,8 @@ _registry: domain: "Domain" createKey: "Create key" _aboutFirefish: - about: "Firefish is a fork of Misskey made by ThatOneCalculator, which has been in - development since 2022." + about: "Firefish is a fork of Misskey made by ThatOneCalculator, which has been + in development since 2022." contributors: "Main contributors" allContributors: "All contributors" misskeyContributors: "Misskey contributors" @@ -1245,13 +1258,15 @@ _aboutFirefish: donate: "Donate to Firefish" donateTitle: "Enjoying Firefish?" pleaseDonateToFirefish: "Please consider donating to Firefish to support its development." - pleaseDonateToHost: "Please also consider donating to your home server, {host}, to help support its operation costs." + pleaseDonateToHost: "Please also consider donating to your home server, {host}, + to help support its operation costs." donateHost: "Donate to {host}" morePatrons: "We also appreciate the support of many other helpers not listed here. Thank you! 🥰" sponsors: "Firefish sponsors" patrons: "Firefish patrons" - patronsList: "Listed chronologically, not by donation size. Donate with the link above to get your name on here!" + patronsList: "Listed chronologically, not by donation size. Donate with the link + above to get your name on here!" _nsfw: respect: "Hide NSFW media" ignore: "Don't hide NSFW media" @@ -1266,7 +1281,8 @@ _mfm: can be used in many places. Here you can view a list of all available MFM syntax." dummy: "Firefish expands the world of the Fediverse" advanced: "Advanced MFM" - advancedDescription: "If disabled, only allows for basic markup unless animated MFM is playing" + advancedDescription: "If disabled, only allows for basic markup unless animated + MFM is playing" mention: "Mention" mentionDescription: "You can specify a user by using an At-Symbol and a username." hashtag: "Hashtag" @@ -1522,10 +1538,10 @@ _tutorial: step5_4: "The Local {icon} timeline is where you can see posts from everyone else on this server." step5_5: "The Social {icon} timeline is a combination of the Home and Local timelines." - step5_6: "The Recommended {icon} timeline is where you can see posts from servers\ - \ the admins recommend." - step5_7: "The Global {icon} timeline is where you can see posts from every other\ - \ connected server." + step5_6: "The Recommended {icon} timeline is where you can see posts from servers + the admins recommend." + step5_7: "The Global {icon} timeline is where you can see posts from every other + connected server." step6_1: "So, what is this place?" step6_2: "Well, you didn't just join Firefish. You joined a portal to the Fediverse, an interconnected network of thousands of servers." @@ -1538,23 +1554,29 @@ _2fa: registerTOTP: "Register authenticator app" step1: "First, install an authentication app (such as {a} or {b}) on your device." step2: "Then, scan the QR code displayed on this screen." - step2Click: "Clicking on this QR code will allow you to register 2FA to your security key or phone authenticator app." + step2Click: "Clicking on this QR code will allow you to register 2FA to your security + key or phone authenticator app." step2Url: "You can also enter this URL if you're using a desktop program:" step3Title: "Enter an authentication code" step3: "Enter the token provided by your app to finish setup." step4: "From now on, any future login attempts will ask for such a login token." securityKeyNotSupported: "Your browser does not support security keys." - registerTOTPBeforeKey: "Please set up an authenticator app to register a security or pass key." - securityKeyInfo: "Besides fingerprint or PIN authentication, you can also setup authentication via hardware security keys that support FIDO2 to further secure your account." + registerTOTPBeforeKey: "Please set up an authenticator app to register a security + or pass key." + securityKeyInfo: "Besides fingerprint or PIN authentication, you can also setup + authentication via hardware security keys that support FIDO2 to further secure + your account." chromePasskeyNotSupported: "Chrome passkeys are currently not supported." registerSecurityKey: "Register a security or pass key" securityKeyName: "Enter a key name" tapSecurityKey: "Please follow your browser to register the security or pass key" removeKey: "Remove security key" removeKeyConfirm: "Really delete the {name} key?" - whyTOTPOnlyRenew: "The authenticator app cannot be removed as long as a security key is registered." + whyTOTPOnlyRenew: "The authenticator app cannot be removed as long as a security + key is registered." renewTOTP: "Reconfigure authenticator app" - renewTOTPConfirm: "This will cause verification codes from your previous app to stop working" + renewTOTPConfirm: "This will cause verification codes from your previous app to + stop working" renewTOTPOk: "Reconfigure" renewTOTPCancel: "Cancel" token: "2FA Token" @@ -1702,10 +1724,9 @@ _profile: youCanIncludeHashtags: "You can also include hashtags in your bio." metadata: "Additional Information" metadataEdit: "Edit additional Information" - metadataDescription: - "Using these, you can display additional information fields - in your profile. You can add an {a} tag or {l} tag with {rel} - to verify the link on your profile!" + metadataDescription: "Using these, you can display additional information fields + in your profile. You can add an {a} tag or {l} tag with {rel} to verify the link + on your profile!" metadataLabel: "Label" metadataContent: "Content" changeAvatar: "Change avatar" @@ -2116,9 +2137,9 @@ _deck: _experiments: title: "Experiments" enablePostImports: "Enable post imports" - postImportsCaption: "Allows users to import their posts from past Firefish,\ - \ Misskey, Mastodon, Akkoma, and Pleroma accounts. It may cause slowdowns during\ - \ load if your queue is bottlenecked." + postImportsCaption: "Allows users to import their posts from past Firefish, Misskey, + Mastodon, Akkoma, and Pleroma accounts. It may cause slowdowns during load if + your queue is bottlenecked." _dialog: charactersExceeded: "Max characters exceeded! Current: {current}/Limit: {max}" charactersBelow: "Not enough characters! Current: {current}/Limit: {min}" @@ -2134,3 +2155,11 @@ _feeds: rss: "RSS" atom: "Atom" jsonFeed: "JSON feed" +_iconSets: + bold: "Bold" + light: "Light" + regular: "Regular" + fill: "Filled" + duotone: "Duotone" +moreUrls: "Pinned pages" +moreUrlsDescription: "Enter the pages you want to pin to the help menu in the lower left corner using this notation:\n\"Display name\": https://example.com/" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index 045f2d616c..442fec1e32 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -340,9 +340,6 @@ dayX: "Día {day}" monthX: "Mes {month}" yearX: "Año {year}" pages: "Páginas" -integration: "Integraciones" -connectService: "Conectar" -disconnectService: "Desconectar" enableLocalTimeline: "Habilitar linea de tiempo local" enableGlobalTimeline: "Habilitar linea de tiempo global" disablingTimelinesInfo: "Aunque se desactiven estas lineas de tiempo, por conveniencia @@ -1988,7 +1985,7 @@ migration: Migración silenced: Silenciado deleted: Eliminado edited: 'Editado a las {date} {time}' -editNote: Editar nota +editNote: Editar publicación silenceThisInstance: Silenciar este servidor findOtherInstance: Buscar otro servidor userSaysSomethingReasonRenote: '{name} impulsó una publicación que contiene {reason]' @@ -2164,3 +2161,4 @@ noGraze: Por favor desactiva la extensión de navegador "Graze for Mastodon" ya silencedWarning: Esta página se muestra debido a que estos usuarios son de servidores que tu administrador ha silenciado, ya que son presumiblemente fuente de spam. isBot: Esta cuenta es un bot +clickToShowPatterns: Haz clic para mostrar patrones de módulos diff --git a/locales/fi.yml b/locales/fi.yml index c4bd16ed22..7ccfb32f46 100644 --- a/locales/fi.yml +++ b/locales/fi.yml @@ -339,8 +339,6 @@ instanceName: Instanssin nimi thisMonth: Kuukausi today: Tänään monthX: '{month}' -connectService: Yhdistä -disconnectService: Katkaise yhteys enableLocalTimeline: Ota käyttöön paikallinen aikajana enableGlobalTimeline: Ota käyttöön globaali aikajana enableRecommendedTimeline: Ota käyttöön suositellut -aikajana @@ -385,7 +383,6 @@ disablingTimelinesInfo: Järjestelmänvalvojilla ja moderaattoreilla on aina pä dayX: '{day}' yearX: '{year}' pages: Sivut -integration: Integraatiot instanceDescription: Instanssin kuvaus invite: Kutsu iconUrl: Ikoni URL-linkki diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 7ea66d7efb..f6c2eb55f1 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -114,7 +114,7 @@ you: "Vous" clickToShow: "Cliquer pour afficher" sensitive: "Contenu sensible" add: "Ajouter" -reaction: "Réactions" +reaction: "Réaction" reactionSetting: "Réactions à afficher dans le sélecteur de réactions" reactionSettingDescription2: "Déplacer pour réorganiser, cliquer pour effacer, utiliser « + » pour ajouter." @@ -341,9 +341,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Pages" -integration: "Intégrations" -connectService: "Connexion" -disconnectService: "Déconnexion" enableLocalTimeline: "Activer le fil local" enableGlobalTimeline: "Activer le fil global" disablingTimelinesInfo: "Même si vous désactivez ces fils, les administrateur·rice·s @@ -646,7 +643,7 @@ emptyToDisableSmtpAuth: "Laisser le nom d’utilisateur et le mot de passe vides smtpSecure: "Utiliser SSL/TLS implicitement dans les connexions SMTP" smtpSecureInfo: "Désactiver cette option lorsque STARTTLS est utilisé" testEmail: "Tester la distribution de courriel" -wordMute: "Filtre de mots" +wordMute: "Filtre de mots et langages" regexpError: "Erreur d’expression régulière" instanceMute: "Serveur masqué" userSaysSomething: "{name} a dit quelque chose" @@ -960,7 +957,8 @@ _accountDelete: inProgress: "Suppression en cours" _ad: back: "Retour" - reduceFrequencyOfThisAd: "Voir cette publicité moins souvent" + reduceFrequencyOfThisAd: "Voir cette bannière moins souvent" + adsBy: Bannière communautaire par {by} _forgotPassword: enterEmail: "Entrez ici l'adresse e-mail que vous avez enregistrée pour votre compte. Un lien vous permettant de réinitialiser votre mot de passe sera envoyé à cette @@ -1145,6 +1143,13 @@ _wordMute: soft: "Doux" hard: "Strict" mutedNotes: "Publications masquées" + muteLangsDescription2: Utiliser les code de langage (i.e en, fr, ja, zh). + lang: Langage + langDescription: Cacher du fil de publication les publications qui correspondent + à ces langues. + muteLangs: Langages filtrés + muteLangsDescription: Séparer avec des espaces ou des retours à la ligne pour une + condition OU (OR). _instanceMute: instanceMuteDescription2: "Séparer avec des sauts de lignes" title: "Masque les publications provenant des serveurs listés." @@ -2218,3 +2223,16 @@ openServerInfo: Afficher les informations du serveur en cliquant sur le bandeau serveur d’une publication indexable: Indexable languageForTranslation: Langage post-traduction +vibrate: Jouer les vibrations +clickToShowPatterns: Cliquer pour montrer les patrons de modules +iconSet: Jeu d'icônes +_iconSets: + fill: Rempli + regular: Normal + bold: Gras + duotone: Deux tons + light: Fin +reactions: Réactions +replies: Réponses +quotes: Citations +renotes: Boosts diff --git a/locales/gl.yml b/locales/gl.yml index 3b8d60181a..eada0c213b 100644 --- a/locales/gl.yml +++ b/locales/gl.yml @@ -1,4 +1,4 @@ -_lang_: Inglés +_lang_: Galego introFirefish: Benvida! Firefish é unha plataforma de medios sociais de código aberto, descentralizada e gratuíta para sempre!🚀 monthAndDay: '{day}/{month}' diff --git a/locales/hi.yml b/locales/hi.yml new file mode 100644 index 0000000000..4ac343988d --- /dev/null +++ b/locales/hi.yml @@ -0,0 +1 @@ +_lang_: "हिन्दी" diff --git a/locales/id-ID.yml b/locales/id-ID.yml index 4aca0eb2ce..71cfdf72a2 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -148,11 +148,11 @@ cacheRemoteFiles: "Tembolokkan berkas remote" cacheRemoteFilesDescription: "Ketika pengaturan ini dinonaktifkan, berkas luar akan dimuat langsung dari server luar. Menonaktifkan ini akan mengurangi penggunaan penyimpanan, tapi dapat menyebabkan meningkatkan lalu lintas, mengingat keluku tidak akan dihasilkan." -flagAsBot: "Atur akun ini sebagai Bot" -flagAsBotDescription: "Jika akun ini dikendalikan oleh program, tetapkanlah opsi ini. +flagAsBot: "Tandai akun ini sebagai akun otomatis" +flagAsBotDescription: "Jika akun ini dikendalikan oleh program, aktifkan opsi ini. Jika diaktifkan, ini akan berfungsi sebagai tanda bagi pengembang lain untuk mencegah - interaksi berantai dengan bot lain dan menyesuaikan sistem internal Firefish untuk - memperlakukan akun ini sebagai bot." + interaksi berantai dengan akun otomatis lain dan menyesuaikan sistem internal Firefish + untuk memperlakukan akun ini sebagai akun otomatis." flagAsCat: "Atur akun ini sebagai kucing" flagAsCatDescription: "Kamu akan mendapatkan telinga kucing dan berbicara seperti seekor kucing!" @@ -278,8 +278,7 @@ agreeTo: "Saya setuju kepada {0}" tos: "Syarat dan ketentuan" start: "Mulai" home: "Beranda" -remoteUserCaution: "Informasi ini mungkin tidak mutakhir, karena pengguna ini berasal - dari instansi luar." +remoteUserCaution: "Informasi dari pengguna luar tidak lengkap." activity: "Aktivitas" images: "Gambar" birthday: "Tanggal lahir" @@ -342,9 +341,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Halaman" -integration: "Integrasi" -connectService: "Sambungkan" -disconnectService: "Putuskan" enableLocalTimeline: "Nyalakan linimasa lokal" enableGlobalTimeline: "Nyalakan linimasa global" disablingTimelinesInfo: "Admin dan Moderator akan selalu memiliki akses ke semua linimasa @@ -637,7 +633,7 @@ emptyToDisableSmtpAuth: "Kosongkan nama pengguna dan kata sandi untuk menonaktif smtpSecure: "Gunakan SSL/TLS implisit untuk koneksi SMTP" smtpSecureInfo: "Matikan ini ketika menggunakan STARTTLS" testEmail: "Tes pengiriman surel" -wordMute: "Bisukan kata" +wordMute: "Bisukan kata dan bahasa" regexpError: "Kesalahan ekspresi reguler" regexpErrorDescription: "Galat terjadi pada baris {line} ekspresi reguler dari {tab} kata yang dibisukan:" @@ -953,7 +949,8 @@ _accountDelete: inProgress: "Penghapusan sedang dalam proses" _ad: back: "Kembali" - reduceFrequencyOfThisAd: "Tampilkan iklan ini lebih sedikit" + reduceFrequencyOfThisAd: "Tampilkan banner ini lebih sedikit" + adsBy: Banner komunitas oleh {by} _forgotPassword: enterEmail: "Masukkan alamat surel yang kamu gunakan pada saat mendaftar. Sebuah tautan untuk mengatur ulang kata sandi kamu akan dikirimkan ke alamat surel tersebut." @@ -1135,6 +1132,12 @@ _wordMute: soft: "Lembut" hard: "Keras" mutedNotes: "Postingan yang dibisukan" + muteLangsDescription2: Gunakan kode bahasa misalnya en, fr, ja, zh. + lang: Bahasa + langDescription: Sembunyikan postingan yang cocok dengan bahasa yang ditetapkan + dari timeline. + muteLangs: Bahasa yang dibisukan + muteLangsDescription: Pisahkan dengan spasi atau jeda baris untuk kondisi ATAU. _instanceMute: instanceMuteDescription: "Pengaturan ini akan membisukan postingan/pembagian apa saja dari server yang terdaftar, termasuk pengguna yang membalas pengguna lain @@ -1262,8 +1265,8 @@ _tutorial: {introduction} atau \"Halo dunia!\" yang sederhana." step5_1: "Linimasa, linimasa di mana-mana!" step5_2: "Servermu memiliki {timelines} lini masa berbeda yang diaktifkan." - step5_3: "Lini masa Beranda {icon} adalah tempat di mana kamu bisa melihat postingan - dari akun yang kamu ikuti." + step5_3: "Lini masa Beranda {icon} adalah tempat kamu bisa melihat postingan dari + akun yang kamu ikuti." step5_4: "Linimasa Lokal {icon} adalah tempat kamu dapat melihat postingan dari siapa pun di server ini." step6_1: "Jadi, tempat apa ini?" @@ -1917,9 +1920,9 @@ moderation: Moderasi userSaysSomethingReason: '{name} mengatakan {reason}' secureMode: Mode Aman (Pengambilan Terotorisasi) secureModeInfo: Saat meminta dari server lain, jangan kirim kembali tanpa bukti. -privateModeInfo: Saat aktif, hanya server yang masuk daftar putih dapat terfederasi - dengan servermu. Semua postingan akan disembunyikan dari publik. -allowedInstances: Server Masuk Daftar Putih +privateModeInfo: Saat aktif, hanya server yang masuk daftar yang diizinkan yang dapat + terfederasi dengan servermu. Semua postingan akan disembunyikan dari publik. +allowedInstances: Daftar Server Diizinkan newer: lebih baru userSaysSomethingReasonReply: '{name} membalas postingan berisi {reason}' userSaysSomethingReasonRenote: '{name} memposting ulang postingan berisi {reason}' @@ -1929,8 +1932,8 @@ jumpToPrevious: Lompat ke sebelumnya flagSpeakAsCatDescription: Postinganmu akan nyampak dalam mode kucing cw: Peringatan konten flagSpeakAsCat: Bicara sebagai kucing -allowedInstancesDescription: Host server akan masuk daftar putih untuk federasi, mereka - dipisahkan dengan baris baru (hanya diterapkan pada mode pribadi). +allowedInstancesDescription: Server host akan masuk daftar yang diizinkan untuk federasi, + mereka dipisahkan dengan baris baru (hanya diterapkan pada mode pribadi). xl: XL privateMode: Mode Pribadi seperateRenoteQuote: Tombol posting ulang dan kutip terpisah @@ -2001,7 +2004,7 @@ signupsDisabled: Pendaftaran ke server ini nonaktif, tapi kamu dapat selalu mend ke server lain! Jika kamu memiliki kode undangan server ini, harap masukkan di bawah ini. enableCustomKaTeXMacro: Aktifkan makro KaTeX khusus -isBot: Akun ini bot +isBot: Akun ini akun otomatis customMOTD: MOTD khusus (pesan layar percik) recommendedInstancesDescription: Server yang direkomendasikan dipisahkan dengan garis baru untuk tampil di linimasa rekomendasi. @@ -2175,3 +2178,18 @@ indexable: Dapat diindeks languageForTranslation: Bahasa terjemahan kiriman openServerInfo: Tampilkan informasi server dengan mengeklik ticker server di sebuah kiriman +vibrate: Putar getaran +clickToShowPatterns: Klik untuk menampilkan pola modul +iconSet: Set ikon +_iconSets: + fill: Penuh + regular: Reguler + bold: Tebal + duotone: Duotone + light: Tipis +reactions: Reaksi +replies: Balasan +quotes: Kutipan +renotes: Postingan ulang +showAttachedNotes: Tampilkan postingan dengan berkas ini +attachedToNotes: Posting dengan berkas ini diff --git a/locales/it-IT.yml b/locales/it-IT.yml index 9ecb4ac304..e6e2234c97 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -147,11 +147,11 @@ cacheRemoteFiles: "Mantieni i file remoti nella cache" cacheRemoteFilesDescription: "Disabilitando questa opzione, i file remoti verranno scaricati direttamente dal loro server. L'opzione permette di risparmiare spazio ma aumenta il traffico di rete e non verranno generate anteprime." -flagAsBot: "Questo account è un bot" +flagAsBot: "Questo account è automatizzato" flagAsBotDescription: "Se l'account esegue principalmente operazioni automatiche, - attiva quest'opzione. Quando attivata, opera come un segnalatore per gli altri sviluppatori - allo scopo di prevenire catene d’interazione senza fine con altri bot, e di adeguare - i sistemi interni di Firefish perché trattino questo account come un bot." + attiva quest'opzione. Quando attivata, permette agli sviluppatori di prevenire catene + d’interazione senza fine con altri account automatizzati. Inoltre imposta Firefish + perché tratti questo account come automatizzato." flagAsCat: "Sei un gatto? 😺" flagAsCatDescription: "Ti compariranno le orecchie e parlerai come un gatto!" autoAcceptFollowed: "Accetta in automatico i follow dagli account che segui" @@ -268,7 +268,7 @@ agreeTo: "Sono d'accordo con {0}" tos: "Termini d'uso" start: "Inizia" home: "Home" -remoteUserCaution: "Le informazioni degli utenti remoti possono essere incomplete." +remoteUserCaution: "Le informazioni degli utenti remoti sono incomplete." activity: "Attività" images: "Immagini" birthday: "Compleanno" @@ -331,9 +331,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Pagine" -integration: "Integrazioni" -connectService: "Connetti" -disconnectService: "Disconnetti" enableLocalTimeline: "Abilita timeline locale" enableGlobalTimeline: "Abilita timeline federata" disablingTimelinesInfo: "Anche se disabiliti queste timeline, gli amministratori e @@ -626,7 +623,7 @@ emptyToDisableSmtpAuth: "Lasciare username e password vuoti per disabilitare la smtpSecure: "Usa la porta SSL/TLS predefinita per le connessioni SMTP" smtpSecureInfo: "Disabilita quando è attivo STARTTLS" testEmail: "Test di consegna email" -wordMute: "Filtro parole" +wordMute: "Filtro parole e lingua" instanceMute: "Server silenziati" userSaysSomething: "{name} ha detto qualcosa" makeActive: "Attiva" @@ -901,7 +898,8 @@ _accountDelete: caricato. _ad: back: "Indietro" - reduceFrequencyOfThisAd: "Mostra meno spesso questa pubblicità" + reduceFrequencyOfThisAd: "Mostra meno spesso questo banner" + adsBy: Banner della comunità da {by} _forgotPassword: enterEmail: "Inserisci l'e-mail che hai registrato nel tuo profilo. Il link di ripristino della password verrà inviato a questo indirizzo." @@ -1084,6 +1082,11 @@ _wordMute: soft: "Moderato" hard: "Severo" mutedNotes: "Post silenziati" + muteLangsDescription2: 'Usa il codice lingua, esempio: en, fr, ja, zh.' + lang: Lingua + langDescription: Nascondi dalla timeline i post in quest'insieme di lingue. + muteLangs: Lingue da non mostrare + muteLangsDescription: Separa andando a capo o con spazi per la condizione OR. _theme: explore: "Esplora temi" install: "Installa un tema" @@ -1992,11 +1995,11 @@ secureMode: Modalità sicura (Acquisizione autorizzata) secureModeInfo: Le richieste dai server remoti non ricevono risposta senza prima una verifica. privateMode: Modalità privata -allowedInstancesDescription: Gli host dei server che saranno federati in esclusiva, +allowedInstancesDescription: Gli host dei server con cui sarà permessa la federazione, uno per riga (funziona solo in modalità privata). -privateModeInfo: Se abilitata, solo i server in una whitelist potranno essere federati +privateModeInfo: Se abilitata, solo i server nell'elenco potranno essere federati con questo server. Tutti i post saranno nascosti al pubblico. -allowedInstances: Whitelist dei server +allowedInstances: Elenco server permessi customCssWarn: Questa impostazione dovrebbe essere usata solo se sai cosa stai facendo. Inserire valori errati potrebbe bloccare il funzionamento del client. lastCommunication: Ultima comunicazione @@ -2076,7 +2079,7 @@ noGraze: Per favore disattiva l'estenzione del browser "Graze for Mastodon", per interferisce con Firefish. silencedWarning: Vedi questa pagina perché gli utenti sono su un server che il tuo admin ha silenziato, quindi potrebbero essere spam. -isBot: Questo account è un bot +isBot: Questo account è automatizzato isLocked: Serve una approvazione per seguire questo account moveFromDescription: Questa operazione crea un alias del vecchio account in modo che tu possa migrare su questo nuovo account. Fallo PRIMA di migrare il tuo vecchio @@ -2164,3 +2167,18 @@ indexable: Indicizzabile languageForTranslation: Linguaggio di traduzione dei post openServerInfo: Mostra informazioni sul server cliccando sul riquadro del server in un post +vibrate: Abilita la vibrazione +clickToShowPatterns: Clicca per vedere i pattern del modulo +iconSet: Set di icone +_iconSets: + fill: Con riempimento + regular: Regolare + bold: Grassetto + duotone: Con due toni + light: Sottile +reactions: Reazioni +replies: Risposte +quotes: Citazioni +renotes: Boost +showAttachedNotes: Mostra i post con questo allegato +attachedToNotes: Post con questo allegato diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 2b82df1f8b..0a6740b340 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -52,6 +52,7 @@ sendMessage: "メッセージを送信" copyUsername: "ユーザー名をコピー" searchUser: "ユーザーを検索" reply: "返信" +replies: "返信" loadMore: "もっと読み込む" showMore: "もっと見る" showLess: "閉じる" @@ -97,11 +98,13 @@ unfollow: "フォロー解除" followRequestPending: "フォロー許可待ち" enterEmoji: "絵文字を入力" renote: "ブースト" +renotes: "ブースト" unrenote: "ブースト解除" renoted: "ブーストしました。" cantRenote: "この投稿はブーストできません。" cantReRenote: "ブーストをブーストすることはできません。" quote: "引用" +quotes: "引用" pinnedNote: "ピン留めされた投稿" pinned: "ピン留め" you: "あなた" @@ -109,6 +112,7 @@ clickToShow: "クリックして表示" sensitive: "閲覧注意" add: "追加" reaction: "リアクション" +reactions: "リアクション" enableEmojiReactions: "絵文字リアクションを有効にする" showEmojisInReactionNotifications: "自分の投稿に対するリアクションの通知で絵文字を表示する" reactionSetting: "ピッカーに表示するリアクション" @@ -145,8 +149,8 @@ addEmoji: "絵文字を追加" settingGuide: "おすすめ設定" cacheRemoteFiles: "リモートのファイルをキャッシュする" cacheRemoteFilesDescription: "この設定を無効にすると、リモートファイルをキャッシュせず直リンクします。サーバーのストレージを節約できますが、サムネイルが生成されないので通信量が増加します。" -flagAsBot: "Botとして設定" -flagAsBotDescription: "このアカウントがBotである場合は、この設定をオンにします。オンにすると、反応の連鎖を防ぐためのフラグとして他の開発者に役立ったり、Firefishのシステム上での扱いがBotに合ったものになります。" +flagAsBot: "自動化されたアカウントとして設定" +flagAsBotDescription: "このアカウントが自動で投稿する場合は、この設定をオンにします。オンにすると、反応の連鎖を防ぐためのフラグとして他の開発者に役立ったり、Firefishのシステム上での扱いが自動で投稿するアカウントに合ったものになります。" flagAsCat: "あなたは…猫?😺" flagAsCatDescription: "このアカウントが猫であることを示す猫モードを有効にするには、このフラグをオンにします。" flagSpeakAsCat: "猫語で話す" @@ -334,9 +338,6 @@ dayX: "{day}日" monthX: "{month}月" yearX: "{year}年" pages: "ページ" -integration: "連携" -connectService: "接続する" -disconnectService: "切断する" enableLocalTimeline: "ローカルタイムラインを有効にする" enableGlobalTimeline: "グローバルタイムラインを有効にする" enableRecommendedTimeline: "おすすめタイムラインを有効にする" @@ -383,6 +384,8 @@ withReplies: "返信を含む" connectedTo: "次のアカウントに接続されています" notesAndReplies: "投稿と返信" withFiles: "ファイル付き" +attachedToNotes: "このファイルが添付された投稿" +showAttachedNotes: "このファイルが添付された投稿を見る" silence: "サイレンス" silenceConfirm: "サイレンスしますか?" unsilence: "サイレンス解除" @@ -615,7 +618,7 @@ emptyToDisableSmtpAuth: "ユーザー名とパスワードを空欄にするこ smtpSecure: "SMTP 接続に暗黙的なSSL/TLSを使用する" smtpSecureInfo: "STARTTLS使用時はオフにします。" testEmail: "配信テスト" -wordMute: "ワードミュート" +wordMute: "単語または言語のミュート" regexpError: "正規表現エラー" regexpErrorDescription: "{tab}ワードミュートの{line}行目の正規表現にエラーが発生しました:" instanceMute: "サーバーミュート" @@ -693,7 +696,7 @@ no: "いいえ" driveFilesCount: "ドライブのファイル数" driveUsage: "ドライブ使用量" noCrawle: "クローラーによるインデックスを拒否" -noCrawleDescription: "検索エンジンにあなたのプロフィールや投稿、ページなどのコンテンツを登録(インデックス)しないよう要請します。" +noCrawleDescription: "Web検索にあなたのプロフィールや投稿、ページなどのコンテンツを登録(インデックス)しないよう要請します。" lockedAccountInfo: "フォローを承認制にしても、投稿の公開範囲を「フォロワー」にしない限り、誰でもあなたの投稿を見られます。" alwaysMarkSensitive: "デフォルトでメディアを閲覧注意にする" loadRawImages: "添付画像のサムネイルをオリジナル画質にする" @@ -810,7 +813,7 @@ instanceSecurity: "サーバーのセキュリティー" secureModeInfo: "認証情報の無いリモートサーバーからのリクエストに応えません。" privateMode: "非公開モード" privateModeInfo: "有効にすると、許可したサーバーのみからリクエストを受け付けます。" -allowedInstances: "許可されたサーバー" +allowedInstances: "許可するサーバー" allowedInstancesDescription: "許可したいサーバーのホストを改行で区切って設定します。非公開モードだけで有効です。" previewNoteText: "本文をプレビュー" customCss: "カスタムCSS" @@ -833,7 +836,7 @@ translatedFrom: "{x}から翻訳" accountDeletionInProgress: "アカウントの削除が進行中です" usernameInfo: "サーバー上であなたのアカウントを一意に識別するための名前です。アルファベット(a~z, A~Z)、数字(0~9)、およびアンダーバー(_)が使用できます。ユーザー名は後から変更できません。" aiChanMode: "藍モード(クラシックUI)" -enterSendsMessage: "メッセージングでReturnキーを押すと、メッセージが送信されます(デフォルトはCtrl + Returnです)" +enterSendsMessage: "チャットでEnterキー(Returnキー)を押すと、メッセージが送信されます(オフの場合はCtrl + Enterで送信します)" keepCw: "CWを維持する" pubSub: "Pub/Subのアカウント" lastCommunication: "直近の通信" @@ -990,6 +993,7 @@ remindMeLater: "また後で" addRe: "閲覧注意の投稿への返信で、注釈の先頭に\"re:\"を追加する" languageForTranslation: "投稿翻訳に使用する言語" detectPostLanguage: "投稿の言語を自動検出し、外国語の投稿に翻訳ボタンを表示する" +iconSet: "アイコンのスタイル" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" @@ -1022,7 +1026,8 @@ _accountDelete: inProgress: "削除が進行中" _ad: back: "戻る" - reduceFrequencyOfThisAd: "この広告の表示頻度を下げる" + adsBy: "バナーで{by}" + reduceFrequencyOfThisAd: "このバナーの表示頻度を下げる" _forgotPassword: enterEmail: "アカウントに登録したメールアドレスを入力してください。そのアドレス宛てに、パスワードリセット用のリンクが送信されます。" ifNoEmail: "メールアドレスを登録していない場合は、管理者までお問い合わせください。" @@ -1503,7 +1508,7 @@ _profile: youCanIncludeHashtags: "ハッシュタグを含められます。" metadata: "追加情報" metadataEdit: "追加情報を編集" - metadataDescription: "プロフィールに表として追加情報を表示できます。{a}タグまたは{l}タグを{rel}とともに追加すると、プロフィールのリンクを確認できます。" + metadataDescription: "プロフィールに追加情報を表示できます。{rel}属性をつけた{a}タグや{l}タグを含むページをリンクすることで、リンクの本人確認もできます!" metadataLabel: "ラベル" metadataContent: "内容" changeAvatar: "アバター画像を変更" @@ -1951,7 +1956,7 @@ isModerator: モデレーター audio: 音声 image: 画像 video: 動画 -isBot: このアカウントはBotです +isBot: このアカウントは自動で投稿します isLocked: このアカウントのフォローは承認制です isAdmin: 管理者 isPatron: Firefish 後援者 @@ -1988,3 +1993,15 @@ emojiPackCreator: 絵文字パックの作者 confirm: 確認 exportZip: ZIPをエクスポート openServerInfo: "投稿内のサーバー名をクリックでサーバー情報を開く" +indexableDescription: MastodonやFirefishなどの検索機能に、あなたの投稿が表示されるのを許可します。 +clickToShowPatterns: クリックしてトラックを表示 +vibrate: 振動を有効にする +indexable: 投稿検索に登録 +_iconSets: + bold: "太め" + light: "細め" + regular: "標準" + fill: "塗りつぶし" + duotone: "2色" +moreUrls: "固定するページ" +moreUrlsDescription: "左下のヘルプメニューに固定したいページを以下の形式で、改行区切りで入力してください:\n\"表示名\": https://example.com/" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 8d052d6175..4f77592dcd 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -64,7 +64,7 @@ import: "インポート" export: "エクスポート" files: "ファイル" download: "ダウンロード" -driveFileDeleteConfirm: "ファイル「{name}」を消してしもうてええか?このファイルを添付した投稿も消えてまうで。" +driveFileDeleteConfirm: "ファイル「{name}」を消してええんか?添付した全部の投稿から、きれいさっぱり消えてなくなるで。" unfollowConfirm: "{name}のフォローを解除してもええんか?" exportRequested: "エクスポートしてな、ってリクエストしたけど、これ多分めっちゃ時間かかるで。エクスポート終わったら「ドライブ」に突っ込んどくで。" importRequested: "インポートしてな、ってリクエストしたけど、これ多分めっちゃ時間かかるで。" @@ -86,7 +86,7 @@ serverIsDead: "サーバーの応答がおまへん。ちーとの間待って youShouldUpgradeClient: "このページを表示するには、リロードして新しいバージョンのクライアントを使うてや。" enterListName: "リスト名を入れてや" privacy: "プライバシー" -makeFollowManuallyApprove: "自分が認めた人だけがこのアカウントをフォローできるようにする" +makeFollowManuallyApprove: "ワイが認めた奴だけがワイをフォローできるようにする" defaultNoteVisibility: "もとからの公開範囲" follow: "フォロー" followRequest: "フォローを頼む" @@ -138,9 +138,9 @@ addEmoji: "絵文字を追加" settingGuide: "ええ感じの設定" cacheRemoteFiles: "リモートのファイルをキャッシュする" cacheRemoteFilesDescription: "この設定を切っとくと、リモートファイルをキャッシュせず直リンクするようになるで。サーバーの容量は節約できるけど、サムネイルが作られんくなるから通信量が増えるで。" -flagAsBot: "ワイはBotや 🤖" +flagAsBot: "ワイはBotや🤖" flagAsBotDescription: "もしこのアカウントがプログラムによって運用されるんやったら、このフラグをオンにしてたのむで。オンにすると、反応の連鎖を防ぐためのフラグとして他の開発者に役立ったり、Firefishのシステム上での扱いがBotに合ったもんになったりするんやで。" -flagAsCat: "ワイはCatや 🐯" +flagAsCat: "ワイはCatや🐯" flagAsCatDescription: "自分、猫ちゃんならこのフラグつけてみ?" flagShowTimelineReplies: "タイムラインに返信を表示させたる" flagShowTimelineRepliesDescription: "有効にすると、タイムラインに他のユーザー宛ての投稿も表示したるで。" @@ -246,8 +246,8 @@ uploadFromUrl: "URLアップロード" uploadFromUrlDescription: "このURLのファイルをアップロードしたいねん" uploadFromUrlRequested: "アップロードしたい言うといたで" uploadFromUrlMayTakeTime: "アップロード終わるんにちょい時間かかるかもしれへんわ。" -explore: "みつける" -messageRead: "もう読んだ" +explore: "みっける" +messageRead: "もう読まはった" noMoreHistory: "これより過去の履歴はあらへんで" startMessaging: "チャットやるで" nUsersRead: "{n}人が読んでもうた" @@ -317,9 +317,6 @@ dayX: "{day}日" monthX: "{month}月" yearX: "{year}年" pages: "ページ" -integration: "連携" -connectService: "つなげるで" -disconnectService: "切るで" enableLocalTimeline: "ローカルタイムラインを使えるようにする" enableGlobalTimeline: "グローバルタイムラインを使えるようにする" disablingTimelinesInfo: "ここらへんのタイムラインを使えんようにしてしもても、管理者とモデレーターは使えるままになってるで、そうやなかったら不便やからな。" @@ -334,7 +331,7 @@ bannerUrl: "バナー画像のURL" backgroundImageUrl: "背景画像のURL" basicInfo: "基本情報" pinnedUsers: "ピン留めしたユーザー" -pinnedUsersDescription: "「みつける」ページとかにピン留めしたいユーザーをここに書けばええんやで。他ん人との名前は改行で区切ればええんやで。" +pinnedUsersDescription: "「みっける」ページとかにピン留めしときたい兄ちゃんらをここに書いといたらええわ。名前は改行で区切ればええで。" pinnedPages: "ピン留めページ" pinnedPagesDescription: "サーバーのいっちゃん上にピン留めしたいページのパスを、改行で区切って記述してな。" pinnedClipId: "ピン留めするクリップのID" @@ -363,7 +360,7 @@ caseSensitive: "大文字と小文字は別もんや" withReplies: "返信も入れたって" connectedTo: "次のアカウントに繋がっとるで" notesAndReplies: "投稿と返信" -withFiles: "ファイル付いとる" +withFiles: "ファイル付いとるやつ" silence: "サイレンス" silenceConfirm: "サイレンスしよか?" unsilence: "サイレンスやめるで" @@ -389,7 +386,7 @@ securityKeyName: "キーの名前" registerSecurityKey: "セキュリティキーを登録するで" lastUsed: "最後につこうた日" unregister: "登録やめる" -passwordLessLogin: "パスワード無くてもログインできるようにする" +passwordLessLogin: "パスワードなんか無うてもログインでけるようにする" resetPassword: "パスワードをリセット" newPasswordIs: "今度のパスワードは「{password}」や" reduceUiAnimation: "UIの動きやアニメーションを減らす" @@ -398,8 +395,8 @@ notFound: "見つからへんね" notFoundDescription: "指定されたURLに該当するページはあらへんやった。" uploadFolder: "とりあえずアップロードしたやつ置いとく所" cacheClear: "キャッシュをほかす" -markAsReadAllNotifications: "通知はもう全て読んだわっ" -markAsReadAllUnreadNotes: "投稿は全て読んだわっ" +markAsReadAllNotifications: "通知はもうぜんぶ読んだわっ" +markAsReadAllUnreadNotes: "投稿はぜんぶ読んだわっ" markAsReadAllTalkMessages: "チャットはもうぜんぶ読んだわっ" help: "ヘルプ" inputMessageHere: "ここにメッセージ書いてや" @@ -507,8 +504,8 @@ listen: "聴く" none: "なし" showInPage: "ページで表示" popout: "ポップアウト" -volume: "音量" -masterVolume: "全体の音量" +volume: "やかましさ" +masterVolume: "全体的なやかましさ" details: "もっと" chooseEmoji: "絵文字を選ぶ" unableToProcess: "なんか作業が止まってしまったようやね" @@ -527,7 +524,7 @@ scratchpad: "スクラッチパッド" scratchpadDescription: "スクラッチパッドではAiScriptを色々試すことができるんや。Firefishに対して色々できるコードを書いて動かしてみたり、結果を見たりできるで。" output: "出力" script: "スクリプト" -disablePagesScript: "Pagesのスクリプトを無効にしてや" +disablePagesScript: "ページ機能のスクリプトを無効にしてや" updateRemoteUser: "リモートユーザー情報の更新してくれん?" deleteAllFiles: "すべてのファイルを削除" deleteAllFilesConfirm: "ホンマにすべてのファイルを削除するん?消したもんはもう戻ってこんのやで?" @@ -684,7 +681,7 @@ clips: "クリップ" experimentalFeatures: "実験的機能やで" developer: "開発者やで" makeExplorable: "アカウントを見つけやすくするで" -makeExplorableDescription: "オフにすると、「みつける」にアカウントが載らんくなるで。" +makeExplorableDescription: "オフにすると、「みっける」ページに名前が載らんくなるで。" showGapBetweenNotesInTimeline: "タイムライン上の投稿を離して表示するで" duplicate: "複製" left: "左" @@ -714,7 +711,7 @@ saveConfirm: "保存するで?" deleteConfirm: "ホンマに削除するで?" invalidValue: "有効な値じゃないみたいやで。" registry: "レジストリ" -closeAccount: "アカウントを閉鎖する" +closeAccount: "このアカウントにさいならする" currentVersion: "現在のバージョン" latestVersion: "最新のバージョン" youAreRunningUpToDateClient: "今使ってるクライアントが最新やで!" @@ -872,8 +869,8 @@ _registry: domain: "ドメイン" createKey: "キーを作る" _aboutFirefish: - about: "Firefishは、ThatOneCalculatorが2022年にMisskeyをいじって作った、オープンなソースのソフトウェアや。" - contributors: "主な貢献者" + about: "Firefishは、ThatOneCalculatorが2022年にMisskeyをいじって作った、オープンなソースのソフトウエアーや。" + contributors: "ごっつい貢献者" allContributors: "全ての貢献者" source: "ソースコード" translation: "Firefishを翻訳" @@ -1082,8 +1079,9 @@ _visibility: public: 公開 homeDescription: ローカルTLやグローバルTLには流さへん _profile: - name: "名前" + name: "お名前" username: "ユーザー名" + youCanIncludeHashtags: ハッシュタグを書いてもええよ。 _exportOrImport: allNotes: "すべての投稿" followingList: "フォロー" @@ -1441,6 +1439,17 @@ _tutorial: step1_2: 使い始める前に、いくつか設定を済ませまひょ。すぐできますえ。 step2_1: 最初に、あんさんのプロフィールを作りまひょ step2_2: プロフィールを設定しはることで、他ん人があんさんの投稿を見たり、フォローしたりするときの助けになってます。 + step3_2: "あんさんのホームとソーシャルタイムラインは、どなたはんをフォローしはるかで決まります。ほな、いくつかアカウントをフォローしてみまひょ。\n\ + プロフィールの右上にある、まあるい+ボタンをクリックしはるとフォローできますえ。" + step4_1: 投稿しとーみ + step5_1: タイムライン! 文字と写真の宝石箱や~ + step5_2: うちのサーバーでは{timelines}種類のタイムラインをご用意しとります。 + step4_2: 最初は{introduction}に投稿したり、シンプルに「ここは賑やかどすなぁ。ウチはそんなに喋れまへんが、どうぞよろしゅうに」などと投稿しはる方もいてます。 + step5_7: グローバル{icon}タイムラインでは、接続しとるそこいらのサーバーからアレがガーッ流れてきてえらいこっちゃで。 + step5_6: おすすめ{icon}タイムラインでは、うちの管理人がばりおすすめしとるサーバーの投稿を表示させとうよ。 + step5_5: ソーシャル{icon}タイムラインでは、ホームタイムラインとローカルタイムラインの投稿が両方見られてホンマお得やわぁ。 + step5_3: ホーム{icon}タイムラインでは、あんたはんがフォローしてはる兄ちゃんらの投稿が見られまんねん。 + step5_4: ローカル{icon}タイムラインでは、このサーバーにおる人らの投稿を見られますわ。 _postForm: _placeholders: b: なんかおましたか? @@ -1449,7 +1458,7 @@ _postForm: d: なんや言いたいんちゃいますか? f: あんさん書くんを待っとるんどす... a: いまなにしとん? -flagSpeakAsCat: 猫弁で話す +flagSpeakAsCat: 猫弁で喋る flagSpeakAsCatDescription: オンにすると、ワレの投稿の「な」を「にゃ」に変換したるで。 welcomeBackWithName: おおきに、{name}はん migration: アカウントの引っ越し diff --git a/locales/kab-KAB.yml b/locales/kab-KAB.yml index 29eca64c7a..410133fcab 100644 --- a/locales/kab-KAB.yml +++ b/locales/kab-KAB.yml @@ -36,7 +36,6 @@ selectList: "Fren tabdart" youHaveNoLists: "Ulac ɣur-k·m ula d yiwet n tabdart" security: "Taɣellist" remove: "Kkes" -connectService: "Qqen" userList: "Tibdarin" securityKey: "Tasarutt n tɣellist" securityKeyName: "Isem n tsarutt" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index f2e2d57b92..c27077b17f 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -323,9 +323,6 @@ dayX: "{day}일" monthX: "{month}월" yearX: "{year}년" pages: "페이지" -integration: "연동" -connectService: "계정 연동" -disconnectService: "계정 연동 해제" enableLocalTimeline: "로컬 타임라인 활성화" enableGlobalTimeline: "글로벌 타임라인 활성화" disablingTimelinesInfo: "특정 타임라인을 비활성화하더라도 관리자 및 모더레이터는 계속 사용할 수 있습니다." diff --git a/locales/nl-NL.yml b/locales/nl-NL.yml index 394947e05d..a797a98c2d 100644 --- a/locales/nl-NL.yml +++ b/locales/nl-NL.yml @@ -36,11 +36,11 @@ save: "Opslaan" users: "Gebruikers" addUser: "Toevoegen gebruiker" favorite: "Favorieten" -favorites: "Toevoegen aan favorieten" +favorites: "Favorieten" unfavorite: "Verwijderen uit favorieten" favorited: "Toegevoegd aan favorieten." alreadyFavorited: "Al toegevoegd aan favorieten" -cantFavorite: "Kon niet toevoegen aan favorieten" +cantFavorite: "Kon niet toevoegen aan favorieten." pin: "Vastmaken aan profielpagina" unpin: "Losmaken van profielpagina" copyContent: "Kopiëren inhoud" @@ -302,7 +302,7 @@ nsfw: "NSFW" whenServerDisconnected: "Wanneer de verbinding met de server wordt onderbroken" disconnectedFromServer: "Verbinding met de server onderbroken." inMb: "in megabytes" -pinnedNotes: "Vastgemaakte notitie" +pinnedNotes: "Vastgemaakte posts" userList: "Lijsten" aboutFirefish: "Over Firefish" administrator: "Beheerder" @@ -412,7 +412,7 @@ emoji: Emoji selectList: Selecteer een lijst selectAntenna: Selecteer een antenne deleted: Verwijderd -editNote: Bewerk notitie +editNote: Bewerk post edited: 'Bewerkt om {date} {time}' emojis: Emojis emojiName: Emoji naam @@ -483,8 +483,6 @@ accept: Accepteren reject: Afwijzen normal: Normaal pages: Pagina's -integration: Integraties -connectService: Koppelen monthX: '{month}' yearX: '{year}' instanceName: Servernaam @@ -492,7 +490,6 @@ instanceDescription: Server omschrijving maintainerName: Onderhouder maintainerEmail: Onderhouder email tosUrl: Algemene Voorwaarden URL -disconnectService: Ontkoppelen unread: Ongelezen manageGroups: Beheer groepen subscribePushNotification: Pushmeldingen inschakelen @@ -682,3 +679,27 @@ serverLogs: Server logboek deleteAll: Verwijder alles showFixedPostForm: Toon het post formulier bovenaan de tijdlijn newNoteRecived: Er zijn nieuwe posts +pinnedUsersDescription: Lijst gebruikersnamen gescheiden door regeleinden om vast + te pinnen in het tabblad "Verkennen". +silencedInstancesDescription: Geef de hostnames op van de servers die je het zwijgen + wilt opleggen. Accounts op de vermelde servers worden als "Stil" behandeld, kunnen + alleen volgverzoeken doen en kunnen geen lokale accounts vermelden als ze niet worden + gevolgd. Dit heeft geen invloed op de geblokkeerde servers. +searchPlaceholder: Doorzoek Firefish +pinnedPagesDescription: Voer de paden in van de pagina's die je aan de bovenste pagina + van deze server wilt vastmaken, gescheiden door regeleinden. +_permissions: + "read:favorites": Lijst van uw favorieten + "write:favorites": Beheer uw favorieten +clipsDesc: Paperclips zijn deelbare gebundelde favorieten. Je kunt paperclips maken + vanuit het menu van individuele posts. +selectChannel: Selecteer een kanaal +removeReaction: Uw reactie verwijderen +antennasDesc: "Antennes geven nieuwe berichten weer die voldoen aan de criteria die + je hebt ingesteld!\nZe zijn toegankelijk via de pagina Tijdlijnen." +pinnedClipId: ID van de paperclip om vast te pinnen +hiddenTagsDescription: 'Vermeld de hashtags (zonder #) van de hashtags die je wilt + verbergen voor trending en verkennen. Verborgen hashtags zijn nog steeds op andere + manieren te ontdekken.' +listsDesc: Met lijsten kun je tijdlijnen aanmaken met gespecificeerde gebruikers. + Ze zijn toegankelijk via de pagina Tijdlijnen. diff --git a/locales/no-NO.yml b/locales/no-NO.yml index fbe8904b9e..0fe80ad4da 100644 --- a/locales/no-NO.yml +++ b/locales/no-NO.yml @@ -225,8 +225,6 @@ instanceDescription: Tjenerbeskrivelse maintainerName: Administrator maintainerEmail: Administrator-epost monthX: '{month}' -connectService: Koble til -disconnectService: Koble fra enableLocalTimeline: Aktiver lokal tidslinje enableRegistration: Tillat registrering av nye brukere invite: Inviter @@ -449,7 +447,6 @@ watch: Følg med på thisMonth: Måned today: I dag dayX: '{day}' -integration: Integrasjoner yearX: '{year}' pages: Sider enableRecaptcha: Slå på reCAPTCHA diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index e0af7d72ec..1369babee2 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -1,6 +1,6 @@ _lang_: "Polski" -headlineFirefish: "Otwartoźródłowa, zdecentralizowana sieć społecznościowa, która zawsze - będzie darmowa! 🚀" +headlineFirefish: "Otwartoźródłowa, zdecentralizowana sieć społecznościowa, która + zawsze będzie darmowa! 🚀" introFirefish: "Hej! Firefish to otwartoźródłowa oraz zdecentralizowana sieć społecznościowa, która zawsze będzie darmowa! 🚀" monthAndDay: "{month}-{day}" @@ -94,7 +94,7 @@ privacy: "Prywatność" makeFollowManuallyApprove: "Prośby o możliwość obserwacji wymagają zatwierdzenia" defaultNoteVisibility: "Domyślna widoczność" follow: "Obserwuj" -followRequest: "Poproś o możliwość obserwacji" +followRequest: "Poproś o możliwość obserwowania" followRequests: "Prośby o możliwość obserwacji" unfollow: "Przestań obserwować" followRequestPending: "Oczekująca prośba o możliwość obserwacji" @@ -147,9 +147,9 @@ cacheRemoteFilesDescription: "Gdy ta opcja jest wyłączona, zdalne pliki są ł bezpośrednio ze zdalnego serwera. Wyłączenie tej opcji zmniejszy użycie powierzchni dyskowej, ale zwiększy transfer, ponieważ miniaturki nie będą generowane." flagAsBot: "To konto jest botem" -flagAsBotDescription: "Jeżeli ten kanał jest kontrolowany przez jakiś program, ustaw - tę opcję. Jeżeli włączona, będzie działać jako flaga informująca innych programistów, - aby zapobiegać nieskończonej interakcji z różnymi botami i dostosowywać wewnętrzne +flagAsBotDescription: "Ustaw tę opcję ten jeśli kanał kontrolowany jest przez jakiś + program. Po włączeniu, będzie działać jako flaga informująca innych programistów, + aby zapobiegać nieskończonej interakcji pomiędzy innymi botami i dostosowywać wewnętrzne systemy Firefish, traktując konto jako bota." flagAsCat: "Czy jesteś kotem? 😺" flagAsCatDescription: "Dostaniesz kocie uszka, oraz będziesz mówić jak kot!" @@ -158,7 +158,7 @@ autoAcceptFollowed: "Automatycznie przyjmuj prośby o możliwość obserwacji od których obserwujesz" addAccount: "Dodaj konto" loginFailed: "Nie udało się zalogować" -showOnRemote: "Zobacz na zdalnym serwerze" +showOnRemote: "Zobacz oryginalną treść" general: "Ogólne" wallpaper: "Tapeta" setWallpaper: "Ustaw tapetę" @@ -211,7 +211,7 @@ noUsers: "Brak użytkowników" editProfile: "Edytuj profil" noteDeleteConfirm: "Czy na pewno chcesz usunąć ten wpis?" pinLimitExceeded: "Nie możesz przypiąć więcej wpisów" -intro: "Zakończono instalację Firefish! Utwórz konto administratora." +intro: "Zakończono instalację Firefish! Utwórz teraz konto administratora." done: "Gotowe" processing: "Przetwarzanie" preview: "Podgląd" @@ -299,11 +299,11 @@ emptyDrive: "Dysk jest pusty" emptyFolder: "Ten katalog jest pusty" unableToDelete: "Nie można usunąć" inputNewFileName: "Wprowadź nową nazwę pliku" -inputNewDescription: "Proszę wpisać nowy napis" +inputNewDescription: "Podaj nowy napis" inputNewFolderName: "Wprowadź nową nazwę katalogu" circularReferenceFolder: "Katalog docelowy jest podkatalogiem katalogu, który chcesz przenieść." -hasChildFilesOrFolders: "Ponieważ ten katalog nie jest pusty, nie może być usunięty." +hasChildFilesOrFolders: "Katalog nie może być usunięty ponieważ nie jest pusty." copyUrl: "Skopiuj adres URL" rename: "Zmień nazwę" avatar: "Awatar" @@ -331,9 +331,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Strony" -integration: "Integracje" -connectService: "Połącz" -disconnectService: "Rozłącz" enableLocalTimeline: "Włącz lokalną oś czasu" enableGlobalTimeline: "Włącz globalną oś czasu" disablingTimelinesInfo: "Administratorzy i moderatorzy będą zawsze mieć dostęp do @@ -581,8 +578,8 @@ disablePlayer: "Zamknij odtwarzacz wideo" expandTweet: "Rozwiń tweet" themeEditor: "Edytor motywu" description: "Opis" -describeFile: "Dodaj podpis" -enterFileDescription: "Wprowadź napis" +describeFile: "Dodaj opis" +enterFileDescription: "Wprowadź opis" author: "Autor" leaveConfirm: "Są niezapisane zmiany. Czy chcesz je odrzucić?" manage: "Zarządzanie" @@ -619,7 +616,7 @@ emptyToDisableSmtpAuth: "Pozostaw adres e-mail i hasło puste, aby wyłączyć w SMTP" smtpSecureInfo: "Wyłącz, jeżeli używasz STARTTLS" testEmail: "Przetestuj dostarczanie wiadomości e-mail" -wordMute: "Wyciszenie słowa" +wordMute: "Wyciszenie słów i języków" instanceMute: "Wyciszenie serwera" userSaysSomething: "{name} powiedział* coś" makeActive: "Aktywuj" @@ -694,8 +691,7 @@ no: "Nie" driveFilesCount: "Liczba plików na dysku" driveUsage: "Użycie przestrzeni dyskowej" noCrawle: "Odrzuć indeksowanie przez crawlery" -noCrawleDescription: "Proś wyszukiwarki internetowe, aby nie indeksowały Twojego profilu, - wpisów, stron itd." +noCrawleDescription: "Proś wyszukiwarki internetowe, aby nie indeksowały Twoich treści." lockedAccountInfo: "Dopóki nie ustawisz widoczności wpisu na \"Obserwujący\", twoje wpisy będą mogli widzieć wszyscy, nawet jeśli ustawisz manualne zatwierdzanie obserwujących." alwaysMarkSensitive: "Oznacz domyślnie jako NSFW" @@ -762,7 +758,7 @@ useReactionPickerForContextMenu: "Otwórz wybornik reakcji prawym kliknięciem" typingUsers: "{users} pisze/ą" jumpToSpecifiedDate: "Przejdź do określonej daty" showingPastTimeline: "Obecnie wyświetla starą oś czasu" -clear: "Wróć" +clear: "Wyczyść" markAllAsRead: "Oznacz wszystkie jako przeczytane" goBack: "Wróć" unlikeConfirm: "Na pewno chcesz usunąć polubienie?" @@ -803,7 +799,7 @@ gallery: "Galeria" recentPosts: "Ostatnie wpisy" popularPosts: "Popularne wpisy" shareWithNote: "Udostępnij z wpisem" -ads: "Reklamy" +ads: "Banery" expiration: "Ankieta kończy się" memo: "Notatki" priority: "Priorytet" @@ -855,7 +851,7 @@ ffVisibility: "Widoczność obserwowanych/obserwujących" ffVisibilityDescription: "Pozwala skonfigurować, kto może zobaczyć, kogo obserwujesz i kto Cię obserwuje." continueThread: "Kontynuuj wątek" -deleteAccountConfirm: "Spowoduje to nieodwracalne usunięcie Twojego konta. Kontynuować?" +deleteAccountConfirm: "Spowoduje to nieodwracalne usunięcie tego konta. Kontynuować?" incorrectPassword: "Nieprawidłowe hasło." voteConfirm: "Potwierdzić swój głos na \"{choice}\"?" hide: "Ukryj" @@ -1004,8 +1000,8 @@ _nsfw: force: "Ukrywaj wszystkie media" _mfm: cheatSheet: "Ściąga MFM" - intro: "MFM jest językiem składniowym używanym przez m.in. Firefish, forki *key (w - tym Firefish), oraz Akkomę, który może być użyty w wielu miejscach. Tu znajdziesz + intro: "MFM jest językiem składniowym używanym przez m.in. Firefish, forki *key + (w tym Firefish), oraz Akkomę, który może być użyty w wielu miejscach. Tu znajdziesz listę wszystkich możliwych elementów składni MFM." dummy: "Firefish rozszerza świat Fediwersum" mention: "Wspomnij" @@ -1253,7 +1249,7 @@ _tutorial: innej połączonej instancji." step6_1: "Więc, czym to jest to miejsce?" step6_2: "Cóż, nie dołączył*ś po prostu do Firefish. Dołączył*ś do portalu do Fediverse, - połączonej sieci tysięcy serwerów, zwanych instancjami." + sieci tysięcy połączonych ze sobą serwerów, zwanych instancjami." step6_3: "Każdy serwer działa w inny sposób, i nie wszystkie serwery używają Firefish. Ten jednak używa! Jest to trochę skomplikowane, ale w krótkim czasie załapiesz o co chodzi." @@ -1819,8 +1815,8 @@ instanceSecurity: Bezpieczeństwo serwera privateMode: Tryb prywatny allowedInstances: Dopuszczone serwery recommended: Polecane -allowedInstancesDescription: Hosty serwerów, które mają być dopuszczone do federacji, - każdy oddzielony nowym wierszem (dotyczy tylko trybu prywatnego). +allowedInstancesDescription: Hosty serwerów, które mają być dopuszczone do federacji. + Każdy oddzielony nowym wierszem (dotyczy tylko trybu prywatnego). seperateRenoteQuote: Oddziel przyciski podbicia i cytowania refreshInterval: 'Częstotliwość aktualizacji ' slow: Wolna @@ -1919,14 +1915,14 @@ sendErrorReportsDescription: "Gdy ta opcja jest włączona, szczegółowe inform błędach będą udostępnianie z Firefish gdy wystąpi problem, pomagając w ulepszaniu Firefish.\nZawrze to informacje takie jak wersja twojego systemu operacyjnego, przeglądarki, Twoja aktywność na Firefish itd." -privateModeInfo: Gdy ta opcja jest włączona, tylko serwery z białej listy mogą federować - się z twoim serwerem. Wszystkie posty będą ukryte publicznie. +privateModeInfo: Gdy ta opcja jest włączona, tylko serwery z listy serwerów dozwolonych + mogą federować się z twoim serwerem. Żadne posty nie będą publicznie dostępne. oneHour: Godzina oneDay: Dzień oneWeek: Tydzień recommendedInstances: Polecane serwery recommendedInstancesDescription: Polecane serwery, mające pojawić się w odpowiedniej - osi czasu, oddzielane nowymi liniami. NIE dodawaj “https://”, TYLKO samą domenę. + osi czasu, oddzielane nowymi liniami. rateLimitExceeded: Przekroczono ratelimit cropImage: Kadruj zdjęcie cropImageAsk: Czy chcesz skadrować to zdjęcie? @@ -1951,7 +1947,7 @@ activeEmailValidationDescription: Włącza ściślejszą walidację adresów e-m obejmuje sprawdzanie adresów jednorazowych oraz tego, czy rzeczywiście można się z nim komunikować. Jeśli wyłączone, walidowany jest tylko format wiadomości e-mail. shuffle: Losuj -showAds: Pokazuj reklamy +showAds: Pokazuj banery enterSendsMessage: Wciśnij Enter w komunikatorze, by wysłać wiadomość (domyślnie – Ctrl + Enter) adminCustomCssWarn: To ustawienie powinno być używane tylko pod warunkiem, że wiesz @@ -2015,7 +2011,7 @@ silencedInstancesDescription: Wypisz nazwy hostów serwerów, które chcesz wyci cannotUploadBecauseExceedsFileSizeLimit: Ten plik nie mógł być przesłany, ponieważ jego wielkość przekracza dozwolony limit. sendModMail: Wyślij Powiadomienie Moderacyjne -searchPlaceholder: Szukaj Firefish +searchPlaceholder: Szukaj w Firefish jumpToPrevious: Przejdź do poprzedniej sekcji listsDesc: Listy umożliwiają tworzenie osi czasu z określonymi użytkownikami. Dostęp do nich można uzyskać na stronie osi czasu. @@ -2031,3 +2027,15 @@ newer: nowsze older: starsze cw: Ostrzeżenie zawartości removeReaction: Usuń reakcję +reactions: Reakcje +clipsDesc: Spinki to skategoryzowane zakładki, które można udostępniać. Możesz utworzyć + spinkę dla każdego wpisu w menu wpisu. +swipeOnMobile: Pozwalaj na przeciąganie pomiędzy stronami +image: Obrazek +xl: XL +replies: Odpowiedzi +video: Film +quotes: Cytaty +clickToShowPatterns: Kliknij aby pokazać wzory modułów +renotes: Boosty +audio: Dźwięk diff --git a/locales/pt-PT.yml b/locales/pt-PT.yml index 574afa851f..092b0ac751 100644 --- a/locales/pt-PT.yml +++ b/locales/pt-PT.yml @@ -1,4 +1,4 @@ -_lang_: "Português" +_lang_: "Português (Portugal)" headlineFirefish: "Uma rede ligada por notas" introFirefish: "Bem-vindo! Firefish é um serviço de microblogue descentralizado de código aberto, gratuito para sempre! 🚀" @@ -120,6 +120,7 @@ rememberNoteVisibility: "Lembrar das configurações de visibilidade de notas" attachCancel: "Remover anexo" markAsSensitive: "Marcar como sensível" unmarkAsSensitive: "Desmarcar como sensível" +clickToShowPatterns: "Clique para mostrar os padrões do módulo" enterFileName: "Digite o nome do ficheiro" mute: "Silenciar" unmute: "Dessilenciar" @@ -338,9 +339,6 @@ dayX: " Dia {day}" monthX: "mês de {month}" yearX: "Ano {year}" pages: "Páginas" -integration: "Integração" -connectService: "Conectar" -disconnectService: "Desconectar" enableLocalTimeline: "Ativar linha do tempo local" enableGlobalTimeline: "Ativar linha do tempo global" disablingTimelinesInfo: "Se você desabilitar essas linhas do tempo, administradores diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml index f8fb651182..deaa2f32d9 100644 --- a/locales/pt_BR.yml +++ b/locales/pt_BR.yml @@ -1,6 +1,6 @@ +_lang_: Português (Brasil) username: Nome de usuário ok: OK -_lang_: Inglês headlineFirefish: Uma plataforma de mídia social descentralizada e de código aberto que é gratuita para sempre! 🚀 search: Pesquisar diff --git a/locales/ro-RO.yml b/locales/ro-RO.yml index e9fa49f6c7..51c7b30810 100644 --- a/locales/ro-RO.yml +++ b/locales/ro-RO.yml @@ -316,9 +316,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Pagini" -integration: "Integrare" -connectService: "Conectează" -disconnectService: "Deconectează" enableLocalTimeline: "Activează cronologia locală" enableGlobalTimeline: "Activeaza cronologia globală" disablingTimelinesInfo: "Administratorii și Moderatorii vor avea mereu access la toate cronologiile, chiar dacă nu sunt activate." diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index fada843e7a..cd6bf75cf2 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -335,9 +335,6 @@ dayX: "{day} день" monthX: "{month} месяц" yearX: "{year} год" pages: "Страницы" -integration: "Интеграции" -connectService: "Подключиться" -disconnectService: "Отключиться" enableLocalTimeline: "Включить локальную ленту" enableGlobalTimeline: "Включить глобальную ленту" disablingTimelinesInfo: "У администраторов и модераторов есть доступ ко всем лентам, @@ -2154,3 +2151,14 @@ deletePasskeysConfirm: Это действие безвозвратно удал на этом аккаунте. Продолжить? inputNotMatch: Введённые данные не совпадают addRe: Добавить "re:" в начале комментария в ответ на запись с предупреждением о содержимом +detectPostLanguage: Автоматическое определение языка и отображение кнопки перевода + для сообщений на иностранных языках +indexableDescription: Разрешить встроенной поисковой системе искать ваши публичные + записи +reactions: Реакции +indexable: Индексируемый(-ая) +languageForTranslation: Язык перевода поста +replies: Ответы +quotes: Цитаты +clickToShowPatterns: Нажмите, чтобы показать модуль шаблонов +renotes: Репосты diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index cdf0c807d8..70609220be 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -317,9 +317,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Stránky" -integration: "Integrácia" -connectService: "Pripojiť" -disconnectService: "Odpojiť" enableLocalTimeline: "Povoliť lokálnu časovú os" enableGlobalTimeline: "Povoliť globálnu časovú os" disablingTimelinesInfo: "Administrátori a moderátori majú vždy prístup ku všetkým časovým osiam, aj keď sú vypnuté." diff --git a/locales/sv-SE.yml b/locales/sv-SE.yml index 6c28196f11..7541467d2d 100644 --- a/locales/sv-SE.yml +++ b/locales/sv-SE.yml @@ -365,8 +365,6 @@ today: Idag dayX: '{day}' monthX: '{month}' yearX: '{year}' -connectService: Anslut -disconnectService: Bortkoppla enableLocalTimeline: Anslut till lokal tidslinje invite: Bjud in driveCapacityPerLocalAccount: Enhetens kapacitet per lokal användare @@ -779,7 +777,6 @@ serverLogs: Serverloggar deleteAll: Radera alla removeAllFollowing: Sluta följa alla följda användare medium: Mellan -integration: Integreringar xl: XL desktop: Skrivbord createNew: Skapa nya diff --git a/locales/th-TH.yml b/locales/th-TH.yml index 4d34471cae..8f3e2595e3 100644 --- a/locales/th-TH.yml +++ b/locales/th-TH.yml @@ -327,9 +327,6 @@ dayX: "{วัน}" monthX: "{เดือน}" yearX: "{ปี}" pages: "หน้า" -integration: "รวบรวม" -connectService: "เชื่อมต่อ" -disconnectService: "ตัดการเชื่อมต่อ" enableLocalTimeline: "เปิดใช้งานไทม์ไลน์ในพื้นที่" enableGlobalTimeline: "เปิดใช้งานไทม์ไลน์ทั่วโลก" disablingTimelinesInfo: "ผู้ดูแลระบบและผู้ควบคุมจะสามารถเข้าถึงไทม์ไลน์ทั้งหมด ถึงแม้ว่าจะไม่ได้เปิดใช้งานก็ตาม" diff --git a/locales/tr-TR.yml b/locales/tr-TR.yml index bda13aa909..5e71dea263 100644 --- a/locales/tr-TR.yml +++ b/locales/tr-TR.yml @@ -16,10 +16,10 @@ noNotifications: "Bildirim bulunmuyor" settings: "Ayarlar" basicSettings: "Temel Ayarlar" otherSettings: "Diğer Ayarlar" -openInWindow: "Bir pencere ile aç" +openInWindow: "Açılır pencerede aç" profile: "Profil" -timeline: "Zaman çizelgesi" -noAccountDescription: "Bu kullanıcı henüz kendi hakkında kısmını yazmadı." +timeline: "Akış" +noAccountDescription: "Bu kullanıcı henüz \"hakkında\" kısmını yazmadı." login: "Giriş Yap" logout: "Çıkış Yap" signup: "Kayıt Ol" @@ -29,7 +29,7 @@ addUser: "Kullanıcı Ekle" favorite: "Favorilere ekle" favorites: "Favoriler" unfavorite: "Favorilerden Kaldır" -favorited: "Favorilerime eklendi." +favorited: "Favorilere eklendi." alreadyFavorited: "Zaten favorilerinizde kayıtlı." pin: "Sabitlenmiş" unpin: "Sabitlemeyi kaldır" @@ -41,9 +41,9 @@ deleteAndEditConfirm: "Bu gönderiyi silip yeniden düzenlemek istiyor musunuz? ilişkin tüm tepkiler, destekler ve yanıtlar silinecektir." addToList: "Listeye ekle" sendMessage: "Mesaj Gönder" -copyUsername: "Kullanıcı Adını Kopyala" +copyUsername: "Kullanıcı Adını kopyala" searchUser: "Kullanıcıları ara" -pinned: "Sabitlenmiş" +pinned: "Profile sabitle" remove: "Sil" smtpUser: "Kullanıcı Adı" smtpPass: "Şifre" @@ -240,7 +240,7 @@ instance: Sunucu fetchingAsApObject: Fediverse'den çekiliyor removeReaction: Tepkini sil rememberNoteVisibility: Gönderi görünürlüğü ayarlarını hatırla -attachCancel: Eklentiyi kaldır +attachCancel: Ek'i kaldır suspend: Askıya Al unsuspend: Askıya Almayı Kaldır unmute: Susturmayı Kaldır @@ -248,13 +248,13 @@ blockConfirm: Bu hesabı engellemek istediğinize emin misiniz? unblockConfirm: Bu hesabın engelini kaldırmak istediğinize emin misiniz? settingGuide: Tavsiye edilen ayarlar cacheRemoteFilesDescription: Bu ayar devre dışı bırakıldığında, uzak dosyalar doğrudan - uzak sunucudan yüklenir. Bunun devre dışı bırakılması depolama kullanımını azaltacak, - ancak küçük resimler oluşturulmayacağından trafiği artıracaktır. + dosyanın bulunduğu sunucudan yüklenir. Bunun devre dışı bırakılması depolama kullanımını + azaltacak, ancak küçük resimler oluşturulmayacağından trafiği artıracaktır. flagAsCatDescription: Kedi kulaklarına sahip olacak ve bir kedi gibi konuşacaksın! flagSpeakAsCat: Kedi gibi konuş setWallpaper: Arkaplanı ayarla removeWallpaper: Arkaplanı sil -operations: Operasyonlar +operations: İşlemler clearCachedFiles: Ön belleği temizle clearCachedFilesConfirm: Önbelleğe alınan tüm uzak dosyaları silmek istediğinizden emin misiniz? @@ -285,7 +285,7 @@ pinnedPagesDescription: Bu sunucunun üst kısmına sabitlemek istediğiniz Sayf yollarını satır sonundan ayırarak girin. enableHcaptcha: hCaptcha'yı Aktif Et notifyAntenna: Yeni gönderileri bildir -recentlyUpdatedUsers: En son aktif kullanıcılar +recentlyUpdatedUsers: En son aktif olan kullanıcılar about: Hakkında twoStepAuthentication: İki-adımlı doğrulama securityKeyName: Anahtar ismi @@ -357,13 +357,13 @@ whatIsNew: Değişiklikleri göster translate: Çevir breakFollow: Takipçiyi sil breakFollowConfirm: Takipçiyi kaldırmak istediğinizden emin misiniz? -unfollowConfirm: "{name}'i takibi bırakmak istediğinizden emin misiniz?" +unfollowConfirm: "{name} kullanıcısını takip etmeyi bırakmak istediğinizden emin misiniz?" importRequested: Bir içe aktarma isteğinde bulundunuz. Bu biraz zaman alabilir. somethingHappened: Bir hata ile karşılaşıldı retry: Tekrar Dene youShouldUpgradeClient: Bu sayfayı görüntülemek için, lütfen istemcinizi yenileyin. reactionSetting: Tepki seçicide gösterilecek tepkiler -unmarkAsSensitive: NSFW işaretini kaldır +unmarkAsSensitive: NSFW (Müstehcen İçerik) işaretini kaldır enterFileName: Dosya adı gir noJobs: Hiçbir iş yok instanceFollowing: Sunucuda takip ediliyor @@ -481,8 +481,8 @@ mention: Bahset download: İndir lists: Listeler noLists: Hiç listen yok -cantRenote: Bu gönderi yükseltilemez. -cantReRenote: Bir yükseltme tekrar yükseltilemez. +cantRenote: Bu gönderi desteklenemez. +cantReRenote: Bir destek tekrardan desteklenemez. mute: Sustur block: Engelle editWidgetsExit: Tamamlandı @@ -636,10 +636,10 @@ reactionSettingDescription2: Yeniden sıralamak için sürükleyin, silmek için eklemek için "+"ya basın. you: Sen clickToShow: Görmek için tıkla -sensitive: NSFW +sensitive: NSFW (Müstehcen İçerik) add: Ekle reaction: Tepkiler -markAsSensitive: NSFW olarak işaretle +markAsSensitive: NSFW (Müstehcen İçerik) olarak işaretle unblock: Engeli Kaldır addAccount: Hesap ekle network: İnternet @@ -722,11 +722,11 @@ moveAccountDescription: Bu süreç geri döndürülemez. Taşımadan önce yeni şeklinde biçimlendirilmiş hesabın etiketini girin emojis: Emoji flagAsCat: Kedi misin? 😺 -selectChannel: Kanal seç +selectChannel: Bir kanal seç emojiName: Emoji adı showOnRemote: Orijinal sayfayı aç flagSpeakAsCatDescription: Gönderileriniz kedi modundayken miyavdirilecektir -flagShowTimelineReplies: Yanıtları zaman çizelgesinde göster +flagShowTimelineReplies: Yanıtları akışta göster silenceThisInstance: Bu sunucuyu sustur proxyAccountDescription: Vekil hesabı, belirli koşullar altında kullanıcılar için uzaktan takipçi işlevi gören bir hesaptır. Örneğin, bir kullanıcı listeye bir uzak @@ -760,7 +760,6 @@ banner: Banner nsfw: NSFW doNothing: Görmezden Gel watch: İzle -connectService: Bağlan registration: Kayıt hcaptcha: hCaptcha pinnedNotes: Sabitlenmiş gönderiler @@ -845,8 +844,8 @@ pageLoadErrorDescription: Bu problem genelde ağ hataları veya tarayıcının kaynaklanır. Önbelleği temizlemeyi deneyin ve biraz bekledikten sonra tekrar deneyin. quote: Alıntıla pinnedNote: Sabitlenmiş gönderi -renote: Yükselt -unrenote: Yükseltmeyi geri al +renote: Destekle +unrenote: Desteklemeyi geri al emojiUrl: Emoji URL'si suspendConfirm: Bu hesabı askıya almak istediğinize emin misiniz? addEmoji: Ekle @@ -858,7 +857,7 @@ wallpaper: Arkaplan searchWith: 'Arat: {q}' youHaveNoLists: Hiçbir listen yok followConfirm: '{name} kullanıcısını takip etmek istediğine emin misin?' -metadata: Metadata +metadata: Üstveri monitor: Monitör jobQueue: İş Sırası noUsers: Kullanıcılar bulunamadı @@ -885,7 +884,6 @@ deleteFolder: Bu klasörü sil addFile: Dosya ekle dayX: '{day}' enableLocalTimeline: Yerel zaman çizgisini aktif et -disconnectService: Bağlantıyı kes enableGlobalTimeline: Global zaman çizgisini aktif et enableRegistration: Yeni kullanıcı kaydını aktif et invite: Davet et @@ -1013,7 +1011,7 @@ incorrectPassword: Yanlış şifre. voteConfirm: '"{choice}" için oyunuzu onaylıyor musunuz?' failedToFetchAccountInformation: Hesap bilgileri getirilemedi rateLimitExceeded: Hız limiti aşıldı -renotedBy: '{user} Yükseltti' +renotedBy: '{user} destekledi' host: Host objectStorage: Nesne Depolaması objectStorageUseSSLDesc: API bağlantıları için HTTPS kullanmayacaksanız bunu kapatın @@ -1026,8 +1024,8 @@ verificationEmailSent: Bir doğrulama maili gönderildi. Doğrulamayı tamamlama lütfen verilen bağlantıyı takip edin. hashtags: Etiketler resolved: Çözüldü -flagShowTimelineRepliesDescription: Açıksa, kullanıcıların zaman çizelgesindeki diğer - kullanıcıların gönderilerine verdiği yanıtları gösterir. +flagShowTimelineRepliesDescription: Açıksa, kullanıcıların akıştaki diğer kullanıcıların + gönderilerine verdiği yanıtları gösterir. clearQueueConfirmText: Kuyrukta kalan teslim edilmemiş gönderiler birleştirilmeyecektir. Genellikle bu işleme gerek yoktur. image: Resim @@ -1040,8 +1038,8 @@ unsuspendConfirm: Bu hesabın askıya almasını kaldırmak istediğinize emin m selectList: Liste seç editWidgets: Widget'ları düzenle showEmojisInReactionNotifications: Tepki bildirimlerinde emojileri göster -renoteMute: Yükseltmeleri sustur -renoteUnmute: Yükseltmeleri susturmayı kaldır +renoteMute: Desteklemeleri sustur +renoteUnmute: Desteklemelerde ki susturmayı kaldır loginFailed: Giriş yapılamadı proxyAccount: Vekil Hesap selectUser: Kullanıcı seç @@ -1068,7 +1066,7 @@ hideThisNote: Bu gönderiyi gizle file: Dosya enableEmojiReactions: Emoji tepkilerini aç cw: İçerik uyarısı -makeFollowManuallyApprove: Onay gerektiren takip istekleri +makeFollowManuallyApprove: Onayınızı gerektiren takip istekleri today: Bugün enableRecommendedTimeline: Tavsiye edilen zaman çizgisini aktive et state: Durum @@ -1165,7 +1163,7 @@ indexFromDescription: Her gönderiyi dizine eklemek için boş bırakın indexNotice: Şimdi indeksleniyor. Bu muhtemelen biraz zaman alacaktır, lütfen sunucunuzu en az bir saat yeniden başlatmayın. customKaTeXMacro: Özel KaTeX makroları -directNotes: Direkt Mesajlar +directNotes: Özel Mesajlar import: İçeri Aktar export: Dışarı Aktar mentions: Bahsetmeler @@ -1173,8 +1171,8 @@ files: Dosyalar driveFileDeleteConfirm: '"{name}" dosyasını silmek istediğinizden emin misiniz? Dosyayı "Ek" olarak içeren tüm gönderilerden kaldırılacaktır.' createList: Liste oluştur -listsDesc: Listeler, belirtilen kullanıcılarla zaman çizelgesi oluşturmanıza olanak - tanır. Zaman Çizelgesi sayfasından erişilebilirler. +listsDesc: Listeler, belirtilen kullanıcıların içeriklerini içeren akışlar oluşturmanıza + olanak tanır. Akış sayfasından erişilebilirler. note: Gönder enterListName: Liste için isim gir unfollow: Takipten Çık @@ -1183,14 +1181,14 @@ followRequestPending: Takip isteği bekleniyor enterEmoji: Bir emoji gir followRequest: Takip İsteği followRequests: Takip istekleri -renoted: Yükseldi. +renoted: Desteklendi. emoji: Emoji cacheRemoteFiles: Uzak dosyaları önbelleğe al flagAsBot: Bu hesabı robot olarak işaretle flagAsBotDescription: Bu hesap bir program tarafından kontrol ediliyorsa bu seçeneği etkinleştirin. Etkinleştirilirse, diğer geliştiricilerin botlarıyla sonsuz etkileşim zincirlerinin önlemesi ve Firefish'in dahili sistemlerinin bu hesabı bir bot olarak - ele alacak şekilde ayarlaması için bir bayrak görevi görür. + ele alacak şekilde ayarlaması için bir işaret görevi görür. clearQueue: Sırayı Temizle hiddenTags: Gizlenmiş Etiketler done: Tamamlandı @@ -1206,7 +1204,6 @@ location: Konum registeredDate: Katılım tarihi yearX: '{year}' pages: Sayfalar -integration: Entegrasyonlar antennasDesc: "Antenler, belirlediğiniz kriterlere uyan yeni gönderiler görüntüler!\n  Zaman çizelgeleri sayfasından erişilebilirler." notesAndReplies: Gönderiler ve yanıtlar @@ -2156,3 +2153,4 @@ importZip: ZIP içe aktar indexable: Endekslenebilir languageForTranslation: Çeviri sonrası dili confirm: Onayla +clickToShowPatterns: Modülün örüntülerini göstermek için tıklayın diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml index f1c9dab4b4..701078ce6d 100644 --- a/locales/uk-UA.yml +++ b/locales/uk-UA.yml @@ -336,9 +336,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Сторінки" -integration: "Інтеграції" -connectService: "Під’єднати" -disconnectService: "Відключитися" enableLocalTimeline: "Увімкнути локальну стрічку" enableGlobalTimeline: "Увімкнути глобальну стрічку" disablingTimelinesInfo: "Адміністратори та модератори завжди мають доступ до всіх diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index 297be51e1c..23af18e722 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -338,9 +338,6 @@ dayX: "{day}" monthX: "{month}" yearX: "{year}" pages: "Trang" -integration: "Tương tác" -connectService: "Kết nối" -disconnectService: "Ngắt kết nối" enableLocalTimeline: "Bật bảng tin máy chủ" enableGlobalTimeline: "Bật bảng tin liên hợp" disablingTimelinesInfo: "Quản trị viên và Kiểm duyệt viên luôn có quyền truy cập mọi diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 66983ae464..dba8d63682 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -12,7 +12,7 @@ ok: "好" gotIt: "知道了!" cancel: "取消" enterUsername: "输入用户名" -renotedBy: "转发自 {user}" +renotedBy: "{user} 转发了" noNotes: "没有帖子" noNotifications: "没有通知" instance: "服务器" @@ -49,6 +49,7 @@ sendMessage: "发送" copyUsername: "复制用户名" searchUser: "搜索用户" reply: "回复" +replies: "回复" loadMore: "加载更多" showMore: "查看更多" showLess: "关闭" @@ -58,7 +59,7 @@ followRequestAccepted: "关注请求已通过" mention: "提及" mentions: "提及" directNotes: "私信" -importAndExport: "导入/导出数据" +importAndExport: "导入 / 导出数据" import: "导入" export: "导出" files: "文件" @@ -69,7 +70,7 @@ exportRequested: "导出请求已提交,这可能需要花一些时间,导 importRequested: "导入请求已提交,这可能需要花一点时间。" lists: "列表" noLists: "列表为空" -note: "帖子" +note: "发帖" notes: "帖子" following: "关注中" followers: "关注者" @@ -94,11 +95,13 @@ unfollow: "取消关注" followRequestPending: "关注请求待批准" enterEmoji: "输入表情符号" renote: "转发" +renotes: "转发" unrenote: "取消转发" renoted: "已转发。" cantRenote: "此帖子无法被转发。" cantReRenote: "转发无法被再次转发。" quote: "引用" +quotes: "引用" pinnedNote: "已置顶的帖子" pinned: "置顶" you: "您" @@ -106,6 +109,7 @@ clickToShow: "点击以显示" sensitive: "敏感内容" add: "添加" reaction: "回应" +reactions: "回应" enableEmojiReaction: "启用表情符号回应" showEmojisInReactionNotifications: "在回应通知中显示表情符号" reactionSetting: "在回应选择器中显示的回应" @@ -243,7 +247,7 @@ saved: "已保存" messaging: "聊天" upload: "本地上传" keepOriginalUploading: "保留原图" -keepOriginalUploadingDescription: "上传图片时保留原始图片。如果关闭,会在上传时生成一张用于 web 发布的图片。" +keepOriginalUploadingDescription: "上传图片时保留原始图片。如果关闭,会在上传时生成一张用于 Web 发布的图片。" fromDrive: "从网盘中" fromUrl: "从 URL" uploadFromUrl: "从 URL 上传" @@ -321,9 +325,6 @@ dayX: "{day} 日" monthX: "{month} 月" yearX: "{year} 年" pages: "页面" -integration: "整合" -connectService: "连接" -disconnectService: "断开连接" enableLocalTimeline: "启用本地时间线功能" enableGlobalTimeline: "启用全局时间线" disablingTimelinesInfo: "管理员和监察员将始终拥有对所有时间线的访问权,即使它们没有被启用。" @@ -486,15 +487,16 @@ hideThisNote: "隐藏这条帖子" showFeaturedNotesInTimeline: "在时间线上显示热门推荐" objectStorage: "对象存储" useObjectStorage: "使用对象存储" -objectStorageBaseUrl: "Base URL" -objectStorageBaseUrlDesc: "用于引用的 URL。如果您正在使用 CDN 或反向代理,请指定其 URL。\n例如S3:“https://.s3.amazonaws.com”,GCS:“https://storage.googleapis.com/”,其它同理。" +objectStorageBaseUrl: "根 URL" +objectStorageBaseUrlDesc: "用于引用的 URL。如果您正在使用 CDN 或反向代理,请指定其 URL。\n例如S3:\"https://.s3.amazonaws.com\"\ + ,GCS:\"https://storage.googleapis.com/\",其它同理。" objectStorageBucket: "存储桶" objectStorageBucketDesc: "请指定使用的对象存储服务的存储桶名称。" objectStoragePrefix: "前缀" objectStoragePrefixDesc: "文件将存储在此前缀的目录下。" -objectStorageEndpoint: "Endpoint" -objectStorageEndpointDesc: "如果您使用 AWS S3 请留空。否则请根据您使用的服务商的说明来进行设置,指定 Endpoint 形式为 - \"\" 或 \":\"。" +objectStorageEndpoint: "端点 (Endpoint)" +objectStorageEndpointDesc: "如果您使用 AWS S3 请留空。否则请根据您使用的服务商的说明来进行设置,指定端点 (Endpoint) + 形式为 \"\" 或 \":\"。" objectStorageRegion: "可用区" objectStorageRegionDesc: "指定一个可用区,例如 \"xx-east-1\"。 如果您的对象存储服务没有可用区概念,请将其留空或填写 \"\ us-east-1\"。\n对于 Cloudflare R2,可以填为 \"auto\"。" @@ -502,7 +504,7 @@ objectStorageUseSSL: "使用 SSL" objectStorageUseSSLDesc: "如果不使用 HTTPS 进行 API 连接,请关闭" objectStorageUseProxy: "使用代理" objectStorageUseProxyDesc: "如果您不使用代理进行 API 连接,请将其关闭" -objectStorageSetPublicRead: "上传时设置为 public-read" +objectStorageSetPublicRead: "上传时设置为 \"public-read\"" serverLogs: "服务器日志" deleteAll: "全部删除" showFixedPostForm: "在时间线顶部显示发帖框" @@ -599,7 +601,7 @@ emptyToDisableSmtpAuth: "留空用户名和密码以禁用 SMTP 验证" smtpSecure: "在 SMTP 连接中使用隐式 SSL / TLS" smtpSecureInfo: "使用 STARTTLS 时关闭" testEmail: "邮件发送测试" -wordMute: "文字过滤" +wordMute: "文字和语言过滤" regexpError: "正则表达式错误" regexpErrorDescription: "{tab} 文字过滤的第 {line} 行的正则表达式有错误:" instanceMute: "服务器静音" @@ -608,7 +610,7 @@ makeActive: "启用" display: "显示" copy: "复制" metrics: "指标" -overview: "服务器概况" +overview: "概况" logs: "日志" delayed: "滞后" database: "数据库" @@ -674,7 +676,7 @@ driveFilesCount: "网盘的文件数" driveUsage: "网盘的空间用量" noCrawle: "要求搜索引擎不索引该用户" noCrawleDescription: "要求外部搜索引擎不收录(索引)您的内容。" -lockedAccountInfo: "即使通过了关注请求,只要您不将帖子可见范围设置成“关注者”,任何人都可以看到您的帖子。" +lockedAccountInfo: "即使通过了关注请求,只要您不将帖子可见范围设置成「关注者」,任何人都可以看到您的帖子。" alwaysMarkSensitive: "默认将媒体文件标记为敏感内容" loadRawImages: "加载原始图像而不是显示缩略图" disableShowingAnimatedImages: "不播放动画" @@ -689,8 +691,8 @@ useSystemFont: "使用系统默认字体" clips: "便签" experimentalFeatures: "实验性功能" developer: "开发者" -makeExplorable: "使账号在“发现”中可见" -makeExplorableDescription: "关闭时,账号不会显示在\"发现\"中。" +makeExplorable: "使账号在「发现」中可见" +makeExplorableDescription: "关闭时,账号不会显示在「发现」中。" showGapBetweenNotesInTimeline: "时间线上的帖子分开显示" duplicate: "复制" left: "左" @@ -745,7 +747,7 @@ unlikeConfirm: "取消赞?" fullView: "全屏" quitFullView: "退出全屏" addDescription: "添加描述" -userPagePinTip: "在帖子的菜单中选择“置顶”,即可显示该条帖子。" +userPagePinTip: "在帖子的菜单中选择「置顶」,即可在此显示该条帖子。" notSpecifiedMentionWarning: "有未指定的提及" info: "关于" userInfo: "用户信息" @@ -805,7 +807,7 @@ accountDeletionInProgress: "正在删除账号" usernameInfo: "在服务器上唯一标识您的账号的名称。您可以使用字母 (a ~ z, A ~ Z)、数字 (0 ~ 9) 和下划线 (_)。用户名以后不能更改。" aiChanMode: "小蓝模式" keepCw: "保留内容警告" -pubSub: "推送 (Pub)/订阅 (Sub) 账号" +pubSub: "推送 (Pub) / 订阅 (Sub) 账号" lastCommunication: "最近通信" resolved: "已解决" unresolved: "未解决" @@ -822,8 +824,8 @@ makeReactionsPublicDescription: "将您发表过的回应设置成公开可见 classic: "居中" muteThread: "静音帖子串" unmuteThread: "取消静音帖子串" -ffVisibility: "关注/关注者 可见性" -ffVisibilityDescription: "您可以设置谁可以看到您的关注/关注者信息。" +ffVisibility: "关注 / 关注者可见性" +ffVisibilityDescription: "您可以设置谁可以看到您的关注 / 关注者信息。" continueThread: "查看更多帖子" deleteAccountConfirm: "这将不可逆转地删除账号,是否继续?" incorrectPassword: "密码错误。" @@ -921,7 +923,7 @@ _emailUnavailable: _ffVisibility: public: "公开" followers: "仅对关注者可见" - private: "私信" + private: "私密" _signup: almostThere: "即将完成" emailAddressInfo: "请输入您所使用的电子邮件地址,它不会公开显示。" @@ -935,7 +937,8 @@ _accountDelete: inProgress: "正在删除" _ad: back: "返回" - reduceFrequencyOfThisAd: "减少此广告的频率" + reduceFrequencyOfThisAd: "减少此横幅的频率" + adsBy: 社区横幅(作者:{by}) _forgotPassword: enterEmail: "请输入您注册账号时用的电子邮箱地址,密码重置链接将发送至该邮箱上。" ifNoEmail: "如果您在注册时没有输入电子邮件地址,请联系服务器管理员。" @@ -1113,7 +1116,7 @@ _wordMute: muteLangs: "过滤语言" muteWordsDescription: "AND 条件用空格分隔,OR 条件用换行符分隔。" muteWordsDescription2: "将关键字用斜线括起来表示正则表达式。" - muteLangsDescription: "OR 条件用空格,换行符分隔" + muteLangsDescription: "OR 条件用空格或换行符分隔。" muteLangsDescription2: "使用语言代码。例: en, fr, ja, zh." softDescription: "隐藏时间线中指定条件的帖子。" langDescription: "从时间线中隐藏与设置语言匹配的帖子。" @@ -1236,15 +1239,15 @@ _tutorial: step4_2: "对于第一条帖子,可以做一个 {introduction} 或一个简单的 \"hello world!\"" step5_1: "时间线,无处不在的时间线!" step5_2: "您的服务器已启用 {timelines} 种不同的时间线。" - step5_3: "主页 {icon} 时间线是您可以看到您关注账号的帖子的时间线。" + step5_3: "首页{icon}时间线是您可以看到您关注账号的帖子的时间线。" step5_4: "本地{icon}时间线是您可以看到此服务器上其它用户的帖子的时间线。" step5_5: "社交{icon}时间线是主页和本地时间线的结合。" step5_6: "推荐{icon}时间线是您可以看到管理员推荐服务器的帖子的时间线。" - step5_7: "全球{icon}时间线是您可以看到来自其它所有互联服务器的帖子的时间线。" + step5_7: "全局{icon}时间线是您可以看到来自其它所有互联服务器的帖子的时间线。" step6_1: "那么,这里是什么地方?" step6_2: "好吧,您不只是加入 Firefish。您已经加入了 Fediverse 的一个门户,这是一个由成千上万台服务器组成的互联网络。" step6_3: "每个服务器的工作方式不同,并不是所有的服务器都运行 Firefish。但这个服务器是的! 这有点复杂,但您很快就会明白的。" - step6_4: "现在,去吧,去探索,去享受乐趣吧!" + step6_4: "现在,去吧,去探索,去享受乐趣吧!" _2fa: alreadyRegistered: "您已经注册了两步验证设备。" registerTOTP: "注册身份验证器应用" @@ -1839,8 +1842,8 @@ customMOTD: 自定义 MOTD(启动屏幕消息) sendPushNotificationReadMessageCaption: 会短暂显示 "{emptyPushNotificationMessage}" 的通知,如果启用,可能会增加您的设备的耗电量。 adminCustomCssWarn: 仅当您知道此设置的作用时才应使用它。输入不正确的值可能会导致每个人的客户端停止正常运行。请在用户设置中进行测试来确保您的 CSS 正常工作。 -customMOTDDescription: 自定义 MOTD(启动屏幕)消息,一行一个,每次用户加载/刷新页面时都会随机显示。 -customSplashIconsDescription: 用换行符隔开的自定义启动屏幕图标的 URL,在用户每次加载/重新载入页面时随机显示。请确保图片是在一个静态的 +customMOTDDescription: 自定义 MOTD(启动屏幕)消息,一行一个,每次用户加载 / 重新加载页面时都会随机显示。 +customSplashIconsDescription: 用换行符隔开的自定义启动屏幕图标的 URL,在用户每次加载 / 重新加载页面时随机显示。请确保图片是在一个静态的 URL 上,最好全部调整为 192x192 的大小。 recommendedInstancesDescription: 推荐的服务器一行一个,它们将出现在推荐时间线中。 splash: 启动画面 @@ -1863,7 +1866,7 @@ customSplashIcons: 自定义启动屏幕图标(urls) alt: 替代文字 pushNotificationNotSupported: 您的浏览器或者服务器不支持推送通知 showAds: 显示社区横幅 -enterSendsMessage: 按回车键发送信息(关闭则是 Ctrl + Retun 发送) +enterSendsMessage: 按回车键发送信息(关闭则是 Ctrl + Return 发送) recommendedInstances: 推荐服务器 updateAvailable: 可能有可用更新! swipeOnMobile: 允许在页面之间滑动 @@ -1916,7 +1919,7 @@ _skinTones: isModerator: 监察员 isAdmin: 管理员 findOtherInstance: 寻找其它服务器 -moveFromDescription: 这将为您的旧账号设置一个别名,以便您可以从该旧账号迁移到当前账号。在从旧账号迁移之前执行此操作。请输入格式如@person@server.com +moveFromDescription: 这将为您的旧账号设置一个别名,以便您可以从该旧账号迁移到当前账号。在从旧账号迁移之前执行此操作。请输入格式如 @person@server.com 的账号标签 indexPosts: 索引帖子 signupsDisabled: 该服务器目前关闭注册,但您随时可以在另一台服务器上注册!如果您有该服务器的邀请码,请在下面输入。 @@ -1976,7 +1979,7 @@ confirm: 确认 importZip: 导入 ZIP exportZip: 导出 ZIP emojiPackCreator: 表情包创建工具 -objectStorageS3ForcePathStyleDesc: 打开此选项可构建格式为 's3.amazonaws.com//' 而非 '.s3.amazonaws.com' +objectStorageS3ForcePathStyleDesc: 打开此选项可构建格式为 "s3.amazonaws.com//" 而非 ".s3.amazonaws.com" 的端点 URL。 objectStorageS3ForcePathStyle: 使用基于路径的端点 URL delete2fa: 禁用 2FA @@ -1989,3 +1992,6 @@ detectPostLanguage: 自动检测语言,并显示外文帖子的翻译按钮 indexableDescription: 允许内置搜索显示您的公开帖子 indexable: 可索引的 languageForTranslation: 帖子翻译语言 +vibrate: 播放振动 +openServerInfo: 点击帖子上的服务器滚动条时显示服务器信息 +clickToShowPatterns: 点击显示模块模式 diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 11229b1e1d..82b3276b62 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -12,7 +12,7 @@ ok: "OK" gotIt: "知道了!" cancel: "取消" enterUsername: "輸入使用者名稱" -renotedBy: "{user} 轉傳了" +renotedBy: "{user} 轉發了" noNotes: "無貼文" noNotifications: "沒有通知" instance: "伺服器" @@ -21,7 +21,7 @@ basicSettings: "基本設定" otherSettings: "其他設定" openInWindow: "在新視窗開啟" profile: "個人檔案" -timeline: "時間線" +timeline: "時間軸" noAccountDescription: "此用戶還沒有自我介紹。" login: "登入" loggingIn: "登入中" @@ -49,6 +49,7 @@ sendMessage: "發送訊息" copyUsername: "複製使用者名稱" searchUser: "搜尋使用者" reply: "回覆" +replies: "回覆" loadMore: "載入更多" showMore: "載入更多" showLess: "關閉" @@ -94,11 +95,13 @@ unfollow: "取消追隨" followRequestPending: "追隨許可批准中" enterEmoji: "輸入表情符號" renote: "轉發" +renotes: "轉發" unrenote: "取消轉發" renoted: "已轉發。" cantRenote: "無法轉發此貼文。" cantReRenote: "無法轉發之前已經轉發過的內容。" quote: "引用" +quotes: "引用" pinnedNote: "已置頂的貼文" pinned: "置頂" you: "您" @@ -106,6 +109,7 @@ clickToShow: "按一下以顯示" sensitive: "敏感內容" add: "新增" reaction: "反應" +reactions: "反應" enableEmojiReaction: "啟用表情符號反應" showEmojisInReactionNotifications: "在反應通知中顯示表情符號" reactionSetting: "在選擇器中顯示反應" @@ -145,12 +149,12 @@ flagAsBot: "標記此帳號是機器人" flagAsBotDescription: "如果本帳戶是由程式控制,請啟用此選項。啟用後,會作為標示幫助其他開發者防止機器人之間產生無限互動的行為,並會調整Firefish內部系統將本帳戶識別為機器人。" flagAsCat: "你是喵咪嗎?w😺" flagAsCatDescription: "如果想將本帳戶標示為一隻貓,請開啟此標示!" -flagShowTimelineReplies: "在時間線上顯示貼文的回覆" -flagShowTimelineRepliesDescription: "啟用時,時間線除了顯示用戶的貼文以外,還會顯示用戶對其他貼文的回覆。" +flagShowTimelineReplies: "在時間軸上顯示貼文的回覆" +flagShowTimelineRepliesDescription: "啟用時,時間軸除了顯示用戶的貼文以外,還會顯示用戶對其他貼文的回覆。" autoAcceptFollowed: "自動准予追隨中使用者的追隨請求" addAccount: "添加帳戶" loginFailed: "登入失敗" -showOnRemote: "轉到所在伺服器顯示" +showOnRemote: "開啟來源頁面" general: "一般" wallpaper: "桌布" setWallpaper: "設定桌布" @@ -320,12 +324,9 @@ dayX: "{day}日" monthX: "{month}月" yearX: "{year}年" pages: "頁面" -integration: "整合" -connectService: "己連結" -disconnectService: "己斷開" -enableLocalTimeline: "開啟本地時間線" -enableGlobalTimeline: "啟用公開時間線" -disablingTimelinesInfo: "即使您關閉了時間線功能,管理員和版主始終可以訪問所有的時間線。" +enableLocalTimeline: "開啟本地時間軸" +enableGlobalTimeline: "啟用公開時間軸" +disablingTimelinesInfo: "即使您關閉了時間軸功能,管理員和板主仍可訪問所有的時間軸。" registration: "註冊" enableRegistration: "開啟新使用者註冊" invite: "邀請" @@ -385,7 +386,7 @@ administrator: "管理員" token: "權杖" twoStepAuthentication: "兩階段驗證" moderator: "板主" -moderation: "言論調節" +moderation: "管理" nUsersMentioned: "提到了{n}" securityKey: "安全金鑰" securityKeyName: "金鑰名稱" @@ -458,7 +459,7 @@ youHaveNoGroups: "找不到群組" joinOrCreateGroup: "請加入現有群組,或創建新群組。" noHistory: "沒有歷史紀錄" signinHistory: "登入歷史" -disableAnimatedMfm: "禁用MFM動畫" +disableAnimatedMfm: "停用MFM動畫" doing: "正在處理..." category: "類別" tags: "標籤" @@ -482,7 +483,7 @@ promotion: "推廣" promote: "推廣" numberOfDays: "有效天數" hideThisNote: "隱藏此貼文" -showFeaturedNotesInTimeline: "在時間線上顯示熱門推薦" +showFeaturedNotesInTimeline: "在時間軸上顯示熱門推薦" objectStorage: "Object Storage (物件儲存)" useObjectStorage: "使用Object Storage" objectStorageBaseUrl: "根URL" @@ -502,7 +503,7 @@ objectStorageUseProxyDesc: "如果不使用代理進行API連接,請關閉" objectStorageSetPublicRead: "上傳時設定為\"public-read\"" serverLogs: "伺服器日誌" deleteAll: "刪除所有記錄" -showFixedPostForm: "於時間線頁頂顯示「發送貼文」方框" +showFixedPostForm: "於時間軸頁頂顯示「發送貼文」方框" newNoteRecived: "發現新的貼文" sounds: "音效" listen: "聆聽" @@ -596,7 +597,7 @@ emptyToDisableSmtpAuth: "留空使用者名稱及密碼以關閉SMTP驗證" smtpSecure: "在 SMTP 連接中使用隱式 SSL/TLS" smtpSecureInfo: "如使用STARTTLS,請關閉" testEmail: "測試郵件發送" -wordMute: "被靜音的文字" +wordMute: "被靜音的文字及語言" regexpError: "正規表達式錯誤" regexpErrorDescription: "{tab} 靜音文字的第 {line} 行的正規表達式有錯誤:" instanceMute: "伺服器的靜音" @@ -670,7 +671,7 @@ no: "取消" driveFilesCount: "雲端硬碟檔案數量" driveUsage: "雲端硬碟使用量" noCrawle: "拒絕搜尋引擎索引" -noCrawleDescription: "要求網路搜尋引擎不要索引你的個人資料頁、貼文及頁面等。" +noCrawleDescription: "要求外部搜尋引擎不要收錄(索引)你的內容(個人檔案、貼文、頁面等)。" lockedAccountInfo: "即使你通過了追隨者請求,除非你將貼文的可見性設定為 「追隨者」,否則任何人都能看見你的貼文。" alwaysMarkSensitive: "默認將圖像/影像標記為敏感內容" loadRawImages: "以原始圖檔顯示附件圖檔的縮圖" @@ -688,7 +689,7 @@ experimentalFeatures: "實驗中的功能" developer: "開發者" makeExplorable: "使自己的帳戶能夠在“探索”頁面中顯示" makeExplorableDescription: "如果關閉,帳戶將不會被顯示在\"探索\"頁面中。" -showGapBetweenNotesInTimeline: "分開顯示時間線上的貼文" +showGapBetweenNotesInTimeline: "分開顯示時間軸上的貼文" duplicate: "複製" left: "左" center: "置中" @@ -734,7 +735,7 @@ inChannelSearch: "頻道内搜尋" useReactionPickerForContextMenu: "點擊右鍵開啟反應工具欄" typingUsers: "{users}輸入中" jumpToSpecifiedDate: "跳轉到特定日期" -showingPastTimeline: "顯示過往的時間線" +showingPastTimeline: "顯示過往的時間軸" clear: "清除" markAllAsRead: "全部標示為已讀" goBack: "返回" @@ -765,7 +766,7 @@ user: "使用者" administration: "管理" accounts: "帳戶" switch: "切換" -noMaintainerInformationWarning: "尚未設定管理員信息。" +noMaintainerInformationWarning: "尚未設定管理員資訊。" noBotProtectionWarning: "尚未設定Bot防護。" configure: "設定" postToGallery: "發佈到相簿" @@ -786,7 +787,7 @@ previewNoteText: "預覽文本" customCss: "自定義 CSS" customCssWarn: "這個設定必須由具備相關知識的人員操作,不當的設定可能导致客戶端無法正常使用。" global: "公開" -squareAvatars: "頭像以方形顯示" +squareAvatars: "大頭貼以方形顯示" sent: "發送" received: "收取" searchResult: "搜尋結果" @@ -801,7 +802,7 @@ translatedFrom: "從 {x} 翻譯" accountDeletionInProgress: "正在刪除帳戶" usernameInfo: "在伺服器上您的帳戶是唯一的識別名稱。您可以使用字母 (a ~ z, A ~ Z)、數字 (0 ~ 9) 和下底線 (_)。之後帳戶名是不能更改的。" aiChanMode: "小藍模式" -keepCw: "保持CW" +keepCw: "保持內容警告" pubSub: "Pub/Sub 帳戶" lastCommunication: "最近的通信" resolved: "已解決" @@ -822,7 +823,7 @@ unmuteThread: "將貼文串的靜音解除" ffVisibility: "連接的公開範圍" ffVisibilityDescription: "您可以設定您的關注/關注者資訊的公開範圍。" continueThread: "查看更多貼文" -deleteAccountConfirm: "將要刪除帳戶。是否確定?" +deleteAccountConfirm: "此帳戶將被刪除,是否繼續?" incorrectPassword: "密碼錯誤。" voteConfirm: "確定投給「{choice}」?" hide: "隱藏" @@ -899,7 +900,7 @@ customKaTeXMacro: "自訂KaTeX巨集" customKaTeXMacroDescription: "使用巨集來輕鬆輸入數學表達式吧!巨集的用法與 LaTeX 中的命令定義相同。你可以使用 \\newcommand{\\ name}{content} 或 \\newcommand{\\name}[number of arguments]{content} 來輸入數學表達式。舉例來說,\\ newcommand{\\add}[2]{#1 + #2} 會將 \\add{3}{foo} 展開為 3 + foo。巨集名稱除了可用大括號 {} 括起來之外,也可使用小括號 - () 和中括號 [],但使用於巨集參數的括號會有所變更。每行只能夠定義一個巨集,巨集中間無法間換。無效的行將被忽略。只支援簡單字串的替換功能,不支援條件分歧的高級語法。" + () 和中括號 [],但使用於巨集參數的括號會有所變更。每行只能夠定義一個巨集,巨集中間無法間換。無效的行將被忽略。只支援簡單字串的替換功能,不支援條件分歧的進階語法。" enableCustomKaTeXMacro: "啟用自定義 KaTeX 宏" _sensitiveMediaDetection: description: "您可以使用機器學習自動檢測敏感媒體並將其用於審核。 伺服器的負荷會稍微增加。" @@ -932,7 +933,8 @@ _accountDelete: inProgress: "正在刪除" _ad: back: "返回" - reduceFrequencyOfThisAd: "降低此廣告的頻率" + reduceFrequencyOfThisAd: "降低此橫幅的頻率" + adsBy: 社群橫幅(作者:{by}) _forgotPassword: enterEmail: "請輸入您的帳戶註冊的電子郵件地址。 密碼重置連結將被發送到該電子郵件地址。" ifNoEmail: "如果您還沒有註冊您的電子郵件地址,請聯繫管理員。" @@ -1026,7 +1028,7 @@ _mfm: emoji: "自訂表情符號" emojiDescription: "您可以通過將自定義表情符號名稱括在冒號中來顯示自定義表情符號。" search: "搜尋" - searchDescription: "您可以顯示所輸入的搜索框。" + searchDescription: "顯示含有指定文字的搜尋欄。" flip: "翻轉" flipDescription: "將內容上下或左右翻轉。" jelly: "動畫(果凍)" @@ -1067,8 +1069,8 @@ _mfm: position: 位置 alwaysPlay: 自動播放所有MFM動畫 positionDescription: 按指定數量移動內容。 - advancedDescription: 如果禁用,則僅允許基本標記,除非正在播放 MFM 動畫 - advanced: 高級MFM + advancedDescription: 如果停用,僅顯示基礎MFM及正在播放的MFM動畫 + advanced: 進階MFM fade: 淡出 foreground: 文字顏色 crop: 裁切 @@ -1109,11 +1111,16 @@ _wordMute: muteWords: "加入靜音文字" muteWordsDescription: "用空格分隔指定AND,用換行分隔指定OR。" muteWordsDescription2: "將關鍵字用斜線括起來表示正規表達式。" - softDescription: "隱藏時間線中指定條件的貼文。" - hardDescription: "具有指定條件的貼文將不添加到時間線。 即使您更改條件,未被添加的貼文也會被排除在外。" + softDescription: "隱藏時間軸中指定條件的貼文。" + hardDescription: "符合指定條件的貼文將不添加到時間軸。 即使您更改條件,未被添加的貼文也會被排除在外。" soft: "軟性靜音" hard: "硬性靜音" mutedNotes: "已靜音的貼文" + muteLangsDescription2: '使用語言代碼。例: en, fr, ja, zh.' + lang: 語言 + langDescription: 將指定語言的貼文從時間軸中隱藏。 + muteLangs: 被靜音的語言 + muteLangsDescription: OR條件以空格或換行進行分隔。 _instanceMute: instanceMuteDescription: "包括對被靜音伺服器上的用戶的回覆,被設定的伺服器上所有貼文及轉發都會被靜音。" instanceMuteDescription2: "設定時以換行進行分隔" @@ -1223,16 +1230,16 @@ _tutorial: step2_1: "首先,請完成你的個人資料。" step2_2: "通過提供一些關於你自己的資料,其他人會更容易了解他們是否想看到你的貼文或關注你。" step3_1: "現在是時候追隨一些人了!" - step3_2: "你的主頁和社交時間線是基於你所追蹤的人,所以試著先追蹤幾個帳戶。\n點擊個人資料右上角的加號圈就可以關注它。" + step3_2: "你的主頁和社交時間軸是基於你所追蹤的人,所以試著先追蹤幾個帳戶。\n點擊個人資料右上角的加號按鈕就可以關注它。" step4_1: "讓我們出去找你。" - step4_2: "對於他們的第一條信息,有些人喜歡做 {introduction} 或一個簡單的 \"hello world!\"" - step5_1: "時間線,到處都是時間線!" - step5_2: "您的伺服器已啟用了{timelines}個時間線。" - step5_3: "首頁 {icon} 時間線是顯示你追蹤的帳號的貼文。" - step5_4: "本地 {icon} 時間線是你可以看到伺服器中所有其他用戶的貼文的時間線。" - step5_5: "社交 {icon} 時間線是你的 首頁時間線 和 本地時間線 的結合體。" - step5_6: "推薦 {icon} 時間線是顯示你的伺服器管理員推薦的貼文。" - step5_7: "全球 {icon} 時間線是顯示來自所有其他連接的伺服器的貼文。" + step4_2: "作為第一則貼文,有些人喜歡發 {introduction} 或單純發一個 \"hello world!\"" + step5_1: "時間軸,到處都是時間軸!" + step5_2: "您的伺服器已啟用了{timelines}個時間軸。" + step5_3: "首頁 {icon} 時間軸是顯示你追蹤的帳號的貼文。" + step5_4: "本地 {icon} 時間軸是你可以看到伺服器中所有其他用戶的貼文的時間軸。" + step5_5: "社交 {icon} 時間軸是你的 首頁時間軸 和 本地時間軸 的結合體。" + step5_6: "推薦 {icon} 時間軸是顯示你的伺服器管理員推薦的貼文。" + step5_7: "全球 {icon} 時間軸是顯示來自所有其他連接的伺服器的貼文。" step6_1: "那麼,這裡是什麼地方?" step6_2: "你不只是加入Firefish。你已經加入了Fediverse的一個門戶,這是一個由成千上萬台服務器組成的互聯網絡。" step6_3: "每個服務器也有不同,而並不是所有的服務器都運行Firefish。但這個服務器確實是運行Firefish的! 你可能會覺得有點複雜,但你很快就會明白的。" @@ -1321,7 +1328,7 @@ _weekday: _widgets: memo: "備忘錄" notifications: "通知" - timeline: "時間線" + timeline: "時間軸" calendar: "行事曆" trends: "發燒貼文" clock: "時鐘" @@ -1355,9 +1362,9 @@ _cw: files: "{count} 個檔案" _poll: noOnlyOneChoice: "至少需要兩個選項" - choiceN: "選擇{n}" + choiceN: "選項{n}" noMore: "沒辦法再添加選項了" - canMultipleVote: "可以多次投票" + canMultipleVote: "允許複選" expiration: "期限" infinite: "無期限" at: "結束時間" @@ -1366,7 +1373,7 @@ _poll: deadlineTime: "小時" duration: "時長" votesCount: "{n}票" - totalVotes: "一共{n}票" + totalVotes: "總計{n}票" vote: "投票" showResult: "顯示結果" voted: "已投票" @@ -1377,9 +1384,9 @@ _poll: remainingSeconds: "{s}秒後截止" _visibility: public: "公開" - publicDescription: "發佈至公開時間線" + publicDescription: "發佈至公開時間軸" home: "不在主頁顯示" - homeDescription: "僅發送至首頁的時間線" + homeDescription: "僅發送至首頁的時間軸" followers: "追隨者" followersDescription: "僅發佈至關注者" specified: "指定使用者" @@ -1777,6 +1784,8 @@ _notification: reply: "回覆" renote: "轉發" reacted: 對您的貼文做出了反應 + renoted: 轉發了您的貼文 + voted: 投了票 _deck: alwaysShowMainColumn: "總是顯示主欄" columnAlign: "對齊欄位" @@ -1800,7 +1809,7 @@ _deck: main: "主列" widgets: "小工具" notifications: "通知" - tl: "時間線" + tl: "時間軸" antenna: "天線" list: "清單" mentions: "提及" @@ -1809,7 +1818,7 @@ _deck: secureMode: 安全模式(授權獲取) instanceSecurity: 伺服器安全性 privateMode: 私人模式 -allowedInstances: 列入白名單的伺服器 +allowedInstances: 列入允許名單的伺服器 secureModeInfo: 當從其他伺服器請求時,不要在沒有證據的情況下發回。 _messaging: dms: 私訊 @@ -1817,8 +1826,8 @@ _messaging: manageGroups: 管理群組 replayTutorial: 重新播放教程 moveFromLabel: '您想遷移的舊帳戶:' -customMOTDDescription: 每次用戶加載/重新加載頁面時,由換行符號分隔的 MOTD(啟動畫面)的自定信息將隨機顯示。 -privateModeInfo: 啟用後,只有列入白名單的伺服器才能與你的伺服器聯合。所有貼文都將對公眾隱藏。 +customMOTDDescription: 自訂MOTD(啟動畫面)訊息,一行一個。每次用戶載入/重新整理頁面時將會隨機顯示。 +privateModeInfo: 啟用後,只有列入允許名單的伺服器才能與你的伺服器聯合。所有貼文都將對公眾隱藏。 adminCustomCssWarn: 除非你知道它的作用,否則請不要使用此設定。 輸入不正確的值可能會導致每個人的客戶端無法正常運行。你可在你的的用戶設定中測試,確保你的 CSS 正常工作。 showUpdates: Firefish 更新時顯示彈出視窗 @@ -1832,7 +1841,7 @@ accountMoved: '該使用者已遷移至新帳戶:' showAds: 顯示社群橫幅 noThankYou: 不用了,謝謝 selectInstance: 選擇伺服器 -enableRecommendedTimeline: 啟用推薦時間線 +enableRecommendedTimeline: 啟用推薦時間軸 antennaInstancesDescription: 分行列出一個伺服器 moveTo: 遷移此帳戶到新帳戶 moveToLabel: '請輸入你將會遷移到的帳戶:' @@ -1846,7 +1855,7 @@ enableEmojiReactions: 啟用表情符號反應 breakFollowConfirm: 您確定要移除該關注者嗎? socialTimeline: 社交時間軸 cannotUploadBecauseExceedsFileSizeLimit: 因檔案太大而無法上傳。 -customMOTD: 自定義MOTD (網頁載入時顯示的信息) +customMOTD: 自定義MOTD (網頁載入時顯示的訊息) customSplashIcons: 啟動畫面圖標 (網址) splash: 啟動畫面 updateAvailable: 可能有可用的更新! @@ -1863,9 +1872,11 @@ silencedInstances: 已靜音的伺服器 silenced: 已靜音 _experiments: title: 試驗功能 + enablePostImports: 啟用匯入貼文的功能 + postImportsCaption: 允許用戶從舊有的Firefish・Misskey・Mastodon・Akkoma・Pleroma帳號匯入貼文。在伺服器佇列堵塞時匯入貼文可能會導致載入速度變慢。 findOtherInstance: 找找另一個伺服器 -noGraze: 瀏覽器擴展 "Graze for Mastodon" 會與Firefish發生衝突,請停用該擴展。 -userSaysSomethingReasonRenote: '{name} 轉傳了包含 {reason} 的貼文' +noGraze: 瀏覽器擴充元件 "Graze for Mastodon" 會與Firefish發生衝突,請停用該擴充元件。 +userSaysSomethingReasonRenote: '{name} 轉發了包含 {reason} 的貼文' pushNotificationNotSupported: 你的瀏覽器或伺服器不支援推送通知 accessibility: 輔助功能 userSaysSomethingReasonReply: '{name} 回覆了包含 {reason} 的貼文' @@ -1876,15 +1887,15 @@ deleted: 已刪除 editNote: 編輯貼文 edited: '於 {date} {time} 編輯' userSaysSomethingReason: '{name} 說了 {reason}' -allowedInstancesDescription: 要加入聯邦白名單的服務器,每台伺服器用新行分隔(僅適用於私有模式)。 +allowedInstancesDescription: 允許聯邦的伺服器名單,一行一個(僅適用於私人模式)。 defaultReaction: 默認的表情符號反應 license: 授權 apps: 應用 pushNotification: 推送通知 subscribePushNotification: 啟用推送通知 -unsubscribePushNotification: 禁用推送通知 +unsubscribePushNotification: 停用推送通知 pushNotificationAlreadySubscribed: 推送通知已經啟用 -recommendedInstancesDescription: 以每行分隔的推薦伺服器出現在推薦的時間線中。 +recommendedInstancesDescription: 推薦的伺服器(將顯示在推薦時間軸中),一行一個。 searchPlaceholder: 在 Firefish 上搜尋 cw: 內容警告 selectChannel: 選擇一個頻道 @@ -1892,9 +1903,9 @@ newer: 較新 older: 較舊 jumpToPrevious: 跳到上一個 removeReaction: 移除你的反應 -listsDesc: 清單可以創建一個只有您指定用戶的時間線。 可以從時間線頁面訪問它們。 +listsDesc: 清單可以創建一個只有您指定用戶的時間軸。 可以從時間軸頁面訪問它們。 flagSpeakAsCatDescription: 在喵咪模式下你的貼文會被喵化ヾ(•ω•`)o -antennasDesc: "天線會顯示符合您設置條件的新貼文!\n 可以從時間線訪問它們。" +antennasDesc: "天線會顯示符合您設置條件的新貼文!\n 可以從時間軸訪問它們。" expandOnNoteClick: 點擊以打開貼文 expandOnNoteClickDesc: 即使停用,您仍然可以從右鍵選單或單擊發文時間來打開貼文。 hiddenTagsDescription: '列出您希望隱藏趨勢和探索的主題標籤(不帶 #)。 隱藏的主題標籤仍然可以通過其他方式發現。' @@ -1909,25 +1920,25 @@ channelFederationWarn: 頻道功能尚未與聯邦宇宙連動 swipeOnMobile: 允許以滑動在頁面之間切換 sendPushNotificationReadMessage: 閱讀相關通知或消息後刪除推送通知 image: 圖片 -seperateRenoteQuote: 分別獨立的轉傳及引用按鈕 +seperateRenoteQuote: 分開轉發及引用的按鈕 clipsDesc: 摘錄就像一個可以分享的書籤。 你可以從每個貼文的菜單創建新摘錄或將貼文加入已有的摘錄。 noteId: 貼文 ID sendModMail: 發送審核通知 -enableIdenticonGeneration: 啟用碎片生成 +enableIdenticonGeneration: 啟用Identicon生成 enableServerMachineStats: 啟用伺服器硬體統計資訊 reactionPickerSkinTone: 首選表情符號膚色 indexFromDescription: 留空以索引每個貼文 preventAiLearning: 防止 AI 機器人抓取 preventAiLearningDescription: 請求第三方 AI 語言模型不要研究您上傳的內容,例如貼文和圖像。 -indexFrom: 從貼文 ID 開始的索引 +indexFrom: 建立此貼文ID以後的索引 isLocked: 該帳戶已獲得以下批准 isModerator: 板主 isAdmin: 管理員 isPatron: Firefish 項目贊助者 silencedWarning: 顯示此頁面是因為這些使用者來自您伺服器管理員已靜音的伺服器,因此他們可能是垃圾訊息。 -signupsDisabled: 該伺服器上的註冊當前已被禁用,但您隨時可以在另一台伺服器上註冊!或是您有該伺服器的邀請碼,請在下面輸入。 +signupsDisabled: 此伺服器目前停止註冊,但您隨時可以在另一台伺服器上註冊!如果您有此伺服器的邀請碼,請在下面輸入。 showPopup: 通過彈出式視窗通知用戶 -showWithSparkles: 閃閃發光的顯示 +showWithSparkles: 讓標題閃閃發光 youHaveUnreadAnnouncements: 您有未讀的公告 donationLink: 連結到贊助頁面 neverShow: 不再顯示 @@ -1954,11 +1965,39 @@ _dialog: charactersExceeded: 超過字數限制! 當前 {current} / 限制 {max} _skinTones: yellow: 黃色 + medium: 中等 + dark: 深色 + mediumDark: 中等偏深 + light: 淺色 + mediumLight: 中等偏淺 exportZip: 匯出ZIP _feeds: atom: Atom rss: RSS + copyFeed: 複製訂閱URL + jsonFeed: JSON Feed emojiPackCreator: 表情包的作者 importZip: 匯入ZIP delete2fa: 停用二階段認證(2FA) confirm: 確認 +deletePasskeysConfirm: 此帳號的所有通行密鑰及安全密鑰將被完全刪除。此動作無法復原,是否繼續? +deletePasskeys: 刪除通行密鑰 +detectPostLanguage: 自動判定貼文的語言,並在外文貼文顯示翻譯按鈕 +indexableDescription: 允許內建搜尋引擎顯示您的公開貼文 +addRe: 在回覆有內容警告的貼文時,在標題前面加上 "re:" +vibrate: 播放振動 +openServerInfo: 點擊貼文中的伺服器名稱以顯示伺服器資訊 +languageForTranslation: 貼文翻譯語言 +objectStorageS3ForcePathStyleDesc: 以 "s3.amazonaws.com//" 而非 ".s3.amazonaws.com" + 的格式建構端點(Endpoint)URL。 +indexable: 登錄至貼文搜尋引擎 +origin: 來源 +objectStorageS3ForcePathStyle: 使用基於路徑的端點(Endpoint)URL +clickToShowPatterns: 點擊顯示模組模式(Module Pattern) +iconSet: 圖示的樣式 +_iconSets: + fill: 填滿 + regular: 標準 + bold: 粗線 + duotone: 雙色 + light: 細線 diff --git a/package.json b/package.json index a1607880cf..7ac61c09c0 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "name": "firefish", - "version": "1.0.4-beta31", + "version": "1.0.5-rc", "codename": "aqua", "repository": { "type": "git", "url": "https://git.joinfirefish.org/firefish/firefish.git" }, - "packageManager": "pnpm@8.7.6", + "packageManager": "pnpm@8.10.5", "private": true, "scripts": { - "rebuild": "pnpm run clean && ./scripts/build-greet.sh && pnpm -r --parallel run build && pnpm run gulp", - "build": "./scripts/build-greet.sh && pnpm -r --parallel run build && pnpm run gulp", + "rebuild": "pnpm run clean && pnpm run build", + "build": "./scripts/build-greet.sh && pnpm --filter firefish-js run build && pnpm --filter !firefish-js -r --parallel run build && pnpm run gulp", "start": "pnpm --filter backend run start", "start:test": "pnpm --filter backend run start:test", "init": "pnpm run migrate", @@ -19,7 +19,7 @@ "migrateandstart": "pnpm run migrate && pnpm run start", "gulp": "gulp build", "watch": "pnpm run dev", - "dev": "pnpm node ./scripts/dev.js", + "dev": "pnpm node ./scripts/dev.mjs", "dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start", "lint": "pnpm -r --parallel run lint", "debug": "pnpm run build:debug && pnpm run start", @@ -30,42 +30,42 @@ "mocha": "pnpm --filter backend run mocha", "test": "pnpm run mocha", "format": "pnpm -r --parallel run format", - "clean": "pnpm node ./scripts/clean.js", - "clean-all": "pnpm node ./scripts/clean-all.js", + "clean": "pnpm node ./scripts/clean.mjs", + "clean-all": "pnpm node ./scripts/clean-all.mjs", "cleanall": "pnpm run clean-all" }, "resolutions": { "chokidar": "^3.3.1" }, "dependencies": { - "@bull-board/api": "5.8.0", - "@bull-board/ui": "5.8.0", - "@napi-rs/cli": "^2.16.2", - "@tensorflow/tfjs": "^4.10.0", + "@bull-board/api": "5.9.1", + "@bull-board/ui": "5.9.1", + "@napi-rs/cli": "^2.16.5", + "@tensorflow/tfjs": "^4.13.0", "js-yaml": "4.1.0", "seedrandom": "^3.0.5" }, "devDependencies": { - "@biomejs/biome": "1.0.0", - "@biomejs/cli-darwin-arm64": "^1.0.0", - "@biomejs/cli-darwin-x64": "^1.0.0", - "@biomejs/cli-linux-arm64": "^1.0.0", - "@biomejs/cli-linux-x64": "^1.0.0", - "@types/gulp": "4.0.13", - "@types/gulp-rename": "2.0.2", - "@types/node": "20.5.8", + "@biomejs/biome": "1.3.3", + "@biomejs/cli-darwin-arm64": "^1.3.3", + "@biomejs/cli-darwin-x64": "^1.3.3", + "@biomejs/cli-linux-arm64": "^1.3.3", + "@biomejs/cli-linux-x64": "^1.3.3", + "@types/gulp": "4.0.17", + "@types/gulp-rename": "2.0.5", + "@types/node": "20.9.0", "add": "2.0.6", "cross-env": "7.0.3", - "cypress": "10.11.0", - "execa": "5.1.1", + "cypress": "13.5.1", + "execa": "8.0.1", "gulp": "4.0.2", "gulp-cssnano": "2.1.3", "gulp-rename": "2.0.0", "gulp-replace": "1.1.4", "gulp-terser": "2.1.0", "install-peers": "^1.0.4", - "pnpm": "8.7.1", - "start-server-and-test": "1.15.2", + "pnpm": "8.10.5", + "start-server-and-test": "2.0.3", "typescript": "5.2.2" } } diff --git a/packages/backend/assets/badges/error.png b/packages/backend/assets/badges/error.png deleted file mode 100644 index 046f18e149..0000000000 Binary files a/packages/backend/assets/badges/error.png and /dev/null differ diff --git a/packages/backend/assets/badges/error.webp b/packages/backend/assets/badges/error.webp new file mode 100644 index 0000000000..ccdf7ebcbb Binary files /dev/null and b/packages/backend/assets/badges/error.webp differ diff --git a/packages/backend/assets/badges/info.png b/packages/backend/assets/badges/info.png deleted file mode 100644 index c6ab300a72..0000000000 Binary files a/packages/backend/assets/badges/info.png and /dev/null differ diff --git a/packages/backend/assets/badges/info.webp b/packages/backend/assets/badges/info.webp new file mode 100644 index 0000000000..cce0a32d74 Binary files /dev/null and b/packages/backend/assets/badges/info.webp differ diff --git a/packages/backend/assets/badges/not-found.png b/packages/backend/assets/badges/not-found.png deleted file mode 100644 index 63356530ce..0000000000 Binary files a/packages/backend/assets/badges/not-found.png and /dev/null differ diff --git a/packages/backend/assets/badges/not-found.webp b/packages/backend/assets/badges/not-found.webp new file mode 100644 index 0000000000..502f09fa10 Binary files /dev/null and b/packages/backend/assets/badges/not-found.webp differ diff --git a/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700.woff2 b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700.woff2 new file mode 100644 index 0000000000..f3898921c8 Binary files /dev/null and b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700.woff2 differ diff --git a/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700italic.woff2 b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700italic.woff2 new file mode 100644 index 0000000000..9aac4b88e4 Binary files /dev/null and b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-700italic.woff2 differ diff --git a/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-italic.woff2 b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-italic.woff2 new file mode 100644 index 0000000000..ce7c7fed1d Binary files /dev/null and b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-italic.woff2 differ diff --git a/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-regular.woff2 b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-regular.woff2 new file mode 100644 index 0000000000..7093c429f2 Binary files /dev/null and b/packages/backend/assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-regular.woff2 differ diff --git a/packages/backend/assets/robots.txt b/packages/backend/assets/robots.txt index dc17e04e3f..cedb5b6cf2 100644 --- a/packages/backend/assets/robots.txt +++ b/packages/backend/assets/robots.txt @@ -1,4 +1,14 @@ -user-agent: * -allow: / +User-agent: * +Allow: / -# todo: sitemap +# Uncomment the following to block CommonCrawl +# +# User-agent: CCBot +# User-agent: CCBot/2.0 +# User-agent: CCBot/3.1 +# Disallow: / + +# Uncomment the following to block ChatGPT +# +# User-agent: GPTBot +# Disallow: / diff --git a/packages/backend/migration/1000000000000-Init.js b/packages/backend/migration/1000000000000-Init.js index bab5fae7a0..a72f53841c 100644 --- a/packages/backend/migration/1000000000000-Init.js +++ b/packages/backend/migration/1000000000000-Init.js @@ -220,7 +220,7 @@ export class Init1000000000000 { `CREATE INDEX "IDX_3c601b70a1066d2c8b517094cb" ON "notification" ("notifieeId") `, ); await queryRunner.query( - `CREATE TABLE "meta" ("id" character varying(32) NOT NULL, "name" character varying(128), "description" character varying(1024), "maintainerName" character varying(128), "maintainerEmail" character varying(128), "announcements" jsonb NOT NULL DEFAULT '[]', "disableRegistration" boolean NOT NULL DEFAULT false, "disableLocalTimeline" boolean NOT NULL DEFAULT false, "disableGlobalTimeline" boolean NOT NULL DEFAULT false, "enableEmojiReaction" boolean NOT NULL DEFAULT true, "useStarForReactionFallback" boolean NOT NULL DEFAULT false, "langs" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "hiddenTags" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "blockedHosts" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "mascotImageUrl" character varying(512) DEFAULT '/static-assets/badges/info.png', "bannerUrl" character varying(512), "errorImageUrl" character varying(512) DEFAULT '/static-assets/badges/error.png', "iconUrl" character varying(512), "cacheRemoteFiles" boolean NOT NULL DEFAULT false, "proxyAccount" character varying(128), "enableRecaptcha" boolean NOT NULL DEFAULT false, "recaptchaSiteKey" character varying(64), "recaptchaSecretKey" character varying(64), "localDriveCapacityMb" integer NOT NULL DEFAULT 1024, "remoteDriveCapacityMb" integer NOT NULL DEFAULT 32, "maxNoteTextLength" integer NOT NULL DEFAULT 500, "summalyProxy" character varying(128), "enableEmail" boolean NOT NULL DEFAULT false, "email" character varying(128), "smtpSecure" boolean NOT NULL DEFAULT false, "smtpHost" character varying(128), "smtpPort" integer, "smtpUser" character varying(128), "smtpPass" character varying(128), "enableServiceWorker" boolean NOT NULL DEFAULT false, "swPublicKey" character varying(128), "swPrivateKey" character varying(128), "enableTwitterIntegration" boolean NOT NULL DEFAULT false, "twitterConsumerKey" character varying(128), "twitterConsumerSecret" character varying(128), "enableGithubIntegration" boolean NOT NULL DEFAULT false, "githubClientId" character varying(128), "githubClientSecret" character varying(128), "enableDiscordIntegration" boolean NOT NULL DEFAULT false, "discordClientId" character varying(128), "discordClientSecret" character varying(128), CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id"))`, + `CREATE TABLE "meta" ("id" character varying(32) NOT NULL, "name" character varying(128), "description" character varying(1024), "maintainerName" character varying(128), "maintainerEmail" character varying(128), "announcements" jsonb NOT NULL DEFAULT '[]', "disableRegistration" boolean NOT NULL DEFAULT false, "disableLocalTimeline" boolean NOT NULL DEFAULT false, "disableGlobalTimeline" boolean NOT NULL DEFAULT false, "enableEmojiReaction" boolean NOT NULL DEFAULT true, "useStarForReactionFallback" boolean NOT NULL DEFAULT false, "langs" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "hiddenTags" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "blockedHosts" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "mascotImageUrl" character varying(512) DEFAULT '/static-assets/badges/info.webp', "bannerUrl" character varying(512), "errorImageUrl" character varying(512) DEFAULT '/static-assets/badges/error.webp', "iconUrl" character varying(512), "cacheRemoteFiles" boolean NOT NULL DEFAULT false, "proxyAccount" character varying(128), "enableRecaptcha" boolean NOT NULL DEFAULT false, "recaptchaSiteKey" character varying(64), "recaptchaSecretKey" character varying(64), "localDriveCapacityMb" integer NOT NULL DEFAULT 1024, "remoteDriveCapacityMb" integer NOT NULL DEFAULT 32, "maxNoteTextLength" integer NOT NULL DEFAULT 500, "summalyProxy" character varying(128), "enableEmail" boolean NOT NULL DEFAULT false, "email" character varying(128), "smtpSecure" boolean NOT NULL DEFAULT false, "smtpHost" character varying(128), "smtpPort" integer, "smtpUser" character varying(128), "smtpPass" character varying(128), "enableServiceWorker" boolean NOT NULL DEFAULT false, "swPublicKey" character varying(128), "swPrivateKey" character varying(128), "enableTwitterIntegration" boolean NOT NULL DEFAULT false, "twitterConsumerKey" character varying(128), "twitterConsumerSecret" character varying(128), "enableGithubIntegration" boolean NOT NULL DEFAULT false, "githubClientId" character varying(128), "githubClientSecret" character varying(128), "enableDiscordIntegration" boolean NOT NULL DEFAULT false, "discordClientId" character varying(128), "discordClientSecret" character varying(128), CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id"))`, ); await queryRunner.query( `CREATE TABLE "following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, "followerHost" character varying(128), "followerInbox" character varying(512), "followerSharedInbox" character varying(512), "followeeHost" character varying(128), "followeeInbox" character varying(512), "followeeSharedInbox" character varying(512), CONSTRAINT "PK_c76c6e044bdf76ecf8bfb82a645" PRIMARY KEY ("id"))`, diff --git a/packages/backend/migration/1695334243217-add-post-lang.js b/packages/backend/migration/1695334243217-add-post-lang.js new file mode 100644 index 0000000000..7e8618953a --- /dev/null +++ b/packages/backend/migration/1695334243217-add-post-lang.js @@ -0,0 +1,13 @@ +export class AddPostLang1695334243217 { + name = "AddPostLang1695334243217"; + + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note" ADD "lang" character varying(10)`, + ); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "lang"`); + } +} diff --git a/packages/backend/migration/1699305365258-more-urls.js b/packages/backend/migration/1699305365258-more-urls.js new file mode 100644 index 0000000000..6ef1dcd2b3 --- /dev/null +++ b/packages/backend/migration/1699305365258-more-urls.js @@ -0,0 +1,13 @@ +export class MoreUrls1699305365258 { + name = "MoreUrls1699305365258"; + + async up(queryRunner) { + queryRunner.query( + `ALTER TABLE "meta" ADD "moreUrls" jsonb NOT NULL DEFAULT '[]'`, + ); + } + + async down(queryRunner) { + queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "moreUrls"`); + } +} diff --git a/packages/backend/native-utils/migration/src/lib.rs b/packages/backend/native-utils/migration/src/lib.rs index f8be136f46..a0f8fc85b4 100644 --- a/packages/backend/native-utils/migration/src/lib.rs +++ b/packages/backend/native-utils/migration/src/lib.rs @@ -7,6 +7,7 @@ mod m20230627_185451_index_note_url; mod m20230709_000510_move_antenna_to_cache; mod m20230806_170616_fix_antenna_stream_ids; mod m20230904_013244_is_indexable; +mod m20231002_143323_remove_integrations; pub struct Migrator; @@ -19,6 +20,7 @@ impl MigratorTrait for Migrator { Box::new(m20230709_000510_move_antenna_to_cache::Migration), Box::new(m20230806_170616_fix_antenna_stream_ids::Migration), Box::new(m20230904_013244_is_indexable::Migration), + Box::new(m20231002_143323_remove_integrations::Migration), ] } } diff --git a/packages/backend/native-utils/migration/src/m20231002_143323_remove_integrations.rs b/packages/backend/native-utils/migration/src/m20231002_143323_remove_integrations.rs new file mode 100644 index 0000000000..a8ef8fdbbd --- /dev/null +++ b/packages/backend/native-utils/migration/src/m20231002_143323_remove_integrations.rs @@ -0,0 +1,117 @@ +use sea_orm_migration::prelude::*; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { + manager + .alter_table( + Table::alter() + .table(UserProfile::Table) + .drop_column(UserProfile::Integrations) + .to_owned(), + ) + .await?; + + manager + .alter_table( + Table::alter() + .table(Meta::Table) + .drop_column(Meta::EnableTwitterIntegration) + .drop_column(Meta::TwitterConsumerKey) + .drop_column(Meta::TwitterConsumerSecret) + .drop_column(Meta::EnableGithubIntegration) + .drop_column(Meta::GithubClientId) + .drop_column(Meta::GithubClientSecret) + .drop_column(Meta::EnableDiscordIntegration) + .drop_column(Meta::DiscordClientId) + .drop_column(Meta::DiscordClientSecret) + .to_owned(), + ) + .await?; + + Ok(()) + } + + async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { + manager + .alter_table( + Table::alter() + .table(Meta::Table) + .add_column(ColumnDef::new(Meta::DiscordClientSecret).string()) + .add_column(ColumnDef::new(Meta::DiscordClientId).string()) + .add_column( + ColumnDef::new(Meta::EnableDiscordIntegration) + .boolean() + .not_null() + .default(false), + ) + .add_column(ColumnDef::new(Meta::GithubClientSecret).string()) + .add_column(ColumnDef::new(Meta::GithubClientId).string()) + .add_column( + ColumnDef::new(Meta::EnableGithubIntegration) + .boolean() + .not_null() + .default(false), + ) + .add_column(ColumnDef::new(Meta::TwitterConsumerSecret).string()) + .add_column(ColumnDef::new(Meta::TwitterConsumerKey).string()) + .add_column( + ColumnDef::new(Meta::EnableTwitterIntegration) + .boolean() + .not_null() + .default(false), + ) + .to_owned(), + ) + .await?; + + manager + .alter_table( + Table::alter() + .table(UserProfile::Table) + .add_column( + ColumnDef::new(UserProfile::Integrations) + .json() + .default("{}"), + ) + .to_owned(), + ) + .await?; + + Ok(()) + } +} + +#[derive(Iden)] + +enum UserProfile { + Table, + #[iden = "integrations"] + Integrations, +} + +#[derive(Iden)] +enum Meta { + Table, + #[iden = "enableTwitterIntegration"] + EnableTwitterIntegration, + #[iden = "twitterConsumerKey"] + TwitterConsumerKey, + #[iden = "twitterConsumerSecret"] + TwitterConsumerSecret, + #[iden = "enableGithubIntegration"] + EnableGithubIntegration, + #[iden = "githubClientId"] + GithubClientId, + #[iden = "githubClientSecret"] + GithubClientSecret, + #[iden = "enableDiscordIntegration"] + EnableDiscordIntegration, + #[iden = "discordClientId"] + DiscordClientId, + #[iden = "discordClientSecret"] + DiscordClientSecret, +} diff --git a/packages/backend/native-utils/package.json b/packages/backend/native-utils/package.json index 180c24cbe3..c0c09e21cf 100644 --- a/packages/backend/native-utils/package.json +++ b/packages/backend/native-utils/package.json @@ -42,8 +42,8 @@ "test": "pnpm run cargo:test && pnpm run build:napi && ava", "universal": "napi universal", "version": "napi version", - "format": "cargo fmt --all -- --check", - "lint": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt --all -- --check", + "format": "cargo fmt --all --", + "lint": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt --all --", "cargo:test": "pnpm run cargo:unit && pnpm run cargo:integration", "cargo:unit": "cargo test unit_test && cargo test -F napi unit_test", "cargo:integration": "cargo test -F noarray int_test -- --test-threads=1" diff --git a/packages/backend/native-utils/src/model/entity/meta.rs b/packages/backend/native-utils/src/model/entity/meta.rs index ac43a78427..79ff8477a7 100644 --- a/packages/backend/native-utils/src/model/entity/meta.rs +++ b/packages/backend/native-utils/src/model/entity/meta.rs @@ -71,28 +71,12 @@ pub struct Model { pub sw_public_key: Option, #[sea_orm(column_name = "swPrivateKey")] pub sw_private_key: Option, - #[sea_orm(column_name = "enableTwitterIntegration")] - pub enable_twitter_integration: bool, - #[sea_orm(column_name = "twitterConsumerKey")] - pub twitter_consumer_key: Option, - #[sea_orm(column_name = "twitterConsumerSecret")] - pub twitter_consumer_secret: Option, - #[sea_orm(column_name = "enableGithubIntegration")] - pub enable_github_integration: bool, - #[sea_orm(column_name = "githubClientId")] - pub github_client_id: Option, - #[sea_orm(column_name = "githubClientSecret")] - pub github_client_secret: Option, - #[sea_orm(column_name = "enableDiscordIntegration")] - pub enable_discord_integration: bool, - #[sea_orm(column_name = "discordClientId")] - pub discord_client_id: Option, - #[sea_orm(column_name = "discordClientSecret")] - pub discord_client_secret: Option, #[sea_orm(column_name = "pinnedUsers")] pub pinned_users: StringVec, #[sea_orm(column_name = "ToSUrl")] pub to_s_url: Option, + #[sea_orm(column_name = "moreUrls", column_type = "JsonBinary")] + pub more_urls: Json, #[sea_orm(column_name = "repositoryUrl")] pub repository_url: String, #[sea_orm(column_name = "feedbackUrl")] diff --git a/packages/backend/native-utils/src/model/entity/user_profile.rs b/packages/backend/native-utils/src/model/entity/user_profile.rs index 5fd09dea30..2da562ed78 100644 --- a/packages/backend/native-utils/src/model/entity/user_profile.rs +++ b/packages/backend/native-utils/src/model/entity/user_profile.rs @@ -46,8 +46,6 @@ pub struct Model { pub pinned_page_id: Option, #[sea_orm(column_type = "JsonBinary")] pub room: Json, - #[sea_orm(column_type = "JsonBinary")] - pub integrations: Json, #[sea_orm(column_name = "injectFeaturedNote")] pub inject_featured_note: bool, #[sea_orm(column_name = "enableWordMute")] diff --git a/packages/backend/package.json b/packages/backend/package.json index 83c49459b5..c4f0236757 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -23,36 +23,35 @@ }, "optionalDependencies": { "@swc/core-android-arm64": "1.3.11", - "@tensorflow/tfjs-node": "3.21.1" + "@tensorflow/tfjs-node": "4.13.0" }, "dependencies": { - "@bull-board/api": "5.8.0", - "@bull-board/koa": "5.8.0", - "@bull-board/ui": "5.8.0", + "@bull-board/api": "5.9.1", + "@bull-board/koa": "5.9.1", + "@bull-board/ui": "5.9.1", "@discordapp/twemoji": "14.1.2", - "@elastic/elasticsearch": "7.17.0", - "@koa/cors": "3.4.3", + "@elastic/elasticsearch": "8.10.0", + "@koa/cors": "4.0.0", "@koa/multer": "3.0.2", - "@koa/router": "9.0.1", + "@koa/router": "12.0.1", + "@ladjs/koa-views": "9.0.0", "@peertube/http-signature": "1.7.0", - "@redocly/openapi-core": "1.0.2", - "@sinonjs/fake-timers": "9.1.2", - "@syuilo/aiscript": "0.11.1", - "@tensorflow/tfjs": "^4.2.0", + "@redocly/openapi-core": "1.4.1", + "@sinonjs/fake-timers": "11.2.2", + "@tensorflow/tfjs": "^4.13.0", "adm-zip": "^0.5.10", "ajv": "8.12.0", - "archiver": "6.0.0", - "argon2": "^0.31.1", - "autolinker": "4.0.0", - "autwh": "0.1.0", - "aws-sdk": "2.1413.0", - "axios": "^1.4.0", + "archiver": "6.0.1", + "argon2": "^0.31.2", + "aws-sdk": "2.1498.0", + "axios": "^1.6.2", "bcryptjs": "2.4.3", "blurhash": "2.0.5", - "bull": "4.11.3", + "bull": "4.11.5", "cacheable-lookup": "TheEssem/cacheable-lookup", + "cbor-x": "^1.5.4", "chalk": "5.3.0", - "chalk-template": "0.4.0", + "chalk-template": "1.1.0", "chokidar": "^3.5.3", "cli-highlight": "2.1.11", "color-convert": "2.0.1", @@ -62,19 +61,18 @@ "deep-email-validator": "0.1.21", "escape-regexp": "0.0.1", "feed": "4.2.2", - "file-type": "18.5.0", - "firefish-js": "workspace:*", + "file-type": "18.7.0", "fluent-ffmpeg": "2.1.2", "got": "13.0.0", "gunzip-maybe": "^1.4.2", - "happy-dom": "^11.0.2", + "happy-dom": "^12.10.3", "hpagent": "1.2.0", "ioredis": "5.3.2", "ip-cidr": "3.1.0", "is-svg": "5.0.0", "js-yaml": "4.1.0", "json5": "2.2.3", - "jsonld": "8.2.1", + "jsonld": "8.3.1", "jsrsasign": "10.8.6", "koa": "2.14.2", "koa-body": "^6.0.1", @@ -86,118 +84,118 @@ "koa-remove-trailing-slashes": "2.0.3", "koa-send": "5.0.1", "koa-slow": "2.1.0", - "koa-views": "7.0.2", "megalodon": "workspace:*", - "meilisearch": "0.34.1", + "meilisearch": "0.35.0", "mfm-js": "0.23.3", "mime-types": "2.1.35", - "msgpackr": "1.9.7", - "multer": "1.4.4-lts.1", + "msgpackr": "^1.9.9", + "multer": "1.4.5-lts.1", "native-utils": "link:native-utils", "nested-property": "4.0.0", "node-fetch": "3.3.2", - "nodemailer": "6.9.4", + "nodemailer": "6.9.7", "nsfwjs": "2.4.2", - "oauth": "^0.10.0", "opencc-js": "^1.0.5", "os-utils": "0.0.14", - "otpauth": "^9.1.4", + "otpauth": "^9.2.0", "parse5": "7.1.2", "pg": "8.11.3", "private-ip": "3.0.1", "probe-image-size": "7.2.3", "promise-limit": "2.7.0", - "punycode": "2.3.0", - "pureimage": "0.4.8", + "punycode": "2.3.1", + "pureimage": "0.4.13", "qrcode": "1.5.3", "qs": "6.11.2", "random-seed": "0.3.0", "ratelimiter": "3.4.1", - "re2": "1.20.3", + "re2": "1.20.8", "redis-semaphore": "5.5.0", "reflect-metadata": "0.1.13", "rename": "1.0.4", "rndstr": "1.0.0", "rss-parser": "3.13.0", "sanitize-html": "2.11.0", - "seedrandom": "^3.0.5", "semver": "7.5.4", - "sharp": "0.32.5", + "sharp": "0.32.6", "sonic-channel": "^1.3.1", "stringz": "2.1.0", "summaly": "2.7.0", "syslog-pro": "1.0.0", - "systeminformation": "5.21.3", + "systeminformation": "5.21.17", "tar-stream": "^3.1.6", - "tesseract.js": "^4.1.1", + "tesseract.js": "^5.0.3", "tinycolor2": "1.6.0", "tinyld": "^1.3.4", "tmp": "0.2.1", "twemoji-parser": "14.0.0", "typeorm": "0.3.17", "ulid": "2.3.0", - "uuid": "9.0.0", - "web-push": "3.6.5", + "uuid": "9.0.1", + "web-push": "3.6.6", "websocket": "1.0.34", "xev": "3.0.2" }, "devDependencies": { - "@swc/cli": "^0.1.62", + "@swc/cli": "^0.1.63", "@swc/core": "1.3.78", - "@types/adm-zip": "^0.5.0", - "@types/bcryptjs": "2.4.2", - "@types/escape-regexp": "0.0.1", - "@types/fluent-ffmpeg": "2.1.21", - "@types/js-yaml": "4.0.5", - "@types/jsonld": "1.5.9", - "@types/jsrsasign": "10.5.8", - "@types/koa": "2.13.8", - "@types/koa-bodyparser": "4.3.10", - "@types/koa-cors": "0.0.2", - "@types/koa-favicon": "2.0.21", - "@types/koa-logger": "3.1.2", - "@types/koa-mount": "4.0.2", - "@types/koa-send": "4.1.3", - "@types/koa-views": "7.0.0", - "@types/koa__cors": "3.3.0", - "@types/koa__multer": "2.0.4", - "@types/koa__router": "8.0.11", - "@types/mocha": "9.1.1", - "@types/node": "18.11.18", - "@types/node-fetch": "3.0.3", - "@types/nodemailer": "6.4.9", - "@types/oauth": "0.9.1", - "@types/probe-image-size": "^7.2.0", - "@types/pug": "2.0.6", - "@types/punycode": "2.1.0", - "@types/qrcode": "1.5.1", - "@types/qs": "6.9.7", - "@types/random-seed": "0.3.3", - "@types/ratelimiter": "3.4.4", - "@types/redis": "4.0.11", - "@types/rename": "1.0.4", - "@types/sanitize-html": "2.9.0", - "@types/semver": "7.5.0", - "@types/sinonjs__fake-timers": "8.1.2", - "@types/tinycolor2": "1.4.3", - "@types/tmp": "0.2.3", - "@types/uuid": "9.0.2", - "@types/web-push": "3.3.2", - "@types/websocket": "1.0.5", - "@types/ws": "8.5.5", + "@types/adm-zip": "^0.5.4", + "@types/bcryptjs": "2.4.6", + "@types/color-convert": "^2.0.3", + "@types/content-disposition": "^0.5.8", + "@types/escape-regexp": "0.0.3", + "@types/fluent-ffmpeg": "2.1.24", + "@types/js-yaml": "4.0.9", + "@types/jsonld": "1.5.12", + "@types/jsrsasign": "10.5.12", + "@types/koa": "2.13.11", + "@types/koa-bodyparser": "4.3.12", + "@types/koa-cors": "0.0.5", + "@types/koa-favicon": "2.1.3", + "@types/koa-logger": "3.1.5", + "@types/koa-mount": "4.0.5", + "@types/koa-send": "4.1.6", + "@types/koa__cors": "4.0.3", + "@types/koa__multer": "2.0.7", + "@types/koa__router": "12.0.4", + "@types/mocha": "10.0.4", + "@types/node": "20.9.0", + "@types/node-fetch": "2.6.9", + "@types/nodemailer": "6.4.14", + "@types/oauth": "0.9.4", + "@types/opencc-js": "^1.0.3", + "@types/pg": "^8.10.9", + "@types/probe-image-size": "^7.2.3", + "@types/pug": "2.0.9", + "@types/punycode": "2.1.2", + "@types/qrcode": "1.5.5", + "@types/qs": "6.9.10", + "@types/random-seed": "0.3.5", + "@types/ratelimiter": "3.4.6", + "@types/rename": "1.0.7", + "@types/sanitize-html": "2.9.4", + "@types/semver": "7.5.5", + "@types/sinonjs__fake-timers": "8.1.5", + "@types/syslog-pro": "^1.0.3", + "@types/tinycolor2": "1.4.6", + "@types/tmp": "0.2.6", + "@types/uuid": "9.0.7", + "@types/web-push": "3.6.3", + "@types/websocket": "1.0.9", + "@types/ws": "8.5.9", "cross-env": "7.0.3", - "eslint": "^8.46.0", - "execa": "6.1.0", + "eslint": "^8.53.0", + "execa": "8.0.1", "json5-loader": "4.0.1", "mocha": "10.2.0", "pug": "3.0.2", "strict-event-emitter-types": "2.0.0", "swc-loader": "^0.2.3", - "ts-loader": "9.4.4", + "ts-loader": "9.5.1", "ts-node": "10.9.1", "tsconfig-paths": "4.2.0", - "typescript": "5.1.6", - "webpack": "^5.88.2", - "ws": "8.13.0" + "typescript": "5.2.2", + "webpack": "^5.89.0", + "ws": "8.14.2" } } 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 4470cea9cb..bc0dd182c4 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -1,19 +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 { lessThan } from "@/prelude/array.js"; -import { envOption } from "../env.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 236621b010..b407004ac1 100644 --- a/packages/backend/src/boot/worker.ts +++ b/packages/backend/src/boot/worker.ts @@ -1,7 +1,6 @@ import cluster from "node:cluster"; -import { initDb } from "../db/postgre.js"; -import config from "@/config/index.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/const.ts b/packages/backend/src/const.ts index 2a955ee521..8fc4bd25e0 100644 --- a/packages/backend/src/const.ts +++ b/packages/backend/src/const.ts @@ -1,7 +1,7 @@ import config from "@/config/index.js"; import { - DB_MAX_NOTE_TEXT_LENGTH, DB_MAX_IMAGE_COMMENT_LENGTH, + DB_MAX_NOTE_TEXT_LENGTH, } from "@/misc/hard-limits.js"; export const MAX_NOTE_TEXT_LENGTH = Math.min( @@ -68,6 +68,15 @@ export const FILE_TYPE_BROWSERSAFE = [ "audio/x-flac", "audio/flac", "audio/vnd.wave", + + "audio/mod", + "audio/x-mod", + "audio/s3m", + "audio/x-s3m", + "audio/xm", + "audio/x-xm", + "audio/it", + "audio/x-it", ]; /* https://github.com/sindresorhus/file-type/blob/main/supported.js diff --git a/packages/backend/src/daemons/queue-stats.ts b/packages/backend/src/daemons/queue-stats.ts index 381b52a916..82e8226e99 100644 --- a/packages/backend/src/daemons/queue-stats.ts +++ b/packages/backend/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ +import { deliverQueue, inboxQueue } from "@/queue/queues.js"; import Xev from "xev"; -import { deliverQueue, inboxQueue } from "../queue/queues.js"; const ev = new Xev(); diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 39d81ec914..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 10ea5b15f6..7d4666bba5 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -2,81 +2,82 @@ 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 { envOption } from "../env.js"; import { dbLogger } from "./logger.js"; import { redisClient } from "./redis.js"; + +// TODO?: should we avoid importing things from built directory? import { nativeInitDatabase } from "native-utils/built/index.js"; const sqlLogger = dbLogger.createSubLogger("sql", "gray", false); 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/global.d.ts b/packages/backend/src/global.d.ts index 503e26eb60..6c5a22e4b4 100644 --- a/packages/backend/src/global.d.ts +++ b/packages/backend/src/global.d.ts @@ -1,2 +1,2 @@ -// rome-ignore lint/suspicious/noExplicitAny: i have no idea +// biome-ignore lint/suspicious/noExplicitAny: i have no idea type FIXME = any; diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 278f630f70..33b5826a7e 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -1,5 +1,5 @@ /** - * Misskey Entry Point! + * Firefish Entry Point */ import { EventEmitter } from "node:events"; diff --git a/packages/backend/src/mfm/from-html.ts b/packages/backend/src/mfm/from-html.ts index 7c956e9058..fbcf310252 100644 --- a/packages/backend/src/mfm/from-html.ts +++ b/packages/backend/src/mfm/from-html.ts @@ -110,9 +110,8 @@ export function fromHtml(html: string, hashtagNames?: string[]): string { } case "h1": { - text += "【"; appendChildren(node.childNodes); - text += "】\n"; + text += "\n"; break; } 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/app-lock.ts b/packages/backend/src/misc/app-lock.ts index 198310c884..91d408ac5d 100644 --- a/packages/backend/src/misc/app-lock.ts +++ b/packages/backend/src/misc/app-lock.ts @@ -1,4 +1,4 @@ -import { redisClient } from "../db/redis.js"; +import { redisClient } from "@/db/redis.js"; import { Mutex } from "redis-semaphore"; /** 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 8ea4abedb6..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 "./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 1ff09d6299..6d2a01ac08 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -1,76 +1,29 @@ +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 { - UserListJoinings, - UserGroupJoinings, - Blockings, -} from "@/models/index.js"; -import { getFullApAccount } from "./convert-host.js"; -import * as Acct from "@/misc/acct.js"; -import type { Packed } from "./schema.js"; -import { Cache } from "./cache.js"; +import { Blockings, UserProfiles } from "@/models/index.js"; const blockingCache = new Cache("blocking", 60 * 5); +const mutedWordsCache = new Cache("mutedWords", 60 * 5); -// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている - -/** - * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい - */ export async function checkHitAntenna( antenna: Antenna, note: Note | Packed<"Note">, noteUser: { id: User["id"]; username: string; host: string | null }, - noteUserFollowers?: User["id"][], - antennaUserFollowing?: User["id"][], ): Promise { if (note.visibility === "specified") return false; if (note.visibility === "home") return false; - - // アンテナ作成者がノート作成者にブロックされていたらスキップ - const blockings = await blockingCache.fetch(noteUser.id, () => - Blockings.findBy({ blockerId: noteUser.id }).then((res) => - res.map((x) => x.blockeeId), - ), - ); - if (blockings.some((blocking) => blocking === antenna.userId)) return false; - - if (note.visibility === "followers") { - if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) - return false; - if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) - return false; + if (!antenna.withReplies && note.replyId != null) return false; + if (antenna.withFile) { + if (note.fileIds && note.fileIds.length === 0) return false; } - if (!antenna.withReplies && note.replyId != null) return false; - - if (antenna.src === "home") { - if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) - return false; - if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) - return false; - } else if (antenna.src === "list") { - const listUsers = ( - await UserListJoinings.findBy({ - userListId: antenna.userListId!, - }) - ).map((x) => x.userId); - - if (!listUsers.includes(note.userId)) return false; - } else if (antenna.src === "group") { - const joining = await UserGroupJoinings.findOneByOrFail({ - id: antenna.userGroupJoiningId!, - }); - - const groupUsers = ( - await UserGroupJoinings.findBy({ - userGroupId: joining.userGroupId, - }) - ).map((x) => x.userId); - - if (!groupUsers.includes(note.userId)) return false; - } else if (antenna.src === "users") { + if (antenna.src === "users") { const accts = antenna.users.map((x) => { const { username, host } = Acct.parse(x); return getFullApAccount(username, host).toLowerCase(); @@ -128,9 +81,20 @@ export async function checkHitAntenna( if (matched) return false; } - if (antenna.withFile) { - if (note.fileIds && note.fileIds.length === 0) return false; - } + // アンテナ作成者がノート作成者にブロックされていたらスキップ + const blockings = await blockingCache.fetch(noteUser.id, () => + Blockings.findBy({ blockerId: noteUser.id }).then((res) => + res.map((x) => x.blockeeId), + ), + ); + if (blockings.includes(antenna.userId)) return false; + + const mutedWords = await mutedWordsCache.fetch(antenna.userId, () => + UserProfiles.findOneBy({ userId: antenna.userId }).then( + (profile) => profile?.mutedWords, + ), + ); + if (await getWordHardMute(note, antenna.userId, mutedWords)) return false; // TODO: eval expression diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index a75beed9d1..c5348d168d 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -1,6 +1,5 @@ -import RE2 from "re2"; import type { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; +import RE2 from "re2"; type NoteLike = { userId: Note["userId"]; @@ -9,10 +8,6 @@ type NoteLike = { cw?: Note["cw"]; }; -type UserLike = { - id: User["id"]; -}; - function checkWordMute( note: NoteLike, mutedWords: Array, @@ -61,13 +56,10 @@ function checkWordMute( export async function getWordHardMute( note: NoteLike, - me: UserLike | null | undefined, - mutedWords: Array, + meId: string | null | undefined, + mutedWords?: Array, ): Promise { - // 自分自身 - if (me && note.userId === me.id) { - return false; - } + if (note.userId === meId || mutedWords == null) return false; if (mutedWords.length > 0) { return ( 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 new file mode 100644 index 0000000000..15763d5afa --- /dev/null +++ b/packages/backend/src/misc/detect-language.ts @@ -0,0 +1,11 @@ +import * as mfm from "mfm-js"; +import { detect } from "tinyld"; + +export default function detectLanguage(text: string): string { + const nodes = mfm.parse(text); + const filtered = mfm.extract(nodes, (node) => { + return node.type === "text" || node.type === "quote"; + }); + const purified = mfm.toString(filtered); + return detect(purified); +} 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/get-reaction-emoji.ts b/packages/backend/src/misc/get-reaction-emoji.ts deleted file mode 100644 index 71521c4ae8..0000000000 --- a/packages/backend/src/misc/get-reaction-emoji.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default function (reaction: string): string { - switch (reaction) { - case "like": - return "👍"; - case "love": - return "❤️"; - case "laugh": - return "😆"; - case "hmm": - return "🤔"; - case "surprise": - return "😮"; - case "congrats": - return "🎉"; - case "angry": - return "💢"; - case "confused": - return "😥"; - case "rip": - return "😇"; - case "pudding": - return "🍮"; - case "star": - return "⭐"; - default: - return reaction; - } -} diff --git a/packages/backend/src/misc/id/aid.ts b/packages/backend/src/misc/id/aid.ts deleted file mode 100644 index a12360360b..0000000000 --- a/packages/backend/src/misc/id/aid.ts +++ /dev/null @@ -1,25 +0,0 @@ -// AID -// 長さ8の[2000年1月1日からの経過ミリ秒をbase36でエンコードしたもの] + 長さ2の[ノイズ文字列] - -import * as crypto from "node:crypto"; - -const TIME2000 = 946684800000; -let counter = crypto.randomBytes(2).readUInt16LE(0); - -function getTime(time: number) { - time = time - TIME2000; - if (time < 0) time = 0; - - return time.toString(36).padStart(8, "0"); -} - -function getNoise() { - return counter.toString(36).padStart(2, "0").slice(-2); -} - -export function genAid(date: Date): string { - const t = date.getTime(); - if (isNaN(t)) throw "Failed to create AID: Invalid Date"; - counter++; - return getTime(t) + getNoise(); -} diff --git a/packages/backend/src/misc/id/meid.ts b/packages/backend/src/misc/id/meid.ts deleted file mode 100644 index ee78eb8d14..0000000000 --- a/packages/backend/src/misc/id/meid.ts +++ /dev/null @@ -1,26 +0,0 @@ -const CHARS = "0123456789abcdef"; - -function getTime(time: number) { - if (time < 0) time = 0; - if (time === 0) { - return CHARS[0]; - } - - time += 0x800000000000; - - return time.toString(16).padStart(12, CHARS[0]); -} - -function getRandom() { - let str = ""; - - for (let i = 0; i < 12; i++) { - str += CHARS[Math.floor(Math.random() * CHARS.length)]; - } - - return str; -} - -export function genMeid(date: Date): string { - return getTime(date.getTime()) + getRandom(); -} diff --git a/packages/backend/src/misc/id/meidg.ts b/packages/backend/src/misc/id/meidg.ts deleted file mode 100644 index 4fd39a8b41..0000000000 --- a/packages/backend/src/misc/id/meidg.ts +++ /dev/null @@ -1,28 +0,0 @@ -const CHARS = "0123456789abcdef"; - -// 4bit Fixed hex value 'g' -// 44bit UNIX Time ms in Hex -// 48bit Random value in Hex - -function getTime(time: number) { - if (time < 0) time = 0; - if (time === 0) { - return CHARS[0]; - } - - return time.toString(16).padStart(11, CHARS[0]); -} - -function getRandom() { - let str = ""; - - for (let i = 0; i < 12; i++) { - str += CHARS[Math.floor(Math.random() * CHARS.length)]; - } - - return str; -} - -export function genMeidg(date: Date): string { - return `g${getTime(date.getTime())}${getRandom()}`; -} diff --git a/packages/backend/src/misc/id/object-id.ts b/packages/backend/src/misc/id/object-id.ts deleted file mode 100644 index 45822f0acc..0000000000 --- a/packages/backend/src/misc/id/object-id.ts +++ /dev/null @@ -1,26 +0,0 @@ -const CHARS = "0123456789abcdef"; - -function getTime(time: number) { - if (time < 0) time = 0; - if (time === 0) { - return CHARS[0]; - } - - time = Math.floor(time / 1000); - - return time.toString(16).padStart(8, CHARS[0]); -} - -function getRandom() { - let str = ""; - - for (let i = 0; i < 16; i++) { - str += CHARS[Math.floor(Math.random() * CHARS.length)]; - } - - return str; -} - -export function genObjectId(date: Date): string { - return getTime(date.getTime()) + getRandom(); -} 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/nyaize.ts b/packages/backend/src/misc/nyaize.ts index 13a112ce57..32c54fbd7b 100644 --- a/packages/backend/src/misc/nyaize.ts +++ b/packages/backend/src/misc/nyaize.ts @@ -1,28 +1,31 @@ -export function nyaize(text: string): string { - return ( - text - // ja-JP - .replaceAll("な", "にゃ") - .replaceAll("ナ", "ニャ") - .replaceAll("ナ", "ニャ") - // en-US - .replace(/(?<=n)a/gi, (x) => (x === "A" ? "YA" : "ya")) - .replace(/(?<=morn)ing/gi, (x) => (x === "ING" ? "YAN" : "yan")) - .replace(/(?<=every)one/gi, (x) => (x === "ONE" ? "NYAN" : "nyan")) - .replace(/non(?=[bcdfghjklmnpqrstvwxyz])/gi, (x) => - x === "NON" ? "NYAN" : "nyan", - ) - // ko-KR - .replace(/[나-낳]/g, (match) => - String.fromCharCode( - match.charCodeAt(0)! + "냐".charCodeAt(0) - "나".charCodeAt(0), - ), - ) - .replace(/(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm, "다냥") - .replace(/(야(?=\?))|(야$)|(야(?= ))/gm, "냥") - // el-GR - .replaceAll("να", "νια") - .replaceAll("ΝΑ", "ΝΙΑ") - .replaceAll("Να", "Νια") - ); +export function nyaize(text: string, lang?: string): string { + text = text + // ja-JP + .replaceAll("な", "にゃ") + .replaceAll("ナ", "ニャ") + .replaceAll("ナ", "ニャ") + // en-US + .replace(/(?<=n)a/gi, (x) => (x === "A" ? "YA" : "ya")) + .replace(/(?<=morn)ing/gi, (x) => (x === "ING" ? "YAN" : "yan")) + .replace(/(?<=every)one/gi, (x) => (x === "ONE" ? "NYAN" : "nyan")) + .replace(/non(?=[bcdfghjklmnpqrstvwxyz])/gi, (x) => + x === "NON" ? "NYAN" : "nyan", + ) + // ko-KR + .replace(/[나-낳]/g, (match) => + String.fromCharCode( + match.charCodeAt(0)! + "냐".charCodeAt(0) - "나".charCodeAt(0), + ), + ) + .replace(/(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm, "다냥") + .replace(/(야(?=\?))|(야$)|(야(?= ))/gm, "냥") + // el-GR + .replaceAll("να", "νια") + .replaceAll("ΝΑ", "ΝΙΑ") + .replaceAll("Να", "Νια"); + + // zh-CN, zh-TW + if (lang === "zh") text = text.replace(/(妙|庙|描|渺|瞄|秒|苗|藐|廟)/g, "喵"); + + return text; } 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 e25b2d6614..b3e4903fa3 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -1,74 +1,31 @@ +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"; -const legacies = new Map([ - ["like", "👍"], - ["love", "❤️"], - ["laugh", "😆"], - ["hmm", "🤔"], - ["surprise", "😮"], - ["congrats", "🎉"], - ["angry", "💢"], - ["confused", "😥"], - ["rip", "😇"], - ["pudding", "🍮"], - ["star", "⭐"], -]); - -export async function getFallbackReaction() { - const meta = await fetchMeta(); - return meta.defaultReaction; -} - -export function convertLegacyReactions(reactions: Record) { - const _reactions = new Map(); - const decodedReactions = new Map(); +export function convertReactions(reactions: Record) { + const result = new Map(); for (const reaction in reactions) { if (reactions[reaction] <= 0) continue; - let decodedReaction; - if (decodedReactions.has(reaction)) { - decodedReaction = decodedReactions.get(reaction); - } else { - decodedReaction = decodeReaction(reaction); - decodedReactions.set(reaction, decodedReaction); - } - - let emoji = legacies.get(decodedReaction.reaction); - if (emoji) { - _reactions.set(emoji, (_reactions.get(emoji) || 0) + reactions[reaction]); - } else { - _reactions.set( - reaction, - (_reactions.get(reaction) || 0) + reactions[reaction], - ); - } + const decoded = decodeReaction(reaction).reaction; + result.set(decoded, (result.get(decoded) || 0) + reactions[reaction]); } - const _reactions2 = new Map(); - for (const [reaction, count] of _reactions) { - const decodedReaction = decodedReactions.get(reaction); - _reactions2.set(decodedReaction.reaction, count); - } - - return Object.fromEntries(_reactions2); + return Object.fromEntries(result); } export async function toDbReaction( reaction?: string | null, reacterHost?: string | null, ): Promise { - if (!reaction) return await getFallbackReaction(); + if (!reaction) return (await fetchMeta()).defaultReaction; reacterHost = toPunyNullable(reacterHost); - // Convert string-type reactions to unicode - const emoji = legacies.get(reaction) || (reaction === "♥️" ? "❤️" : null); - if (emoji) return emoji; + if (reaction.includes("❤") || reaction.includes("♥️")) return "❤️"; // Allow unicode reactions const match = emojiRegex.exec(reaction); @@ -88,7 +45,7 @@ export async function toDbReaction( if (emoji) return reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`; } - return await getFallbackReaction(); + return (await fetchMeta()).defaultReaction; } type DecodedReaction = { @@ -128,9 +85,3 @@ export function decodeReaction(str: string): DecodedReaction { host: undefined, }; } - -export function convertLegacyReaction(reaction: string): string { - const decoded = decodeReaction(reaction).reaction; - if (legacies.has(decoded)) return legacies.get(decoded)!; - return decoded; -} 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 9fbe30449b..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 { @@ -162,7 +162,7 @@ export class Meta { @Column("varchar", { length: 512, nullable: true, - default: "/static-assets/badges/info.png", + default: "/static-assets/badges/info.webp", }) public mascotImageUrl: string | null; @@ -187,7 +187,7 @@ export class Meta { @Column("varchar", { length: 512, nullable: true, - default: "/static-assets/badges/error.png", + default: "/static-assets/badges/error.webp", }) public errorImageUrl: string | null; @@ -354,57 +354,6 @@ export class Meta { }) public swPrivateKey: string | null; - @Column("boolean", { - default: false, - }) - public enableTwitterIntegration: boolean; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public twitterConsumerKey: string | null; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public twitterConsumerSecret: string | null; - - @Column("boolean", { - default: false, - }) - public enableGithubIntegration: boolean; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public githubClientId: string | null; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public githubClientSecret: string | null; - - @Column("boolean", { - default: false, - }) - public enableDiscordIntegration: boolean; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public discordClientId: string | null; - - @Column("varchar", { - length: 128, - nullable: true, - }) - public discordClientSecret: string | null; - @Column("varchar", { length: 128, nullable: true, @@ -434,6 +383,12 @@ export class Meta { }) public ToSUrl: string | null; + @Column("jsonb", { + default: [], + nullable: false, + }) + public moreUrls: [string, string][]; + @Column("varchar", { length: 512, default: "https://git.joinfirefish.org/firefish/firefish", 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 704b328503..1b2bbebdc3 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -1,14 +1,13 @@ 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 { 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 21fe64e901..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 }) @@ -66,6 +66,12 @@ export class Note { }) public text: string | null; + @Column("varchar", { + length: 10, + nullable: true, + }) + public lang: string | null; + @Column("varchar", { length: 256, nullable: true, 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 c30e56b66b..b7226c52e1 100644 --- a/packages/backend/src/models/entities/user-ip.ts +++ b/packages/backend/src/models/entities/user-ip.ts @@ -1,14 +1,5 @@ -import { - PrimaryColumn, - Entity, - Index, - JoinColumn, - Column, - ManyToOne, - PrimaryGeneratedColumn, -} from "typeorm"; +import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm"; import { id } from "../id.js"; -import { Note } from "./note.js"; import type { User } from "./user.js"; @Entity() 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 0b8863867c..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 する」のようなクエリは書けなくなるからウーン @@ -215,11 +215,6 @@ export class UserProfile { @JoinColumn() public pinnedPage: Page | null; - @Column("jsonb", { - default: {}, - }) - public integrations: Record; - @Index() @Column("boolean", { default: false, 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 8782d57408..f842f024c3 100644 --- a/packages/backend/src/models/index.ts +++ b/packages/backend/src/models/index.ts @@ -1,72 +1,70 @@ -import {} from "typeorm"; import { db } from "@/db/postgre.js"; -import { Announcement } from "./entities/announcement.js"; -import { AnnouncementRead } from "./entities/announcement-read.js"; -import { Instance } from "./entities/instance.js"; -import { Poll } from "./entities/poll.js"; -import { PollVote } from "./entities/poll-vote.js"; -import { Meta } from "./entities/meta.js"; -import { SwSubscription } from "./entities/sw-subscription.js"; -import { NoteWatching } from "./entities/note-watching.js"; -import { 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 3918f7947b..2de8d7fa8a 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -1,15 +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, Promiseable } 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 { Meta } from "@/models/entities/meta.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Users, DriveFolders } from "../index.js"; -import { deepClone } from "@/misc/clone.js"; +import { awaitAll } from "@/prelude/await-all.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 6d1dfbd6fd..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 { decodeReaction } from "@/misc/reaction-lib.js"; import type { Packed } from "@/misc/schema.js"; -import { convertLegacyReaction } from "@/misc/reaction-lib.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( @@ -27,7 +27,7 @@ export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ id: reaction.id, createdAt: reaction.createdAt.toISOString(), user: await Users.pack(reaction.user ?? reaction.userId, me), - type: convertLegacyReaction(reaction.reaction), + type: decodeReaction(reaction.reaction).reaction, ...(opts.withNote ? { // may throw error @@ -41,7 +41,7 @@ export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ src: NoteReaction[], me?: { id: User["id"] } | null | undefined, options?: { - withNote: booleam; + withNote: boolean; }, ): Promise[]> { const reactions = await Promise.allSettled( diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 082455f42a..e946c30e04 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -1,33 +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 { - convertLegacyReaction, - convertLegacyReactions, - 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 { detect as detectLanguage_ } from "tinyld"; +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 }); @@ -77,7 +72,7 @@ async function populateMyReaction( if (_hint_?.myReactions) { const reaction = _hint_.myReactions.get(note.id); if (reaction) { - return convertLegacyReaction(reaction.reaction); + return decodeReaction(reaction.reaction).reaction; } else if (reaction === null) { return undefined; } @@ -90,7 +85,7 @@ async function populateMyReaction( }); if (reaction) { - return convertLegacyReaction(reaction.reaction); + return decodeReaction(reaction.reaction).reaction; } return undefined; @@ -203,7 +198,6 @@ export const NoteRepository = db.getRepository(Note).extend({ host, ); - const lang = detectLanguage_(`${note.cw ?? ''}\n${note.text ?? ''}`) ?? "unknown" const reactionEmoji = await populateEmojis(reactionEmojiNames, host); const packed: Packed<"Note"> = await awaitAll({ id: note.id, @@ -220,7 +214,7 @@ export const NoteRepository = db.getRepository(Note).extend({ note.visibility === "specified" ? note.visibleUserIds : undefined, renoteCount: note.renoteCount, repliesCount: note.repliesCount, - reactions: convertLegacyReactions(note.reactions), + reactions: convertReactions(note.reactions), reactionEmojis: reactionEmoji, emojis: noteEmoji, tags: note.tags.length > 0 ? note.tags : undefined, @@ -263,14 +257,15 @@ export const NoteRepository = db.getRepository(Note).extend({ : undefined, } : {}), - lang: lang, + lang: note.lang, }); if (packed.user.isCat && packed.user.speakAsCat && packed.text) { const tokens = packed.text ? mfm.parse(packed.text) : []; function nyaizeNode(node: mfm.MfmNode) { if (node.type === "quote") return; - if (node.type === "text") node.props.text = nyaize(node.props.text); + if (node.type === "text") + node.props.text = nyaize(node.props.text, packed.lang); if (node.children) { for (const child of node.children) { diff --git a/packages/backend/src/models/repositories/notification.ts b/packages/backend/src/models/repositories/notification.ts index 1538e67d86..9dd4934215 100644 --- a/packages/backend/src/models/repositories/notification.ts +++ b/packages/backend/src/models/repositories/notification.ts @@ -1,19 +1,18 @@ -import { In, Repository } 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 { notificationTypes } from "@/types.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 86bef413b5..5061797767 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -1,42 +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 { getAntennas } from "@/misc/antenna-cache.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", @@ -565,7 +564,6 @@ export const UserRepository = db.getRepository(User).extend({ hasUnreadNotification: this.getHasUnreadNotification(user.id), hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id), - integrations: profile!.integrations, mutedWords: profile!.mutedWords, mutedInstances: profile!.mutedInstances, mutingNotificationTypes: profile!.mutingNotificationTypes, diff --git a/packages/backend/src/models/schema/user.ts b/packages/backend/src/models/schema/user.ts index d625308f00..9550111014 100644 --- a/packages/backend/src/models/schema/user.ts +++ b/packages/backend/src/models/schema/user.ts @@ -24,7 +24,7 @@ export const packedUserLiteSchema = { type: "string", nullable: true, optional: false, - example: "misskey.example.com", + example: "firefish.example.com", description: "The local host is represented with `null`.", }, avatarUrl: { @@ -459,11 +459,6 @@ export const packedMeDetailedOnlySchema = { nullable: false, optional: false, }, - integrations: { - type: "object", - nullable: true, - optional: false, - }, mutedWords: { type: "array", nullable: false, 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 c0275b420a..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 meilisearch from "@/db/meilisearch.js"; import { Note } from "@/models/entities/note.js"; -import meilisearch from "../../../db/meilisearch.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 7a19d0b60b..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,18 +1,16 @@ -import type Bull from "bull"; import * as fs from "node:fs"; +import type Bull from "bull"; -import { ulid } from "ulid"; -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 {} from "@/queue/types.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 2fdf80a6eb..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, Blockings } 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 9b86a5903f..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,16 +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 { Note } from "@/models/entities/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"); @@ -56,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 3bf010a1b9..140b315e87 100644 --- a/packages/backend/src/queue/processors/ended-poll-notification.ts +++ b/packages/backend/src/queue/processors/ended-poll-notification.ts @@ -1,11 +1,12 @@ -import type Bull from "bull"; import { Notes, PollVotes } from "@/models/index.js"; -import { queueLogger } from "../logger.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"; -const logger = queueLogger.createSubLogger("ended-poll-notification"); +// unused +// const logger = queueLogger.createSubLogger("ended-poll-notification"); export async function endedPollNotification( job: Bull.Job, diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index 0e500b89ed..71cf7d458a 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -1,27 +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"; const logger = new Logger("inbox"); @@ -95,11 +96,31 @@ export default async (job: Bull.Job): Promise => { } // HTTP-Signatureの検証 - const httpSignatureValidated = httpSignature.verifySignature( + let httpSignatureValidated = httpSignature.verifySignature( signature, authUser.key.keyPem, ); + // If signature validation failed, try refetching the actor + if (!httpSignatureValidated) { + authUser.key = await dbResolver.refetchPublicKeyForApId(authUser.user); + + if (authUser.key == null) { + return "skip: failed to re-resolve user publicKey"; + } + + httpSignatureValidated = httpSignature.verifySignature( + signature, + authUser.key.keyPem, + ); + } + + if (httpSignatureValidated) { + if (!verifySignature(signature, authUser.key)) { + return "skip: Invalid HTTP signature"; + } + } + // また、signatureのsignerは、activity.actorと一致する必要がある if (!httpSignatureValidated || authUser.user.uri !== activity.actor) { // 一致しなくても、でもLD-Signatureがありそうならそっちも見る 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 3ddda9baf4..b2c1d65b82 100644 --- a/packages/backend/src/queue/processors/system/verify-links.ts +++ b/packages/backend/src/queue/processors/system/verify-links.ts @@ -1,10 +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"; -import config from "@/config/index.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 286b401ba7..19f0aec3c5 100644 --- a/packages/backend/src/queue/processors/webhook-deliver.ts +++ b/packages/backend/src/queue/processors/webhook-deliver.ts @@ -1,10 +1,9 @@ -import { URL } from "node:url"; -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 21b1b2e6ac..6a45581e66 100644 --- a/packages/backend/src/remote/activitypub/audience.ts +++ b/packages/backend/src/remote/activitypub/audience.ts @@ -1,14 +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 { User } 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 c885b4a199..77ba795253 100644 --- a/packages/backend/src/remote/activitypub/check-fetch.ts +++ b/packages/backend/src/remote/activitypub/check-fetch.ts @@ -1,14 +1,17 @@ +import type { IncomingMessage } from "http"; +import { verify } from "node:crypto"; +import { createHash } from "node:crypto"; import { URL } from "url"; -import httpSignature 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 httpSignature, { IParsedSignature } from "@peertube/http-signature"; export async function hasSignature(req: IncomingMessage): Promise { const meta = await fetchMeta(); @@ -28,10 +31,14 @@ export async function hasSignature(req: IncomingMessage): Promise { export async function checkFetch(req: IncomingMessage): Promise { const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { + if (req.headers.host !== config.host) return 400; + let signature; try { - signature = httpSignature.parseRequest(req, { headers: [] }); + signature = httpSignature.parseRequest(req, { + headers: ["(request-target)", "host", "date"], + }); } catch (e) { return 401; } @@ -86,14 +93,30 @@ export async function checkFetch(req: IncomingMessage): Promise { } // HTTP-Signatureの検証 - const httpSignatureValidated = httpSignature.verifySignature( + let httpSignatureValidated = httpSignature.verifySignature( signature, authUser.key.keyPem, ); + // If signature validation failed, try refetching the actor + if (!httpSignatureValidated) { + authUser.key = await dbResolver.refetchPublicKeyForApId(authUser.user); + + if (authUser.key == null) { + return 403; + } + + httpSignatureValidated = httpSignature.verifySignature( + signature, + authUser.key.keyPem, + ); + } + if (!httpSignatureValidated) { return 403; } + + return verifySignature(signature, authUser.key) ? 200 : 401; } return 200; } @@ -116,3 +139,39 @@ export async function getSignatureUser(req: IncomingMessage): Promise<{ keyId.hash = ""; return await dbResolver.getAuthUserFromApId(getApId(keyId.toString())); } + +export function verifySignature( + sig: IParsedSignature, + key: UserPublickey, +): boolean { + if (!["hs2019", "rsa-sha256"].includes(sig.algorithm.toLowerCase())) + return false; + try { + return verify( + "rsa-sha256", + Buffer.from(sig.signingString, "utf8"), + key.keyPem, + Buffer.from(sig.params.signature, "base64"), + ); + } catch { + // Algo not supported + return false; + } +} + +export function verifyDigest( + body: string, + digest: string | string[] | undefined, +): boolean { + digest = toSingle(digest); + if ( + body == null || + digest == null || + !digest.toLowerCase().startsWith("sha-256=") + ) + return false; + + return ( + createHash("sha256").update(body).digest("base64") === digest.substring(8) + ); +} diff --git a/packages/backend/src/remote/activitypub/db-resolver.ts b/packages/backend/src/remote/activitypub/db-resolver.ts index a710b9f115..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 } from "./models/person.js"; const publicKeyCache = new Cache("publicKey", 60 * 30); const publicKeyByUserIdCache = new Cache( @@ -70,7 +70,7 @@ export function parseUri(value: string | IObject): UriParseResult { export default class DbResolver { /** - * AP Note => Misskey Note in DB + * AP Note => Firefish Note in DB */ public async getNoteFromApId(value: string | IObject): Promise { const parsed = parseUri(value); @@ -114,7 +114,7 @@ export default class DbResolver { } /** - * AP Person => Misskey User in DB + * AP Person => Firefish User in DB */ public async getUserFromApId( value: string | IObject, @@ -147,11 +147,11 @@ export default class DbResolver { } /** - * AP KeyId => Misskey User and Key + * AP KeyId => Firefish User and Key */ public async getAuthUserFromKeyId(keyId: string): Promise<{ user: CacheableRemoteUser; - key: UserPublickey; + key: UserPublickey | null; } | null> { const key = await publicKeyCache.fetch( keyId, @@ -181,7 +181,7 @@ export default class DbResolver { } /** - * AP Actor id => Misskey User and Key + * AP Actor id => Firefish User and Key */ public async getAuthUserFromApId(uri: string): Promise<{ user: CacheableRemoteUser; @@ -203,4 +203,15 @@ export default class DbResolver { key, }; } + + public async refetchPublicKeyForApId( + user: CacheableRemoteUser, + ): Promise { + await updatePerson(user.uri!, undefined, undefined, user); + const key = await UserPublickeys.findOneBy({ userId: user.id }); + if (key != null) { + await publicKeyByUserIdCache.set(user.id, key); + } + return key; + } } 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 7cc70976c3..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 { 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"; -import { isSelfHost, extractDbHost } from "@/misc/convert-host.js"; -import { MessagingMessages } from "@/models/index.js"; -import { readUserMessagingMessage } from "../../../server/api/common/read-messaging-message.js"; export const performReadActivity = async ( actor: 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 2cd05a77d2..6e33661961 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts @@ -1,9 +1,8 @@ -import unfollow from "@/services/following/delete.js"; -import cancelRequest from "@/services/following/requests/cancel.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 cb5294f731..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 { toHtml } from "@/mfm/to-html.js"; import type { Note } from "@/models/entities/note.js"; -import { toHtml } from "../../../mfm/to-html.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 9d71a46a36..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 { fromHtml } from "@/mfm/from-html.js"; import { extractApHashtagObjects } from "../models/tag.js"; -import { fromHtml } from "../../../mfm/from-html.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 67652d57de..36eeda36c5 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -1,13 +1,12 @@ -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { IRemoteUser } from "@/models/entities/user.js"; -import Resolver from "../resolver.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { apLogger } from "../logger.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles, Users } 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 b888fa21a4..4f7ff66903 100644 --- a/packages/backend/src/remote/activitypub/models/mention.ts +++ b/packages/backend/src/remote/activitypub/models/mention.ts @@ -1,10 +1,9 @@ -import promiseLimit from "promise-limit"; -import { toArray, unique } from "@/prelude/array.js"; import type { CacheableUser } from "@/models/entities/user.js"; -import { User } 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 12b2c19972..c70d1acfb7 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -1,58 +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 { - ILocalUser, - 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 { fetchMeta } from "@/misc/fetch-meta.js"; +import { resolvePerson } from "./person.js"; +import { extractPollFromQuestion } from "./question.js"; +import { extractApHashtags } from "./tag.js"; const logger = apLogger; @@ -247,7 +244,7 @@ export async function createNote( // Quote let quote: Note | undefined | null; - if (note._misskey_quote || note.quoteUrl || note.quoteUri) { + if (note.quoteUrl || note.quoteUri) { const tryResolveNote = async ( uri: string, ): Promise< @@ -284,7 +281,7 @@ export async function createNote( }; const uris = unique( - [note._misskey_quote, note.quoteUrl, note.quoteUri].filter( + [note.quoteUrl, note.quoteUri].filter( (x): x is string => typeof x === "string", ), ); @@ -305,13 +302,24 @@ export async function createNote( // Text parsing let text: string | null = null; + let lang: string | null = null; if ( note.source?.mediaType === "text/x.misskeymarkdown" && typeof note.source?.content === "string" ) { text = note.source.content; - } else if (typeof note._misskey_content !== "undefined") { - text = note._misskey_content; + if (note.contentMap != null) { + const key = Object.keys(note.contentMap)[0]; + lang = Object.keys(langmap).includes(key) + ? key.trim().split("-")[0].split("@")[0] + : null; + } + } else if (note.contentMap != null) { + const entry = Object.entries(note.contentMap)[0]; + lang = Object.keys(langmap).includes(entry[0]) + ? entry[0].trim().split("-")[0].split("@")[0] + : null; + text = htmlToMfm(entry[1], note.tag); } else if (typeof note.content === "string") { text = htmlToMfm(note.content, note.tag); } @@ -380,6 +388,7 @@ export async function createNote( name: note.name, cw, text, + lang, localOnly: false, visibility, visibleUsers, @@ -567,13 +576,24 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) { // Text parsing let text: string | null = null; + let lang: string | null = null; if ( post.source?.mediaType === "text/x.misskeymarkdown" && typeof post.source?.content === "string" ) { text = post.source.content; - } else if (typeof post._misskey_content !== "undefined") { - text = post._misskey_content; + if (post.contentMap != null) { + const key = Object.keys(post.contentMap)[0]; + lang = Object.keys(langmap).includes(key) + ? key.trim().split("-")[0].split("@")[0] + : null; + } + } else if (post.contentMap != null) { + const entry = Object.entries(post.contentMap)[0]; + lang = Object.keys(langmap).includes(entry[0]) + ? entry[0].trim().split("-")[0].split("@")[0] + : null; + text = htmlToMfm(entry[1], post.tag); } else if (typeof post.content === "string") { text = htmlToMfm(post.content, post.tag); } @@ -667,6 +687,9 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) { if (text && text !== note.text) { update.text = text; } + if (lang && lang !== note.lang) { + update.lang = lang; + } if (cw !== note.cw) { update.cw = cw ? cw : null; } diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index c02905fabf..afd91e4e7f 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -2,52 +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, - DriveFiles, - 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 type { IActor, IObject, IApPropertyValue } from "../type.js"; -import { - isCollectionOrOrderedCollection, - isCollection, - getApId, - getOneApHrefNullable, - isPropertyValue, - getApType, - isActor, -} from "../type.js"; import Resolver from "../resolver.js"; -import { extractApHashtags } from "./tag.js"; -import { resolveNote, extractEmojis } from "./note.js"; +import type { IActor, IObject } from "../type.js"; +import { + getApId, + getApType, + getOneApHrefNullable, + isActor, + isCollection, + isCollectionOrOrderedCollection, + isPropertyValue, +} from "../type.js"; import { resolveImage } from "./image.js"; +import { extractEmojis, resolveNote } from "./note.js"; +import { extractApHashtags } from "./tag.js"; const logger = apLogger; @@ -185,7 +184,7 @@ export async function createPerson( const host = toPuny(new URL(object.id).hostname); - const { fields } = analyzeAttachments(person.attachment || []); + const fields = analyzeAttachments(person.attachment || []); const tags = extractApHashtags(person.tag) .map((tag) => normalizeForSearch(tag)) @@ -302,7 +301,10 @@ export async function createPerson( tags, isBot, isCat: (person as any).isCat === true, - speakAsCat: person.speakAsCat, + speakAsCat: + person.speakAsCat != null + ? person.speakAsCat === true + : (person as any).isCat === true, isIndexable: person.indexable, }), )) as IRemoteUser; @@ -310,7 +312,9 @@ export async function createPerson( await transactionalEntityManager.save( new UserProfile({ userId: user.id, - description: person.summary + description: person._misskey_summary + ? truncate(person._misskey_summary, summaryLength) + : person.summary ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null, url: url, @@ -453,7 +457,7 @@ export async function updatePerson( const emojiNames = emojis.map((emoji) => emoji.name); - const { fields } = analyzeAttachments(person.attachment || []); + const fields = analyzeAttachments(person.attachment || []); const tags = extractApHashtags(person.tag) .map((tag) => normalizeForSearch(tag)) @@ -471,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 { @@ -486,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 { @@ -501,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) { @@ -549,6 +553,10 @@ export async function updatePerson( tags, isBot: getApType(object) !== "Person", isCat: (person as any).isCat === true, + speakAsCat: + person.speakAsCat != null + ? person.speakAsCat === true + : (person as any).isCat === true, isIndexable: person.indexable, isLocked: !!person.manuallyApprovesFollowers, movedToUri: person.movedTo || null, @@ -635,39 +643,6 @@ export async function resolvePerson( return await createPerson(uri, resolver); } -const services: { - [x: string]: (id: string, username: string) => any; -} = { - "misskey:authentication:twitter": (userId, screenName) => ({ - userId, - screenName, - }), - "misskey:authentication:github": (id, login) => ({ id, login }), - "misskey:authentication:discord": (id, name) => $discord(id, name), -}; - -const $discord = (id: string, name: string) => { - if (typeof name !== "string") { - name = "unknown#0000"; - } - const [username, discriminator] = name.split("#"); - return { id, username, discriminator }; -}; - -function addService(target: { [x: string]: any }, source: IApPropertyValue) { - const service = services[source.name]; - - if (typeof source.value !== "string") { - source.value = "unknown"; - } - - const [id, username] = source.value.split("@"); - - if (service) { - target[source.name.split(":")[2]] = service(id, username); - } -} - export function analyzeAttachments( attachments: IObject | IObject[] | undefined, ) { @@ -675,22 +650,17 @@ export function analyzeAttachments( name: string; value: string; }[] = []; - const services: { [x: string]: any } = {}; if (Array.isArray(attachments)) { for (const attachment of attachments.filter(isPropertyValue)) { - if (isPropertyValue(attachment.identifier)) { - addService(services, attachment.identifier); - } else { - fields.push({ - name: attachment.name, - value: fromHtml(attachment.value), - }); - } + fields.push({ + name: attachment.name, + value: fromHtml(attachment.value), + }); } } - return { fields, services }; + return fields; } export async function updateFeatured(userId: User["id"], resolver?: Resolver) { 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/flag.ts b/packages/backend/src/remote/activitypub/renderer/flag.ts index f94d508e1d..44da33f5c2 100644 --- a/packages/backend/src/remote/activitypub/renderer/flag.ts +++ b/packages/backend/src/remote/activitypub/renderer/flag.ts @@ -1,8 +1,5 @@ import config from "@/config/index.js"; -import { IObject, IActivity } from "@/remote/activitypub/type.js"; import type { ILocalUser } from "@/models/entities/user.js"; -import { IRemoteUser } from "@/models/entities/user.js"; -import { getInstanceActor } from "@/services/instance-actor.js"; // to anonymise reporters, the reporting actor must be a system user // object has to be a uri or array of uris 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 bb5dcdfc19..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"; @@ -35,13 +35,15 @@ export const renderActivity = (x: any): IActivity | null => { schema: "http://schema.org#", PropertyValue: "schema:PropertyValue", value: "schema:value", + // Firefish + firefish: "https://joinfirefish.org/ns#", + speakAsCat: "firefish:speakAsCat", // Misskey misskey: "https://misskey-hub.net/ns#", - _misskey_content: "misskey:_misskey_content", - _misskey_quote: "misskey:_misskey_quote", + _misskey_talk: "misskey:_misskey_talk", _misskey_reaction: "misskey:_misskey_reaction", _misskey_votes: "misskey:_misskey_votes", - _misskey_talk: "misskey:_misskey_talk", + _misskey_summary: "misskey:_misskey_summary", isCat: "misskey:isCat", // Fedibird fedibird: "http://fedibird.com/ns#", 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 2ad2fec9fb..a63118ad4e 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -1,15 +1,16 @@ -import { In, IsNull } from "typeorm"; import config from "@/config/index.js"; -import type { Note, IMentionedRemoteUsers } from "@/models/entities/note.js"; +import detectLanguage from "@/misc/detect-language.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 { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; import type { Poll } from "@/models/entities/poll.js"; -import toHtml from "../misc/get-note-html.js"; -import renderEmoji from "./emoji.js"; -import renderMention from "./mention.js"; -import renderHashtag from "./hashtag.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, @@ -114,6 +115,13 @@ export default async function renderNote( }), ); + const lang = note.lang ?? detectLanguage(text); + const contentMap = lang + ? { + [lang]: content, + } + : null; + const emojis = await getEmojis(note.emojis); const apemojis = emojis.map((emoji) => renderEmoji(emoji)); @@ -152,12 +160,11 @@ export default async function renderNote( attributedTo, summary, content, - _misskey_content: text, + contentMap, source: { content: text, mediaType: "text/x.misskeymarkdown", }, - _misskey_quote: quote, quoteUri: quote, quoteUrl: quote, published: note.createdAt.toISOString(), diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index 9f642bb9e5..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}`; @@ -74,6 +74,7 @@ export async function renderPerson(user: ILocalUser) { summary: profile.description ? toHtml(mfm.parse(profile.description)) : null, + _misskey_summary: profile.description, icon: avatar ? renderImage(avatar) : null, image: banner ? renderImage(banner) : null, tag, 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/undo.ts b/packages/backend/src/remote/activitypub/renderer/undo.ts index 249d643b25..4394c4bf2f 100644 --- a/packages/backend/src/remote/activitypub/renderer/undo.ts +++ b/packages/backend/src/remote/activitypub/renderer/undo.ts @@ -1,6 +1,5 @@ import config from "@/config/index.js"; import type { User } from "@/models/entities/user.js"; -import { ILocalUser } from "@/models/entities/user.js"; export default (object: any, user: { id: User["id"] }) => { if (object == null) return null; 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 608ca3e935..e487f5ff97 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -1,29 +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 { - FollowRequests, - 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/activitypub/type.ts b/packages/backend/src/remote/activitypub/type.ts index ecaf6d6872..cf0410767b 100644 --- a/packages/backend/src/remote/activitypub/type.ts +++ b/packages/backend/src/remote/activitypub/type.ts @@ -14,6 +14,7 @@ export interface IObject { inReplyTo?: any; replies?: ICollection; content?: string; + contentMap?: obj; name?: string; startTime?: Date; endTime?: Date; @@ -134,7 +135,6 @@ export interface IPost extends IObject { content: string; mediaType: string; }; - _misskey_quote?: string; quoteUrl?: string; quoteUri?: string; _misskey_talk: boolean; @@ -146,7 +146,6 @@ export interface IQuestion extends IObject { content: string; mediaType: string; }; - _misskey_quote?: string; quoteUrl?: string; oneOf?: IQuestionChoice[]; anyOf?: IQuestionChoice[]; @@ -206,6 +205,7 @@ export interface IActor extends IObject { }; "vcard:bday"?: string; "vcard:Address"?: string; + _misskey_summary?: string; } export const isCollection = (object: IObject): object is ICollection => 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 f9d5eb99c3..e8f32c772a 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -1,36 +1,38 @@ import Router from "@koa/router"; -import json from "koa-json-body"; 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 { isSelfHost, toPuny } from "@/misc/convert-host.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, - hasSignature, 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"; @@ -40,15 +42,27 @@ const router = new Router(); //#region Routing function inbox(ctx: Router.RouterContext) { + if (ctx.req.headers.host !== config.host) { + ctx.status = 400; + return; + } + let signature; try { - signature = httpSignature.parseRequest(ctx.req, { headers: [] }); + signature = httpSignature.parseRequest(ctx.req, { + headers: ["(request-target)", "digest", "host", "date"], + }); } catch (e) { ctx.status = 401; return; } + if (!verifyDigest(ctx.request.rawBody, ctx.headers.digest)) { + ctx.status = 401; + return; + } + processInbox(ctx.request.body, signature); ctx.status = 202; @@ -73,9 +87,23 @@ export function setResponseType(ctx: Router.RouterContext) { } } +async function parseJsonBodyOrFail(ctx: Router.RouterContext, next: Koa.Next) { + const koaBodyParser = bodyParser({ + enableTypes: ["json"], + detectJSON: () => true, + }); + + try { + await koaBodyParser(ctx, next); + } catch { + ctx.status = 400; + return; + } +} + // inbox -router.post("/inbox", json(), inbox); -router.post("/users/:user/inbox", json(), inbox); +router.post("/inbox", parseJsonBodyOrFail, inbox); +router.post("/users/:user/inbox", parseJsonBodyOrFail, inbox); // note router.get("/notes/:note", async (ctx, next) => { 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 0a1027b835..5048e70af0 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -1,17 +1,15 @@ -import { performance } from "perf_hooks"; -import type Koa from "koa"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; -import { User } 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 type { AccessToken } from "@/models/entities/access-token.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 ee0844185f..83ba31c367 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,9 +1,8 @@ import * as fs from "node:fs"; -import Ajv from "ajv"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; -import { ILocalUser } 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 4861431403..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 "../../define.js"; import { AbuseUserReports } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 2e035d1695..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 "../../../define.js"; import { Users } from "@/models/index.js"; -import { signup } from "../../../common/signup.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 3f7243ab50..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 "../../../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 a7b6e95c28..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 define from "../../../define.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 db39f3eb27..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 "../../../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 ee6d314de7..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,6 +1,6 @@ -import define from "../../../define.js"; import { Ads } from "@/models/index.js"; -import { ApiError } from "../../../error.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/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 65944d31e9..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 "../../../define.js"; import { Ads } from "@/models/index.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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 2c70387310..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,6 +1,6 @@ -import define from "../../../define.js"; import { Ads } from "@/models/index.js"; -import { ApiError } from "../../../error.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/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 754cc6c893..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 "../../../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 5665b94a7b..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,6 +1,6 @@ -import define from "../../../define.js"; import { Announcements } from "@/models/index.js"; -import { ApiError } from "../../../error.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/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index e96517c68e..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 "../../../define.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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 616b94d699..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,6 +1,6 @@ -import define from "../../../define.js"; import { Announcements } from "@/models/index.js"; -import { ApiError } from "../../../error.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/delete-2fa.ts b/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts index 04f6abb82c..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 { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; -import define from "../../define.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 9fd196888d..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 define from "@/server/api/define.js"; import { deleteAccount } from "@/services/delete-account.js"; -import define from "../../define.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 7969008113..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 define from "../../define.js"; -import { deleteFile } from "@/services/drive/delete-file.js"; import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { deleteFile } from "@/services/drive/delete-file.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 3b5c595281..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 { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; -import define from "../../define.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 c8be344696..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 "../../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 1b0c1260bd..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 "../../../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 04208f6004..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 define from "../../../define.js"; -import { deleteFile } from "@/services/drive/delete-file.js"; import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { deleteFile } from "@/services/drive/delete-file.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 5cb0aecd81..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 "../../../define.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index d65ec09fc2..a080615e74 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -1,6 +1,6 @@ import { DriveFiles } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.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/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index 1ea457adf2..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,8 +1,7 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { ApiError } from "../../../error.js"; 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 4366406ec3..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 "../../../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 "../../../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 c90e606335..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 "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { ApiError } from "../../../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 585af231f6..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,9 +1,8 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { ApiError } from "../../../error.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 761c7c3776..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 "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { ApiError } from "../../../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 9eba9dfd54..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 "../../../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 6252e7e929..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 "../../../define.js"; -import { Emojis } from "@/models/index.js"; import { toPuny } from "@/misc/convert-host.js"; -import { makePaginationQuery } from "../../../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 f8269588ca..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 "../../../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 4e57fa3dda..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,8 +1,7 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { ApiError } from "../../../error.js"; 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 1197f60779..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,8 +1,7 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { ApiError } from "../../../error.js"; 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 17881a4454..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,8 +1,7 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { ApiError } from "../../../error.js"; 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 c98ca03fae..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,8 +1,7 @@ -import define from "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { In } from "typeorm"; -import { ApiError } from "../../../error.js"; 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 9e2e854760..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 "../../../define.js"; -import { Emojis } from "@/models/index.js"; -import { ApiError } from "../../../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 534f226c28..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 define from "../../../define.js"; -import { deleteFile } from "@/services/drive/delete-file.js"; import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { deleteFile } from "@/services/drive/delete-file.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 9c7165593c..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 "../../../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 a1ccf11af0..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 define from "../../../define.js"; -import deleteFollowing from "@/services/following/delete.js"; import { Followings, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import deleteFollowing from "@/services/following/delete.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 016989b541..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 "../../../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 f39a369ecb..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 "../../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/get-table-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts index 25d07f327a..13c893f4b9 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts @@ -1,5 +1,5 @@ import { db } from "@/db/postgre.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/admin/get-user-ips.ts b/packages/backend/src/server/api/endpoints/admin/get-user-ips.ts index da76ae624e..1b394ebb85 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-user-ips.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-user-ips.ts @@ -1,5 +1,5 @@ import { UserIps } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index b8bdb38b46..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 "../../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 9abb57b1b3..64fd38eeb2 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -1,8 +1,7 @@ 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 "../../define.js"; -import { Exp } from "@tensorflow/tfjs"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], @@ -64,7 +63,7 @@ export const meta = { type: "string", optional: false, nullable: false, - default: "/static-assets/badges/info.png", + default: "/static-assets/badges/info.webp", }, bannerUrl: { type: "string", @@ -75,7 +74,7 @@ export const meta = { type: "string", optional: false, nullable: false, - default: "/static-assets/badges/error.png", + default: "/static-assets/badges/error.webp", }, iconUrl: { type: "string", @@ -170,21 +169,6 @@ export const meta = { optional: false, nullable: false, }, - enableTwitterIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, - enableGithubIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, - enableDiscordIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, enableServiceWorker: { type: "boolean", optional: false, @@ -326,36 +310,6 @@ export const meta = { nullable: true, format: "id", }, - twitterConsumerKey: { - type: "string", - optional: true, - nullable: true, - }, - twitterConsumerSecret: { - type: "string", - optional: true, - nullable: true, - }, - githubClientId: { - type: "string", - optional: true, - nullable: true, - }, - githubClientSecret: { - type: "string", - optional: true, - nullable: true, - }, - discordClientId: { - type: "string", - optional: true, - nullable: true, - }, - discordClientSecret: { - type: "string", - optional: true, - nullable: true, - }, summaryProxy: { type: "string", optional: true, @@ -518,6 +472,7 @@ export default define(meta, paramDef, async (ps, me) => { description: instance.description, langs: instance.langs, tosUrl: instance.ToSUrl, + moreUrls: instance.moreUrls, repositoryUrl: instance.repositoryUrl, feedbackUrl: instance.feedbackUrl, disableRegistration: instance.disableRegistration, @@ -544,9 +499,6 @@ export default define(meta, paramDef, async (ps, me) => { defaultLightTheme: instance.defaultLightTheme, defaultDarkTheme: instance.defaultDarkTheme, enableEmail: instance.enableEmail, - enableTwitterIntegration: instance.enableTwitterIntegration, - enableGithubIntegration: instance.enableGithubIntegration, - enableDiscordIntegration: instance.enableDiscordIntegration, enableServiceWorker: instance.enableServiceWorker, translatorAvailable: instance.deeplAuthKey != null || instance.libreTranslateApiUrl != null, @@ -573,12 +525,6 @@ export default define(meta, paramDef, async (ps, me) => { enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos, proxyAccountId: instance.proxyAccountId, - twitterConsumerKey: instance.twitterConsumerKey, - twitterConsumerSecret: instance.twitterConsumerSecret, - githubClientId: instance.githubClientId, - githubClientSecret: instance.githubClientSecret, - discordClientId: instance.discordClientId, - discordClientSecret: instance.discordClientSecret, summalyProxy: instance.summalyProxy, email: instance.email, smtpSecure: instance.smtpSecure, 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 478f2661b6..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 "../../../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 a43cc0cbe1..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 "../../../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 00244a777a..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getNote } from "../../../common/getters.js"; 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"; 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 9b828bb241..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 "../../../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 15fdfb0250..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,6 +1,6 @@ -import { deliverQueue } from "@/queue/queues.js"; import { URL } from "node:url"; -import define from "../../../define.js"; +import { deliverQueue } 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/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 1890bd4345..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 "../../../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 4a437c3d12..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,11 +1,11 @@ import { + backgroundQueue, + dbQueue, deliverQueue, inboxQueue, - dbQueue, objectStorageQueue, - backgroundQueue, } from "@/queue/queues.js"; -import define from "../../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], 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 bb56216a74..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 "../../../define.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import { addRelay } from "@/services/relay.js"; -import { ApiError } from "../../../error.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index 4c294ba9b2..5c3b7a9225 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -1,4 +1,4 @@ -import define from "../../../define.js"; +import define from "@/server/api/define.js"; import { listRelay } from "@/services/relay.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index 1b3d90628b..19a9dfa393 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -1,4 +1,4 @@ -import define from "../../../define.js"; +import define from "@/server/api/define.js"; import { removeRelay } from "@/services/relay.js"; export const meta = { 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 cbe6735ce5..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 define from "../../define.js"; +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 c876a21984..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 "../../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 135b48eccd..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 "../../../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-email.ts b/packages/backend/src/server/api/endpoints/admin/send-email.ts index 1676f68907..1b43d90c8b 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-email.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-email.ts @@ -1,4 +1,4 @@ -import define from "../../define.js"; +import define from "@/server/api/define.js"; import { sendEmail } from "@/services/send-email.js"; export const meta = { 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 db12ab6c23..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 define from "../../define.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import { ApiError } from "../../error.js"; -import { sendEmail } from "@/services/send-email.js"; +import { UserProfiles, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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"], @@ -49,7 +49,7 @@ export default define(meta, paramDef, async (ps) => { createNotification(user.id, "app", { customBody: ps.comment, customHeader: "Moderation Notice", - customIcon: "/static-assets/badges/info.png", + customIcon: "/static-assets/badges/info.webp", }); setImmediate(async () => { 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 8998032cc9..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 "../../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 df7e8979ca..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 "../../define.js"; import { ModerationLogs } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index 3c3a0913d0..f3a74c313b 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -1,5 +1,5 @@ import { Signins, UserProfiles, Users } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], @@ -46,13 +46,6 @@ export default define(meta, paramDef, async (ps, me) => { }; } - const maskedKeys = ["accessToken", "accessTokenSecret", "refreshToken"]; - Object.keys(profile.integrations).forEach((integration) => { - maskedKeys.forEach( - (key) => (profile.integrations[integration][key] = ""), - ); - }); - const signins = await Signins.findBy({ userId: user.id }); return { @@ -67,7 +60,6 @@ export default define(meta, paramDef, async (ps, me) => { carefulBot: profile.carefulBot, injectFeaturedNote: profile.injectFeaturedNote, receiveAnnouncementEmail: profile.receiveAnnouncementEmail, - integrations: profile.integrations, mutedWords: profile.mutedWords, mutedInstances: profile.mutedInstances, mutingNotificationTypes: profile.mutingNotificationTypes, 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 b777bd26d9..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 { Users } from "@/models/index.js"; -import define from "../../define.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; +import { Users } 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/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index a61823297b..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 "../../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 984bc0789e..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 define from "../../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 { Followings, Notifications, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import deleteFollowing from "@/services/following/delete.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 6a01b8e8d3..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 "../../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 e51d5851c2..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 "../../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 2142c7df73..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 define from "../../define.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"], @@ -132,15 +132,6 @@ export const paramDef = { deeplIsPro: { type: "boolean" }, libreTranslateApiUrl: { type: "string", nullable: true }, libreTranslateApiKey: { type: "string", nullable: true }, - enableTwitterIntegration: { type: "boolean" }, - twitterConsumerKey: { type: "string", nullable: true }, - twitterConsumerSecret: { type: "string", nullable: true }, - enableGithubIntegration: { type: "boolean" }, - githubClientId: { type: "string", nullable: true }, - githubClientSecret: { type: "string", nullable: true }, - enableDiscordIntegration: { type: "boolean" }, - discordClientId: { type: "string", nullable: true }, - discordClientSecret: { type: "string", nullable: true }, enableEmail: { type: "boolean" }, email: { type: "string", nullable: true }, smtpSecure: { type: "boolean" }, @@ -152,6 +143,17 @@ export const paramDef = { swPublicKey: { type: "string", nullable: true }, swPrivateKey: { type: "string", nullable: true }, tosUrl: { type: "string", nullable: true }, + moreUrls: { + type: "array", + items: { + type: "object", + properties: { + name: { type: "string" }, + url: { type: "string" }, + }, + }, + nullable: true, + }, repositoryUrl: { type: "string" }, feedbackUrl: { type: "string" }, useObjectStorage: { type: "boolean" }, @@ -183,6 +185,18 @@ export const paramDef = { required: [], } as const; +function isValidHttpUrl(src: string) { + let url; + + try { + url = new URL(src); + } catch (_) { + return false; + } + + return url.protocol === "http:" || url.protocol === "https:"; +} + export default define(meta, paramDef, async (ps, me) => { const set = {} as Partial; @@ -395,42 +409,6 @@ export default define(meta, paramDef, async (ps, me) => { set.summalyProxy = ps.summalyProxy; } - if (ps.enableTwitterIntegration !== undefined) { - set.enableTwitterIntegration = ps.enableTwitterIntegration; - } - - if (ps.twitterConsumerKey !== undefined) { - set.twitterConsumerKey = ps.twitterConsumerKey; - } - - if (ps.twitterConsumerSecret !== undefined) { - set.twitterConsumerSecret = ps.twitterConsumerSecret; - } - - if (ps.enableGithubIntegration !== undefined) { - set.enableGithubIntegration = ps.enableGithubIntegration; - } - - if (ps.githubClientId !== undefined) { - set.githubClientId = ps.githubClientId; - } - - if (ps.githubClientSecret !== undefined) { - set.githubClientSecret = ps.githubClientSecret; - } - - if (ps.enableDiscordIntegration !== undefined) { - set.enableDiscordIntegration = ps.enableDiscordIntegration; - } - - if (ps.discordClientId !== undefined) { - set.discordClientId = ps.discordClientId; - } - - if (ps.discordClientSecret !== undefined) { - set.discordClientSecret = ps.discordClientSecret; - } - if (ps.enableEmail !== undefined) { set.enableEmail = ps.enableEmail; } @@ -479,6 +457,14 @@ export default define(meta, paramDef, async (ps, me) => { set.ToSUrl = ps.tosUrl; } + if (ps.moreUrls !== undefined) { + const areUrlsVaild = ps.moreUrls.every( + (obj: { name: string; url: string }) => isValidHttpUrl(String(obj.url)), + ); + if (!areUrlsVaild) throw new Error("invalid URL"); + set.moreUrls = ps.moreUrls; + } + if (ps.repositoryUrl !== undefined) { set.repositoryUrl = ps.repositoryUrl; } diff --git a/packages/backend/src/server/api/endpoints/admin/update-user-note.ts b/packages/backend/src/server/api/endpoints/admin/update-user-note.ts index 04870d1c1c..d1a4a60439 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-user-note.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-user-note.ts @@ -1,5 +1,5 @@ import { UserProfiles, Users } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.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 559b310e46..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 define from "../../define.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { db } from "@/db/postgre.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/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index 1bab61ba2c..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 "../define.js"; -import { makePaginationQuery } from "../common/make-pagination-query.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 ed16450120..52ed628257 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -1,7 +1,7 @@ -import define from "../../define.js"; import { genId } from "@/misc/gen-id.js"; -import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js"; -import { ApiError } from "../../error.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"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index a6cf79011a..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Antennas } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 929b761d4f..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 "../../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 db8e683e49..f552f3450c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/markread.ts +++ b/packages/backend/src/server/api/endpoints/antennas/markread.ts @@ -1,6 +1,5 @@ -import define from "../../define.js"; import { Antennas } from "@/models/index.js"; -import { FindOptionsWhere } from "typeorm"; +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 149f98ea9b..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 "../../define.js"; -import readNote from "@/services/note/read.js"; -import { Antennas, Notes } from "@/models/index.js"; import { redisClient } from "@/db/redis.js"; -import { genId, getTimestamp } from "@/misc/gen-id.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { ApiError } from "../../error.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; +import { getTimestamp } from "@/misc/gen-id.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 350d739216..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Antennas } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 f491c0b638..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 define from "../../define.js"; -import { ApiError } from "../../error.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"; 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 f0db67a343..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 "../../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 c25f0a8018..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 "../../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 "../../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 013c5a10b9..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 "../../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 60949512e0..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Apps } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 8e6ad6527a..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 "../../define.js"; -import { ApiError } from "../../error.js"; -import { AuthSessions, AccessTokens, Apps } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import { secureRndstr } from "@/misc/secure-rndstr.js"; +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 1defb94006..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { Apps, AuthSessions } from "@/models/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 { 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 01a5fe5dc7..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { 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/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index 0e97bf414e..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { Apps, AuthSessions, AccessTokens, Users } from "@/models/index.js"; +import { AccessTokens, Apps, AuthSessions, Users } 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/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index f00a2923d5..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { Blockings, NoteWatchings, Users } from "@/models/index.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 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 037d5af22c..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { Blockings, Users } from "@/models/index.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 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 83fca7b42c..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 "../../define.js"; import { Blockings } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 26a3448b2b..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { Channels, DriveFiles } from "@/models/index.js"; -import type { Channel } from "@/models/entities/channel.js"; 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"; 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 06e0e850fd..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 "../../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 de0554383e..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { Channels, ChannelFollowings } from "@/models/index.js"; 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 { 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 993a211f7e..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 define from "../../define.js"; -import { Channels, ChannelFollowings } from "@/models/index.js"; +import { ChannelFollowings, Channels } from "@/models/index.js"; +import define from "@/server/api/define.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 78d9e80ccf..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 "../../define.js"; import { Channels } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 b21fa76206..f6e0f4d271 100644 --- a/packages/backend/src/server/api/endpoints/channels/search.ts +++ b/packages/backend/src/server/api/endpoints/channels/search.ts @@ -1,10 +1,8 @@ -import define from "../../define.js"; -import { Brackets } from "typeorm"; -import { Endpoint } from "@/server/api/endpoint-base.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { Channels } from "@/models/index.js"; -import { DI } from "@/di-symbols.js"; 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"; 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 e4ca756634..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Channels } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 b5d5325234..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { Notes, Channels } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; +import { 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 { 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 654a4fbba5..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { Channels, ChannelFollowings } from "@/models/index.js"; +import { ChannelFollowings, Channels } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 d9f6f7644c..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Channels, DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 3817a32ca9..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 "../../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 9e9013ce53..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 "../../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 03ac4c0473..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 "../../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 5862aad56e..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 "../../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 0af1e35ea9..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 "../../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 11a1dbce1b..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 "../../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 27e69a4c9b..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 "../../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 178ba453c6..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 "../../../define.js"; export const meta = { tags: ["charts", "drive", "users"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index 6a0c22df11..8d8177c300 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -1,4 +1,4 @@ -import define from "../../../define.js"; +import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserFollowingChart } from "@/services/chart/index.js"; 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 d788076962..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 "../../../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 5b0048c50e..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 "../../../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 8973f013b7..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 "../../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 416af6faa2..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 "../../define.js"; -import { ClipNotes, Clips } from "@/models/index.js"; -import { ApiError } from "../../error.js"; import { genId } from "@/misc/gen-id.js"; -import { getNote } from "../../common/getters.js"; +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 918e9462a4..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 "../../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 8f2489dddd..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 d1625ee036..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 "../../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 c641d9ba9f..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 "../../define.js"; import { ClipNotes, Clips, Notes } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { ApiError } from "../../error.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; +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 2cc19aca94..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 "../../define.js"; import { ClipNotes, Clips } from "@/models/index.js"; -import { ApiError } from "../../error.js"; -import { getNote } from "../../common/getters.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 14709b5040..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 e78f36e455..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 62e0836e85..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 define from "../../define.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/compatibility/peers.ts b/packages/backend/src/server/api/endpoints/compatibility/peers.ts index 30f6e0e937..df81d2b0d9 100644 --- a/packages/backend/src/server/api/endpoints/compatibility/peers.ts +++ b/packages/backend/src/server/api/endpoints/compatibility/peers.ts @@ -1,5 +1,5 @@ import { Instances } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/custom-motd.ts b/packages/backend/src/server/api/endpoints/custom-motd.ts index 098a676a57..d61b31fed6 100644 --- a/packages/backend/src/server/api/endpoints/custom-motd.ts +++ b/packages/backend/src/server/api/endpoints/custom-motd.ts @@ -1,6 +1,6 @@ // import { IsNull } from 'typeorm'; import { fetchMeta } from "@/misc/fetch-meta.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/custom-splash-icons.ts b/packages/backend/src/server/api/endpoints/custom-splash-icons.ts index c4833a4eef..f63a1b9600 100644 --- a/packages/backend/src/server/api/endpoints/custom-splash-icons.ts +++ b/packages/backend/src/server/api/endpoints/custom-splash-icons.ts @@ -1,6 +1,6 @@ // import { IsNull } from 'typeorm'; import { fetchMeta } from "@/misc/fetch-meta.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index ce98b53a6b..164e7b8f93 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -1,6 +1,6 @@ import { fetchMeta } from "@/misc/fetch-meta.js"; import { DriveFiles } from "@/models/index.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["drive", "account"], diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index c749e49038..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 "../../define.js"; import { DriveFiles } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 9267da5856..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { DriveFiles, Notes } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["drive", "notes"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/caption-image.ts b/packages/backend/src/server/api/endpoints/drive/files/caption-image.ts index 30c8e3de86..8b23e324d1 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/caption-image.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/caption-image.ts @@ -1,4 +1,4 @@ -import define from "../../../define.js"; +import define from "@/server/api/define.js"; import { createWorker } from "tesseract.js"; export const meta = { 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 e26da30eb5..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 "../../../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 51b9ea4c36..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 define from "../../../define.js"; -import { apiLogger } from "../../../logger.js"; -import { ApiError } from "../../../error.js"; +import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.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 4e8b4156f3..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 { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import { deleteFile } from "@/services/drive/delete-file.js"; import { publishDriveStream } from "@/services/stream.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { DriveFiles, Users } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts index ce14f4e09e..eb6881f5be 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -1,5 +1,5 @@ import { DriveFiles } from "@/models/index.js"; -import define from "../../../define.js"; +import define from "@/server/api/define.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 c2ad95126f..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 "../../../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/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index 291e3f56bb..455eb76b35 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -1,7 +1,7 @@ import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles, Users } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import { DriveFiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["drive"], 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 e833fddb58..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 define from "../../../define.js"; -import { ApiError } from "../../../error.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 7bb47dbef5..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 "../../../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 ed0d38844b..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 "../../define.js"; import { DriveFolders } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 d50f5f2815..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { DriveFolders } from "@/models/index.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 { 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 98895a7320..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 define from "../../../define.js"; +import { DriveFiles, DriveFolders } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import { publishDriveStream } from "@/services/stream.js"; -import { ApiError } from "../../../error.js"; -import { DriveFolders, DriveFiles } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index 45451fb90b..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 "../../../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 6a72a22777..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { DriveFolders } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 13673e9f2e..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { DriveFolders } 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/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 0c9654ca23..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 "../../define.js"; import { DriveFiles } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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/email-address/available.ts b/packages/backend/src/server/api/endpoints/email-address/available.ts index dc3c5e4b8e..eb1d833bd6 100644 --- a/packages/backend/src/server/api/endpoints/email-address/available.ts +++ b/packages/backend/src/server/api/endpoints/email-address/available.ts @@ -1,4 +1,4 @@ -import define from "../../define.js"; +import define from "@/server/api/define.js"; import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/emoji.ts b/packages/backend/src/server/api/endpoints/emoji.ts index f5a5be4ec5..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 "../define.js"; -import { ApiError } from "../error.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/endpoint.ts b/packages/backend/src/server/api/endpoints/endpoint.ts index ad0ce45623..7dd24f7b7a 100644 --- a/packages/backend/src/server/api/endpoints/endpoint.ts +++ b/packages/backend/src/server/api/endpoints/endpoint.ts @@ -1,5 +1,5 @@ -import define from "../define.js"; -import endpoints from "../endpoints.js"; +import define from "@/server/api/define.js"; +import endpoints from "@/server/api/endpoints.js"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/endpoints.ts b/packages/backend/src/server/api/endpoints/endpoints.ts index c5844f8437..3064fa07ed 100644 --- a/packages/backend/src/server/api/endpoints/endpoints.ts +++ b/packages/backend/src/server/api/endpoints/endpoints.ts @@ -1,5 +1,5 @@ -import define from "../define.js"; -import endpoints from "../endpoints.js"; +import define from "@/server/api/define.js"; +import endpoints from "@/server/api/endpoints.js"; export const meta = { requireCredential: false, 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 f4fc43c173..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 { createExportCustomEmojisJob } from "@/queue/index.js"; -import define from "../define.js"; import { HOUR } from "@/const.js"; +import { createExportCustomEmojisJob } 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/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index 4c6d83abdb..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 "../../define.js"; import { Followings } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 88b168600b..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 "../../define.js"; import { Followings } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 fa1a415312..6f9b6c9bdd 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -1,8 +1,7 @@ -import config from "@/config/index.js"; -import define from "../../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 633bb57073..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 "../../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 ede7a56c27..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 "../../define.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 f4c3f6d18c..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 "../../define.js"; -import { getRemoteUser } from "../../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 ded0a26c5f..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 "../../define.js"; import { Users } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 b73d7262c9..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 define from "../define.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 48ae6ae7af..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import { IdentifiableError } from "@/misc/identifiable-error.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 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 cbc6097f4d..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { Followings, Users } from "@/models/index.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 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 01ccc2761b..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { Followings, Users } from "@/models/index.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 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 a4fc052367..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 { getUser } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import acceptFollowRequest from "@/services/following/requests/accept.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index f309e32999..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.js"; -import { Users } from "@/models/index.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 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 6ba23de585..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 "../../../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 fedc0db487..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 { getUser } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; import { rejectFollowRequest } from "@/services/following/reject.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index d478e8e3bf..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 "../../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 5eef68d971..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 "../../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 f97c161aff..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 "../../define.js"; -import { makePaginationQuery } from "../../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 f3b3768e28..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,10 +1,9 @@ -import define from "../../../define.js"; -import { DriveFiles, GalleryPosts } from "@/models/index.js"; -import { genId } from "../../../../../misc/gen-id.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; -import { ApiError } from "../../../error.js"; -import type { DriveFile } from "@/models/entities/drive-file.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 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 9fd9a50099..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 2506e40aaa..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { GalleryPosts, GalleryLikes } from "@/models/index.js"; 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"; 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 87e272f018..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 03bc299b94..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { GalleryPosts, GalleryLikes } from "@/models/index.js"; +import { GalleryLikes, GalleryPosts } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 64e204172e..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,9 +1,7 @@ -import define from "../../../define.js"; -import { DriveFiles, GalleryPosts } from "@/models/index.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; -import { ApiError } from "../../../error.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 805674a5b7..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 "../define.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 f7edd38609..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 define from "@/server/api/define.js"; import { readdir } from "fs/promises"; -import define from "../define.js"; 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 df99a1e5a6..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 "../../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 cde586af0c..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 "../../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 8cf90e4505..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { Hashtags } from "@/models/index.js"; 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"; 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 e2a8345112..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 "../../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 532c663070..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 "../../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.ts b/packages/backend/src/server/api/endpoints/i.ts index 39543442c5..69eabf4d24 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -1,5 +1,5 @@ import { Users } from "@/models/index.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], 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 05d57d2821..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 "../../../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 32f972d0b6..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 "msgpackr"; -import define from "../../../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 "../../../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")); @@ -62,7 +62,7 @@ export default define(meta, paramDef, async (ps, user) => { const clientDataJSONHash = hash(Buffer.from(ps.clientDataJSON, "utf-8")); - const attestation = decode(Buffer.from(ps.attestationObject, "utf-8")); + const attestation = decode(Buffer.from(ps.attestationObject, "hex")); const rpIdHash = attestation.authData.slice(0, 32); if (!rpIdHashReal.equals(rpIdHash)) { @@ -79,7 +79,13 @@ 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 = decode(publicKeyData); + const publicKey: Map = new Map( + Object.entries(decode(publicKeyData)).map(([key, value]) => [ + Number(key), + value, + ]), + ); + if (publicKey.get(3) !== -7) { throw new Error("alg mismatch"); } 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 b9f3426804..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 define from "../../../define.js"; -import { Users, UserProfiles, UserSecurityKeys } from "@/models/index.js"; +import { UserProfiles, UserSecurityKeys, 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"; -import { ApiError } from "../../../error.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 a10dc9b256..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 "../../../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 "../../../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 cf391ca2fd..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 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 * as OTPAuth from "otpauth"; import * as QRCode from "qrcode"; -import config from "@/config/index.js"; -import { UserProfiles } from "@/models/index.js"; -import define from "../../../define.js"; -import { comparePassword } from "@/misc/password.js"; 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 d91c8f214b..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 "../../../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 54f1422d4c..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 "../../../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 7587ec780e..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 { UserSecurityKeys, 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"; -import define from "../../../define.js"; -import { Users, UserSecurityKeys } from "@/models/index.js"; -import { ApiError } from "../../../error.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 b951601949..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 "../../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 f759b23037..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 "../../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 8bbb3ad93a..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 "../../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 781abe0b38..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 "../../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 4517ad5fab..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 "../../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 a228de8f17..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 "../../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 7bddc434d4..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 "../../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 48506ed6d9..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 "../../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 a71b1730b4..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 "../../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 f0dbd2de6b..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 "../../define.js"; import { NoteFavorites } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 d71ee3e5a1..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 "../../../define.js"; import { GalleryLikes } from "@/models/index.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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 e471731ae7..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 "../../../define.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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 bd58f9257a..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 "../../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 e4f1da60cc..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 "../../define.js"; -import { createImportBlockingJob } from "@/queue/index.js"; -import { ApiError } from "../../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 1a6c9b565d..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 "../../define.js"; -import { createImportFollowingJob } from "@/queue/index.js"; -import { ApiError } from "../../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 20d240e739..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 "../../define.js"; -import { createImportMutingJob } from "@/queue/index.js"; -import { ApiError } from "../../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 3adba0514e..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 "../../define.js"; -import { createImportPostsJob } from "@/queue/index.js"; -import { ApiError } from "../../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 03b1dffbbb..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 "../../define.js"; -import { createImportUserListsJob } from "@/queue/index.js"; -import { ApiError } from "../../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 0d0c06180a..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 "../../logger.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { parse } from "@/misc/acct.js"; export const meta = { tags: ["users"], @@ -33,7 +33,7 @@ export const meta = { id: "4362f8dc-731f-4ad8-a694-be2a88922a24", }, uriNull: { - message: "User ActivityPup URI is null.", + message: "User ActivityPub URI is null.", code: "URI_NULL", id: "bf326f31-d430-4f97-9933-5d61e4d48a23", }, diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index d972aaf1d9..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { apiLogger } from "../../logger.js"; -import deleteFollowing from "@/services/following/delete.js"; -import create from "@/services/following/create.js"; +import { resolveUser } from "@/remote/resolve-user.js"; import { getUser } from "@/server/api/common/getters.js"; -import { Followings, Users } from "@/models/index.js"; -import config from "@/config/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { apiLogger } from "@/server/api/logger.js"; +import create from "@/services/following/create.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"], @@ -53,12 +53,12 @@ export const meta = { id: "fcd2eef9-a9b2-4c4f-8624-038099e90aa5", }, uriNull: { - message: "User ActivityPup URI is null.", + message: "User ActivityPub URI is null.", code: "URI_NULL", id: "bf326f31-d430-4f97-9933-5d61e4d48a23", }, localUriNull: { - message: "Local User ActivityPup URI is null.", + message: "Local User ActivityPub URI is null.", code: "URI_NULL", id: "95ba11b9-90e8-43a5-ba16-7acc1ab32e71", }, diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 6e1aabef7d..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 { 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 read from "@/services/note/read.js"; -import { readNotification } from "../../common/read-notification.js"; -import define from "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 1be783a061..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 78b72e3bce..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 7520705265..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 0333677275..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 "../../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 8a8857c83c..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 "../../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 d0dfa66579..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 "../../define.js"; -import { ApiError } from "../../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 b5b34c0902..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 "../../common/generate-native-user-token.js"; -import define from "../../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 ee9fe7e9d5..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 "../../../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 85900bd74d..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,6 +1,6 @@ -import define from "../../../define.js"; import { RegistryItems } from "@/models/index.js"; -import { ApiError } from "../../../error.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-unsecure.ts b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts index a9bcf69351..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 "../../../error.js"; -import define from "../../../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 b143b7228a..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,6 +1,6 @@ -import define from "../../../define.js"; import { RegistryItems } from "@/models/index.js"; -import { ApiError } from "../../../error.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/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index 23698dc53a..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 "../../../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 ad7d08c5af..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 "../../../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 d3793b0e20..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,6 +1,6 @@ -import define from "../../../define.js"; import { RegistryItems } from "@/models/index.js"; -import { ApiError } from "../../../error.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/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index 3d66359c1d..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 "../../../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 7f9eebd5e0..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 "../../../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 3a410fa0e5..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 "../../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 288b750b7b..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 "../../define.js"; import { Signins } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 c248eb34e5..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 94ad6b3c72..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 "../../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 "../../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 0037839b5c..d352db7241 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -1,21 +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 { 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 { ApiError } from "../../error.js"; -import config from "@/config/index.js"; -import define from "../../define.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 d0c6caf0e2..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 "../../define.js"; import { UserGroupInvitations } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 2b0f1781ea..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 "../../../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 4a2c3d83be..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { Webhooks } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 3afead5996..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 "../../../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 96c0457475..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; import { Webhooks } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.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 161d705e12..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 define from "../../../define.js"; -import { ApiError } from "../../../error.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 { ApiError } from "@/server/api/error.js"; +import { publishInternalEvent } from "@/services/stream.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/latest-version.ts b/packages/backend/src/server/api/endpoints/latest-version.ts index 4d07406d1e..a5c00e7a4c 100644 --- a/packages/backend/src/server/api/endpoints/latest-version.ts +++ b/packages/backend/src/server/api/endpoints/latest-version.ts @@ -1,4 +1,4 @@ -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 7d1df69850..f9e00aa79f 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -1,11 +1,11 @@ -import { Brackets } from "typeorm"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { MessagingMessages, Mutings, UserGroupJoinings, } from "@/models/index.js"; -import define from "../../define.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 17f626b69e..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 "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; import { MessagingMessages, - UserGroups, UserGroupJoinings, + UserGroups, Users, } from "@/models/index.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { Brackets } from "typeorm"; +import { getUser } from "@/server/api/common/getters.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { - readUserMessagingMessage, - readGroupMessagingMessage, deliverReadActivity, -} from "../../common/read-messaging-message.js"; + 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 4ffbb0699f..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,15 +1,14 @@ -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.js"; -import { - MessagingMessages, - DriveFiles, - UserGroups, - UserGroupJoinings, - Blockings, -} from "@/models/index.js"; -import type { User } from "@/models/entities/user.js"; 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 { 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 42ff050d16..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +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 { 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 0ef013b799..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 "../../../define.js"; -import { ApiError } from "../../../error.js"; import { MessagingMessages } from "@/models/index.js"; import { - readUserMessagingMessage, readGroupMessagingMessage, -} from "../../../common/read-messaging-message.js"; + 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 fc8235ea60..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 "../define.js"; +import define from "@/server/api/define.js"; +import JSON5 from "json5"; +import { IsNull, MoreThan } from "typeorm"; export const meta = { tags: ["meta"], @@ -64,6 +64,11 @@ export const meta = { optional: false, nullable: true, }, + moreUrls: { + type: "object", + optional: false, + nullable: false, + }, repositoryUrl: { type: "string", optional: false, @@ -155,7 +160,7 @@ export const meta = { type: "string", optional: false, nullable: false, - default: "/static-assets/badges/info.png", + default: "/static-assets/badges/info.webp", }, bannerUrl: { type: "string", @@ -166,7 +171,7 @@ export const meta = { type: "string", optional: false, nullable: false, - default: "/static-assets/badges/error.png", + default: "/static-assets/badges/error.webp", }, iconUrl: { type: "string", @@ -268,21 +273,6 @@ export const meta = { optional: false, nullable: false, }, - enableTwitterIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, - enableGithubIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, - enableDiscordIntegration: { - type: "boolean", - optional: false, - nullable: false, - }, enableServiceWorker: { type: "boolean", optional: false, @@ -343,21 +333,6 @@ export const meta = { optional: false, nullable: false, }, - twitter: { - type: "boolean", - optional: false, - nullable: false, - }, - github: { - type: "boolean", - optional: false, - nullable: false, - }, - discord: { - type: "boolean", - optional: false, - nullable: false, - }, serviceWorker: { type: "boolean", optional: false, @@ -446,6 +421,7 @@ export default define(meta, paramDef, async (ps, me) => { description: instance.description, langs: instance.langs, tosUrl: instance.ToSUrl, + moreUrls: instance.moreUrls, repositoryUrl: instance.repositoryUrl, feedbackUrl: instance.feedbackUrl, @@ -493,10 +469,6 @@ export default define(meta, paramDef, async (ps, me) => { })), enableEmail: instance.enableEmail, - enableTwitterIntegration: instance.enableTwitterIntegration, - enableGithubIntegration: instance.enableGithubIntegration, - enableDiscordIntegration: instance.enableDiscordIntegration, - enableServiceWorker: instance.enableServiceWorker, translatorAvailable: @@ -539,9 +511,6 @@ export default define(meta, paramDef, async (ps, me) => { hcaptcha: instance.enableHcaptcha, recaptcha: instance.enableRecaptcha, objectStorage: instance.useObjectStorage, - twitter: instance.enableTwitterIntegration, - github: instance.enableGithubIntegration, - discord: instance.enableDiscordIntegration, serviceWorker: instance.enableServiceWorker, postEditing: true, postImports: instance.experimentalFeatures?.postImports || false, 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 0525d79a7e..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 "../../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 7b2f109053..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; import { genId } from "@/misc/gen-id.js"; -import { Mutings, NoteWatchings } from "@/models/index.js"; import 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 { 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 cd00c1a8ab..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; 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 { 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 7bbe29a4c8..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 "../../define.js"; -import { makePaginationQuery } from "../../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 8a097c8a04..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 "../../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 9787740ab0..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 "../define.js"; -import { makePaginationQuery } from "../common/make-pagination-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/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index a35b17a022..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 34b035add2..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 "../../define.js"; -import { getNote } from "../../common/getters.js"; -import { ApiError } from "../../error.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 c74da2ec71..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getNote } from "../../common/getters.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: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 542f617b30..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 "../../error.js"; -import define from "../../define.js"; -import { HOUR } from "@/const.js"; -import { getNote } from "../../common/getters.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"], @@ -108,6 +108,7 @@ export const paramDef = { }, }, text: { type: "string", maxLength: MAX_NOTE_TEXT_LENGTH, nullable: true }, + lang: { type: "string", nullable: true, maxLength: 10 }, cw: { type: "string", nullable: true, maxLength: 100 }, localOnly: { type: "boolean", default: false }, noExtractMentions: { type: "boolean", default: false }, @@ -294,6 +295,7 @@ export default define(meta, paramDef, async (ps, user) => { } : undefined, text: ps.text || undefined, + lang: ps.lang, reply, renote, cw: ps.cw, diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 5fc79db7d1..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 "../../define.js"; -import { getNote } from "../../common/getters.js"; -import { ApiError } from "../../error.js"; -import { SECOND, HOUR } 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 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 8daf44b48f..9e9fdd9e5b 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -1,40 +1,41 @@ -import { In } from "typeorm"; -import create, { 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 "../../error.js"; -import define from "../../define.js"; -import { HOUR } from "@/const.js"; -import { getNote } from "../../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 { fetchMeta } from "@/misc/fetch-meta.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"], @@ -169,6 +170,7 @@ export const paramDef = { }, }, text: { type: "string", maxLength: MAX_NOTE_TEXT_LENGTH, nullable: true }, + lang: { type: "string", nullable: true, maxLength: 10 }, cw: { type: "string", nullable: true, maxLength: 250 }, localOnly: { type: "boolean", default: false }, noExtractMentions: { type: "boolean", default: false }, @@ -375,6 +377,16 @@ export default define(meta, paramDef, async (ps, user) => { ps.text = null; } + if (ps.lang) { + if (!Object.keys(langmap).includes(ps.lang.trim())) + throw new Error("invalid param"); + ps.lang = ps.lang.trim().split("-")[0].split("@")[0]; + } else if (ps.text) { + ps.lang = detectLanguage(ps.text); + } else { + ps.lang = null; + } + let tags = []; let emojis = []; let mentionedUsers = []; @@ -532,6 +544,9 @@ export default define(meta, paramDef, async (ps, user) => { if (ps.text !== note.text) { update.text = ps.text; } + if (ps.lang !== note.lang) { + update.lang = ps.lang; + } if (ps.cw !== note.cw || (ps.cw && !note.cw)) { update.cw = ps.cw; } 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 64862a3733..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getNote } from "../../../common/getters.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"; 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 e05d04a969..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getNote } from "../../../common/getters.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: ["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 47c1e13812..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 "../../define.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 0a365a6dfd..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 { 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 { 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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "../../common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.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 4e32b0ab29..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 { 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 { activeUsersChart } from "@/services/chart/index.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "../../common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.js"; -import { generateChannelQuery } from "../../common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.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 82e93e371f..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, Users } from "@/models/index.js"; +import { 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 { 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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateRepliesQuery } from "../../common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.js"; -import { generateChannelQuery } from "../../common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.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 68688b504c..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 { 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 { Notes, Followings } from "@/models/index.js"; -import define from "../../define.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedNoteThreadQuery } from "../../common/generate-muted-note-thread-query.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 fcd24db992..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 { Mutings, Notes, PollVotes, Polls } from "@/models/index.js"; +import define from "@/server/api/define.js"; import { Brackets, In } from "typeorm"; -import { Polls, Mutings, Notes, PollVotes } from "@/models/index.js"; -import define from "../../../define.js"; 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 40535d3401..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 "../../../common/getters.js"; -import { ApiError } from "../../../error.js"; -import define from "../../../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 { 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 3c8af119ab..ed38b1af14 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -1,10 +1,9 @@ -import type { FindOptionsWhere } from "typeorm"; -import { DeepPartial } from "typeorm"; -import { NoteReactions } from "@/models/index.js"; import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getNote } from "../../common/getters.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 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 2c8671070f..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 { 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"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../error.js"; export const meta = { tags: ["reactions", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 59096c4c88..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 { 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 deleteReaction from "@/services/note/reaction/delete.js"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../error.js"; -import { SECOND, HOUR } from "@/const.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 d3b5cbff50..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 { 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 { activeUsersChart } from "@/services/chart/index.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateRepliesQuery } from "../../common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.js"; -import { generateChannelQuery } from "../../common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.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 df801c7fc4..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 "../../define.js"; -import { getNote } from "../../common/getters.js"; -import { ApiError } from "../../error.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 5ea4d479c5..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 f988acaa51..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 { 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 8c5798b62d..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "../../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"], @@ -62,6 +62,7 @@ export const paramDef = { type: "string", default: "chronological", nullable: true, + description: "Either 'chronological' or 'relevancy'", }, }, required: ["query"], @@ -75,9 +76,11 @@ export default define(meta, paramDef, async (ps, me) => { ps.untilId, ); - if (ps.userId) { + if (ps.userId != null) { query.andWhere("note.userId = :userId", { userId: ps.userId }); - } else if (ps.channelId) { + } + + if (ps.channelId != null) { query.andWhere("note.channelId = :channelId", { channelId: ps.channelId, }); @@ -87,6 +90,7 @@ export default define(meta, paramDef, async (ps, me) => { .andWhere("note.text ILIKE :q", { q: `%${sqlLikeEscape(ps.query)}%` }) .andWhere("note.visibility = 'public'") .innerJoinAndSelect("note.user", "user") + .andWhere("user.isIndexable = TRUE") .leftJoinAndSelect("user.avatar", "avatar") .leftJoinAndSelect("user.banner", "banner") .leftJoinAndSelect("note.reply", "reply") @@ -239,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 8c5f91c5c1..7cbb6b3f6f 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -1,7 +1,7 @@ import { Notes } from "@/models/index.js"; -import define from "../../define.js"; -import { getNote } from "../../common/getters.js"; -import { ApiError } from "../../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: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/state.ts b/packages/backend/src/server/api/endpoints/notes/state.ts index 630b2a8007..b14e6842d1 100644 --- a/packages/backend/src/server/api/endpoints/notes/state.ts +++ b/packages/backend/src/server/api/endpoints/notes/state.ts @@ -1,11 +1,10 @@ import { NoteFavorites, - Notes, NoteThreadMutings, NoteWatchings, } from "@/models/index.js"; -import { getNote } from "../../common/getters.js"; -import define from "../../define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], 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 e4803cc291..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 { 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"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../error.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 c06fd59ba5..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,7 +1,7 @@ import { NoteThreadMutings } from "@/models/index.js"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../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: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index 56243977f8..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 { 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 { 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 define from "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "../../common/generate-replies-query.js"; -import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.js"; -import { generateChannelQuery } from "../../common/generate-channel-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.js"; -import { ApiError } from "../../error.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 1e90fb617e..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 "../../error.js"; -import { getNote } from "../../common/getters.js"; -import define from "../../define.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"], @@ -64,6 +64,7 @@ export default define(meta, paramDef, async (ps, user) => { let targetLang = ps.targetLang; if (targetLang.includes("-")) targetLang = targetLang.split("-")[0]; + if (targetLang.includes("_")) targetLang = targetLang.split("_")[0]; if (instance.libreTranslateApiUrl != null) { const jsonBody = { diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index a30a19f190..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 "../../define.js"; -import { getNote } from "../../common/getters.js"; -import { ApiError } from "../../error.js"; -import { SECOND, HOUR } 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 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 5c3fc55bef..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 { 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 { activeUsersChart } from "@/services/chart/index.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.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 f8921099a1..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 { 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"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../error.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 b441ad74b9..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 { 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"; -import define from "../../../define.js"; -import { getNote } from "../../../common/getters.js"; -import { ApiError } from "../../../error.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 bc5723369c..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 define from "@/server/api/define.js"; import { createNotification } from "@/services/create-notification.js"; -import define from "../../define.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 e0888ad752..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 "../../define.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 9efb2fcc0b..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 "../../define.js"; -import { readNotification } from "../../common/read-notification.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 a0f1e912fc..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 { 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"; -import { Users, Pages } from "@/models/index.js"; -import define from "../define.js"; -import { ApiError } from "../error.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 716d3265cc..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 define from "../../define.js"; -import { ApiError } from "../../error.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"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index 98b035f7c7..85688d9b4f 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -1,6 +1,6 @@ import { Pages } from "@/models/index.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index a763465897..c3ff1f57f8 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -1,5 +1,5 @@ import { Pages } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.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 03482c9616..4a396786db 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -1,7 +1,7 @@ -import { Pages, PageLikes } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; +import { PageLikes, Pages } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index a25eb30b6d..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 define from "../../define.js"; -import { ApiError } from "../../error.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 e607d7a546..3b020709ed 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -1,6 +1,6 @@ -import { Pages, PageLikes } from "@/models/index.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; +import { PageLikes, Pages } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 65e1b3b2d2..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 define from "../../define.js"; -import { ApiError } from "../../error.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 { 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 d4793e1b94..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 "../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/ping.ts b/packages/backend/src/server/api/endpoints/ping.ts index c1f7e110bc..7b45edad13 100644 --- a/packages/backend/src/server/api/endpoints/ping.ts +++ b/packages/backend/src/server/api/endpoints/ping.ts @@ -1,4 +1,4 @@ -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 22020068ce..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 define from "../define.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 5310382a43..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getNote } from "../../common/getters.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"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/recommended-instances.ts b/packages/backend/src/server/api/endpoints/recommended-instances.ts index 8407afb1d3..b235678428 100644 --- a/packages/backend/src/server/api/endpoints/recommended-instances.ts +++ b/packages/backend/src/server/api/endpoints/recommended-instances.ts @@ -1,6 +1,6 @@ // import { IsNull } from 'typeorm'; import { fetchMeta } from "@/misc/fetch-meta.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/release.ts b/packages/backend/src/server/api/endpoints/release.ts index bce1bc082c..1314e90365 100644 --- a/packages/backend/src/server/api/endpoints/release.ts +++ b/packages/backend/src/server/api/endpoints/release.ts @@ -1,4 +1,4 @@ -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], 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 f09f197c01..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.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"; 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 7a898141c3..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; +import { getUser } 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"], 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 9149dd9753..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 bac564c1d6..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,13 +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 { publishMainStream } from "@/services/stream.js"; -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 { ApiError } from "../error.js"; -import define from "../define.js"; -import { HOUR } from "@/const.js"; export const meta = { tags: ["reset password"], diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index c64db7bca8..daba09b8e5 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -1,6 +1,5 @@ import { resetDb } from "@/db/postgre.js"; -import define from "../define.js"; -import { ApiError } from "../error.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["non-productive"], diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index f695ae41f1..8f642f8845 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -1,8 +1,6 @@ -import { publishMainStream } from "@/services/stream.js"; -import { Users, UserProfiles, PasswordResetRequests } from "@/models/index.js"; -import define from "../define.js"; -import { ApiError } from "../error.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 87132758fe..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 "../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/stats.ts b/packages/backend/src/server/api/endpoints/stats.ts index 97889c42ed..e50305c692 100644 --- a/packages/backend/src/server/api/endpoints/stats.ts +++ b/packages/backend/src/server/api/endpoints/stats.ts @@ -1,7 +1,6 @@ import { Instances, NoteReactions, Notes, Users } from "@/models/index.js"; -import define from "../define.js"; +import define from "@/server/api/define.js"; import { driveChart, notesChart, usersChart } from "@/services/chart/index.js"; -import { IsNull } from "typeorm"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index 6268ae26d7..ee6b3bbf45 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -1,7 +1,7 @@ import { fetchMeta } from "@/misc/fetch-meta.js"; import { genId } from "@/misc/gen-id.js"; import { SwSubscriptions } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/sw/show-registration.ts b/packages/backend/src/server/api/endpoints/sw/show-registration.ts index 3ccb7de948..412179244d 100644 --- a/packages/backend/src/server/api/endpoints/sw/show-registration.ts +++ b/packages/backend/src/server/api/endpoints/sw/show-registration.ts @@ -1,5 +1,5 @@ import { SwSubscriptions } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts index e2a40f51cb..d8a49cbeac 100644 --- a/packages/backend/src/server/api/endpoints/sw/unregister.ts +++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts @@ -1,5 +1,5 @@ import { SwSubscriptions } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/sw/update-registration.ts b/packages/backend/src/server/api/endpoints/sw/update-registration.ts index 5ba53ee8a7..ece1c8449e 100644 --- a/packages/backend/src/server/api/endpoints/sw/update-registration.ts +++ b/packages/backend/src/server/api/endpoints/sw/update-registration.ts @@ -1,5 +1,5 @@ import { SwSubscriptions } from "@/models/index.js"; -import define from "../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/test.ts b/packages/backend/src/server/api/endpoints/test.ts index 2c43c61152..f5041cfbff 100644 --- a/packages/backend/src/server/api/endpoints/test.ts +++ b/packages/backend/src/server/api/endpoints/test.ts @@ -1,4 +1,4 @@ -import define from "../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["non-productive"], diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 6fa09ba369..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 define from "../../define.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 f0a8670902..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 "../define.js"; -import { generateMutedUserQueryForUsers } from "../common/generate-muted-user-query.js"; -import { generateBlockQueryForUsers } from "../common/generate-block-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 0dc90b8f99..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 31719bad32..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 { 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 1c1da0e117..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 { 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 5d64fb4727..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 "../../../define.js"; import { GalleryPosts } from "@/models/index.js"; -import { makePaginationQuery } from "../../../common/make-pagination-query.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 9722804c8d..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 define from "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.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 { 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 76bd78c49f..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,8 +1,8 @@ -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 define from "../../../define.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 = { tags: ["groups"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/delete.ts b/packages/backend/src/server/api/endpoints/users/groups/delete.ts index 81c15ad38e..93bf594f51 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/delete.ts @@ -1,6 +1,6 @@ import { UserGroups } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["groups"], 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 5cb3a7bad3..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 "../../../../error.js"; -import define from "../../../../define.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/invitations/reject.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts index c04ebed23b..9d4e51cca9 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -1,6 +1,6 @@ import { UserGroupInvitations } from "@/models/index.js"; -import define from "../../../../define.js"; -import { ApiError } from "../../../../error.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 10cc215861..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 { + UserGroupInvitations, + 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 { createNotification } from "@/services/create-notification.js"; -import { getUser } from "../../../common/getters.js"; -import { ApiError } from "../../../error.js"; -import define from "../../../define.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 8422cf586d..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 define from "../../../define.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 fac0a47fc5..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,6 +1,6 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import { UserGroupJoinings, UserGroups } 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/owned.ts b/packages/backend/src/server/api/endpoints/users/groups/owned.ts index d86185ff02..293897c16d 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/owned.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/owned.ts @@ -1,5 +1,5 @@ import { UserGroups } from "@/models/index.js"; -import define from "../../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["groups", "account"], 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 ce294b8c86..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.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"; 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 46f4410c84..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,6 +1,6 @@ -import { UserGroups, UserGroupJoinings } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["groups", "account"], 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 0322441574..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 define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.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"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/update.ts b/packages/backend/src/server/api/endpoints/users/groups/update.ts index fa720c9c45..77e63c6dc9 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/update.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/update.ts @@ -1,6 +1,6 @@ import { UserGroups } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["groups"], 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 6bbbf603e5..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,7 +1,7 @@ -import { UserLists } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserList } from "@/models/entities/user-list.js"; -import define from "../../../define.js"; +import { UserLists } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["lists"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete-all.ts b/packages/backend/src/server/api/endpoints/users/lists/delete-all.ts index 49c4cf6f63..49ab4f1023 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete-all.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete-all.ts @@ -1,6 +1,6 @@ import { UserLists } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["lists"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 4566295676..e1df681354 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -1,6 +1,6 @@ import { UserLists } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["lists"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/list.ts b/packages/backend/src/server/api/endpoints/users/lists/list.ts index 5d590ee0ec..2a731b70d3 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/list.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/list.ts @@ -1,5 +1,5 @@ import { UserLists } from "@/models/index.js"; -import define from "../../../define.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["lists", "account"], 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 07fae20675..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 { 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 { publishUserListStream } from "@/services/stream.js"; -import { UserLists, UserListJoinings, Users } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.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 899754aafb..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 { 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 { pushUserToUserList } from "@/services/user-list/push.js"; -import { UserLists, UserListJoinings, Blockings } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; -import { getUser } from "../../../common/getters.js"; export const meta = { tags: ["lists", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index cb4893b0e4..ca90fec38c 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -1,6 +1,6 @@ import { UserLists } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["lists", "account"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index 0ac788fd37..e331ce33c3 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -1,6 +1,6 @@ import { UserLists } from "@/models/index.js"; -import define from "../../../define.js"; -import { ApiError } from "../../../error.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["lists"], diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 724cfc9af1..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 "../../define.js"; -import { ApiError } from "../../error.js"; -import { getUser } from "../../common/getters.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; -import { generateBlockedUserQuery } from "../../common/generate-block-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 { getUser } 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"; +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 c08258b19d..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 "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.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 6b6d32e8ad..3a41c671b5 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -1,8 +1,8 @@ import { NoteReactions, UserProfiles } from "@/models/index.js"; -import define from "../../define.js"; -import { makePaginationQuery } from "../../common/make-pagination-query.js"; -import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; -import { ApiError } from "../../error.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: ["users", "reactions"], @@ -49,7 +49,7 @@ export const paramDef = { export default define(meta, paramDef, async (ps, me) => { const profile = await UserProfiles.findOneByOrFail({ userId: ps.userId }); - if (me.id !== ps.userId && !profile.publicReactions) { + if (!profile.publicReactions && (me == null || me.id !== ps.userId)) { throw new ApiError(meta.errors.reactionsNotPublic); } diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 615cca7856..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 "../../define.js"; -import { generateMutedUserQueryForUsers } from "../../common/generate-muted-user-query.js"; -import { - generateBlockedUserQuery, - generateBlockQueryForUsers, -} from "../../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/relation.ts b/packages/backend/src/server/api/endpoints/users/relation.ts index 5580eaea0b..61cc761162 100644 --- a/packages/backend/src/server/api/endpoints/users/relation.ts +++ b/packages/backend/src/server/api/endpoints/users/relation.ts @@ -1,5 +1,5 @@ import { Users } from "@/models/index.js"; -import define from "../../define.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 1368f9e2b9..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 "../../common/getters.js"; -import { ApiError } from "../../error.js"; -import define from "../../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 f34083233f..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,9 +1,8 @@ -import { Brackets } from "typeorm"; -import { Followings, Users } from "@/models/index.js"; -import { USER_ACTIVE_THRESHOLD } from "@/const.js"; -import type { User } from "@/models/entities/user.js"; -import define from "../../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 2d84d5bfeb..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 "../../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 bead8df0a4..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 "../../define.js"; -import { apiLogger } from "../../logger.js"; -import { ApiError } from "../../error.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index 83e821f498..ed4dd3b0c1 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -9,8 +9,8 @@ import { Users, } from "@/models/index.js"; import { awaitAll } from "@/prelude/await-all.js"; -import define from "../../define.js"; -import { ApiError } from "../../error.js"; +import define from "@/server/api/define.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 9e8c458868..edce9be2be 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -2,34 +2,32 @@ * 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 { Instances, AccessTokens, Users } from "@/models/index.js"; -import config from "@/config/index.js"; -import fs from "fs"; -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 discord from "./service/discord.js"; -import github from "./service/github.js"; -import twitter from "./service/twitter.js"; -import { koaBody } from "koa-body"; + +// TODO?: should we avoid importing things from built directory? import { - convertId, IdConvertType as IdType, -} from "../../../native-utils/built/index.js"; -import { convertAttachment } from "./mastodon/converters.js"; + convertId, +} from "native-utils/built/index.js"; // re-export native rust id conversion (function and enum) export { IdType, convertId }; @@ -181,10 +179,6 @@ router.post("/signin", signin); router.post("/signup-pending", signupPending); router.post("/verify-email", verifyEmail); -router.use(discord.routes()); -router.use(github.routes()); -router.use(twitter.routes()); - router.post("/miauth/:session/check", async (ctx) => { const token = await AccessTokens.findOneBy({ session: ctx.params.session, diff --git a/packages/backend/src/server/api/limiter.ts b/packages/backend/src/server/api/limiter.ts index 367fb3d279..edaed8f2d8 100644 --- a/packages/backend/src/server/api/limiter.ts +++ b/packages/backend/src/server/api/limiter.ts @@ -1,9 +1,8 @@ -import Limiter from "ratelimiter"; -import { CacheableLocalUser, User } from "@/models/entities/user.js"; -import Logger from "@/services/logger.js"; -import { redisClient } from "../../db/redis.js"; -import type { IEndpointMeta } from "./endpoints.js"; +import { redisClient } from "@/db/redis.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 44485ac429..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 "../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 6469d9c97b..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 "../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 36548cd3b2..9d9c2c54fa 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -1,10 +1,6 @@ -import { Users } from "@/models/index.js"; -import { resolveUser } from "@/remote/resolve-user.js"; +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; -import { FindOptionsWhere, IsNull } from "typeorm"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; -import { convertId, IdType } from "../../index.js"; import { convertAccount, convertFeaturedTag, @@ -12,6 +8,7 @@ import { convertRelationship, convertStatus, } from "../converters.js"; +import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; const relationshipModel = { id: "", @@ -37,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}`; @@ -112,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)); } @@ -123,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; @@ -253,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) { @@ -274,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/auth.ts b/packages/backend/src/server/api/mastodon/endpoints/auth.ts index b55cb6388c..3c7ece920a 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/auth.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/auth.ts @@ -1,8 +1,5 @@ -import megalodon, { MegalodonInterface } from "megalodon"; import Router from "@koa/router"; -import { koaBody } from "koa-body"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import bodyParser from "koa-bodyparser"; const readScope = [ "read:account", diff --git a/packages/backend/src/server/api/mastodon/endpoints/filter.ts b/packages/backend/src/server/api/mastodon/endpoints/filter.ts index e27b7e22ae..a3a6c33c36 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/filter.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/filter.ts @@ -1,7 +1,6 @@ -import megalodon, { MegalodonInterface } from "megalodon"; +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { IdType, convertId } from "../../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 f0a0bab984..da59004673 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts @@ -1,10 +1,8 @@ -import megalodon, { MegalodonInterface } from "megalodon"; +import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; -import { koaBody } from "koa-body"; -import { convertId, IdType } from "../../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 8a48175579..d6ef388b64 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/search.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts @@ -1,10 +1,9 @@ -import megalodon, { MegalodonInterface } from "megalodon"; 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 c3e6946e2f..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 axios from "axios"; 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 "../../index.js"; +import { getClient } from "../ApiMastodonCompatibleService.js"; import { convertAccount, convertAttachment, convertPoll, convertStatus, } from "../converters.js"; +import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; function normalizeQuery(data: any) { const str = querystring.stringify(data); @@ -216,10 +216,11 @@ export function apiStatusMastodon(router: Router): void { router.post<{ Params: { id: string } }>( "/v1/statuses/:id/favourite", async (ctx) => { + const meta = await fetchMeta(); const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); - const react = await getFirstReaction(BASE_URL, accessTokens); + const react = meta.defaultReaction; try { const a = (await client.createEmojiReaction( convertId(ctx.params.id, IdType.FirefishId), @@ -238,10 +239,11 @@ export function apiStatusMastodon(router: Router): void { router.post<{ Params: { id: string } }>( "/v1/statuses/:id/unfavourite", async (ctx) => { + const meta = await fetchMeta(); const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); - const react = await getFirstReaction(BASE_URL, accessTokens); + const react = meta.defaultReaction; try { const data = await client.deleteEmojiReaction( convertId(ctx.params.id, IdType.FirefishId), @@ -476,25 +478,3 @@ export function apiStatusMastodon(router: Router): void { }, ); } - -async function getFirstReaction( - BASE_URL: string, - accessTokens: string | undefined, -) { - const accessTokenArr = accessTokens?.split(" ") ?? [null]; - const accessToken = accessTokenArr[accessTokenArr.length - 1]; - let react = "⭐"; - try { - const api = await axios.post(`${BASE_URL}/api/i/registry/get-unsecure`, { - scope: ["client", "base"], - key: "reactions", - i: accessToken, - }); - const reactRaw = api.data; - react = Array.isArray(reactRaw) ? api.data[0] : "⭐"; - console.log(api.data); - return react; - } catch (e) { - return react; - } -} diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 0a4da322d7..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 "../../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 ee14f249f0..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 "../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 06d801a953..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 "../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 "../2fa.js"; -import { randomBytes } from "node:crypto"; +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 type Koa from "koa"; +import * as OTPAuth from "otpauth"; import { IsNull } from "typeorm"; -import { limiter } from "../limiter.js"; -import { getIpHash } from "@/misc/get-ip-hash.js"; 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 c7fdcea221..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 { UserPendings, UserProfiles } from "@/models/index.js"; +import signin from "@/server/api/common/signin.js"; +import { signup } from "@/server/api/common/signup.js"; import type Koa from "koa"; -import { Users, UserPendings, UserProfiles } from "@/models/index.js"; -import { signup } from "../common/signup.js"; -import signin from "../common/signin.js"; 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 440d0e3686..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 "../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/service/discord.ts b/packages/backend/src/server/api/service/discord.ts deleted file mode 100644 index 848a70d4a5..0000000000 --- a/packages/backend/src/server/api/service/discord.ts +++ /dev/null @@ -1,333 +0,0 @@ -import type Koa from "koa"; -import Router from "@koa/router"; -import { OAuth2 } from "oauth"; -import { v4 as uuid } from "uuid"; -import { IsNull } from "typeorm"; -import { getJson } from "@/misc/fetch.js"; -import config from "@/config/index.js"; -import { publishMainStream } from "@/services/stream.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import { redisClient } from "../../../db/redis.js"; -import signin from "../common/signin.js"; - -function getUserToken(ctx: Koa.BaseContext): string | null { - return ((ctx.headers["cookie"] || "").match(/igi=(\w+)/) || [null, null])[1]; -} - -function compareOrigin(ctx: Koa.BaseContext): boolean { - function normalizeUrl(url?: string): string { - return url ? (url.endsWith("/") ? url.slice(0, url.length - 1) : url) : ""; - } - - const referer = ctx.headers["referer"]; - - return normalizeUrl(referer) === normalizeUrl(config.url); -} - -// Init router -const router = new Router(); - -router.get("/disconnect/discord", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (!userToken) { - ctx.throw(400, "signin required"); - return; - } - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - profile.integrations.discord = undefined; - - await UserProfiles.update(user.id, { - integrations: profile.integrations, - }); - - ctx.body = "Discordの連携を解除しました :v:"; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); -}); - -async function getOAuth2() { - const meta = await fetchMeta(true); - - if (meta.enableDiscordIntegration) { - return new OAuth2( - meta.discordClientId!, - meta.discordClientSecret!, - "https://discord.com/", - "api/oauth2/authorize", - "api/oauth2/token", - ); - } else { - return null; - } -} - -router.get("/connect/discord", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (!userToken) { - ctx.throw(400, "signin required"); - return; - } - - const params = { - redirect_uri: `${config.url}/api/dc/cb`, - scope: ["identify"], - state: uuid(), - response_type: "code", - }; - - redisClient.set(userToken, JSON.stringify(params)); - - const oauth2 = await getOAuth2(); - ctx.redirect(oauth2!.getAuthorizeUrl(params)); -}); - -router.get("/signin/discord", async (ctx) => { - const sessid = uuid(); - - const params = { - redirect_uri: `${config.url}/api/dc/cb`, - scope: ["identify"], - state: uuid(), - response_type: "code", - }; - - ctx.cookies.set("signin_with_discord_sid", sessid, { - path: "/", - secure: config.url.startsWith("https"), - httpOnly: true, - }); - - redisClient.set(sessid, JSON.stringify(params)); - - const oauth2 = await getOAuth2(); - ctx.redirect(oauth2!.getAuthorizeUrl(params)); -}); - -router.get("/dc/cb", async (ctx) => { - const userToken = getUserToken(ctx); - - const oauth2 = await getOAuth2(); - - if (!userToken) { - const sessid = ctx.cookies.get("signin_with_discord_sid"); - - if (!sessid) { - ctx.throw(400, "invalid session"); - return; - } - - const code = ctx.query.code; - - if (!code || typeof code !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const { redirect_uri, state } = await new Promise((res, rej) => { - redisClient.get(sessid, async (_, state) => { - res(JSON.parse(state)); - }); - }); - - if (ctx.query.state !== state) { - ctx.throw(400, "invalid session"); - return; - } - - const { accessToken, refreshToken, expiresDate } = await new Promise( - (res, rej) => - oauth2!.getOAuthAccessToken( - code, - { - grant_type: "authorization_code", - redirect_uri, - }, - (err, accessToken, refreshToken, result) => { - if (err) { - rej(err); - } else if (result.error) { - rej(result.error); - } else { - res({ - accessToken, - refreshToken, - expiresDate: Date.now() + Number(result.expires_in) * 1000, - }); - } - }, - ), - ); - - const { id, username, discriminator } = (await getJson( - "https://discord.com/api/users/@me", - "*/*", - 10 * 1000, - { - Authorization: `Bearer ${accessToken}`, - }, - )) as Record; - - if ( - typeof id !== "string" || - typeof username !== "string" || - typeof discriminator !== "string" - ) { - ctx.throw(400, "invalid session"); - return; - } - - const profile = await UserProfiles.createQueryBuilder() - .where("\"integrations\"->'discord'->>'id' = :id", { id: id }) - .andWhere('"userHost" IS NULL') - .getOne(); - - if (profile == null) { - ctx.throw( - 404, - `@${username}#${discriminator}と連携しているMisskeyアカウントはありませんでした...`, - ); - return; - } - - await UserProfiles.update(profile.userId, { - integrations: { - ...profile.integrations, - discord: { - id: id, - accessToken: accessToken, - refreshToken: refreshToken, - expiresDate: expiresDate, - username: username, - discriminator: discriminator, - }, - }, - }); - - signin( - ctx, - (await Users.findOneBy({ id: profile.userId })) as ILocalUser, - true, - ); - } else { - const code = ctx.query.code; - - if (!code || typeof code !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const { redirect_uri, state } = await new Promise((res, rej) => { - redisClient.get(userToken, async (_, state) => { - res(JSON.parse(state)); - }); - }); - - if (ctx.query.state !== state) { - ctx.throw(400, "invalid session"); - return; - } - - const { accessToken, refreshToken, expiresDate } = await new Promise( - (res, rej) => - oauth2!.getOAuthAccessToken( - code, - { - grant_type: "authorization_code", - redirect_uri, - }, - (err, accessToken, refreshToken, result) => { - if (err) { - rej(err); - } else if (result.error) { - rej(result.error); - } else { - res({ - accessToken, - refreshToken, - expiresDate: Date.now() + Number(result.expires_in) * 1000, - }); - } - }, - ), - ); - - const { id, username, discriminator } = (await getJson( - "https://discord.com/api/users/@me", - "*/*", - 10 * 1000, - { - Authorization: `Bearer ${accessToken}`, - }, - )) as Record; - if ( - typeof id !== "string" || - typeof username !== "string" || - typeof discriminator !== "string" - ) { - ctx.throw(400, "invalid session"); - return; - } - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - await UserProfiles.update(user.id, { - integrations: { - ...profile.integrations, - discord: { - accessToken: accessToken, - refreshToken: refreshToken, - expiresDate: expiresDate, - id: id, - username: username, - discriminator: discriminator, - }, - }, - }); - - ctx.body = `Discord: @${username}#${discriminator} を、Misskey: @${user.username} に接続しました!`; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); - } -}); - -export default router; diff --git a/packages/backend/src/server/api/service/github.ts b/packages/backend/src/server/api/service/github.ts deleted file mode 100644 index fd015fb8ad..0000000000 --- a/packages/backend/src/server/api/service/github.ts +++ /dev/null @@ -1,296 +0,0 @@ -import type Koa from "koa"; -import Router from "@koa/router"; -import { OAuth2 } from "oauth"; -import { v4 as uuid } from "uuid"; -import { IsNull } from "typeorm"; -import { getJson } from "@/misc/fetch.js"; -import config from "@/config/index.js"; -import { publishMainStream } from "@/services/stream.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import { redisClient } from "../../../db/redis.js"; -import signin from "../common/signin.js"; - -function getUserToken(ctx: Koa.BaseContext): string | null { - return ((ctx.headers["cookie"] || "").match(/igi=(\w+)/) || [null, null])[1]; -} - -function compareOrigin(ctx: Koa.BaseContext): boolean { - function normalizeUrl(url?: string): string { - return url ? (url.endsWith("/") ? url.slice(0, url.length - 1) : url) : ""; - } - - const referer = ctx.headers["referer"]; - - return normalizeUrl(referer) === normalizeUrl(config.url); -} - -// Init router -const router = new Router(); - -router.get("/disconnect/github", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (!userToken) { - ctx.throw(400, "signin required"); - return; - } - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - profile.integrations.github = undefined; - - await UserProfiles.update(user.id, { - integrations: profile.integrations, - }); - - ctx.body = "GitHubの連携を解除しました :v:"; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); -}); - -async function getOath2() { - const meta = await fetchMeta(true); - - if ( - meta.enableGithubIntegration && - meta.githubClientId && - meta.githubClientSecret - ) { - return new OAuth2( - meta.githubClientId, - meta.githubClientSecret, - "https://github.com/", - "login/oauth/authorize", - "login/oauth/access_token", - ); - } else { - return null; - } -} - -router.get("/connect/github", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (!userToken) { - ctx.throw(400, "signin required"); - return; - } - - const params = { - redirect_uri: `${config.url}/api/gh/cb`, - scope: ["read:user"], - state: uuid(), - }; - - redisClient.set(userToken, JSON.stringify(params)); - - const oauth2 = await getOath2(); - ctx.redirect(oauth2!.getAuthorizeUrl(params)); -}); - -router.get("/signin/github", async (ctx) => { - const sessid = uuid(); - - const params = { - redirect_uri: `${config.url}/api/gh/cb`, - scope: ["read:user"], - state: uuid(), - }; - - ctx.cookies.set("signin_with_github_sid", sessid, { - path: "/", - secure: config.url.startsWith("https"), - httpOnly: true, - }); - - redisClient.set(sessid, JSON.stringify(params)); - - const oauth2 = await getOath2(); - ctx.redirect(oauth2!.getAuthorizeUrl(params)); -}); - -router.get("/gh/cb", async (ctx) => { - const userToken = getUserToken(ctx); - - const oauth2 = await getOath2(); - - if (!userToken) { - const sessid = ctx.cookies.get("signin_with_github_sid"); - - if (!sessid) { - ctx.throw(400, "invalid session"); - return; - } - - const code = ctx.query.code; - - if (!code || typeof code !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const { redirect_uri, state } = await new Promise((res, rej) => { - redisClient.get(sessid, async (_, state) => { - res(JSON.parse(state)); - }); - }); - - if (ctx.query.state !== state) { - ctx.throw(400, "invalid session"); - return; - } - - const { accessToken } = await new Promise((res, rej) => - oauth2!.getOAuthAccessToken( - code, - { - redirect_uri, - }, - (err, accessToken, refresh, result) => { - if (err) { - rej(err); - } else if (result.error) { - rej(result.error); - } else { - res({ accessToken }); - } - }, - ), - ); - - const { login, id } = (await getJson( - "https://api.github.com/user", - "application/vnd.github.v3+json", - 10 * 1000, - { - Authorization: `bearer ${accessToken}`, - }, - )) as Record; - if (typeof login !== "string" || typeof id !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const link = await UserProfiles.createQueryBuilder() - .where("\"integrations\"->'github'->>'id' = :id", { id: id }) - .andWhere('"userHost" IS NULL') - .getOne(); - - if (link == null) { - ctx.throw( - 404, - `@${login}と連携しているMisskeyアカウントはありませんでした...`, - ); - return; - } - - signin( - ctx, - (await Users.findOneBy({ id: link.userId })) as ILocalUser, - true, - ); - } else { - const code = ctx.query.code; - - if (!code || typeof code !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const { redirect_uri, state } = await new Promise((res, rej) => { - redisClient.get(userToken, async (_, state) => { - res(JSON.parse(state)); - }); - }); - - if (ctx.query.state !== state) { - ctx.throw(400, "invalid session"); - return; - } - - const { accessToken } = await new Promise((res, rej) => - oauth2!.getOAuthAccessToken( - code, - { redirect_uri }, - (err, accessToken, refresh, result) => { - if (err) { - rej(err); - } else if (result.error) { - rej(result.error); - } else { - res({ accessToken }); - } - }, - ), - ); - - const { login, id } = (await getJson( - "https://api.github.com/user", - "application/vnd.github.v3+json", - 10 * 1000, - { - Authorization: `bearer ${accessToken}`, - }, - )) as Record; - - if (typeof login !== "string" || typeof id !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - await UserProfiles.update(user.id, { - integrations: { - ...profile.integrations, - github: { - accessToken: accessToken, - id: id, - login: login, - }, - }, - }); - - ctx.body = `GitHub: @${login} を、Misskey: @${user.username} に接続しました!`; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); - } -}); - -export default router; diff --git a/packages/backend/src/server/api/service/twitter.ts b/packages/backend/src/server/api/service/twitter.ts deleted file mode 100644 index 3695592410..0000000000 --- a/packages/backend/src/server/api/service/twitter.ts +++ /dev/null @@ -1,226 +0,0 @@ -import type Koa from "koa"; -import Router from "@koa/router"; -import { v4 as uuid } from "uuid"; -import autwh from "autwh"; -import { IsNull } from "typeorm"; -import { publishMainStream } from "@/services/stream.js"; -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Users, UserProfiles } from "@/models/index.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import signin from "../common/signin.js"; -import { redisClient } from "../../../db/redis.js"; - -function getUserToken(ctx: Koa.BaseContext): string | null { - return ((ctx.headers["cookie"] || "").match(/igi=(\w+)/) || [null, null])[1]; -} - -function compareOrigin(ctx: Koa.BaseContext): boolean { - function normalizeUrl(url?: string): string { - return url == null - ? "" - : url.endsWith("/") - ? url.substr(0, url.length - 1) - : url; - } - - const referer = ctx.headers["referer"]; - - return normalizeUrl(referer) === normalizeUrl(config.url); -} - -// Init router -const router = new Router(); - -router.get("/disconnect/twitter", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (userToken == null) { - ctx.throw(400, "signin required"); - return; - } - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - profile.integrations.twitter = undefined; - - await UserProfiles.update(user.id, { - integrations: profile.integrations, - }); - - ctx.body = "Twitterの連携を解除しました :v:"; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); -}); - -async function getTwAuth() { - const meta = await fetchMeta(true); - - if ( - meta.enableTwitterIntegration && - meta.twitterConsumerKey && - meta.twitterConsumerSecret - ) { - return autwh({ - consumerKey: meta.twitterConsumerKey, - consumerSecret: meta.twitterConsumerSecret, - callbackUrl: `${config.url}/api/tw/cb`, - }); - } else { - return null; - } -} - -router.get("/connect/twitter", async (ctx) => { - if (!compareOrigin(ctx)) { - ctx.throw(400, "invalid origin"); - return; - } - - const userToken = getUserToken(ctx); - if (userToken == null) { - ctx.throw(400, "signin required"); - return; - } - - const twAuth = await getTwAuth(); - const twCtx = await twAuth!.begin(); - redisClient.set(userToken, JSON.stringify(twCtx)); - ctx.redirect(twCtx.url); -}); - -router.get("/signin/twitter", async (ctx) => { - const twAuth = await getTwAuth(); - const twCtx = await twAuth!.begin(); - - const sessid = uuid(); - - redisClient.set(sessid, JSON.stringify(twCtx)); - - ctx.cookies.set("signin_with_twitter_sid", sessid, { - path: "/", - secure: config.url.startsWith("https"), - httpOnly: true, - }); - - ctx.redirect(twCtx.url); -}); - -router.get("/tw/cb", async (ctx) => { - const userToken = getUserToken(ctx); - - const twAuth = await getTwAuth(); - - if (userToken == null) { - const sessid = ctx.cookies.get("signin_with_twitter_sid"); - - if (sessid == null) { - ctx.throw(400, "invalid session"); - return; - } - - const get = new Promise((res, rej) => { - redisClient.get(sessid, async (_, twCtx) => { - res(twCtx); - }); - }); - - const twCtx = await get; - - const verifier = ctx.query.oauth_verifier; - if (!verifier || typeof verifier !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const result = await twAuth!.done(JSON.parse(twCtx), verifier); - - const link = await UserProfiles.createQueryBuilder() - .where("\"integrations\"->'twitter'->>'userId' = :id", { - id: result.userId, - }) - .andWhere('"userHost" IS NULL') - .getOne(); - - if (link == null) { - ctx.throw( - 404, - `@${result.screenName}と連携しているMisskeyアカウントはありませんでした...`, - ); - return; - } - - signin( - ctx, - (await Users.findOneBy({ id: link.userId })) as ILocalUser, - true, - ); - } else { - const verifier = ctx.query.oauth_verifier; - - if (!verifier || typeof verifier !== "string") { - ctx.throw(400, "invalid session"); - return; - } - - const get = new Promise((res, rej) => { - redisClient.get(userToken, async (_, twCtx) => { - res(twCtx); - }); - }); - - const twCtx = await get; - - const result = await twAuth!.done(JSON.parse(twCtx), verifier); - - const user = await Users.findOneByOrFail({ - host: IsNull(), - token: userToken, - }); - - const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - - await UserProfiles.update(user.id, { - integrations: { - ...profile.integrations, - twitter: { - accessToken: result.accessToken, - accessTokenSecret: result.accessTokenSecret, - userId: result.userId, - screenName: result.screenName, - }, - }, - }); - - ctx.body = `Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`; - - // Publish i updated event - publishMainStream( - user.id, - "meUpdated", - await Users.pack(user, user, { - detail: true, - includeSecrets: true, - }), - ); - } -}); - -export default router; 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 f2aca7e3ca..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"; @@ -68,7 +68,7 @@ export default class extends Channel { // そのためレコードが存在するかのチェックでは不十分なので、改めてgetWordHardMuteを呼んでいる if ( this.userProfile && - (await getWordHardMute(note, this.user, this.userProfile.mutedWords)) + (await getWordHardMute(note, this.user?.id, this.userProfile.mutedWords)) ) return; 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 52e2dc2a97..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"; @@ -67,7 +67,7 @@ export default class extends Channel { // そのためレコードが存在するかのチェックでは不十分なので、改めてgetWordHardMuteを呼んでいる if ( this.userProfile && - (await getWordHardMute(note, this.user, this.userProfile.mutedWords)) + (await getWordHardMute(note, this.user?.id, this.userProfile.mutedWords)) ) return; 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 6e2da514f5..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"; @@ -84,7 +84,7 @@ export default class extends Channel { // そのためレコードが存在するかのチェックでは不十分なので、改めてgetWordHardMuteを呼んでいる if ( this.userProfile && - (await getWordHardMute(note, this.user, this.userProfile.mutedWords)) + (await getWordHardMute(note, this.user?.id, this.userProfile.mutedWords)) ) return; 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 2cc286b17f..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"; @@ -60,7 +60,7 @@ export default class extends Channel { // そのためレコードが存在するかのチェックでは不十分なので、改めてgetWordHardMuteを呼んでいる if ( this.userProfile && - (await getWordHardMute(note, this.user, this.userProfile.mutedWords)) + (await getWordHardMute(note, this.user?.id, this.userProfile.mutedWords)) ) return; 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 0622bd4649..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 { - readUserMessagingMessage, - readGroupMessagingMessage, - deliverReadActivity, -} from "../../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 { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; +import { + deliverReadActivity, + readGroupMessagingMessage, + readUserMessagingMessage, +} from "@/server/api/common/read-messaging-message.js"; +import Channel from "../channel.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 186b120320..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"; @@ -82,7 +82,7 @@ export default class extends Channel { // そのためレコードが存在するかのチェックでは不十分なので、改めてgetWordHardMuteを呼んでいる if ( this.userProfile && - (await getWordHardMute(note, this.user, this.userProfile.mutedWords)) + (await getWordHardMute(note, this.user?.id, this.userProfile.mutedWords)) ) return; 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 e483683151..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 "../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 "../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 d80e783cca..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, constants as BufferConstants } from "node:buffer"; +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 92961d33d2..883314d778 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -5,35 +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 { UserProfiles, 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 { publishMainStream } from "@/services/stream.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); @@ -167,7 +166,6 @@ mastoRouter.post("/oauth/token", async (ctx) => { const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const generator = (megalodon as any).default; const client = generator(BASE_URL, null) as MegalodonInterface; - let m = null; let token = null; if (body.code) { //m = body.code.match(/^([a-zA-Z0-9]{8})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{12})/); diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 2d01446522..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(); @@ -89,9 +89,6 @@ const nodeinfo2 = async () => { enableRecaptcha: meta.enableRecaptcha, maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, maxCaptionTextLength: MAX_CAPTION_TEXT_LENGTH, - enableTwitterIntegration: meta.enableTwitterIntegration, - enableGithubIntegration: meta.enableGithubIntegration, - enableDiscordIntegration: meta.enableDiscordIntegration, enableEmail: meta.enableEmail, enableServiceWorker: meta.enableServiceWorker, proxyAccountName: proxyAccount ? proxyAccount.username : null, 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/boot.js b/packages/backend/src/server/web/boot.js index 4bd9326aac..04538332f2 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -25,7 +25,12 @@ //#region Detect language & fetch translations const v = localStorage.getItem("v") || VERSION; - const supportedLangs = LANGS; + let supportedLangs = []; + try { + supportedLangs = SUPPORTED_LANGS; + } catch { + console.warn("LANGS not found"); + } let lang = localStorage.getItem("lang"); if (lang == null || !supportedLangs.includes(lang)) { if (supportedLangs.includes(navigator.language)) { 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 7f28f443f5..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 "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); @@ -492,7 +492,7 @@ router.get("/notes/:note", async (ctx, next) => { ctx.set("Cache-Control", "public, max-age=15"); ctx.set( "Content-Security-Policy", - "default-src 'self' 'unsafe-inline'; img-src *; frame-ancestors *", + "default-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src *; font-src 'self' data:; img-src *; media-src *; worker-src 'self'; frame-ancestors *", ); return; diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index 2090a7f553..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) => { @@ -11,6 +11,7 @@ export const manifestHandler = async (ctx: Koa.Context) => { const instance = await fetchMeta(true); res.short_name = instance.name || "Firefish"; + res.name = instance.name || "Firefish"; if (instance.themeColor) res.theme_color = instance.themeColor; for (const icon of res.icons) { icon.src = `${icon.src}?v=${config.version.replace(/[^0-9]/g, "")}`; diff --git a/packages/backend/src/server/web/style.css b/packages/backend/src/server/web/style.css index cb99a160d9..2a93253992 100644 --- a/packages/backend/src/server/web/style.css +++ b/packages/backend/src/server/web/style.css @@ -1,7 +1,18 @@ +/* atkinson-hyperlegible-regular - latin_latin-ext */ +@font-face { + font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */ + font-family: "Atkinson Hyperlegible"; + font-style: normal; + font-weight: 400; + src: url("/static-assets/fonts/atkinson-hyperlegible-v11-latin_latin-ext-regular.woff2") + format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + html { background-color: var(--bg); color: var(--fg); } + @media (prefers-color-scheme: dark) { html { --bg: rgb(17, 17, 27); @@ -104,7 +115,7 @@ html { } } -@media(prefers-reduced-motion) { +@media (prefers-reduced-motion) { #splashSpinner { display: block; } @@ -122,5 +133,5 @@ html { height: 0; text-align: center; padding-top: 100px; - font-family: sans-serif; + font-family: "Atkinson Hyperlegible", sans-serif; } 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/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 886e7aa9be..1b049e2928 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -36,9 +36,9 @@ html link(rel='icon' href= icon || `/favicon.ico?${ timestamp }`) link(rel='apple-touch-icon' href= icon || `/apple-touch-icon.png?${ timestamp }`) link(rel='manifest' href='/manifest.json') - link(rel='prefetch' href=`/static-assets/badges/info.png?${ timestamp }`) - link(rel='prefetch' href=`/static-assets/badges/not-found.png?${ timestamp }`) - link(rel='prefetch' href=`/static-assets/badges/error.png?${ timestamp }`) + link(rel='prefetch' href=`/static-assets/badges/info.webp?${ timestamp }`) + link(rel='prefetch' href=`/static-assets/badges/not-found.webp?${ timestamp }`) + link(rel='prefetch' href=`/static-assets/badges/error.webp?${ timestamp }`) link(rel='stylesheet' href=`/static-assets/instance.css?${ timestamp }`) link(rel='modulepreload' href=`/assets/${clientEntry.file}`) diff --git a/packages/backend/src/server/web/views/flush.pug b/packages/backend/src/server/web/views/flush.pug index e9866587e5..bb032ffa26 100644 --- a/packages/backend/src/server/web/views/flush.pug +++ b/packages/backend/src/server/web/views/flush.pug @@ -37,7 +37,8 @@ html localStorage.clear(); message('localStorage cleared.'); - const idbPromises = ['MisskeyClient', 'keyval-store'].map((name, i, arr) => new Promise((res, rej) => { + //- Removed 'MisskeyClient' due to seemingly being never referenced + const idbPromises = ['keyval-store'].map((name, i, arr) => new Promise((res, rej) => { const delidb = indexedDB.deleteDatabase(name); delidb.onsuccess = () => res(message(`indexedDB "${name}" cleared. (${i + 1}/${arr.length})`)); delidb.onerror = e => rej(e) 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 60bd6e9431..0ed96e5c6f 100644 --- a/packages/backend/src/services/blocking/create.ts +++ b/packages/backend/src/services/blocking/create.ts @@ -1,25 +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 { IdentifiableError } from "@/misc/identifiable-error.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 67f1e76f0e..2e57525a61 100644 --- a/packages/backend/src/services/blocking/delete.ts +++ b/packages/backend/src/services/blocking/delete.ts @@ -1,11 +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 "../logger.js"; import type { CacheableUser } from "@/models/entities/user.js"; -import { User } 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 322bfd25bc..a9e4cab57f 100644 --- a/packages/backend/src/services/chart/charts/active-users.ts +++ b/packages/backend/src/services/chart/charts/active-users.ts @@ -1,7 +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 { Users } from "@/models/index.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 9793ff79dc..0c69049468 100644 --- a/packages/backend/src/services/chart/charts/drive.ts +++ b/packages/backend/src/services/chart/charts/drive.ts @@ -1,8 +1,6 @@ +import type { DriveFile } from "@/models/entities/drive-file.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; -import { DriveFiles } from "@/models/index.js"; -import { Not, IsNull } from "typeorm"; -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 24536090a9..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/delete-account.ts b/packages/backend/src/services/delete-account.ts index 927776199a..b307611cf5 100644 --- a/packages/backend/src/services/delete-account.ts +++ b/packages/backend/src/services/delete-account.ts @@ -1,7 +1,7 @@ import { Users } from "@/models/index.js"; import { createDeleteAccountJob } from "@/queue/index.js"; -import { publishUserEvent } from "./stream.js"; -import { doPostSuspend } from "./suspend-user.js"; +import { publishUserEvent } from "@/services/stream.js"; +import { doPostSuspend } from "@/services/suspend-user.js"; export async function deleteAccount(user: { id: string; 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 9e8e57cc99..faab329107 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -2,38 +2,37 @@ import * as fs from "node:fs"; import { v4 as uuid } from "uuid"; -import type S3 from "aws-sdk/clients/s3.js"; -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, - Instances, - 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"); @@ -93,7 +92,7 @@ async function save( if (type === "image/png") ext = ".png"; if (type === "image/webp") ext = ".webp"; if (type === "image/apng") ext = ".apng"; - if (type === "image/avif") ext = ".avif"; + if (type === "image/avif") ext = ".webp"; if (type === "image/vnd.mozilla.apng") ext = ".apng"; } diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index 215270df69..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, Instances } from "@/models/index.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 356623e79a..694a79656a 100644 --- a/packages/backend/src/services/drive/generate-video-thumbnail.ts +++ b/packages/backend/src/services/drive/generate-video-thumbnail.ts @@ -1,8 +1,7 @@ -import * as fs from "node:fs"; 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/logger.ts b/packages/backend/src/services/drive/logger.ts index ebde2d7058..06382ddd78 100644 --- a/packages/backend/src/services/drive/logger.ts +++ b/packages/backend/src/services/drive/logger.ts @@ -1,3 +1,3 @@ -import Logger from "../logger.js"; +import Logger from "@/services/logger.js"; export const driveLogger = new Logger("drive", "blue"); diff --git a/packages/backend/src/services/drive/s3.ts b/packages/backend/src/services/drive/s3.ts index 9357be21ca..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"; -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 01ad917648..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 "./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 31e7a95a58..0bb340db45 100644 --- a/packages/backend/src/services/fetch-rel-me.ts +++ b/packages/backend/src/services/fetch-rel-me.ts @@ -1,6 +1,5 @@ -import { getHtml } from "@/misc/fetch.js"; -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 3a77676b38..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 "../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 "../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 { createNotification } from "@/services/create-notification.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 fae4bd3cec..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 "../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 7464219bf6..16e46b1578 100644 --- a/packages/backend/src/services/following/reject.ts +++ b/packages/backend/src/services/following/reject.ts @@ -1,13 +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 { User } 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 6aa17b09ad..2a7c03ba19 100644 --- a/packages/backend/src/services/following/requests/accept.ts +++ b/packages/backend/src/services/following/requests/accept.ts @@ -1,13 +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 { ILocalUser } from "@/models/entities/user.js"; -import { FollowRequests, Users } from "@/models/index.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; export default async function ( followee: { diff --git a/packages/backend/src/services/following/requests/cancel.ts b/packages/backend/src/services/following/requests/cancel.ts index 00daae380d..1b9758c5bd 100644 --- a/packages/backend/src/services/following/requests/cancel.ts +++ b/packages/backend/src/services/following/requests/cancel.ts @@ -1,12 +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 { ILocalUser } 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 50dbd9b3be..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 { createNotification } from "../../create-notification.js"; -import config from "@/config/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 { createNotification } from "@/services/create-notification.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 ee13ce6fed..e23f669f12 100644 --- a/packages/backend/src/services/i/pin.ts +++ b/packages/backend/src/services/i/pin.ts @@ -1,15 +1,15 @@ 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 { deliverToRelays } from "../relay.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 cc950ac85a..ec22907bf5 100644 --- a/packages/backend/src/services/i/update.ts +++ b/packages/backend/src/services/i/update.ts @@ -1,10 +1,10 @@ -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 { deliverToRelays } from "../relay.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"]) { const user = await Users.findOneBy({ id: userId }); 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 330d275029..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 18b524ecb2..8e496928c2 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -1,72 +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 "../update-hashtag.js"; -import { concat } from "@/prelude/array.js"; -import { insertNoteUnread } from "@/services/note/unread.js"; -import { registerOrFetchInstanceDoc } from "../register-or-fetch-instance-doc.js"; -import { extractMentions } from "@/misc/extract-mentions.js"; -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import 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 "../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 "../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 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 { 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 { 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"] }[] @@ -139,6 +141,7 @@ type Option = { createdAt?: Date | null; name?: string | null; text?: string | null; + lang?: string | null; reply?: Note | null; renote?: Note | null; files?: DriveFile[] | null; @@ -170,9 +173,10 @@ export default async ( data: Option, silent = false, ) => - // rome-ignore lint/suspicious/noAsyncPromiseExecutor: FIXME + // biome-ignore lint/suspicious/noAsyncPromiseExecutor: FIXME new Promise(async (res, rej) => { - const dontFederateInitially = data.visibility === "hidden"; + const dontFederateInitially = + data.localOnly || data.visibility?.startsWith("hidden") === true; // If you reply outside the channel, match the scope of the target. // TODO (I think it's a process that could be done on the client side, but it's server side for now.) @@ -206,7 +210,7 @@ export default async ( if (data.channel != null) data.visibility = "public"; if (data.channel != null) data.visibleUsers = []; if (data.channel != null) data.localOnly = true; - if (data.visibility.startsWith("hidden")) + if (data.visibility.startsWith("hidden") && data.visibility !== "hidden") data.visibility = data.visibility.slice(6); // enforce silent clients on server @@ -276,6 +280,16 @@ export default async ( data.text = null; } + if (data.lang) { + if (!Object.keys(langmap).includes(data.lang.trim())) + throw new Error("invalid param"); + data.lang = data.lang.trim().split("-")[0].split("@")[0]; + } else if (data.text) { + data.lang = detectLanguage(data.text); + } else { + data.lang = null; + } + let tags = data.apHashtags; let emojis = data.apEmojis; let mentionedUsers = data.apMentions; @@ -367,18 +381,16 @@ export default async ( ) .then((us) => { for (const u of us) { - getWordHardMute(data, { id: u.userId }, u.mutedWords).then( - (shouldMute) => { - if (shouldMute) { - MutedNotes.insert({ - id: genId(), - userId: u.userId, - noteId: note.id, - reason: "word", - }); - } - }, - ); + getWordHardMute(data, u.userId, u.mutedWords).then((shouldMute) => { + if (shouldMute) { + MutedNotes.insert({ + id: genId(), + userId: u.userId, + noteId: note.id, + reason: "word", + }); + } + }); } }); @@ -712,6 +724,7 @@ async function insertNote( : null, name: data.name, text: data.text, + lang: data.lang, hasPoll: data.poll != null, cw: data.cw == null ? null : data.cw, tags: tags.map((tag) => normalizeForSearch(tag)), diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index 90175ccdc4..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 { registerOrFetchInstanceDoc } from "../register-or-fetch-instance-doc.js"; -import { deliverToRelays } from "../relay.js"; -import meilisearch from "@/db/meilisearch.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 { 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 e02d48d055..073980226c 100644 --- a/packages/backend/src/services/note/polls/update.ts +++ b/packages/backend/src/services/note/polls/update.ts @@ -1,10 +1,10 @@ -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 { deliverToRelays } from "../../relay.js"; +import renderUpdate from "@/remote/activitypub/renderer/update.js"; +import { deliverToRelays } from "@/services/relay.js"; export async function deliverQuestionUpdate(noteId: Note["id"]) { const note = await Notes.findOneBy({ id: noteId }); diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index 582af0b17b..ebffed0d9d 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -1,11 +1,10 @@ -import { publishNoteStream } from "@/services/stream.js"; -import type { CacheableUser } from "@/models/entities/user.js"; -import { User } 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 { createNotification } from "../../create-notification.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 4cf1fd0941..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 "../../create-notification.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 5e61fe95d8..b127e88369 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -1,18 +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 { checkHitAntenna } from "@/misc/check-hit-antenna.js"; -import { getAntennas } from "@/misc/antenna-cache.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 @@ -66,23 +64,6 @@ export default async function ( if (note.channelId && followingChannels.has(note.channelId)) { readChannelNotes.push(note); } - - // if (note.user != null) { - // // たぶんnullになることは無いはずだけど一応 - // for (const antenna of myAntennas) { - // if ( - // await checkHitAntenna( - // antenna, - // note, - // note.user, - // undefined, - // Array.from(following), - // ) - // ) { - // readAntennaNotes.push(note); - // } - // } - // } } if ( 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 e969d783a0..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 "./create-system-user.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-notification.ts b/packages/backend/src/services/send-email-notification.ts index 14a9754fe5..a2f422a962 100644 --- a/packages/backend/src/services/send-email-notification.ts +++ b/packages/backend/src/services/send-email-notification.ts @@ -1,8 +1,8 @@ -import { UserProfiles } from "@/models/index.js"; +// import { UserProfiles } from "@/models/index.js"; import type { User } from "@/models/entities/user.js"; -import { sendEmail } from "./send-email.js"; -import { I18n } from "@/misc/i18n.js"; -import * as Acct from "@/misc/acct.js"; +// import { sendEmail } from "./send-email.js"; +// import { I18n } from "@/misc/i18n.js"; +// import * as Acct from "@/misc/acct.js"; // TODO //const locales = await import('../../../../locales/index.js'); diff --git a/packages/backend/src/services/send-email.ts b/packages/backend/src/services/send-email.ts index 0703865881..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 { fetchMeta } from "@/misc/fetch-meta.js"; -import Logger from "./logger.js"; import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import Logger from "@/services/logger.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 f3846feaf1..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 01bb066019..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 createFollowing from "../following/create.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; diff --git a/packages/backend/test/ap-request.ts b/packages/backend/test/ap-request.ts index bf77a38532..722977fe14 100644 --- a/packages/backend/test/ap-request.ts +++ b/packages/backend/test/ap-request.ts @@ -2,8 +2,8 @@ import * as assert from "assert"; import httpSignature from "@peertube/http-signature"; import { genRsaKeyPair } from "../src/misc/gen-key-pair.js"; import { - createSignedPost, createSignedGet, + createSignedPost, } from "../src/remote/activitypub/ap-request.js"; export const buildParsedSignature = ( diff --git a/packages/backend/test/api-visibility.ts b/packages/backend/test/api-visibility.ts index 0ee4a4d337..49b1b5a064 100644 --- a/packages/backend/test/api-visibility.ts +++ b/packages/backend/test/api-visibility.ts @@ -4,11 +4,11 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, post, - startServer, + request, shutdownServer, + signup, + startServer, } from "./utils.js"; describe("API visibility", () => { diff --git a/packages/backend/test/api.ts b/packages/backend/test/api.ts index 19a754552c..0fc2f424ec 100644 --- a/packages/backend/test/api.ts +++ b/packages/backend/test/api.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, post, react, - uploadFile, - startServer, + request, shutdownServer, + signup, + startServer, + uploadFile, } from "./utils.js"; describe("API", () => { diff --git a/packages/backend/test/block.ts b/packages/backend/test/block.ts index 08192e4869..100a4ab7d5 100644 --- a/packages/backend/test/block.ts +++ b/packages/backend/test/block.ts @@ -4,11 +4,11 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, post, - startServer, + request, shutdownServer, + signup, + startServer, } from "./utils.js"; describe("Block", () => { diff --git a/packages/backend/test/chart.ts b/packages/backend/test/chart.ts index e194c6c195..cd600f661a 100644 --- a/packages/backend/test/chart.ts +++ b/packages/backend/test/chart.ts @@ -2,11 +2,11 @@ process.env.NODE_ENV = "test"; import * as assert from "assert"; import * as lolex from "@sinonjs/fake-timers"; -import TestChart from "../src/services/chart/charts/test.js"; -import TestGroupedChart from "../src/services/chart/charts/test-grouped.js"; -import TestUniqueChart from "../src/services/chart/charts/test-unique.js"; -import TestIntersectionChart from "../src/services/chart/charts/test-intersection.js"; import { initDb } from "../src/db/postgre.js"; +import TestGroupedChart from "../src/services/chart/charts/test-grouped.js"; +import TestIntersectionChart from "../src/services/chart/charts/test-intersection.js"; +import TestUniqueChart from "../src/services/chart/charts/test-unique.js"; +import TestChart from "../src/services/chart/charts/test.js"; describe("Chart", () => { let testChart: TestChart; diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 1090dc1cb5..28d5468ecf 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -15,7 +15,7 @@ import { failedApiCall, uploadFile, } from "../utils.js"; -import type * as misskey from "misskey-js"; +import type * as firefish from "firefish-js"; import type { INestApplicationContext } from "@nestjs/common"; describe("ユーザー", () => { @@ -34,16 +34,16 @@ describe("ユーザー", () => { }; // BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う - type UserLite = misskey.entities.UserLite & { + type UserLite = firefish.entities.UserLite & { badgeRoles: any[]; }; type UserDetailedNotMe = UserLite & - misskey.entities.UserDetailed & { + firefish.entities.UserDetailed & { roles: any[]; }; - type MeDetailed = UserDetailedNotMe & misskey.entities.MeDetailed; + type MeDetailed = UserDetailedNotMe & firefish.entities.MeDetailed; type User = MeDetailed & { token: string }; @@ -69,6 +69,7 @@ describe("ユーザー", () => { avatarBlurhash: user.avatarBlurhash, isBot: user.isBot, isCat: user.isCat, + speakAsCat: user.speakAsCat, instance: user.instance, emojis: user.emojis, onlineStatus: user.onlineStatus, @@ -182,12 +183,12 @@ describe("ユーザー", () => { let root: User; let alice: User; - let aliceNote: misskey.entities.Note; - let alicePage: misskey.entities.Page; - let aliceList: misskey.entities.UserList; + let aliceNote: firefish.entities.Note; + let alicePage: firefish.entities.Page; + let aliceList: firefish.entities.UserList; let bob: User; - let bobNote: misskey.entities.Note; + let bobNote: firefish.entities.Note; let carol: User; let dave: User; @@ -401,6 +402,7 @@ describe("ユーザー", () => { assert.strictEqual(response.avatarBlurhash, null); assert.strictEqual(response.isBot, false); assert.strictEqual(response.isCat, false); + assert.strictEqual(response.speakAsCat, false); assert.strictEqual(response.instance, undefined); assert.deepStrictEqual(response.emojis, {}); assert.strictEqual(response.onlineStatus, "unknown"); @@ -538,6 +540,8 @@ describe("ユーザー", () => { { parameters: (): object => ({ isBot: false }) }, { parameters: (): object => ({ isCat: true }) }, { parameters: (): object => ({ isCat: false }) }, + { parameters: (): object => ({ speakAsCat: true }) }, + { parameters: (): object => ({ speakAsCat: false }) }, { parameters: (): object => ({ injectFeaturedNote: true }) }, { parameters: (): object => ({ injectFeaturedNote: false }) }, { parameters: (): object => ({ receiveAnnouncementEmail: true }) }, diff --git a/packages/backend/test/fetch-resource.ts b/packages/backend/test/fetch-resource.ts index da3116f0e8..00c0d736ef 100644 --- a/packages/backend/test/fetch-resource.ts +++ b/packages/backend/test/fetch-resource.ts @@ -5,13 +5,13 @@ import * as childProcess from "child_process"; import * as openapi from "@redocly/openapi-core"; import { async, - startServer, - signup, + port, post, request, - simpleGet, - port, shutdownServer, + signup, + simpleGet, + startServer, } from "./utils.js"; // Request Accept diff --git a/packages/backend/test/ff-visibility.ts b/packages/backend/test/ff-visibility.ts index f898926d99..efdbe7f0f6 100644 --- a/packages/backend/test/ff-visibility.ts +++ b/packages/backend/test/ff-visibility.ts @@ -4,14 +4,14 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, + connectStream, post, react, - connectStream, - startServer, + request, shutdownServer, + signup, simpleGet, + startServer, } from "./utils.js"; describe("FF visibility", () => { diff --git a/packages/backend/test/get-file-info.ts b/packages/backend/test/get-file-info.ts index 22dc28c8e0..b1092af278 100644 --- a/packages/backend/test/get-file-info.ts +++ b/packages/backend/test/get-file-info.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; -import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import { getFileInfo } from "../src/misc/get-file-info.js"; import { async } from "./utils.js"; diff --git a/packages/backend/test/mfm.ts b/packages/backend/test/mfm.ts index 926bdd259d..81ed95848a 100644 --- a/packages/backend/test/mfm.ts +++ b/packages/backend/test/mfm.ts @@ -1,8 +1,8 @@ import * as assert from "assert"; import * as mfm from "mfm-js"; -import { toHtml } from "../src/mfm/to-html.js"; import { fromHtml } from "../src/mfm/from-html.js"; +import { toHtml } from "../src/mfm/to-html.js"; describe("toHtml", () => { it("br", () => { diff --git a/packages/backend/test/mute.ts b/packages/backend/test/mute.ts index c511628342..831c2c1ee4 100644 --- a/packages/backend/test/mute.ts +++ b/packages/backend/test/mute.ts @@ -4,12 +4,12 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, post, react, - startServer, + request, shutdownServer, + signup, + startServer, waitFire, } from "./utils.js"; diff --git a/packages/backend/test/note.ts b/packages/backend/test/note.ts index 3af4b88d87..b78138b1ed 100644 --- a/packages/backend/test/note.ts +++ b/packages/backend/test/note.ts @@ -4,15 +4,15 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { Note } from "../src/models/entities/note.js"; import { - async, - signup, - request, - post, - uploadUrl, - startServer, - shutdownServer, - initTestDb, api, + async, + initTestDb, + post, + request, + shutdownServer, + signup, + startServer, + uploadUrl, } from "./utils.js"; describe("Note", () => { diff --git a/packages/backend/test/reaction-lib.ts b/packages/backend/test/reaction-lib.ts deleted file mode 100644 index 7c61dc76c2..0000000000 --- a/packages/backend/test/reaction-lib.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* -import * as assert from 'assert'; - -import { toDbReaction } from '../src/misc/reaction-lib.js'; - -describe('toDbReaction', async () => { - it('既存の文字列リアクションはそのまま', async () => { - assert.strictEqual(await toDbReaction('like'), 'like'); - }); - - it('Unicodeプリンは寿司化不能とするため文字列化しない', async () => { - assert.strictEqual(await toDbReaction('🍮'), '🍮'); - }); - - it('プリン以外の既存のリアクションは文字列化する like', async () => { - assert.strictEqual(await toDbReaction('👍'), 'like'); - }); - - it('プリン以外の既存のリアクションは文字列化する love', async () => { - assert.strictEqual(await toDbReaction('❤️'), 'love'); - }); - - it('プリン以外の既存のリアクションは文字列化する love 異体字セレクタなし', async () => { - assert.strictEqual(await toDbReaction('❤'), 'love'); - }); - - it('プリン以外の既存のリアクションは文字列化する laugh', async () => { - assert.strictEqual(await toDbReaction('😆'), 'laugh'); - }); - - it('プリン以外の既存のリアクションは文字列化する hmm', async () => { - assert.strictEqual(await toDbReaction('🤔'), 'hmm'); - }); - - it('プリン以外の既存のリアクションは文字列化する surprise', async () => { - assert.strictEqual(await toDbReaction('😮'), 'surprise'); - }); - - it('プリン以外の既存のリアクションは文字列化する congrats', async () => { - assert.strictEqual(await toDbReaction('🎉'), 'congrats'); - }); - - it('プリン以外の既存のリアクションは文字列化する angry', async () => { - assert.strictEqual(await toDbReaction('💢'), 'angry'); - }); - - it('プリン以外の既存のリアクションは文字列化する confused', async () => { - assert.strictEqual(await toDbReaction('😥'), 'confused'); - }); - - it('プリン以外の既存のリアクションは文字列化する rip', async () => { - assert.strictEqual(await toDbReaction('😇'), 'rip'); - }); - - it('それ以外はUnicodeのまま', async () => { - assert.strictEqual(await toDbReaction('🍅'), '🍅'); - }); - - it('異体字セレクタ除去', async () => { - assert.strictEqual(await toDbReaction('㊗️'), '㊗'); - }); - - it('異体字セレクタ除去 必要なし', async () => { - assert.strictEqual(await toDbReaction('㊗'), '㊗'); - }); - - it('fallback - undefined', async () => { - assert.strictEqual(await toDbReaction(undefined), 'like'); - }); - - it('fallback - null', async () => { - assert.strictEqual(await toDbReaction(null), 'like'); - }); - - it('fallback - empty', async () => { - assert.strictEqual(await toDbReaction(''), 'like'); - }); - - it('fallback - unknown', async () => { - assert.strictEqual(await toDbReaction('unknown'), 'like'); - }); -}); -*/ diff --git a/packages/backend/test/streaming.ts b/packages/backend/test/streaming.ts index 3292c66e17..37171f4184 100644 --- a/packages/backend/test/streaming.ts +++ b/packages/backend/test/streaming.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { Following } from "../src/models/entities/following.js"; import { - connectStream, - signup, api, - post, - startServer, - shutdownServer, + connectStream, initTestDb, + post, + shutdownServer, + signup, + startServer, waitFire, } from "./utils.js"; diff --git a/packages/backend/test/thread-mute.ts b/packages/backend/test/thread-mute.ts index 9b3bb8dfe4..88483b51c8 100644 --- a/packages/backend/test/thread-mute.ts +++ b/packages/backend/test/thread-mute.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, + connectStream, post, react, - connectStream, - startServer, + request, shutdownServer, + signup, + startServer, } from "./utils.js"; describe("Note thread mute", () => { diff --git a/packages/backend/test/user-notes.ts b/packages/backend/test/user-notes.ts index 86a541c101..cdf5e7dbbb 100644 --- a/packages/backend/test/user-notes.ts +++ b/packages/backend/test/user-notes.ts @@ -4,12 +4,12 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - signup, - request, post, - uploadUrl, - startServer, + request, shutdownServer, + signup, + startServer, + uploadUrl, } from "./utils.js"; describe("users/notes", () => { diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 79d622b54b..3c8449fb58 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -1,18 +1,18 @@ -import * as fs from "node:fs"; -import * as path from "node:path"; -import { fileURLToPath } from "node:url"; -import { dirname } from "node:path"; import * as childProcess from "child_process"; -import * as http from "node:http"; import { SIGKILL } from "constants"; -import WebSocket from "ws"; -import * as misskey from "firefish-js"; -import fetch from "node-fetch"; +import * as fs from "node:fs"; +import * as http from "node:http"; +import * as path from "node:path"; +import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import * as firefish from "firefish-js"; import FormData from "form-data"; +import got from "got"; +import fetch from "node-fetch"; import { DataSource } from "typeorm"; +import WebSocket from "ws"; import loadConfig from "../src/config/load.js"; import { entities } from "../src/db/postgre.js"; -import got from "got"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); @@ -113,8 +113,8 @@ export const signup = async (params?: any): Promise => { export const post = async ( user: any, - params?: misskey.Endpoints["notes/create"]["req"], -): Promise => { + params?: firefish.Endpoints["notes/create"]["req"], +): Promise => { const q = Object.assign( { text: "test", diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index 692d7b95b7..324d7da8f9 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -10,7 +10,7 @@ "declaration": false, "sourceMap": false, "target": "es2021", - "module": "es2020", + "module": "esnext", "moduleResolution": "node", "allowSyntheticDefaultImports": true, "removeComments": false, diff --git a/packages/client/package.json b/packages/client/package.json index 6bd13bac95..1a6346cb3b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -11,30 +11,34 @@ }, "devDependencies": { "@discordapp/twemoji": "14.1.2", - "@eslint-sets/eslint-config-vue3": "^5.8.0", + "@eslint-sets/eslint-config-vue3": "^5.10.0", "@eslint-sets/eslint-config-vue3-ts": "^3.3.0", "@phosphor-icons/web": "^2.0.3", - "@rollup/plugin-alias": "5.0.0", - "@rollup/plugin-json": "6.0.0", - "@rollup/pluginutils": "^5.0.4", - "@syuilo/aiscript": "0.11.1", - "@types/escape-regexp": "0.0.1", + "@rollup/plugin-alias": "5.0.1", + "@rollup/plugin-json": "6.0.1", + "@rollup/pluginutils": "^5.0.5", + "@syuilo/aiscript": "0.16.0", + "@types/autosize": "^4.0.3", "@types/glob": "8.1.0", - "@types/gulp": "4.0.13", - "@types/gulp-rename": "2.0.2", - "@types/katex": "0.16.2", - "@types/matter-js": "0.19.0", - "@types/punycode": "2.1.0", - "@types/seedrandom": "3.0.5", - "@types/throttle-debounce": "5.0.0", - "@types/tinycolor2": "1.4.3", - "@types/uuid": "9.0.3", - "@vitejs/plugin-vue": "4.3.4", - "@vue/compiler-sfc": "3.3.4", + "@types/gulp": "4.0.17", + "@types/gulp-rename": "2.0.5", + "@types/insert-text-at-cursor": "^0.3.2", + "@types/katex": "0.16.6", + "@types/matter-js": "0.19.4", + "@types/prismjs": "^1.26.3", + "@types/punycode": "2.1.2", + "@types/seedrandom": "3.0.8", + "@types/textarea-caret": "^3.0.3", + "@types/throttle-debounce": "5.0.2", + "@types/tinycolor2": "1.4.6", + "@types/uuid": "9.0.7", + "@vitejs/plugin-vue": "4.5.0", + "@vue/compiler-sfc": "3.3.8", + "@vue/runtime-core": "3.3.8", "autobind-decorator": "2.4.0", "autosize": "6.0.1", "blurhash": "2.0.5", - "broadcast-channel": "5.3.0", + "broadcast-channel": "6.0.0", "browser-image-resizer": "github:misskey-dev/browser-image-resizer", "chart.js": "4.4.0", "chartjs-adapter-date-fns": "3.0.0", @@ -43,57 +47,47 @@ "chartjs-plugin-zoom": "2.0.1", "city-timezones": "^1.2.1", "compare-versions": "6.1.0", - "cropperjs": "2.0.0-beta.2", - "cross-env": "7.0.3", - "cypress": "10.11.0", + "cropperjs": "2.0.0-beta.4", "date-fns": "2.30.0", - "emojilib": "github:thatonecalculator/emojilib", - "escape-regexp": "0.0.1", + "emojilib": "^3.0.11", "eslint-config-prettier": "9.0.0", "eslint-plugin-file-progress": "^1.3.0", "eventemitter3": "5.0.1", "fast-blurhash": "^1.1.2", "firefish-js": "workspace:*", - "focus-trap": "^7.5.2", - "focus-trap-vue": "^4.0.2", + "focus-trap": "^7.5.4", + "focus-trap-vue": "^4.0.3", "gsap": "^3.12.2", "idb-keyval": "6.2.1", "insert-text-at-cursor": "0.3.0", "json5": "2.2.3", - "katex": "0.16.8", + "katex": "0.16.9", + "libopenmpt-wasm": "github:TheEssem/libopenmpt-packaging#build", "matter-js": "0.19.0", "mfm-js": "0.23.3", - "photoswipe": "5.3.9", - "prettier": "3.0.3", - "prettier-plugin-vue": "1.1.6", + "photoswipe": "5.4.2", + "prettier": "3.1.0", "prismjs": "1.29.0", - "punycode": "2.3.0", - "rndstr": "1.0.0", - "rollup": "3.28.1", + "punycode": "2.3.1", + "rollup": "4.4.1", "s-age": "1.1.2", - "sass": "1.66.1", + "sass": "1.69.5", "seedrandom": "3.0.5", - "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", - "swiper": "10.2.0", + "swiper": "11.0.4", "syuilo-password-strength": "0.0.1", "textarea-caret": "3.1.0", - "three": "0.156.0", + "three": "0.158.0", "throttle-debounce": "5.0.0", "tinycolor2": "1.6.0", "tinyld": "^1.3.4", - "tsc-alias": "1.8.7", - "tsconfig-paths": "4.2.0", - "twemoji-parser": "14.0.0", "typescript": "5.2.2", "unicode-emoji-json": "^0.4.0", - "uuid": "9.0.0", - "vanilla-tilt": "1.8.1", - "vite": "4.4.9", + "uuid": "9.0.1", + "vite": "5.0.0", "vite-plugin-compression": "^0.5.1", - "vue": "3.3.4", - "vue-draggable-plus": "^0.2.6", - "vue-isyourpasswordsafe": "^2.0.0", + "vue": "3.3.8", + "vue-draggable-plus": "^0.2.7", "vue-plyr": "^7.0.0", "vue-prism-editor": "2.0.0-alpha.2" } diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index 13408b525d..d89dd2499e 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -1,21 +1,16 @@ -import { defineAsyncComponent, reactive } from "vue"; -import type * as misskey from "firefish-js"; -import { i18n } from "./i18n"; -import { del, get, set } from "@/scripts/idb-proxy"; import { apiUrl } from "@/config"; -import { alert, api, popup, popupMenu, success, waiting } from "@/os"; +import { alert, api, popup, popupMenu, waiting } from "@/os"; +import { $i } from "@/reactiveAccount"; +import icon from "@/scripts/icon"; +import { del, get, set } from "@/scripts/idb-proxy"; import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; +import type * as firefish from "firefish-js"; +import { defineAsyncComponent } from "vue"; +import { i18n } from "./i18n"; // TODO: 他のタブと永続化されたstateを同期 -type Account = misskey.entities.MeDetailed; - -const accountData = localStorage.getItem("account"); - -// TODO: 外部からはreadonlyに -export const $i = accountData - ? reactive(JSON.parse(accountData) as Account) - : null; +export type Account = firefish.entities.MeDetailed; export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator); export const iAmAdmin = $i?.isAdmin; @@ -97,9 +92,8 @@ function fetchAccount(token: string): Promise { .then((res) => { if (res.error) { if (res.error.id === "a8c724b3-6e9c-4b46-b1a8-bc3ed6258370") { - showSuspendedDialog().then(() => { - signout(); - }); + showSuspendedDialog(); + signout(); } else { alert({ type: "error", @@ -116,6 +110,14 @@ function fetchAccount(token: string): Promise { }); } +function showSuspendedDialog() { + alert({ + type: "error", + title: i18n.ts.yourAccountSuspendedTitle, + text: i18n.ts.yourAccountSuspendedDescription, + }); +} + export function updateAccount(accountData) { for (const [key, value] of Object.entries(accountData)) { $i[key] = value; @@ -150,8 +152,8 @@ export async function openAccountMenu( opts: { includeCurrentAccount?: boolean; withExtraOperation: boolean; - active?: misskey.entities.UserDetailed["id"]; - onChoose?: (account: misskey.entities.UserDetailed) => void; + active?: firefish.entities.UserDetailed["id"]; + onChoose?: (account: firefish.entities.UserDetailed) => void; }, ev: MouseEvent, ) { @@ -183,7 +185,7 @@ export async function openAccountMenu( ); } - async function switchAccount(account: misskey.entities.UserDetailed) { + async function switchAccount(account: firefish.entities.UserDetailed) { const storedAccounts = await getAccounts(); const token = storedAccounts.find((x) => x.id === account.id).token; switchAccountWithToken(token); @@ -200,7 +202,7 @@ export async function openAccountMenu( userIds: storedAccounts.map((x) => x.id), }); - function createItem(account: misskey.entities.UserDetailed) { + function createItem(account: firefish.entities.UserDetailed) { return { type: "user", user: account, @@ -241,7 +243,7 @@ export async function openAccountMenu( ...accountItemPromises, { type: "parent", - icon: "ph-plus ph-bold ph-lg", + icon: `${icon("ph-plus")}`, text: i18n.ts.addAccount, children: [ { @@ -260,13 +262,13 @@ export async function openAccountMenu( }, { type: "link", - icon: "ph-users ph-bold ph-lg", + icon: `${icon("ph-users")}`, text: i18n.ts.manageAccounts, to: "/settings/accounts", }, { type: "button", - icon: "ph-sign-out ph-bold ph-lg", + icon: `${icon("ph-sign-out")}`, text: i18n.ts.logout, action: () => { signout(); diff --git a/packages/client/src/components/MkAbuseReportWindow.vue b/packages/client/src/components/MkAbuseReportWindow.vue index ed4737894a..8d5675868b 100644 --- a/packages/client/src/components/MkAbuseReportWindow.vue +++ b/packages/client/src/components/MkAbuseReportWindow.vue @@ -8,7 +8,7 @@ >