diff --git a/.github/ISSUE_TEMPLATE/01_bug-report.md b/.github/ISSUE_TEMPLATE/01_bug-report.md index be84609e95..019f8c739d 100644 --- a/.github/ISSUE_TEMPLATE/01_bug-report.md +++ b/.github/ISSUE_TEMPLATE/01_bug-report.md @@ -7,6 +7,11 @@ assignees: '' --- + + ## 💡 Summary diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd048e8ea..b60eb59313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1 @@ -see [releases](https://github.com/syuilo/misskey/releases) +see [releases](https://github.com/misskey-dev/misskey/releases) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9d6702e80..848631823c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ - 枩床感高めで芋おほしいものは責付いおください。 ## Issues -Feature suggestions and bug reports are filed in https://github.com/syuilo/misskey/issues . +Feature suggestions and bug reports are filed in https://github.com/misskey-dev/misskey/issues . * Please search existing issues to avoid duplication. If your issue is already filed, please add your reaction or comment to the existing one. * If you have multiple independent issues, please submit them separately. diff --git a/README.md b/README.md index 6d4044243e..5cff3619fd 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@
-[![CircleCI](https://img.shields.io/circleci/project/github/syuilo/misskey.svg?style=for-the-badge&logo=circleci)](https://circleci.com/gh/syuilo/misskey) -[![Dependencies](https://img.shields.io/david/syuilo/misskey.svg?style=for-the-badge&logo=npm)](https://david-dm.org/syuilo/misskey) +[![CircleCI](https://img.shields.io/circleci/project/github/misskey-dev/misskey.svg?style=for-the-badge&logo=circleci)](https://circleci.com/gh/misskey-dev/misskey) +[![Dependencies](https://img.shields.io/david/misskey-dev/misskey.svg?style=for-the-badge&logo=npm)](https://david-dm.org/misskey-dev/misskey) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge&logo=github)](http://makeapullrequest.com) [![Awesome Humane Tech](https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/humane-tech-badge.svg?sanitize=true)](https://github.com/humanetech-community/awesome-humane-tech) @@ -22,11 +22,16 @@ Why don't you take a short break from the hustle and bustle of the city, and div --- +Do you have a question? Or are you experiencing trouble? +Visit [our forum](https://forum.misskey.io/)! + +--- + ![](https://ja.mstdn.wiki/images/e/ed/Deck.jpg) :sparkles: Features ---------------------------------------------------------------- - +

Posting

diff --git a/docs/docker.en.md b/docs/docker.en.md index 965c89a513..93eee8e4b4 100644 --- a/docs/docker.en.md +++ b/docs/docker.en.md @@ -12,13 +12,13 @@ This guide describes how to install and setup Misskey with Docker. ---------------------------------------------------------------- 1. Clone Misskey repository's master branch. - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 2. Move to misskey directory. `cd misskey` -3. Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest) tag. +3. Checkout to the [latest release](https://github.com/misskey-dev/misskey/releases/latest) tag. `git checkout master` diff --git a/docs/docker.fr.md b/docs/docker.fr.md index 52d42ff2e6..7abd46335f 100644 --- a/docs/docker.fr.md +++ b/docs/docker.fr.md @@ -13,13 +13,13 @@ Ce guide explique comment installer et configurer Misskey avec Docker. ---------------------------------------------------------------- 1. Clone le dépÃŽt de Misskey sur la branche master. - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 2. Naviguez dans le dossier du dépÃŽt. `cd misskey` -3. Checkout sur le tag de la [derniÚre version](https://github.com/syuilo/misskey/releases/latest). +3. Checkout sur le tag de la [derniÚre version](https://github.com/misskey-dev/misskey/releases/latest). `git checkout master` diff --git a/docs/docker.ja.md b/docs/docker.ja.md index befcc9116b..15b1a944ac 100644 --- a/docs/docker.ja.md +++ b/docs/docker.ja.md @@ -12,13 +12,13 @@ Dockerを䜿ったMisskey構築方法 ---------------------------------------------------------------- 1. masterブランチからMisskeyレポゞトリをクロヌン - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 2. misskeyディレクトリに移動 `cd misskey` -3. [最新のリリヌス](https://github.com/syuilo/misskey/releases/latest)を確認 +3. [最新のリリヌス](https://github.com/misskey-dev/misskey/releases/latest)を確認 `git checkout master` diff --git a/docs/docker.zh.md b/docs/docker.zh.md index a9d050e95a..a842fcb0cc 100644 --- a/docs/docker.zh.md +++ b/docs/docker.zh.md @@ -12,13 +12,13 @@ Docker 郚眲指南 ---------------------------------------------------------------- 1. 克隆 Misskey 项目的 master 分支。 - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 2. 进入 misskey 文件倹。 `cd misskey` -3. 检查 [最新发垃版](https://github.com/syuilo/misskey/releases/latest) 标筟。 +3. 检查 [最新发垃版](https://github.com/misskey-dev/misskey/releases/latest) 标筟。 `git checkout master` diff --git a/docs/setup.en.md b/docs/setup.en.md index a68e369945..bd36f0f006 100644 --- a/docs/setup.en.md +++ b/docs/setup.en.md @@ -40,13 +40,13 @@ Please install and setup these softwares: 2. Clone the misskey repo from master branch. - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 3. Navigate to misskey directory `cd misskey` -4. Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest) +4. Checkout to the [latest release](https://github.com/misskey-dev/misskey/releases/latest) `git checkout master` diff --git a/docs/setup.fr.md b/docs/setup.fr.md index b16447c4f8..7f4795eec5 100644 --- a/docs/setup.fr.md +++ b/docs/setup.fr.md @@ -41,13 +41,13 @@ Installez les paquets suivants : 2. Clonez la branche master du dépÃŽt misskey. - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 3. Accédez au dossier misskey. `cd misskey` -4. Checkout sur le tag de la [version la plus récente](https://github.com/syuilo/misskey/releases/latest) +4. Checkout sur le tag de la [version la plus récente](https://github.com/misskey-dev/misskey/releases/latest) `git checkout master` diff --git a/docs/setup.ja.md b/docs/setup.ja.md index 7f4ab69995..e8bae56f43 100644 --- a/docs/setup.ja.md +++ b/docs/setup.ja.md @@ -42,13 +42,13 @@ adduser --disabled-password --disabled-login misskey 2. masterブランチからMisskeyレポゞトリをクロヌン - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 3. misskeyディレクトリに移動 `cd misskey` -4. [最新のリリヌス](https://github.com/syuilo/misskey/releases/latest)を確認 +4. [最新のリリヌス](https://github.com/misskey-dev/misskey/releases/latest)を確認 `git checkout master` diff --git a/docs/setup.zh.md b/docs/setup.zh.md index 196e8a541d..50664706b7 100644 --- a/docs/setup.zh.md +++ b/docs/setup.zh.md @@ -40,13 +40,13 @@ adduser --disabled-password --disabled-login misskey 2. 克隆 Misskey 项目的 master 分支。 - `git clone -b master git://github.com/syuilo/misskey.git` + `git clone -b master git://github.com/misskey-dev/misskey.git` 3. 进入 misskey 文件倹。 `cd misskey` -4. 检查 [最新发垃版](https://github.com/syuilo/misskey/releases/latest) 标筟。 +4. 检查 [最新发垃版](https://github.com/misskey-dev/misskey/releases/latest) 标筟。 `git checkout master` diff --git a/locales/README.md b/locales/README.md index 775a39a3c1..a31df4f4cc 100644 --- a/locales/README.md +++ b/locales/README.md @@ -1,6 +1,6 @@ # **DO NOT edit locale files** except `ja-JP.yml`. -When you add text to the ja-JP file (of syuilo/misskey), it will automatically be applied to other language files. +When you add text to the ja-JP file (of misskey-dev/misskey), it will automatically be applied to other language files. Translations added in ja-JP file should contain the original Japanese strings. Please see [Contribution guide](../CONTRIBUTING.md) for more information. diff --git a/migration/1557761316509-AddSomeUrls.ts b/migration/1557761316509-AddSomeUrls.ts index a0a2c7970a..926999de6c 100644 --- a/migration/1557761316509-AddSomeUrls.ts +++ b/migration/1557761316509-AddSomeUrls.ts @@ -4,8 +4,8 @@ export class AddSomeUrls1557761316509 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://github.com/syuilo/misskey'`); - await queryRunner.query(`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://github.com/syuilo/misskey/issues/new'`); + await queryRunner.query(`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://github.com/misskey-dev/misskey'`); + await queryRunner.query(`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://github.com/misskey-dev/misskey/issues/new'`); } public async down(queryRunner: QueryRunner): Promise { diff --git a/package.json b/package.json index 7f2689d89e..94915dc78b 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "misskey", "author": "syuilo ", - "version": "12.75.0", + "version": "12.75.1", "codename": "indigo", "repository": { "type": "git", - "url": "https://github.com/syuilo/misskey.git" + "url": "https://github.com/misskey-dev/misskey.git" }, "main": "./index.js", "private": true, @@ -242,7 +242,6 @@ "typeorm": "0.2.31", "typescript": "4.2.3", "ulid": "2.3.0", - "url-loader": "4.1.1", "uuid": "8.3.2", "v-debounce": "0.1.2", "vanilla-tilt": "1.7.0", diff --git a/src/client/pages/about-misskey.vue b/src/client/pages/about-misskey.vue index 2d1da88fa1..e9e2e15573 100644 --- a/src/client/pages/about-misskey.vue +++ b/src/client/pages/about-misskey.vue @@ -14,7 +14,7 @@ {{ $ts._aboutMisskey.about }} - + {{ $ts._aboutMisskey.source }} @@ -40,7 +40,7 @@ @rinsuki @Xeltica @u1-liquid - + diff --git a/src/client/pages/doc.vue b/src/client/pages/doc.vue index 7155cc1563..4341cd1f6e 100644 --- a/src/client/pages/doc.vue +++ b/src/client/pages/doc.vue @@ -3,7 +3,7 @@

{{ title }}
diff --git a/src/client/pages/settings/update.vue b/src/client/pages/settings/update.vue index a8da8bf11c..bc26af4211 100644 --- a/src/client/pages/settings/update.vue +++ b/src/client/pages/settings/update.vue @@ -79,7 +79,7 @@ export default defineComponent({ localStorage.setItem('v', meta.version); }); - fetch('https://api.github.com/repos/syuilo/misskey/releases', { + fetch('https://api.github.com/repos/misskey-dev/misskey/releases', { method: 'GET', }) .then(res => res.json()) diff --git a/src/client/ui/visitor/a.vue b/src/client/ui/visitor/a.vue index 2aed50100c..ba4506ec56 100644 --- a/src/client/ui/visitor/a.vue +++ b/src/client/ui/visitor/a.vue @@ -32,7 +32,7 @@
{{ host }} - Powered by Misskey + Powered by Misskey
diff --git a/src/client/ui/visitor/b.vue b/src/client/ui/visitor/b.vue index bd00773c57..34690ec643 100644 --- a/src/client/ui/visitor/b.vue +++ b/src/client/ui/visitor/b.vue @@ -1,6 +1,6 @@ diff --git a/src/docs/ar-SA/theme.md b/src/docs/ar-SA/theme.md index 8e24a1cbc7..59b582fa29 100644 --- a/src/docs/ar-SA/theme.md +++ b/src/docs/ar-SA/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/cs-CZ/theme.md b/src/docs/cs-CZ/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/cs-CZ/theme.md +++ b/src/docs/cs-CZ/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/da-DK/theme.md b/src/docs/da-DK/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/da-DK/theme.md +++ b/src/docs/da-DK/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/de-DE/theme.md b/src/docs/de-DE/theme.md index fe1c4fc7bb..e8d95ca628 100644 --- a/src/docs/de-DE/theme.md +++ b/src/docs/de-DE/theme.md @@ -43,7 +43,7 @@ Themencodes werden im Format eines JSON5-Objekts gespeichert. Themen werden wie * `props` ... Definitionen der Themenoptionen.Diese werden im folgenden erlÀutert. ### Definition von Themenoptionen -Die Optionen des Themas werden in `props` definiert. Die SchlÃŒssel werden zu CSS-Variablen, die Werte geben den Inhalt an. ZusÀtzlich werden die `props` des gewÀhlten Basisthemas von diesem Thema geerbt. Ist die `base` dieses Themas auf `light` gesetzt, so werden sie aus [_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5) kopiert, ist sie auf `dark` gesetzt, so werden sie aus [_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5) kopiert. Beispielsweise wird, falls sich in den `props` dieses Themas keine Definition fÃŒr den SchlÃŒssel `panel` befindet, so wird der Wert von `panel` aus dem Basisthema verwendet. +Die Optionen des Themas werden in `props` definiert. Die SchlÃŒssel werden zu CSS-Variablen, die Werte geben den Inhalt an. ZusÀtzlich werden die `props` des gewÀhlten Basisthemas von diesem Thema geerbt. Ist die `base` dieses Themas auf `light` gesetzt, so werden sie aus [_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5) kopiert, ist sie auf `dark` gesetzt, so werden sie aus [_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5) kopiert. Beispielsweise wird, falls sich in den `props` dieses Themas keine Definition fÃŒr den SchlÃŒssel `panel` befindet, so wird der Wert von `panel` aus dem Basisthema verwendet. #### Syntax fÃŒr Wertangaben * Hexadezimalfarben diff --git a/src/docs/en-US/theme.md b/src/docs/en-US/theme.md index 35c0197966..6deb75abe6 100644 --- a/src/docs/en-US/theme.md +++ b/src/docs/en-US/theme.md @@ -43,7 +43,7 @@ Theme codes are saved as a JSON5 object of theme options. Themes are composed of * `props` ... The style definitions of the theme.These will be explained in the following. ### Theme style definitions -Define the style of the theme within `props`. The keys will become CSS variables, and the value specifies the content. In addition, the default `props` options are inherited from the base theme. If this theme's `base` is `light`, they will be copied from [_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5), if it is `dark` they will be copied from [_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5). In other words, if there is for example no `panel` key contained in `props`, then the value of `panel` from the base theme will be used. +Define the style of the theme within `props`. The keys will become CSS variables, and the value specifies the content. In addition, the default `props` options are inherited from the base theme. If this theme's `base` is `light`, they will be copied from [_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5), if it is `dark` they will be copied from [_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5). In other words, if there is for example no `panel` key contained in `props`, then the value of `panel` from the base theme will be used. #### Syntax for values * Hex colors diff --git a/src/docs/es-ES/theme.md b/src/docs/es-ES/theme.md index b6490106d1..3e379ee5f5 100644 --- a/src/docs/es-ES/theme.md +++ b/src/docs/es-ES/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/fr-FR/theme.md b/src/docs/fr-FR/theme.md index cf15c921e4..ab721fe445 100644 --- a/src/docs/fr-FR/theme.md +++ b/src/docs/fr-FR/theme.md @@ -43,7 +43,7 @@ Le code des thÚmes est écrit sous forme d'objets JSON5. Les thÚmes comprennen * `props` ... Définir un style de thÚme.Voir les explications ci-aprÚs. ### Définir un style de thÚme -C'est dans `props` que vous définirez le style de thÚme. Les propriétés deviendront des variables CSS et les valeurs associées spécifieront le contenu de ces variables. Par ailleurs, les objets présents par défaut dans `props` sont hérités du thÚme de base. Ainsi, si le thÚme de `base` est clair `light` ce sera l'objet [_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5) ; et s'il est sombre `dark` ce sera l'objet [_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5). Cela signifie, par exemple, que s'il n'y pas de propriété `panel` définie dans les `props` du thÚme, alors ce sera la valeur `panel` du thÚme de base qui sera prise en compte. +C'est dans `props` que vous définirez le style de thÚme. Les propriétés deviendront des variables CSS et les valeurs associées spécifieront le contenu de ces variables. Par ailleurs, les objets présents par défaut dans `props` sont hérités du thÚme de base. Ainsi, si le thÚme de `base` est clair `light` ce sera l'objet [_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5) ; et s'il est sombre `dark` ce sera l'objet [_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5). Cela signifie, par exemple, que s'il n'y pas de propriété `panel` définie dans les `props` du thÚme, alors ce sera la valeur `panel` du thÚme de base qui sera prise en compte. #### Syntaxe des valeurs * Codes de couleur Hex diff --git a/src/docs/ht-HT/theme.md b/src/docs/ht-HT/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/ht-HT/theme.md +++ b/src/docs/ht-HT/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/id-ID/theme.md b/src/docs/id-ID/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/id-ID/theme.md +++ b/src/docs/id-ID/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/it-IT/theme.md b/src/docs/it-IT/theme.md index ad21299e89..7467bf340d 100644 --- a/src/docs/it-IT/theme.md +++ b/src/docs/it-IT/theme.md @@ -43,7 +43,7 @@ Il codice dei temi Ú scritto a forma di oggetti JSON5. I temi contengono gli og * `props` ... テヌマのスタむル定矩。これから説明したす。 ### Impostare uno stile di tema -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### Sintassi dei valori * 16進数で衚された色 diff --git a/src/docs/ja-JP/theme.md b/src/docs/ja-JP/theme.md index c9604da412..89b467120c 100644 --- a/src/docs/ja-JP/theme.md +++ b/src/docs/ja-JP/theme.md @@ -47,7 +47,7 @@ `props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 -ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 +ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 diff --git a/src/docs/ja-KS/theme.md b/src/docs/ja-KS/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/ja-KS/theme.md +++ b/src/docs/ja-KS/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/kab-KAB/theme.md b/src/docs/kab-KAB/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/kab-KAB/theme.md +++ b/src/docs/kab-KAB/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/kn-IN/theme.md b/src/docs/kn-IN/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/kn-IN/theme.md +++ b/src/docs/kn-IN/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/ko-KR/theme.md b/src/docs/ko-KR/theme.md index 856580e600..e01133b831 100644 --- a/src/docs/ko-KR/theme.md +++ b/src/docs/ko-KR/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/nl-NL/theme.md b/src/docs/nl-NL/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/nl-NL/theme.md +++ b/src/docs/nl-NL/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/no-NO/theme.md b/src/docs/no-NO/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/no-NO/theme.md +++ b/src/docs/no-NO/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/pl-PL/theme.md b/src/docs/pl-PL/theme.md index 36590b7437..7190c39dd7 100644 --- a/src/docs/pl-PL/theme.md +++ b/src/docs/pl-PL/theme.md @@ -43,7 +43,7 @@ Kod motywów jest zapisywany jako obiekt JSON5 z opcjami motywu. Motywy składaj * `props` ... Definicje stylów motywu.これから説明したす。 ### Definicje stylów motywu. -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### Składnia wartości * Kolory Hex diff --git a/src/docs/pt-PT/theme.md b/src/docs/pt-PT/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/pt-PT/theme.md +++ b/src/docs/pt-PT/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/ru-RU/theme.md b/src/docs/ru-RU/theme.md index 6ab7b54665..e4661c1011 100644 --- a/src/docs/ru-RU/theme.md +++ b/src/docs/ru-RU/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/th-TH/theme.md b/src/docs/th-TH/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/th-TH/theme.md +++ b/src/docs/th-TH/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/ug-CN/theme.md b/src/docs/ug-CN/theme.md index 4e52ee8cd7..a406f3433c 100644 --- a/src/docs/ug-CN/theme.md +++ b/src/docs/ug-CN/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/uk-UA/theme.md b/src/docs/uk-UA/theme.md index df1e33a920..baa74c33e4 100644 --- a/src/docs/uk-UA/theme.md +++ b/src/docs/uk-UA/theme.md @@ -43,7 +43,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 16進数で衚された色 diff --git a/src/docs/zh-CN/theme.md b/src/docs/zh-CN/theme.md index a0d0c10bcd..1f33c00b41 100644 --- a/src/docs/zh-CN/theme.md +++ b/src/docs/zh-CN/theme.md @@ -43,7 +43,7 @@ * `props` ... 关于䞻题样匏的定义䞋面是诊细介绍。 ### 䞻题样匏定义 -圚 `props` 䞋䜠可以定义䞻题的样匏。 键是 CSS 变量名倌是指定的内容。 请泚意`props` 对象是从基础䞻题集继承的。 劂果这䞪䞻题的 `base` 是 `light`则基础䞻题䞺 [_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)劂果 `dark`则基础䞻题䞺 [_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)。 换句话诎即䜿这䞪䞻题䞭的 `props` 䞭没有定义关键的 `panel`也䌚继承圚基础䞻题䞭所拥有 `panel`。 +圚 `props` 䞋䜠可以定义䞻题的样匏。 键是 CSS 变量名倌是指定的内容。 请泚意`props` 对象是从基础䞻题集继承的。 劂果这䞪䞻题的 `base` 是 `light`则基础䞻题䞺 [_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)劂果 `dark`则基础䞻题䞺 [_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)。 换句话诎即䜿这䞪䞻题䞭的 `props` 䞭没有定义关键的 `panel`也䌚继承圚基础䞻题䞭所拥有 `panel`。 #### 可以圚倌䞭䜿甚的语法 * 以十六进制衚瀺的颜色 diff --git a/src/docs/zh-TW/theme.md b/src/docs/zh-TW/theme.md index 1c41260339..6715dce72f 100644 --- a/src/docs/zh-TW/theme.md +++ b/src/docs/zh-TW/theme.md @@ -45,7 +45,7 @@ * `props` ... テヌマのスタむル定矩。これから説明したす。 ### テヌマのスタむル定矩 -`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/syuilo/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 +`props`䞋にはテヌマのスタむルを定矩したす。 キヌがCSSの倉数名になり、バリュヌで䞭身を指定したす。 なお、この`props`オブゞェクトはベヌステヌマから継承されたす。 ベヌステヌマは、このテヌマの`base`が`light`なら[_light.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_light.json5)で、`dark`なら[_dark.json5](https://github.com/misskey-dev/misskey/blob/develop/src/client/themes/_dark.json5)です。 ぀たり、このテヌマ内の`props`に`panel`ずいうキヌが無くおも、そこにはベヌステヌマの`panel`があるず芋なされたす。 #### バリュヌで䜿える構文 * 以十六進䜍色碌暙瀺 diff --git a/src/games/reversi/package.json b/src/games/reversi/package.json index 5e7fdcb58a..a4415ad141 100644 --- a/src/games/reversi/package.json +++ b/src/games/reversi/package.json @@ -7,8 +7,8 @@ ], "author": "syuilo ", "license": "MIT", - "repository": "https://github.com/syuilo/misskey.git", - "bugs": "https://github.com/syuilo/misskey/issues", + "repository": "https://github.com/misskey-dev/misskey.git", + "bugs": "https://github.com/misskey-dev/misskey/issues", "main": "./built/core.js", "types": "./built/core.d.ts", "scripts": { diff --git a/src/misc/convert-host.ts b/src/misc/convert-host.ts index ef0ff18fcf..f8957a64a8 100644 --- a/src/misc/convert-host.ts +++ b/src/misc/convert-host.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import config from '@/config'; import { toASCII } from 'punycode'; diff --git a/src/misc/download-url.ts b/src/misc/download-url.ts index d3abf9c34f..dafeff6fc8 100644 --- a/src/misc/download-url.ts +++ b/src/misc/download-url.ts @@ -1,6 +1,7 @@ import * as fs from 'fs'; import * as stream from 'stream'; import * as util from 'util'; +import { URL } from 'url'; import fetch from 'node-fetch'; import { getAgentByUrl } from './fetch'; import { AbortController } from 'abort-controller'; diff --git a/src/models/entities/meta.ts b/src/models/entities/meta.ts index f013169f86..d0b6ee7f2b 100644 --- a/src/models/entities/meta.ts +++ b/src/models/entities/meta.ts @@ -321,14 +321,14 @@ export class Meta { @Column('varchar', { length: 512, - default: 'https://github.com/syuilo/misskey', + default: 'https://github.com/misskey-dev/misskey', nullable: false }) public repositoryUrl: string; @Column('varchar', { length: 512, - default: 'https://github.com/syuilo/misskey/issues/new', + default: 'https://github.com/misskey-dev/misskey/issues/new', nullable: true }) public feedbackUrl: string | null; diff --git a/src/models/repositories/app.ts b/src/models/repositories/app.ts index 12c78fe87a..c919a9bdb1 100644 --- a/src/models/repositories/app.ts +++ b/src/models/repositories/app.ts @@ -9,7 +9,7 @@ export type PackedApp = SchemaType; export class AppRepository extends Repository { public async pack( src: App['id'] | App, - me?: any, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean, includeSecret?: boolean, diff --git a/src/models/repositories/auth-session.ts b/src/models/repositories/auth-session.ts index e985d6925f..f513357e1b 100644 --- a/src/models/repositories/auth-session.ts +++ b/src/models/repositories/auth-session.ts @@ -2,12 +2,13 @@ import { EntityRepository, Repository } from 'typeorm'; import { Apps } from '..'; import { AuthSession } from '../entities/auth-session'; import { awaitAll } from '../../prelude/await-all'; +import { User } from '../entities/user'; @EntityRepository(AuthSession) export class AuthSessionRepository extends Repository { public async pack( src: AuthSession['id'] | AuthSession, - me?: any + me?: { id: User['id'] } | null | undefined ) { const session = typeof src === 'object' ? src : await this.findOneOrFail(src); diff --git a/src/models/repositories/blocking.ts b/src/models/repositories/blocking.ts index 1ecdbd5d05..60b43fae3e 100644 --- a/src/models/repositories/blocking.ts +++ b/src/models/repositories/blocking.ts @@ -3,6 +3,7 @@ import { Users } from '..'; import { Blocking } from '../entities/blocking'; import { awaitAll } from '../../prelude/await-all'; import { SchemaType } from '@/misc/schema'; +import { User } from '../entities/user'; export type PackedBlocking = SchemaType; @@ -10,7 +11,7 @@ export type PackedBlocking = SchemaType; export class BlockingRepository extends Repository { public async pack( src: Blocking['id'] | Blocking, - me?: any + me?: { id: User['id'] } | null | undefined ): Promise { const blocking = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -26,7 +27,7 @@ export class BlockingRepository extends Repository { public packMany( blockings: any[], - me: any + me: { id: User['id'] } ) { return Promise.all(blockings.map(x => this.pack(x, me))); } diff --git a/src/models/repositories/channel.ts b/src/models/repositories/channel.ts index b15cf8b35f..a1c85f2bd7 100644 --- a/src/models/repositories/channel.ts +++ b/src/models/repositories/channel.ts @@ -10,19 +10,19 @@ export type PackedChannel = SchemaType; export class ChannelRepository extends Repository { public async pack( src: Channel['id'] | Channel, - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, ): Promise { const channel = typeof src === 'object' ? src : await this.findOneOrFail(src); - const meId = me ? typeof me === 'string' ? me : me.id : null; + const meId = me ? me.id : null; const banner = channel.bannerId ? await DriveFiles.findOne(channel.bannerId) : null; - const hasUnreadNote = me ? (await NoteUnreads.findOne({ noteChannelId: channel.id, userId: meId })) != null : undefined; + const hasUnreadNote = meId ? (await NoteUnreads.findOne({ noteChannelId: channel.id, userId: meId })) != null : undefined; - const following = await ChannelFollowings.findOne({ + const following = meId ? await ChannelFollowings.findOne({ followerId: meId, followeeId: channel.id, - }); + }) : null; return { id: channel.id, diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts index 3a036beb88..590079fe4a 100644 --- a/src/models/repositories/drive-file.ts +++ b/src/models/repositories/drive-file.ts @@ -53,7 +53,7 @@ export class DriveFileRepository extends Repository { return thumbnail ? (file.thumbnailUrl || (isImage ? (file.webpublicUrl || file.url) : null)) : (file.webpublicUrl || file.url); } - public async calcDriveUsageOf(user: User['id'] | User): Promise { + public async calcDriveUsageOf(user: User['id'] | { id: User['id'] }): Promise { const id = typeof user === 'object' ? user.id : user; const { sum } = await this diff --git a/src/models/repositories/follow-request.ts b/src/models/repositories/follow-request.ts index 0d96b8eb53..31e5fb2d90 100644 --- a/src/models/repositories/follow-request.ts +++ b/src/models/repositories/follow-request.ts @@ -1,12 +1,13 @@ import { EntityRepository, Repository } from 'typeorm'; import { FollowRequest } from '../entities/follow-request'; import { Users } from '..'; +import { User } from '../entities/user'; @EntityRepository(FollowRequest) export class FollowRequestRepository extends Repository { public async pack( src: FollowRequest['id'] | FollowRequest, - me?: any + me?: { id: User['id'] } | null | undefined ) { const request = typeof src === 'object' ? src : await this.findOneOrFail(src); diff --git a/src/models/repositories/following.ts b/src/models/repositories/following.ts index d754661b2d..b886432978 100644 --- a/src/models/repositories/following.ts +++ b/src/models/repositories/following.ts @@ -3,6 +3,7 @@ import { Users } from '..'; import { Following } from '../entities/following'; import { awaitAll } from '../../prelude/await-all'; import { SchemaType } from '@/misc/schema'; +import { User } from '../entities/user'; type LocalFollowerFollowing = Following & { followerHost: null; @@ -50,7 +51,7 @@ export class FollowingRepository extends Repository { public async pack( src: Following['id'] | Following, - me?: any, + me?: { id: User['id'] } | null | undefined, opts?: { populateFollowee?: boolean; populateFollower?: boolean; @@ -76,7 +77,7 @@ export class FollowingRepository extends Repository { public packMany( followings: any[], - me?: any, + me?: { id: User['id'] } | null | undefined, opts?: { populateFollowee?: boolean; populateFollower?: boolean; diff --git a/src/models/repositories/games/reversi/game.ts b/src/models/repositories/games/reversi/game.ts index e23247f664..344cf7b20e 100644 --- a/src/models/repositories/games/reversi/game.ts +++ b/src/models/repositories/games/reversi/game.ts @@ -1,3 +1,4 @@ +import { User } from '@/models/entities/user'; import { EntityRepository, Repository } from 'typeorm'; import { Users } from '../../..'; import { ReversiGame } from '../../../entities/games/reversi/game'; @@ -6,7 +7,7 @@ import { ReversiGame } from '../../../entities/games/reversi/game'; export class ReversiGameRepository extends Repository { public async pack( src: ReversiGame['id'] | ReversiGame, - me?: any, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean } @@ -16,7 +17,6 @@ export class ReversiGameRepository extends Repository { }, options); const game = typeof src === 'object' ? src : await this.findOneOrFail(src); - const meId = me ? typeof me === 'string' ? me : me.id : null; return { id: game.id, @@ -30,10 +30,10 @@ export class ReversiGameRepository extends Repository { user2Accepted: game.user2Accepted, user1Id: game.user1Id, user2Id: game.user2Id, - user1: await Users.pack(game.user1Id, meId), - user2: await Users.pack(game.user2Id, meId), + user1: await Users.pack(game.user1Id, me), + user2: await Users.pack(game.user2Id, me), winnerId: game.winnerId, - winner: game.winnerId ? await Users.pack(game.winnerId, meId) : null, + winner: game.winnerId ? await Users.pack(game.winnerId, me) : null, surrendered: game.surrendered, black: game.black, bw: game.bw, diff --git a/src/models/repositories/games/reversi/matching.ts b/src/models/repositories/games/reversi/matching.ts index 51f17c9a4e..013021eb90 100644 --- a/src/models/repositories/games/reversi/matching.ts +++ b/src/models/repositories/games/reversi/matching.ts @@ -2,12 +2,13 @@ import { EntityRepository, Repository } from 'typeorm'; import { ReversiMatching } from '../../../entities/games/reversi/matching'; import { Users } from '../../..'; import { awaitAll } from '../../../../prelude/await-all'; +import { User } from '@/models/entities/user'; @EntityRepository(ReversiMatching) export class ReversiMatchingRepository extends Repository { public async pack( src: ReversiMatching['id'] | ReversiMatching, - me: any + me: { id: User['id'] } ) { const matching = typeof src === 'object' ? src : await this.findOneOrFail(src); diff --git a/src/models/repositories/messaging-message.ts b/src/models/repositories/messaging-message.ts index 2c78e7fbd3..8d6d03a236 100644 --- a/src/models/repositories/messaging-message.ts +++ b/src/models/repositories/messaging-message.ts @@ -2,6 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { MessagingMessage } from '../entities/messaging-message'; import { Users, DriveFiles, UserGroups } from '..'; import { SchemaType } from '@/misc/schema'; +import { User } from '../entities/user'; export type PackedMessagingMessage = SchemaType; @@ -13,7 +14,7 @@ export class MessagingMessageRepository extends Repository { public async pack( src: MessagingMessage['id'] | MessagingMessage, - me?: any, + me?: { id: User['id'] } | null | undefined, options?: { populateRecipient?: boolean, populateGroup?: boolean, diff --git a/src/models/repositories/muting.ts b/src/models/repositories/muting.ts index 8a5c57a38f..b5bbe8a0a3 100644 --- a/src/models/repositories/muting.ts +++ b/src/models/repositories/muting.ts @@ -3,6 +3,7 @@ import { Users } from '..'; import { Muting } from '../entities/muting'; import { awaitAll } from '../../prelude/await-all'; import { SchemaType } from '@/misc/schema'; +import { User } from '../entities/user'; export type PackedMuting = SchemaType; @@ -10,7 +11,7 @@ export type PackedMuting = SchemaType; export class MutingRepository extends Repository { public async pack( src: Muting['id'] | Muting, - me?: any + me?: { id: User['id'] } | null | undefined ): Promise { const muting = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -26,7 +27,7 @@ export class MutingRepository extends Repository { public packMany( mutings: any[], - me: any + me: { id: User['id'] } ) { return Promise.all(mutings.map(x => this.pack(x, me))); } diff --git a/src/models/repositories/note-favorite.ts b/src/models/repositories/note-favorite.ts index eb2ffff4c1..316ebdff35 100644 --- a/src/models/repositories/note-favorite.ts +++ b/src/models/repositories/note-favorite.ts @@ -1,12 +1,13 @@ import { EntityRepository, Repository } from 'typeorm'; import { NoteFavorite } from '../entities/note-favorite'; import { Notes } from '..'; +import { User } from '../entities/user'; @EntityRepository(NoteFavorite) export class NoteFavoriteRepository extends Repository { public async pack( src: NoteFavorite['id'] | NoteFavorite, - me?: any + me?: { id: User['id'] } | null | undefined ) { const favorite = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -20,7 +21,7 @@ export class NoteFavoriteRepository extends Repository { public packMany( favorites: any[], - me: any + me: { id: User['id'] } ) { return Promise.all(favorites.map(x => this.pack(x, me))); } diff --git a/src/models/repositories/note-reaction.ts b/src/models/repositories/note-reaction.ts index e04a493007..4c56809603 100644 --- a/src/models/repositories/note-reaction.ts +++ b/src/models/repositories/note-reaction.ts @@ -3,6 +3,7 @@ import { NoteReaction } from '../entities/note-reaction'; import { Users } from '..'; import { SchemaType } from '@/misc/schema'; import { convertLegacyReaction } from '@/misc/reaction-lib'; +import { User } from '../entities/user'; export type PackedNoteReaction = SchemaType; @@ -10,7 +11,7 @@ export type PackedNoteReaction = SchemaType; export class NoteReactionRepository extends Repository { public async pack( src: NoteReaction['id'] | NoteReaction, - me?: any + me?: { id: User['id'] } | null | undefined ): Promise { const reaction = typeof src === 'object' ? src : await this.findOneOrFail(src); diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts index aa5f93a5dd..3642a03c2c 100644 --- a/src/models/repositories/note.ts +++ b/src/models/repositories/note.ts @@ -79,7 +79,7 @@ export class NoteRepository extends Repository { public async pack( src: Note['id'] | Note, - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean; skipHide?: boolean; @@ -93,7 +93,7 @@ export class NoteRepository extends Repository { skipHide: false }, options); - const meId = me ? typeof me === 'string' ? me : me.id : null; + const meId = me ? me.id : null; const note = typeof src === 'object' ? src : await this.findOneOrFail(src); const host = note.userHost; @@ -174,7 +174,7 @@ export class NoteRepository extends Repository { id: note.id, createdAt: note.createdAt.toISOString(), userId: note.userId, - user: Users.pack(note.user || note.userId, meId, { + user: Users.pack(note.user || note.userId, me, { detail: false, }), text: text, @@ -204,12 +204,12 @@ export class NoteRepository extends Repository { _prId_: (note as any)._prId_ || undefined, ...(opts.detail ? { - reply: note.replyId ? this.pack(note.reply || note.replyId, meId, { + reply: note.replyId ? this.pack(note.reply || note.replyId, me, { detail: false, _hint_: options?._hint_ }) : undefined, - renote: note.renoteId ? this.pack(note.renote || note.renoteId, meId, { + renote: note.renoteId ? this.pack(note.renote || note.renoteId, me, { detail: true, _hint_: options?._hint_ }) : undefined, @@ -236,7 +236,7 @@ export class NoteRepository extends Repository { public async packMany( notes: Note[], - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean; skipHide?: boolean; @@ -244,7 +244,7 @@ export class NoteRepository extends Repository { ) { if (notes.length === 0) return []; - const meId = me ? typeof me === 'string' ? me : me.id : null; + const meId = me ? me.id : null; const myReactionsMap = new Map(); if (meId) { const renoteIds = notes.filter(n => n.renoteId != null).map(n => n.renoteId!); diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index 7a7ac52018..abadea4632 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -31,38 +31,38 @@ export class NotificationRepository extends Repository { userId: notification.notifierId, user: notification.notifierId ? Users.pack(notification.notifier || notification.notifierId) : null, ...(notification.type === 'mention' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), } : {}), ...(notification.type === 'reply' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), } : {}), ...(notification.type === 'renote' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), } : {}), ...(notification.type === 'quote' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), } : {}), ...(notification.type === 'reaction' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), reaction: notification.reaction } : {}), ...(notification.type === 'pollVote' ? { - note: Notes.pack(notification.note || notification.noteId!, notification.notifieeId, { + note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_ }), diff --git a/src/models/repositories/page-like.ts b/src/models/repositories/page-like.ts index 94b1685e5e..cfef950f3b 100644 --- a/src/models/repositories/page-like.ts +++ b/src/models/repositories/page-like.ts @@ -1,12 +1,13 @@ import { EntityRepository, Repository } from 'typeorm'; import { PageLike } from '../entities/page-like'; import { Pages } from '..'; +import { User } from '../entities/user'; @EntityRepository(PageLike) export class PageLikeRepository extends Repository { public async pack( src: PageLike['id'] | PageLike, - me?: any + me?: { id: User['id'] } | null | undefined ) { const like = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -18,7 +19,7 @@ export class PageLikeRepository extends Repository { public packMany( likes: any[], - me: any + me: { id: User['id'] } ) { return Promise.all(likes.map(x => this.pack(x, me))); } diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index 3017769d6b..a162a50321 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -12,9 +12,9 @@ export type PackedPage = SchemaType; export class PageRepository extends Repository { public async pack( src: Page['id'] | Page, - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, ): Promise { - const meId = me ? typeof me === 'string' ? me : me.id : null; + const meId = me ? me.id : null; const page = typeof src === 'object' ? src : await this.findOneOrFail(src); const attachedFiles: Promise[] = []; @@ -84,7 +84,7 @@ export class PageRepository extends Repository { public packMany( pages: Page[], - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, ) { return Promise.all(pages.map(x => this.pack(x, me))); } diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 51b67a27ea..bb084f0245 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -147,7 +147,7 @@ export class UserRepository extends Repository { public async pack( src: User['id'] | User, - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean, includeSecrets?: boolean, @@ -159,7 +159,7 @@ export class UserRepository extends Repository { }, options); const user = typeof src === 'object' ? src : await this.findOneOrFail(src); - const meId = me ? typeof me === 'string' ? me : me.id : null; + const meId = me ? me.id : null; const relation = meId && (meId !== user.id) && opts.detail ? await this.getRelation(meId, user.id) : null; const pins = opts.detail ? await UserNotePinings.createQueryBuilder('pin') @@ -213,11 +213,11 @@ export class UserRepository extends Repository { followingCount: user.followingCount, notesCount: user.notesCount, pinnedNoteIds: pins.map(pin => pin.noteId), - pinnedNotes: Notes.packMany(pins.map(pin => pin.note!), meId, { + pinnedNotes: Notes.packMany(pins.map(pin => pin.note!), me, { detail: true }), pinnedPageId: profile!.pinnedPageId, - pinnedPage: profile!.pinnedPageId ? Pages.pack(profile!.pinnedPageId, meId) : null, + pinnedPage: profile!.pinnedPageId ? Pages.pack(profile!.pinnedPageId, me) : null, twoFactorEnabled: profile!.twoFactorEnabled, usePasswordLessLogin: profile!.usePasswordLessLogin, securityKeys: profile!.twoFactorEnabled @@ -286,7 +286,7 @@ export class UserRepository extends Repository { public packMany( users: (User['id'] | User)[], - me?: User['id'] | User | null | undefined, + me?: { id: User['id'] } | null | undefined, options?: { detail?: boolean, includeSecrets?: boolean, @@ -295,11 +295,15 @@ export class UserRepository extends Repository { return Promise.all(users.map(u => this.pack(u, me, options))); } - public isLocalUser(user: User): user is ILocalUser { + public isLocalUser(user: User): user is ILocalUser; + public isLocalUser(user: T): user is T & { host: null; }; + public isLocalUser(user: User | { host: User['host'] }): boolean { return user.host == null; } - public isRemoteUser(user: User): user is IRemoteUser { + public isRemoteUser(user: User): user is IRemoteUser; + public isRemoteUser(user: T): user is T & { host: string; }; + public isRemoteUser(user: User | { host: User['host'] }): boolean { return !this.isLocalUser(user); } diff --git a/src/queue/index.ts b/src/queue/index.ts index 6c0dba79c2..201b663799 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -1,7 +1,7 @@ import * as httpSignature from 'http-signature'; import config from '@/config'; -import { ILocalUser } from '../models/entities/user'; +import { User } from '../models/entities/user'; import { program } from '../argv'; import processDeliver from './processors/deliver'; @@ -65,7 +65,7 @@ objectStorageQueue .on('error', (job: any, err: Error) => objectStorageLogger.error(`error ${err}`, { job, e: renderError(err) })) .on('stalled', (job) => objectStorageLogger.warn(`stalled id=${job.id}`)); -export function deliver(user: ILocalUser, content: any, to: any) { +export function deliver(user: { id: User['id']; host: null; }, content: any, to: any) { if (content == null) return null; const data = { @@ -102,7 +102,7 @@ export function inbox(activity: any, signature: httpSignature.IParsedSignature) }); } -export function createDeleteDriveFilesJob(user: ILocalUser) { +export function createDeleteDriveFilesJob(user: { id: User['id'] }) { return dbQueue.add('deleteDriveFiles', { user: user }, { @@ -111,7 +111,7 @@ export function createDeleteDriveFilesJob(user: ILocalUser) { }); } -export function createExportNotesJob(user: ILocalUser) { +export function createExportNotesJob(user: { id: User['id'] }) { return dbQueue.add('exportNotes', { user: user }, { @@ -120,7 +120,7 @@ export function createExportNotesJob(user: ILocalUser) { }); } -export function createExportFollowingJob(user: ILocalUser) { +export function createExportFollowingJob(user: { id: User['id'] }) { return dbQueue.add('exportFollowing', { user: user }, { @@ -129,7 +129,7 @@ export function createExportFollowingJob(user: ILocalUser) { }); } -export function createExportMuteJob(user: ILocalUser) { +export function createExportMuteJob(user: { id: User['id'] }) { return dbQueue.add('exportMute', { user: user }, { @@ -138,7 +138,7 @@ export function createExportMuteJob(user: ILocalUser) { }); } -export function createExportBlockingJob(user: ILocalUser) { +export function createExportBlockingJob(user: { id: User['id'] }) { return dbQueue.add('exportBlocking', { user: user }, { @@ -147,7 +147,7 @@ export function createExportBlockingJob(user: ILocalUser) { }); } -export function createExportUserListsJob(user: ILocalUser) { +export function createExportUserListsJob(user: { id: User['id'] }) { return dbQueue.add('exportUserLists', { user: user }, { @@ -156,7 +156,7 @@ export function createExportUserListsJob(user: ILocalUser) { }); } -export function createImportFollowingJob(user: ILocalUser, fileId: DriveFile['id']) { +export function createImportFollowingJob(user: { id: User['id'] }, fileId: DriveFile['id']) { return dbQueue.add('importFollowing', { user: user, fileId: fileId @@ -166,7 +166,7 @@ export function createImportFollowingJob(user: ILocalUser, fileId: DriveFile['id }); } -export function createImportUserListsJob(user: ILocalUser, fileId: DriveFile['id']) { +export function createImportUserListsJob(user: { id: User['id'] }, fileId: DriveFile['id']) { return dbQueue.add('importUserLists', { user: user, fileId: fileId diff --git a/src/queue/processors/deliver.ts b/src/queue/processors/deliver.ts index d1a3eac175..b167154fcd 100644 --- a/src/queue/processors/deliver.ts +++ b/src/queue/processors/deliver.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import * as Bull from 'bull'; import request from '../../remote/activitypub/request'; import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-instance-doc'; diff --git a/src/queue/processors/inbox.ts b/src/queue/processors/inbox.ts index 39ac55758f..7c746eb25d 100644 --- a/src/queue/processors/inbox.ts +++ b/src/queue/processors/inbox.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import * as Bull from 'bull'; import * as httpSignature from 'http-signature'; import perform from '../../remote/activitypub/perform'; diff --git a/src/remote/activitypub/deliver-manager.ts b/src/remote/activitypub/deliver-manager.ts index 92721f5525..f112b02b4f 100644 --- a/src/remote/activitypub/deliver-manager.ts +++ b/src/remote/activitypub/deliver-manager.ts @@ -1,5 +1,5 @@ import { Users, Followings } from '../../models'; -import { ILocalUser, IRemoteUser } from '../../models/entities/user'; +import { ILocalUser, IRemoteUser, User } from '../../models/entities/user'; import { deliver } from '../../queue'; //#region types @@ -24,7 +24,7 @@ const isDirect = (recipe: any): recipe is IDirectRecipe => //#endregion export default class DeliverManager { - private actor: ILocalUser; + private actor: { id: User['id']; host: null; }; private activity: any; private recipes: IRecipe[] = []; @@ -33,7 +33,7 @@ export default class DeliverManager { * @param actor Actor * @param activity Activity to deliver */ - constructor(actor: ILocalUser, activity: any) { + constructor(actor: { id: User['id']; host: null; }, activity: any) { this.actor = actor; this.activity = activity; } diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 734275a473..5b032d9d9c 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import * as promiseLimit from 'promise-limit'; import config from '@/config'; diff --git a/src/remote/activitypub/renderer/accept.ts b/src/remote/activitypub/renderer/accept.ts index 03f7b07387..8725a30e7c 100644 --- a/src/remote/activitypub/renderer/accept.ts +++ b/src/remote/activitypub/renderer/accept.ts @@ -1,7 +1,7 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; -export default (object: any, user: ILocalUser) => ({ +export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Accept', actor: `${config.url}/users/${user.id}`, object diff --git a/src/remote/activitypub/renderer/delete.ts b/src/remote/activitypub/renderer/delete.ts index dd49193424..710f0482a6 100644 --- a/src/remote/activitypub/renderer/delete.ts +++ b/src/remote/activitypub/renderer/delete.ts @@ -1,7 +1,7 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '../../../models/entities/user'; -export default (object: any, user: ILocalUser) => ({ +export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Delete', actor: `${config.url}/users/${user.id}`, object diff --git a/src/remote/activitypub/renderer/follow.ts b/src/remote/activitypub/renderer/follow.ts index fb8bca52ac..252b0b2838 100644 --- a/src/remote/activitypub/renderer/follow.ts +++ b/src/remote/activitypub/renderer/follow.ts @@ -2,7 +2,7 @@ import config from '@/config'; import { User } from '../../../models/entities/user'; import { Users } from '../../../models'; -export default (follower: User, followee: User, requestId?: string) => { +export default (follower: { id: User['id']; host: User['host']; uri: User['host'] }, followee: { id: User['id']; host: User['host']; uri: User['host'] }, requestId?: string) => { const follow = { type: 'Follow', actor: Users.isLocalUser(follower) ? `${config.url}/users/${follower.id}` : follower.uri, diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts index d96c277881..3283c88bd4 100644 --- a/src/remote/activitypub/renderer/index.ts +++ b/src/remote/activitypub/renderer/index.ts @@ -2,8 +2,8 @@ import config from '@/config'; import { v4 as uuid } from 'uuid'; import { IActivity } from '../type'; import { LdSignature } from '../misc/ld-signature'; -import { ILocalUser } from '../../../models/entities/user'; import { getUserKeypair } from '@/misc/keypair-store'; +import { User } from '@/models/entities/user'; export const renderActivity = (x: any): IActivity | null => { if (x == null) return null; @@ -20,7 +20,7 @@ export const renderActivity = (x: any): IActivity | null => { }, x); }; -export const attachLdSignature = async (activity: any, user: ILocalUser): Promise => { +export const attachLdSignature = async (activity: any, user: { id: User['id']; host: null; }): Promise => { if (activity == null) return null; const keypair = await getUserKeypair(user.id); diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts index 894a6edf01..e4e8f24f10 100644 --- a/src/remote/activitypub/renderer/person.ts +++ b/src/remote/activitypub/renderer/person.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import renderImage from './image'; import renderKey from './key'; import config from '@/config'; diff --git a/src/remote/activitypub/renderer/question.ts b/src/remote/activitypub/renderer/question.ts index 3b17c7dc9c..99670f80a1 100644 --- a/src/remote/activitypub/renderer/question.ts +++ b/src/remote/activitypub/renderer/question.ts @@ -1,9 +1,9 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; import { Note } from '../../../models/entities/note'; import { Poll } from '../../../models/entities/poll'; -export default async function renderQuestion(user: ILocalUser, note: Note, poll: Poll) { +export default async function renderQuestion(user: { id: User['id'] }, note: Note, poll: Poll) { const question = { type: 'Question', id: `${config.url}/questions/${note.id}`, diff --git a/src/remote/activitypub/renderer/read.ts b/src/remote/activitypub/renderer/read.ts index 1b5fef298d..1287f4ccb0 100644 --- a/src/remote/activitypub/renderer/read.ts +++ b/src/remote/activitypub/renderer/read.ts @@ -1,8 +1,8 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; import { MessagingMessage } from '../../../models/entities/messaging-message'; -export const renderReadActivity = (user: ILocalUser, message: MessagingMessage) => ({ +export const renderReadActivity = (user: { id: User['id'] }, message: MessagingMessage) => ({ type: 'Read', actor: `${config.url}/users/${user.id}`, object: message.uri diff --git a/src/remote/activitypub/renderer/reject.ts b/src/remote/activitypub/renderer/reject.ts index e29057ae9e..e1eb5b004e 100644 --- a/src/remote/activitypub/renderer/reject.ts +++ b/src/remote/activitypub/renderer/reject.ts @@ -1,7 +1,7 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; -export default (object: any, user: ILocalUser) => ({ +export default (object: any, user: { id: User['id'] }) => ({ type: 'Reject', actor: `${config.url}/users/${user.id}`, object diff --git a/src/remote/activitypub/renderer/remove.ts b/src/remote/activitypub/renderer/remove.ts index 1d5d2ffe70..ff1fab8e57 100644 --- a/src/remote/activitypub/renderer/remove.ts +++ b/src/remote/activitypub/renderer/remove.ts @@ -1,7 +1,7 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; -export default (user: ILocalUser, target: any, object: any) => ({ +export default (user: { id: User['id'] }, target: any, object: any) => ({ type: 'Remove', actor: `${config.url}/users/${user.id}`, target, diff --git a/src/remote/activitypub/renderer/undo.ts b/src/remote/activitypub/renderer/undo.ts index 0e9998a41d..6f367415c4 100644 --- a/src/remote/activitypub/renderer/undo.ts +++ b/src/remote/activitypub/renderer/undo.ts @@ -1,7 +1,7 @@ import config from '@/config'; import { ILocalUser, User } from '../../../models/entities/user'; -export default (object: any, user: ILocalUser | User) => ({ +export default (object: any, user: { id: User['id'] }) => ({ type: 'Undo', actor: `${config.url}/users/${user.id}`, object diff --git a/src/remote/activitypub/renderer/update.ts b/src/remote/activitypub/renderer/update.ts index 636dc5c55c..4295fc64f3 100644 --- a/src/remote/activitypub/renderer/update.ts +++ b/src/remote/activitypub/renderer/update.ts @@ -1,7 +1,7 @@ import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import { User } from '@/models/entities/user'; -export default (object: any, user: ILocalUser) => { +export default (object: any, user: { id: User['id'] }) => { const activity = { id: `${config.url}/users/${user.id}#updates/${new Date().getTime()}`, actor: `${config.url}/users/${user.id}`, diff --git a/src/remote/activitypub/renderer/vote.ts b/src/remote/activitypub/renderer/vote.ts index 1eb3acc3d5..529fdaafcd 100644 --- a/src/remote/activitypub/renderer/vote.ts +++ b/src/remote/activitypub/renderer/vote.ts @@ -1,10 +1,10 @@ import config from '@/config'; import { Note } from '../../../models/entities/note'; -import { IRemoteUser, ILocalUser } from '../../../models/entities/user'; +import { IRemoteUser, User } from '../../../models/entities/user'; import { PollVote } from '../../../models/entities/poll-vote'; import { Poll } from '../../../models/entities/poll'; -export default async function renderVote(user: ILocalUser, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise { +export default async function renderVote(user: { id: User['id'] }, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise { return { id: `${config.url}/users/${user.id}#votes/${vote.id}/activity`, actor: `${config.url}/users/${user.id}`, diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index fc774bc9a5..e4dca32329 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -4,14 +4,14 @@ import { sign } from 'http-signature'; import * as crypto from 'crypto'; import config from '@/config'; -import { ILocalUser } from '../../models/entities/user'; +import { User } from '@/models/entities/user'; import { getAgentByUrl } from '@/misc/fetch'; import { URL } from 'url'; import got from 'got'; import * as Got from 'got'; import { getUserKeypair } from '@/misc/keypair-store'; -export default async (user: ILocalUser, url: string, object: any) => { +export default async (user: { id: User['id'] }, url: string, object: any) => { const timeout = 10 * 1000; const { protocol, hostname, port, pathname, search } = new URL(url); @@ -24,7 +24,7 @@ export default async (user: ILocalUser, url: string, object: any) => { const keypair = await getUserKeypair(user.id); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const req = https.request({ agent: getAgentByUrl(new URL(`https://example.net`)), protocol, @@ -69,7 +69,7 @@ export default async (user: ILocalUser, url: string, object: any) => { * @param user http-signature user * @param url URL to fetch */ -export async function signedGet(url: string, user: ILocalUser) { +export async function signedGet(url: string, user: { id: User['id'] }) { const timeout = 10 * 1000; const keypair = await getUserKeypair(user.id); diff --git a/src/remote/resolve-user.ts b/src/remote/resolve-user.ts index eec66bb0e6..1bcecee3c1 100644 --- a/src/remote/resolve-user.ts +++ b/src/remote/resolve-user.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import webFinger from './webfinger'; import config from '@/config'; import { createPerson, updatePerson } from './activitypub/models/person'; diff --git a/src/remote/webfinger.ts b/src/remote/webfinger.ts index 48cfc4d500..744ab3639a 100644 --- a/src/remote/webfinger.ts +++ b/src/remote/webfinger.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import { getJson } from '@/misc/fetch'; import { query as urlQuery } from '../prelude/url'; diff --git a/src/server/api/common/generate-block-query.ts b/src/server/api/common/generate-block-query.ts index 3636410485..fa2179ae64 100644 --- a/src/server/api/common/generate-block-query.ts +++ b/src/server/api/common/generate-block-query.ts @@ -2,7 +2,7 @@ import { User } from '../../../models/entities/user'; import { Blockings } from '../../../models'; import { SelectQueryBuilder } from 'typeorm'; -export function generateBlockQueryForUsers(q: SelectQueryBuilder, me: User) { +export function generateBlockQueryForUsers(q: SelectQueryBuilder, me: { id: User['id'] }) { const blockingQuery = Blockings.createQueryBuilder('blocking') .select('blocking.blockeeId') .where('blocking.blockerId = :blockerId', { blockerId: me.id }); diff --git a/src/server/api/common/generate-channel-query.ts b/src/server/api/common/generate-channel-query.ts index c0337b2c6b..74a6d68c40 100644 --- a/src/server/api/common/generate-channel-query.ts +++ b/src/server/api/common/generate-channel-query.ts @@ -2,7 +2,7 @@ import { User } from '../../../models/entities/user'; import { ChannelFollowings } from '../../../models'; import { Brackets, SelectQueryBuilder } from 'typeorm'; -export function generateChannelQuery(q: SelectQueryBuilder, me?: User | null) { +export function generateChannelQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { if (me == null) { q.andWhere('note.channelId IS NULL'); } else { diff --git a/src/server/api/common/generate-muted-note-query.ts b/src/server/api/common/generate-muted-note-query.ts index 498930476c..c7f9f7c5a3 100644 --- a/src/server/api/common/generate-muted-note-query.ts +++ b/src/server/api/common/generate-muted-note-query.ts @@ -2,7 +2,7 @@ import { User } from '../../../models/entities/user'; import { MutedNotes } from '../../../models'; import { SelectQueryBuilder } from 'typeorm'; -export function generateMutedNoteQuery(q: SelectQueryBuilder, me: User) { +export function generateMutedNoteQuery(q: SelectQueryBuilder, me: { id: User['id'] }) { const mutedQuery = MutedNotes.createQueryBuilder('muted') .select('muted.noteId') .where('muted.userId = :userId', { userId: me.id }); diff --git a/src/server/api/common/generate-muted-user-query.ts b/src/server/api/common/generate-muted-user-query.ts index b346f2f0fb..f5e072ba93 100644 --- a/src/server/api/common/generate-muted-user-query.ts +++ b/src/server/api/common/generate-muted-user-query.ts @@ -2,7 +2,7 @@ import { User } from '../../../models/entities/user'; import { Mutings } from '../../../models'; import { SelectQueryBuilder, Brackets } from 'typeorm'; -export function generateMutedUserQuery(q: SelectQueryBuilder, me: User, exclude?: User) { +export function generateMutedUserQuery(q: SelectQueryBuilder, me: { id: User['id'] }, exclude?: User) { const mutingQuery = Mutings.createQueryBuilder('muting') .select('muting.muteeId') .where('muting.muterId = :muterId', { muterId: me.id }); @@ -28,7 +28,7 @@ export function generateMutedUserQuery(q: SelectQueryBuilder, me: User, exc q.setParameters(mutingQuery.getParameters()); } -export function generateMutedUserQueryForUsers(q: SelectQueryBuilder, me: User) { +export function generateMutedUserQueryForUsers(q: SelectQueryBuilder, me: { id: User['id'] }) { const mutingQuery = Mutings.createQueryBuilder('muting') .select('muting.muteeId') .where('muting.muterId = :muterId', { muterId: me.id }); diff --git a/src/server/api/common/generate-replies-query.ts b/src/server/api/common/generate-replies-query.ts index 8ebe93f20a..29b1e17c2e 100644 --- a/src/server/api/common/generate-replies-query.ts +++ b/src/server/api/common/generate-replies-query.ts @@ -1,7 +1,7 @@ import { User } from '../../../models/entities/user'; import { Brackets, SelectQueryBuilder } from 'typeorm'; -export function generateRepliesQuery(q: SelectQueryBuilder, me?: User | null) { +export function generateRepliesQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { if (me == null) { q.andWhere(new Brackets(qb => { qb .where(`note.replyId IS NULL`) // 返信ではない diff --git a/src/server/api/common/generate-visibility-query.ts b/src/server/api/common/generate-visibility-query.ts index d981b4a613..72ed1c46ea 100644 --- a/src/server/api/common/generate-visibility-query.ts +++ b/src/server/api/common/generate-visibility-query.ts @@ -2,7 +2,7 @@ import { User } from '../../../models/entities/user'; import { Followings } from '../../../models'; import { Brackets, SelectQueryBuilder } from 'typeorm'; -export function generateVisibilityQuery(q: SelectQueryBuilder, me?: User | null) { +export function generateVisibilityQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { if (me == null) { q.andWhere(new Brackets(qb => { qb .where(`note.visibility = 'public'`) diff --git a/src/server/api/common/read-messaging-message.ts b/src/server/api/common/read-messaging-message.ts index 515a4d31cb..858c116276 100644 --- a/src/server/api/common/read-messaging-message.ts +++ b/src/server/api/common/read-messaging-message.ts @@ -2,7 +2,7 @@ import { publishMainStream, publishGroupMessagingStream } from '../../../service import { publishMessagingStream } from '../../../services/stream'; import { publishMessagingIndexStream } from '../../../services/stream'; import { pushNotification } from '../../../services/push-notification'; -import { User, ILocalUser, IRemoteUser } from '../../../models/entities/user'; +import { User, IRemoteUser } from '../../../models/entities/user'; import { MessagingMessage } from '../../../models/entities/messaging-message'; import { MessagingMessages, UserGroupJoinings, Users } from '../../../models'; import { In } from 'typeorm'; @@ -136,7 +136,7 @@ export async function readGroupMessagingMessage( } } -export async function deliverReadActivity(user: ILocalUser, recipient: IRemoteUser, messages: MessagingMessage | MessagingMessage[]) { +export async function deliverReadActivity(user: { id: User['id']; host: null; }, recipient: IRemoteUser, messages: MessagingMessage | MessagingMessage[]) { messages = toArray(messages).filter(x => x.uri); const contents = messages.map(x => renderReadActivity(user, x)); diff --git a/src/server/api/define.ts b/src/server/api/define.ts index 7f6cceab8c..432d5017e8 100644 --- a/src/server/api/define.ts +++ b/src/server/api/define.ts @@ -5,6 +5,18 @@ import { ApiError } from './error'; import { SchemaType } from '@/misc/schema'; import { AccessToken } from '../../models/entities/access-token'; +type SimpleUserInfo = { + id: ILocalUser['id']; + host: ILocalUser['host']; + username: ILocalUser['username']; + uri: ILocalUser['uri']; + inbox: ILocalUser['inbox']; + sharedInbox: ILocalUser['sharedInbox']; + isAdmin: ILocalUser['isAdmin']; + isModerator: ILocalUser['isModerator']; + isSilenced: ILocalUser['isSilenced']; +}; + // TODO: defaultが蚭定されおいる堎合はその型も考慮する type Params = { [P in keyof T['params']]: NonNullable[P]['transform'] extends Function @@ -15,13 +27,12 @@ type Params = { export type Response = Record | void; type executor = - (params: Params, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any, cleanup?: Function) => + (params: Params, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any, cleanup?: Function) => Promise>>; -// TODO: API関数に user たるごず枡すのではなくナヌザヌIDなどの最小限のプロパティだけ枡すようにしたい(キャッシュずか考えないでよくなるため) export default function (meta: T, cb: executor) - : (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any) => Promise { - return (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any) => { + : (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => Promise { + return (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => { function cleanup() { fs.unlink(file.path, () => {}); } diff --git a/src/server/api/endpoints/admin/accounts/create.ts b/src/server/api/endpoints/admin/accounts/create.ts index 27ceca158b..9e3fc46acd 100644 --- a/src/server/api/endpoints/admin/accounts/create.ts +++ b/src/server/api/endpoints/admin/accounts/create.ts @@ -34,7 +34,8 @@ export const meta = { } }; -export default define(meta, async (ps, me) => { +export default define(meta, async (ps, _me) => { + const me = _me ? await Users.findOneOrFail(_me.id) : null; const noUsers = (await Users.count({ host: null, })) === 0; diff --git a/src/server/api/endpoints/admin/emoji/list.ts b/src/server/api/endpoints/admin/emoji/list.ts index 4f83777964..9e50ce61c8 100644 --- a/src/server/api/endpoints/admin/emoji/list.ts +++ b/src/server/api/endpoints/admin/emoji/list.ts @@ -96,9 +96,9 @@ export default define(meta, async (ps) => { emojis = await q.getMany(); emojis = emojis.filter(emoji => - emoji.name.includes(ps.query) || - emoji.aliases.some(a => a.includes(ps.query)) || - emoji.category?.includes(ps.query)); + emoji.name.includes(ps.query!) || + emoji.aliases.some(a => a.includes(ps.query!)) || + emoji.category?.includes(ps.query!)); emojis.splice(ps.limit! + 1); } else { diff --git a/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 221aa35e48..1de5b060e2 100644 --- a/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -1,5 +1,6 @@ +import { deliverQueue } from '@/queue/queues'; +import { URL } from 'url'; import define from '../../../define'; -import { deliverQueue } from '../../../../../queue'; export const meta = { desc: { diff --git a/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 52f67cb514..3599c012a5 100644 --- a/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import define from '../../../define'; import { inboxQueue } from '../../../../../queue'; diff --git a/src/server/api/endpoints/admin/queue/jobs.ts b/src/server/api/endpoints/admin/queue/jobs.ts index 5ab78e3c48..ffae1426be 100644 --- a/src/server/api/endpoints/admin/queue/jobs.ts +++ b/src/server/api/endpoints/admin/queue/jobs.ts @@ -1,6 +1,6 @@ +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; import $ from 'cafy'; import define from '../../../define'; -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '../../../../../queue'; export const meta = { desc: { diff --git a/src/server/api/endpoints/admin/queue/stats.ts b/src/server/api/endpoints/admin/queue/stats.ts index bd64d2ac06..cc1cf8a9e0 100644 --- a/src/server/api/endpoints/admin/queue/stats.ts +++ b/src/server/api/endpoints/admin/queue/stats.ts @@ -1,5 +1,5 @@ +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; import define from '../../../define'; -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '../../../../../queue'; export const meta = { desc: { diff --git a/src/server/api/endpoints/admin/relays/add.ts b/src/server/api/endpoints/admin/relays/add.ts index 831e05c835..e10bd92c8d 100644 --- a/src/server/api/endpoints/admin/relays/add.ts +++ b/src/server/api/endpoints/admin/relays/add.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import $ from 'cafy'; import define from '../../../define'; import { addRelay } from '../../../../../services/relay'; diff --git a/src/server/api/endpoints/antennas/create.ts b/src/server/api/endpoints/antennas/create.ts index 9c8d8adf80..04ca21bba7 100644 --- a/src/server/api/endpoints/antennas/create.ts +++ b/src/server/api/endpoints/antennas/create.ts @@ -89,7 +89,7 @@ export default define(meta, async (ps, user) => { let userList; let userGroupJoining; - if (ps.src === 'list') { + if (ps.src === 'list' && ps.userListId) { userList = await UserLists.findOne({ id: ps.userListId, userId: user.id, @@ -98,7 +98,7 @@ export default define(meta, async (ps, user) => { if (userList == null) { throw new ApiError(meta.errors.noSuchUserList); } - } else if (ps.src === 'group') { + } else if (ps.src === 'group' && ps.userGroupId) { userGroupJoining = await UserGroupJoinings.findOne({ userGroupId: ps.userGroupId, userId: user.id, diff --git a/src/server/api/endpoints/antennas/update.ts b/src/server/api/endpoints/antennas/update.ts index e23bff9da9..17b0f854f3 100644 --- a/src/server/api/endpoints/antennas/update.ts +++ b/src/server/api/endpoints/antennas/update.ts @@ -108,7 +108,7 @@ export default define(meta, async (ps, user) => { let userList; let userGroupJoining; - if (ps.src === 'list') { + if (ps.src === 'list' && ps.userListId) { userList = await UserLists.findOne({ id: ps.userListId, userId: user.id, @@ -117,7 +117,7 @@ export default define(meta, async (ps, user) => { if (userList == null) { throw new ApiError(meta.errors.noSuchUserList); } - } else if (ps.src === 'group') { + } else if (ps.src === 'group' && ps.userGroupId) { userGroupJoining = await UserGroupJoinings.findOne({ userGroupId: ps.userGroupId, userId: user.id, diff --git a/src/server/api/endpoints/app/show.ts b/src/server/api/endpoints/app/show.ts index 419e47d077..65f8c77981 100644 --- a/src/server/api/endpoints/app/show.ts +++ b/src/server/api/endpoints/app/show.ts @@ -46,6 +46,6 @@ export default define(meta, async (ps, user, token) => { return await Apps.pack(ap, user, { detail: true, - includeSecret: isSecure && (ap.userId === user.id) + includeSecret: isSecure && (ap.userId === user!.id) }); }); diff --git a/src/server/api/endpoints/blocking/create.ts b/src/server/api/endpoints/blocking/create.ts index 25bc36c6f7..60fde8ad78 100644 --- a/src/server/api/endpoints/blocking/create.ts +++ b/src/server/api/endpoints/blocking/create.ts @@ -62,7 +62,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const blocker = user; + const blocker = await Users.findOneOrFail(user.id); // 自分自身 if (user.id === ps.userId) { @@ -93,7 +93,7 @@ export default define(meta, async (ps, user) => { noteUserId: blockee.id }); - return await Users.pack(blockee.id, user, { + return await Users.pack(blockee.id, blocker, { detail: true }); }); diff --git a/src/server/api/endpoints/blocking/delete.ts b/src/server/api/endpoints/blocking/delete.ts index 8391fd82f2..8caa3efc88 100644 --- a/src/server/api/endpoints/blocking/delete.ts +++ b/src/server/api/endpoints/blocking/delete.ts @@ -126,7 +126,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const blocker = user; + const blocker = await Users.findOneOrFail(user.id); // Check if the blockee is yourself if (user.id === ps.userId) { @@ -152,7 +152,7 @@ export default define(meta, async (ps, user) => { // Delete blocking await deleteBlocking(blocker, blockee); - return await Users.pack(blockee.id, user, { + return await Users.pack(blockee.id, blocker, { detail: true }); }); diff --git a/src/server/api/endpoints/channels/timeline.ts b/src/server/api/endpoints/channels/timeline.ts index 5c844bf5cd..494221010a 100644 --- a/src/server/api/endpoints/channels/timeline.ts +++ b/src/server/api/endpoints/channels/timeline.ts @@ -97,7 +97,7 @@ export default define(meta, async (ps, user) => { const timeline = await query.take(ps.limit!).getMany(); - activeUsersChart.update(user); + if (user) activeUsersChart.update(user); return await Notes.packMany(timeline, user); }); diff --git a/src/server/api/endpoints/clips/create.ts b/src/server/api/endpoints/clips/create.ts index de01aaa5b3..fb2a77fe5b 100644 --- a/src/server/api/endpoints/clips/create.ts +++ b/src/server/api/endpoints/clips/create.ts @@ -32,14 +32,14 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const clip = await Clips.save({ + const clip = await Clips.insert({ id: genId(), createdAt: new Date(), userId: user.id, name: ps.name, isPublic: ps.isPublic, description: ps.description, - }); + }).then(x => Clips.findOneOrFail(x.identifiers[0])); return await Clips.pack(clip); }); diff --git a/src/server/api/endpoints/drive.ts b/src/server/api/endpoints/drive.ts index a2dd49d329..0100d4da79 100644 --- a/src/server/api/endpoints/drive.ts +++ b/src/server/api/endpoints/drive.ts @@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => { const instance = await fetchMeta(true); // Calculate drive usage - const usage = await DriveFiles.calcDriveUsageOf(user); + const usage = await DriveFiles.calcDriveUsageOf(user.id); return { capacity: 1024 * 1024 * instance.localDriveCapacityMb, diff --git a/src/server/api/endpoints/drive/folders/create.ts b/src/server/api/endpoints/drive/folders/create.ts index 218cecff23..d2c5e00a9f 100644 --- a/src/server/api/endpoints/drive/folders/create.ts +++ b/src/server/api/endpoints/drive/folders/create.ts @@ -68,13 +68,13 @@ export default define(meta, async (ps, user) => { } // Create folder - const folder = await DriveFolders.save({ + const folder = await DriveFolders.insert({ id: genId(), createdAt: new Date(), name: ps.name, parentId: parent !== null ? parent.id : null, userId: user.id - }); + }).then(x => DriveFolders.findOneOrFail(x.identifiers[0])); const folderObj = await DriveFolders.pack(folder); diff --git a/src/server/api/endpoints/federation/show-instance.ts b/src/server/api/endpoints/federation/show-instance.ts index ebea14b124..549d7340fb 100644 --- a/src/server/api/endpoints/federation/show-instance.ts +++ b/src/server/api/endpoints/federation/show-instance.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../../define'; import { Instances } from '../../../../models'; import { toPuny } from '@/misc/convert-host'; -import config from '@/config'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/games/reversi/games.ts b/src/server/api/endpoints/games/reversi/games.ts index 96ffd31c6f..6ac150ef2c 100644 --- a/src/server/api/endpoints/games/reversi/games.ts +++ b/src/server/api/endpoints/games/reversi/games.ts @@ -140,7 +140,7 @@ export default define(meta, async (ps, user) => { const query = makePaginationQuery(ReversiGames.createQueryBuilder('game'), ps.sinceId, ps.untilId) .andWhere('game.isStarted = TRUE'); - if (ps.my) { + if (ps.my && user) { query.andWhere(new Brackets(qb => { qb .where('game.user1Id = :userId', { userId: user.id }) .orWhere('game.user2Id = :userId', { userId: user.id }); diff --git a/src/server/api/endpoints/games/reversi/match.ts b/src/server/api/endpoints/games/reversi/match.ts index fca4b09641..2c4ec2ebd8 100644 --- a/src/server/api/endpoints/games/reversi/match.ts +++ b/src/server/api/endpoints/games/reversi/match.ts @@ -72,7 +72,7 @@ export default define(meta, async (ps, user) => { isLlotheo: false } as Partial); - publishReversiStream(exist.parentId, 'matched', await ReversiGames.pack(game, exist.parentId)); + publishReversiStream(exist.parentId, 'matched', await ReversiGames.pack(game, { id: exist.parentId })); const other = await ReversiMatchings.count({ childId: user.id diff --git a/src/server/api/endpoints/i/pin.ts b/src/server/api/endpoints/i/pin.ts index a4f3334762..4bed566935 100644 --- a/src/server/api/endpoints/i/pin.ts +++ b/src/server/api/endpoints/i/pin.ts @@ -61,7 +61,7 @@ export default define(meta, async (ps, user) => { throw e; }); - return await Users.pack(user, user, { + return await Users.pack(user.id, user, { detail: true }); }); diff --git a/src/server/api/endpoints/i/registry/scopes.ts b/src/server/api/endpoints/i/registry/scopes.ts index 8b0e1a7fd8..baf3ebdeca 100644 --- a/src/server/api/endpoints/i/registry/scopes.ts +++ b/src/server/api/endpoints/i/registry/scopes.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '../../../../../models'; diff --git a/src/server/api/endpoints/i/unpin.ts b/src/server/api/endpoints/i/unpin.ts index d0757af6bd..bb8b36a166 100644 --- a/src/server/api/endpoints/i/unpin.ts +++ b/src/server/api/endpoints/i/unpin.ts @@ -47,7 +47,7 @@ export default define(meta, async (ps, user) => { throw e; }); - return await Users.pack(user, user, { + return await Users.pack(user.id, user, { detail: true }); }); diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 8acc38f891..0554fe76fb 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -205,7 +205,8 @@ export const meta = { } }; -export default define(meta, async (ps, user, token) => { +export default define(meta, async (ps, _user, token) => { + const user = await Users.findOneOrFail(_user.id); const isSecure = token == null; const updates = {} as Partial; diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 2a94ae35f6..3760c8b37b 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -71,12 +71,12 @@ export const meta = { repositoryUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: 'https://github.com/syuilo/misskey' + default: 'https://github.com/misskey-dev/misskey' }, feedbackUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: 'https://github.com/syuilo/misskey/issues/new' + default: 'https://github.com/misskey-dev/misskey/issues/new' }, secure: { type: 'boolean' as const, diff --git a/src/server/api/endpoints/notes/unrenote.ts b/src/server/api/endpoints/notes/unrenote.ts index 6fbdd5b023..0233b9db12 100644 --- a/src/server/api/endpoints/notes/unrenote.ts +++ b/src/server/api/endpoints/notes/unrenote.ts @@ -5,7 +5,7 @@ import define from '../../define'; import * as ms from 'ms'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; -import { Notes } from '../../../../models'; +import { Notes, Users } from '../../../../models'; export const meta = { desc: { @@ -55,6 +55,6 @@ export default define(meta, async (ps, user) => { }); for (const note of renotes) { - deleteNote(user, note); + deleteNote(await Users.findOneOrFail(user.id), note); } }); diff --git a/src/server/api/endpoints/page-push.ts b/src/server/api/endpoints/page-push.ts index e2b84c9e0d..9ec9f9184c 100644 --- a/src/server/api/endpoints/page-push.ts +++ b/src/server/api/endpoints/page-push.ts @@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => { event: ps.event, var: ps.var, userId: user.id, - user: await Users.pack(user, page.userId, { + user: await Users.pack(user.id, { id: page.userId }, { detail: true }) }); diff --git a/src/server/api/endpoints/users/groups/create.ts b/src/server/api/endpoints/users/groups/create.ts index 2c397b9cd1..0966ef7819 100644 --- a/src/server/api/endpoints/users/groups/create.ts +++ b/src/server/api/endpoints/users/groups/create.ts @@ -31,12 +31,12 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const userGroup = await UserGroups.save({ + const userGroup = await UserGroups.insert({ id: genId(), createdAt: new Date(), userId: user.id, name: ps.name, - } as UserGroup); + } as UserGroup).then(x => UserGroups.findOneOrFail(x.identifiers[0])); // Push the owner await UserGroupJoinings.insert({ diff --git a/src/server/api/endpoints/users/groups/invite.ts b/src/server/api/endpoints/users/groups/invite.ts index 8b5ee12242..00d4932f55 100644 --- a/src/server/api/endpoints/users/groups/invite.ts +++ b/src/server/api/endpoints/users/groups/invite.ts @@ -96,12 +96,12 @@ export default define(meta, async (ps, me) => { throw new ApiError(meta.errors.alreadyInvited); } - const invitation = await UserGroupInvitations.save({ + const invitation = await UserGroupInvitations.insert({ id: genId(), createdAt: new Date(), userId: user.id, userGroupId: userGroup.id - } as UserGroupInvitation); + } as UserGroupInvitation).then(x => UserGroupInvitations.findOneOrFail(x.identifiers[0])); // 通知を䜜成 createNotification(user.id, 'groupInvited', { diff --git a/src/server/api/endpoints/users/lists/create.ts b/src/server/api/endpoints/users/lists/create.ts index b1714fc321..9891a6dae0 100644 --- a/src/server/api/endpoints/users/lists/create.ts +++ b/src/server/api/endpoints/users/lists/create.ts @@ -30,12 +30,12 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const userList = await UserLists.save({ + const userList = await UserLists.insert({ id: genId(), createdAt: new Date(), userId: user.id, name: ps.name, - } as UserList); + } as UserList).then(x => UserLists.findOneOrFail(x.identifiers[0])); return await UserLists.pack(userList); }); diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index 21a0cb747b..11d36d2ae9 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -6,6 +6,7 @@ import { ApiError } from '../../error'; import { ID } from '@/misc/cafy-id'; import { Users } from '../../../../models'; import { In } from 'typeorm'; +import { User } from '@/models/entities/user'; export const meta = { desc: { @@ -81,9 +82,9 @@ export default define(meta, async (ps, me) => { }); // リク゚ストされた通りに䞊べ替え - const _users = []; + const _users: User[] = []; for (const id of ps.userIds) { - _users.push(users.find(x => x.id === id)); + _users.push(users.find(x => x.id === id)!); } return await Promise.all(_users.map(u => Users.pack(u, me, { diff --git a/src/server/api/limiter.ts b/src/server/api/limiter.ts index b639ef08b9..1e8715a7c4 100644 --- a/src/server/api/limiter.ts +++ b/src/server/api/limiter.ts @@ -7,7 +7,7 @@ import Logger from '../../services/logger'; const logger = new Logger('limiter'); -export default (endpoint: IEndpoint, user: User) => new Promise((ok, reject) => { +export default (endpoint: IEndpoint, user: User) => new Promise((ok, reject) => { const limitation = endpoint.meta.limit!; const key = limitation.hasOwnProperty('key') diff --git a/src/server/api/openapi/gen-spec.ts b/src/server/api/openapi/gen-spec.ts index 221e0a32df..adac3bda2c 100644 --- a/src/server/api/openapi/gen-spec.ts +++ b/src/server/api/openapi/gen-spec.ts @@ -18,7 +18,7 @@ export function genOpenapiSpec(lang = 'ja-JP') { externalDocs: { description: 'Repository', - url: 'https://github.com/syuilo/misskey' + url: 'https://github.com/misskey-dev/misskey' }, servers: [{ @@ -120,7 +120,7 @@ export function genOpenapiSpec(lang = 'ja-JP') { description: desc, externalDocs: { description: 'Source code', - url: `https://github.com/syuilo/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts` + url: `https://github.com/misskey-dev/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts` }, ...(endpoint.meta.tags ? { tags: [endpoint.meta.tags[0]] diff --git a/src/server/api/stream/channels/games/reversi.ts b/src/server/api/stream/channels/games/reversi.ts index 3db338386a..e0e41d9acd 100644 --- a/src/server/api/stream/channels/games/reversi.ts +++ b/src/server/api/stream/channels/games/reversi.ts @@ -26,7 +26,7 @@ export default class extends Channel { childId: body.id }); if (matching == null) return; - publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, matching.childId)); + publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, { id: matching.childId })); break; } } diff --git a/src/server/api/stream/channels/global-timeline.ts b/src/server/api/stream/channels/global-timeline.ts index e47291de50..c59eb37779 100644 --- a/src/server/api/stream/channels/global-timeline.ts +++ b/src/server/api/stream/channels/global-timeline.ts @@ -42,8 +42,9 @@ export default class extends Channel { // 関係ない返信は陀倖 if (note.reply) { + const reply = note.reply as PackedNote; // 「チャンネル接続䞻ぞの返信」でもなければ、「チャンネル接続䞻が行った返信」でもなければ、「投皿者の投皿者自身ぞの返信」でもない堎合 - if (note.reply.userId !== this.user!.id && note.userId !== this.user!.id && note.reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; } // 流れおきたNoteがミュヌトしおいるナヌザヌが関わるものだったら無芖する diff --git a/src/server/api/stream/channels/home-timeline.ts b/src/server/api/stream/channels/home-timeline.ts index a370580674..b1091a46e1 100644 --- a/src/server/api/stream/channels/home-timeline.ts +++ b/src/server/api/stream/channels/home-timeline.ts @@ -50,8 +50,9 @@ export default class extends Channel { // 関係ない返信は陀倖 if (note.reply) { + const reply = note.reply as PackedNote; // 「チャンネル接続䞻ぞの返信」でもなければ、「チャンネル接続䞻が行った返信」でもなければ、「投皿者の投皿者自身ぞの返信」でもない堎合 - if (note.reply.userId !== this.user!.id && note.userId !== this.user!.id && note.reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; } // 流れおきたNoteがミュヌトしおいるナヌザヌが関わるものだったら無芖する diff --git a/src/server/api/stream/channels/hybrid-timeline.ts b/src/server/api/stream/channels/hybrid-timeline.ts index 678554a012..d769a24373 100644 --- a/src/server/api/stream/channels/hybrid-timeline.ts +++ b/src/server/api/stream/channels/hybrid-timeline.ts @@ -59,8 +59,9 @@ export default class extends Channel { // 関係ない返信は陀倖 if (note.reply) { + const reply = note.reply as PackedNote; // 「チャンネル接続䞻ぞの返信」でもなければ、「チャンネル接続䞻が行った返信」でもなければ、「投皿者の投皿者自身ぞの返信」でもない堎合 - if (note.reply.userId !== this.user!.id && note.userId !== this.user!.id && note.reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; } // 流れおきたNoteがミュヌトしおいるナヌザヌが関わるものだったら無芖する diff --git a/src/server/api/stream/channels/local-timeline.ts b/src/server/api/stream/channels/local-timeline.ts index 2c70f46954..aa0b6c4026 100644 --- a/src/server/api/stream/channels/local-timeline.ts +++ b/src/server/api/stream/channels/local-timeline.ts @@ -44,8 +44,9 @@ export default class extends Channel { // 関係ない返信は陀倖 if (note.reply) { + const reply = note.reply as PackedNote; // 「チャンネル接続䞻ぞの返信」でもなければ、「チャンネル接続䞻が行った返信」でもなければ、「投皿者の投皿者自身ぞの返信」でもない堎合 - if (note.reply.userId !== this.user!.id && note.userId !== this.user!.id && note.reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; } // 流れおきたNoteがミュヌトしおいるナヌザヌが関わるものだったら無芖する diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 1dcc31d32f..647b890ff8 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -156,8 +156,8 @@ export default class Connection { }; add(note); - if (note.reply) add(note.reply); - if (note.renote) add(note.renote); + if (note.reply) add(note.reply as PackedNote); + if (note.renote) add(note.renote as PackedNote); } @autobind diff --git a/src/server/index.ts b/src/server/index.ts index f46e851baa..3b43aa7674 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -89,7 +89,7 @@ router.get('/verify-email/:code', async ctx => { emailVerifyCode: null }); - publishMainStream(profile.userId, 'meUpdated', await Users.pack(profile.userId, profile.userId, { + publishMainStream(profile.userId, 'meUpdated', await Users.pack(profile.userId, { id: profile.userId }, { detail: true, includeSecrets: true })); diff --git a/src/server/web/views/info.pug b/src/server/web/views/info.pug index 323dce974f..61f9b7b9e2 100644 --- a/src/server/web/views/info.pug +++ b/src/server/web/views/info.pug @@ -144,4 +144,4 @@ html | :#{emoji.name}: = ' ' footer - p Misskey is open-source software. View source + p Misskey is open-source software. View source diff --git a/src/services/add-note-to-antenna.ts b/src/services/add-note-to-antenna.ts index 108957a899..56d0149155 100644 --- a/src/services/add-note-to-antenna.ts +++ b/src/services/add-note-to-antenna.ts @@ -6,7 +6,7 @@ import { isMutedUserRelated } from '@/misc/is-muted-user-related'; import { publishAntennaStream, publishMainStream } from './stream'; import { User } from '../models/entities/user'; -export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: User) { +export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }) { // 通知しない蚭定になっおいるか、自分自身の投皿なら既読にする const read = !antenna.notify || (antenna.userId === noteUser.id); diff --git a/src/services/chart/charts/classes/active-users.ts b/src/services/chart/charts/classes/active-users.ts index 95ed23a55b..e732b25d24 100644 --- a/src/services/chart/charts/classes/active-users.ts +++ b/src/services/chart/charts/classes/active-users.ts @@ -35,7 +35,7 @@ export default class ActiveUsersChart extends Chart { } @autobind - public async update(user: User) { + public async update(user: { id: User['id'], host: User['host'] }) { const update: Obj = { users: [user.id] }; diff --git a/src/services/chart/charts/classes/hashtag.ts b/src/services/chart/charts/classes/hashtag.ts index c3eb42497c..98d5421c9b 100644 --- a/src/services/chart/charts/classes/hashtag.ts +++ b/src/services/chart/charts/classes/hashtag.ts @@ -35,7 +35,7 @@ export default class HashtagChart extends Chart { } @autobind - public async update(hashtag: string, user: User) { + public async update(hashtag: string, user: { id: User['id'], host: User['host'] }) { const update: Obj = { users: [user.id] }; diff --git a/src/services/chart/charts/classes/per-user-following.ts b/src/services/chart/charts/classes/per-user-following.ts index 6e069fb0d9..5972d3759b 100644 --- a/src/services/chart/charts/classes/per-user-following.ts +++ b/src/services/chart/charts/classes/per-user-following.ts @@ -100,7 +100,7 @@ export default class PerUserFollowingChart extends Chart { } @autobind - public async update(follower: User, followee: User, isFollow: boolean) { + public async update(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }, isFollow: boolean) { const update: Obj = {}; update.total = isFollow ? 1 : -1; diff --git a/src/services/chart/charts/classes/per-user-notes.ts b/src/services/chart/charts/classes/per-user-notes.ts index f29a750192..7f93965adb 100644 --- a/src/services/chart/charts/classes/per-user-notes.ts +++ b/src/services/chart/charts/classes/per-user-notes.ts @@ -46,7 +46,7 @@ export default class PerUserNotesChart extends Chart { } @autobind - public async update(user: User, note: Note, isAdditional: boolean) { + public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean) { const update: Obj = { diffs: {} }; diff --git a/src/services/chart/charts/classes/per-user-reactions.ts b/src/services/chart/charts/classes/per-user-reactions.ts index d2d6b42e58..69ed81cd44 100644 --- a/src/services/chart/charts/classes/per-user-reactions.ts +++ b/src/services/chart/charts/classes/per-user-reactions.ts @@ -36,7 +36,7 @@ export default class PerUserReactionsChart extends Chart { } @autobind - public async update(user: User, note: Note) { + public async update(user: { id: User['id'], host: User['host'] }, note: Note) { this.inc({ [Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 } }, note.userId); diff --git a/src/services/chart/charts/classes/users.ts b/src/services/chart/charts/classes/users.ts index d50db17039..8f208de6d6 100644 --- a/src/services/chart/charts/classes/users.ts +++ b/src/services/chart/charts/classes/users.ts @@ -59,7 +59,7 @@ export default class UsersChart extends Chart { } @autobind - public async update(user: User, isAdditional: boolean) { + public async update(user: { id: User['id'], host: User['host'] }, isAdditional: boolean) { const update: Obj = {}; update.total = isAdditional ? 1 : -1; diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index f502c63157..ad9f753e79 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -302,7 +302,7 @@ async function deleteOldFile(user: IRemoteUser) { * @return Created drive file */ export default async function( - user: User | null, + user: { id: User['id']; host: User['host'] } | null, path: string, name: string | null = null, comment: string | null = null, @@ -347,7 +347,7 @@ export default async function( throw new Error('no-free-space'); } else { // (アバタヌたたはバナヌを含たず)最も叀いファむルを削陀する - deleteOldFile(user as IRemoteUser); + deleteOldFile(await Users.findOneOrFail(user.id) as IRemoteUser); } } } diff --git a/src/services/drive/s3.ts b/src/services/drive/s3.ts index 8bd51ce027..e75937861b 100644 --- a/src/services/drive/s3.ts +++ b/src/services/drive/s3.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import * as S3 from 'aws-sdk/clients/s3'; import { Meta } from '../../models/entities/meta'; import { getAgentByUrl } from '@/misc/fetch'; diff --git a/src/services/drive/upload-from-url.ts b/src/services/drive/upload-from-url.ts index db2c20b3a4..2f4c5aeeaf 100644 --- a/src/services/drive/upload-from-url.ts +++ b/src/services/drive/upload-from-url.ts @@ -1,3 +1,4 @@ +import { URL } from 'url'; import create from './add-file'; import { User } from '../../models/entities/user'; import { driveLogger } from './logger'; @@ -11,7 +12,7 @@ const logger = driveLogger.createSubLogger('downloader'); export default async ( url: string, - user: User | null, + user: { id: User['id']; host: User['host'] } | null, folderId: DriveFolder['id'] | null = null, uri: string | null = null, sensitive = false, diff --git a/src/services/following/create.ts b/src/services/following/create.ts index a759bef0f9..de12285fc7 100644 --- a/src/services/following/create.ts +++ b/src/services/following/create.ts @@ -17,7 +17,7 @@ import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; const logger = new Logger('following/create'); -export async function insertFollowingDoc(followee: User, follower: User) { +export async function insertFollowingDoc(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox'] }) { if (follower.id === followee.id) return; let alreadyFollowed = false; @@ -86,7 +86,7 @@ export async function insertFollowingDoc(followee: User, follower: User) { // Publish follow event if (Users.isLocalUser(follower)) { - Users.pack(followee, follower, { + Users.pack(followee.id, follower, { detail: true }).then(packed => { publishUserEvent(follower.id, 'follow', packed); @@ -96,7 +96,7 @@ export async function insertFollowingDoc(followee: User, follower: User) { // Publish followed event if (Users.isLocalUser(followee)) { - Users.pack(follower, followee).then(packed => publishMainStream(followee.id, 'followed', packed)); + Users.pack(follower.id, followee).then(packed => publishMainStream(followee.id, 'followed', packed)); // 通知を䜜成 createNotification(followee.id, 'follow', { @@ -105,7 +105,12 @@ export async function insertFollowingDoc(followee: User, follower: User) { } } -export default async function(follower: User, followee: User, requestId?: string) { +export default async function(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string) { + const [follower, followee] = await Promise.all([ + Users.findOneOrFail(_follower.id), + Users.findOneOrFail(_followee.id) + ]); + // check blocking const [blocking, blocked] = await Promise.all([ Blockings.findOne({ diff --git a/src/services/following/delete.ts b/src/services/following/delete.ts index 32c47ea7f4..d0df0de6ae 100644 --- a/src/services/following/delete.ts +++ b/src/services/following/delete.ts @@ -11,7 +11,7 @@ import { instanceChart, perUserFollowingChart } from '../chart'; const logger = new Logger('following/delete'); -export default async function(follower: User, followee: User, silent = false) { +export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, silent = false) { const following = await Followings.findOne({ followerId: follower.id, followeeId: followee.id @@ -28,7 +28,7 @@ export default async function(follower: User, followee: User, silent = false) { // Publish unfollow event if (!silent && Users.isLocalUser(follower)) { - Users.pack(followee, follower, { + Users.pack(followee.id, follower, { detail: true }).then(packed => { publishUserEvent(follower.id, 'unfollow', packed); @@ -42,7 +42,7 @@ export default async function(follower: User, followee: User, silent = false) { } } -export async function decrementFollowing(follower: User, followee: User) { +export async function decrementFollowing(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }) { //#region Decrement following count Users.decrement({ id: follower.id }, 'followingCount', 1); //#endregion diff --git a/src/services/following/requests/accept-all.ts b/src/services/following/requests/accept-all.ts index da39965349..5fc70fcf1b 100644 --- a/src/services/following/requests/accept-all.ts +++ b/src/services/following/requests/accept-all.ts @@ -6,7 +6,7 @@ import { FollowRequests, Users } from '../../../models'; * 指定したナヌザヌ宛おのフォロヌリク゚ストをすべお承認 * @param user ナヌザヌ */ -export default async function(user: User) { +export default async function(user: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }) { const requests = await FollowRequests.find({ followeeId: user.id }); diff --git a/src/services/following/requests/accept.ts b/src/services/following/requests/accept.ts index 470458d5d4..4277a1a1e9 100644 --- a/src/services/following/requests/accept.ts +++ b/src/services/following/requests/accept.ts @@ -8,7 +8,7 @@ import { User, ILocalUser } from '../../../models/entities/user'; import { FollowRequests, Users } from '../../../models'; import { IdentifiableError } from '@/misc/identifiable-error'; -export default async function(followee: User, follower: User) { +export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) { const request = await FollowRequests.findOne({ followeeId: followee.id, followerId: follower.id @@ -20,12 +20,12 @@ export default async function(followee: User, follower: User) { await insertFollowingDoc(followee, follower); - if (Users.isRemoteUser(follower)) { - const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId!), followee as ILocalUser)); - deliver(followee as ILocalUser, content, follower.inbox); + if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { + const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId!), followee)); + deliver(followee, content, follower.inbox); } - Users.pack(followee, followee, { + Users.pack(followee.id, followee, { detail: true }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); } diff --git a/src/services/following/requests/cancel.ts b/src/services/following/requests/cancel.ts index 82f6efc40f..53c20088ca 100644 --- a/src/services/following/requests/cancel.ts +++ b/src/services/following/requests/cancel.ts @@ -7,10 +7,13 @@ import { IdentifiableError } from '@/misc/identifiable-error'; import { User, ILocalUser } from '../../../models/entities/user'; import { Users, FollowRequests } from '../../../models'; -export default async function(followee: User, follower: User) { +export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host'] }) { if (Users.isRemoteUser(followee)) { const content = renderActivity(renderUndo(renderFollow(follower, followee), follower)); - deliver(follower as ILocalUser, content, followee.inbox); + + if (Users.isLocalUser(follower)) { // 本来このチェックは䞍芁だけどTSに怒られるので + deliver(follower, content, followee.inbox); + } } const request = await FollowRequests.findOne({ @@ -27,7 +30,7 @@ export default async function(followee: User, follower: User) { followerId: follower.id }); - Users.pack(followee, followee, { + Users.pack(followee.id, followee, { detail: true }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); } diff --git a/src/services/following/requests/create.ts b/src/services/following/requests/create.ts index bab47caaa8..584591b003 100644 --- a/src/services/following/requests/create.ts +++ b/src/services/following/requests/create.ts @@ -7,7 +7,7 @@ import { Blockings, FollowRequests, Users } from '../../../models'; import { genId } from '@/misc/gen-id'; import { createNotification } from '../../create-notification'; -export default async function(follower: User, followee: User, requestId?: string) { +export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, requestId?: string) { if (follower.id === followee.id) return; // check blocking @@ -43,9 +43,9 @@ export default async function(follower: User, followee: User, requestId?: string // Publish receiveRequest event if (Users.isLocalUser(followee)) { - Users.pack(follower, followee).then(packed => publishMainStream(followee.id, 'receiveFollowRequest', packed)); + Users.pack(follower.id, followee).then(packed => publishMainStream(followee.id, 'receiveFollowRequest', packed)); - Users.pack(followee, followee, { + Users.pack(followee.id, followee, { detail: true }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); diff --git a/src/services/following/requests/reject.ts b/src/services/following/requests/reject.ts index d8d3788088..45effc5802 100644 --- a/src/services/following/requests/reject.ts +++ b/src/services/following/requests/reject.ts @@ -7,15 +7,15 @@ import { User, ILocalUser } from '../../../models/entities/user'; import { Users, FollowRequests, Followings } from '../../../models'; import { decrementFollowing } from '../delete'; -export default async function(followee: User, follower: User) { - if (Users.isRemoteUser(follower)) { +export default async function(followee: { id: User['id']; host: User['host']; uri: User['host'] }, follower: User) { + if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { const request = await FollowRequests.findOne({ followeeId: followee.id, followerId: follower.id }); - const content = renderActivity(renderReject(renderFollow(follower, followee, request!.requestId!), followee as ILocalUser)); - deliver(followee as ILocalUser, content, follower.inbox); + const content = renderActivity(renderReject(renderFollow(follower, followee, request!.requestId!), followee)); + deliver(followee, content, follower.inbox); } const request = await FollowRequests.findOne({ @@ -37,7 +37,7 @@ export default async function(followee: User, follower: User) { } } - Users.pack(followee, follower, { + Users.pack(followee.id, follower, { detail: true }).then(packed => { publishUserEvent(follower.id, 'unfollow', packed); diff --git a/src/services/i/pin.ts b/src/services/i/pin.ts index 98e9c22df8..e3a73b5b98 100644 --- a/src/services/i/pin.ts +++ b/src/services/i/pin.ts @@ -16,7 +16,7 @@ import { deliverToRelays } from '../relay'; * @param user * @param noteId */ -export async function addPinned(user: User, noteId: Note['id']) { +export async function addPinned(user: { id: User['id']; host: User['host']; }, noteId: Note['id']) { // Fetch pinee const note = await Notes.findOne({ id: noteId, @@ -55,7 +55,7 @@ export async function addPinned(user: User, noteId: Note['id']) { * @param user * @param noteId */ -export async function removePinned(user: User, noteId: Note['id']) { +export async function removePinned(user: { id: User['id']; host: User['host']; }, noteId: Note['id']) { // Fetch unpinee const note = await Notes.findOne({ id: noteId, diff --git a/src/services/insert-moderation-log.ts b/src/services/insert-moderation-log.ts index 1e04ddf545..8ba64fa34b 100644 --- a/src/services/insert-moderation-log.ts +++ b/src/services/insert-moderation-log.ts @@ -1,8 +1,8 @@ -import { ILocalUser } from '../models/entities/user'; import { ModerationLogs } from '../models'; import { genId } from '@/misc/gen-id'; +import { User } from '@/models/entities/user'; -export async function insertModerationLog(moderator: ILocalUser, type: string, info?: Record) { +export async function insertModerationLog(moderator: { id: User['id'] }, type: string, info?: Record) { await ModerationLogs.insert({ id: genId(), createdAt: new Date(), diff --git a/src/services/messages/create.ts b/src/services/messages/create.ts index fab2df8544..03e2b93b3a 100644 --- a/src/services/messages/create.ts +++ b/src/services/messages/create.ts @@ -13,7 +13,7 @@ import renderCreate from '../../remote/activitypub/renderer/create'; import { renderActivity } from '../../remote/activitypub/renderer'; import { deliver } from '../../queue'; -export async function createMessage(user: User, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | undefined, file: DriveFile | null, uri?: string) { +export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | undefined, file: DriveFile | null, uri?: string) { const message = { id: genId(), createdAt: new Date(), diff --git a/src/services/note/create.ts b/src/services/note/create.ts index c5065b3ba4..64d5513ecc 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -38,14 +38,14 @@ import { getAntennas } from '@/misc/antenna-cache'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; class NotificationManager { - private notifier: User; + private notifier: { id: User['id']; }; private note: Note; private queue: { target: ILocalUser['id']; reason: NotificationType; }[]; - constructor(notifier: User, note: Note) { + constructor(notifier: { id: User['id']; }, note: Note) { this.notifier = notifier; this.note = note; this.queue = []; @@ -112,7 +112,7 @@ type Option = { app?: App | null; }; -export default async (user: User, data: Option, silent = false) => new Promise(async (res, rej) => { +export default async (user: { id: User['id']; username: User['username']; host: User['host']; isSilenced: User['isSilenced']; }, data: Option, silent = false) => new Promise(async (res, rej) => { // チャンネル倖にリプラむしたら察象のスコヌプに合わせる // (クラむアントサむドでやっおも良い凊理だず思うけどずりあえずサヌバヌサむドで) if (data.reply && data.channel && data.reply.channelId !== data.channel.id) { @@ -328,10 +328,6 @@ export default async (user: User, data: Option, silent = false) => new Promise new Promise): Promise { +async function extractMentionedUsers(user: { host: User['host']; }, tokens: ReturnType): Promise { if (tokens == null) return []; const mentions = extractMentions(tokens); diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index 952927f192..e2e7fc54ef 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -14,7 +14,7 @@ import deleteReaction from './delete'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; import { NoteReaction } from '../../../models/entities/note-reaction'; -export default async (user: User, note: Note, reaction?: string) => { +export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => { // TODO: cache reaction = await toDbReaction(reaction, user.host); diff --git a/src/services/note/reaction/delete.ts b/src/services/note/reaction/delete.ts index c0787eee70..712031fa88 100644 --- a/src/services/note/reaction/delete.ts +++ b/src/services/note/reaction/delete.ts @@ -9,7 +9,7 @@ import { Note } from '../../../models/entities/note'; import { NoteReactions, Users, Notes } from '../../../models'; import { decodeReaction } from '@/misc/reaction-lib'; -export default async (user: User, note: Note) => { +export default async (user: { id: User['id']; host: User['host']; }, note: Note) => { // if already unreacted const exist = await NoteReactions.findOne({ noteId: note.id, diff --git a/src/services/relay.ts b/src/services/relay.ts index 5b1d1c8474..a2cc711bd3 100644 --- a/src/services/relay.ts +++ b/src/services/relay.ts @@ -3,7 +3,7 @@ import { renderFollowRelay } from '../remote/activitypub/renderer/follow-relay'; import { renderActivity, attachLdSignature } from '../remote/activitypub/renderer'; import renderUndo from '../remote/activitypub/renderer/undo'; import { deliver } from '../queue'; -import { ILocalUser } from '../models/entities/user'; +import { ILocalUser, User } from '../models/entities/user'; import { Users, Relays } from '../models'; import { genId } from '@/misc/gen-id'; @@ -75,7 +75,7 @@ export async function relayRejected(id: string) { return JSON.stringify(result); } -export async function deliverToRelays(user: ILocalUser, activity: any) { +export async function deliverToRelays(user: { id: User['id']; host: null; }, activity: any) { if (activity == null) return; const relays = await Relays.find({ diff --git a/src/services/suspend-user.ts b/src/services/suspend-user.ts index 597433d6de..c868c01305 100644 --- a/src/services/suspend-user.ts +++ b/src/services/suspend-user.ts @@ -6,7 +6,7 @@ import { User } from '../models/entities/user'; import { Users, Followings } from '../models'; import { Not, IsNull } from 'typeorm'; -export async function doPostSuspend(user: User) { +export async function doPostSuspend(user: { id: User['id']; host: User['host'] }) { if (Users.isLocalUser(user)) { // 知り埗る党SharedInboxにDelete配信 const content = renderActivity(renderDelete(`${config.url}/users/${user.id}`, user)); @@ -28,7 +28,7 @@ export async function doPostSuspend(user: User) { } for (const inbox of queue) { - deliver(user as any, content, inbox); + deliver(user, content, inbox); } } } diff --git a/src/services/update-hashtag.ts b/src/services/update-hashtag.ts index e9508be336..6b7208f005 100644 --- a/src/services/update-hashtag.ts +++ b/src/services/update-hashtag.ts @@ -5,7 +5,7 @@ import { genId } from '@/misc/gen-id'; import { Hashtag } from '../models/entities/hashtag'; import { normalizeForSearch } from '@/misc/normalize-for-search'; -export async function updateHashtags(user: User, tags: string[]) { +export async function updateHashtags(user: { id: User['id']; host: User['host']; }, tags: string[]) { for (const tag of tags) { await updateHashtag(user, tag); } @@ -21,7 +21,7 @@ export async function updateUsertags(user: User, tags: string[]) { } } -export async function updateHashtag(user: User, tag: string, isUserAttached = false, inc = true) { +export async function updateHashtag(user: { id: User['id']; host: User['host']; }, tag: string, isUserAttached = false, inc = true) { tag = normalizeForSearch(tag); const index = await Hashtags.findOne({ name: tag }); diff --git a/src/tsconfig.json b/src/tsconfig.json index 6992d6437c..9389008eef 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -5,7 +5,7 @@ "noImplicitAny": true, "noImplicitReturns": true, "noUnusedParameters": false, - "noUnusedLocals": true, + "noUnusedLocals": false, "noFallthroughCasesInSwitch": true, "declaration": false, "sourceMap": true, diff --git a/test/get-file-info.ts b/test/get-file-info.ts index 8757d5a901..57c021feae 100644 --- a/test/get-file-info.ts +++ b/test/get-file-info.ts @@ -116,7 +116,7 @@ describe('Get file info', () => { })); it('SVG with XML definition', async (async () => { - // https://github.com/syuilo/misskey/issues/4413 + // https://github.com/misskey-dev/misskey/issues/4413 const path = `${__dirname}/resources/with-xml-def.svg`; const info = await getFileInfo(path) as any; delete info.warnings; diff --git a/webpack.config.ts b/webpack.config.ts index 850b2bd3fc..5ead4f3af2 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -105,7 +105,7 @@ module.exports = { }, postcss] }, { test: /\.(eot|woff|woff2|svg|ttf)([?]?.*)$/, - loader: 'url-loader' + type: 'asset/resource' }, { test: /\.json5$/, loader: 'json5-loader', diff --git a/yarn.lock b/yarn.lock index 711b9d0595..398c51f3c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10730,15 +10730,6 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-loader@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.1.tgz#28505e905cae158cf07c92ca622d7f237e70a4e2" - integrity sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA== - dependencies: - loader-utils "^2.0.0" - mime-types "^2.1.27" - schema-utils "^3.0.0" - url@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"