diff options
| author | まっちゃてぃー <56515516+mattyatea@users.noreply.github.com> | 2023-10-16 20:11:27 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-16 20:11:27 +0900 |
| commit | 5efd01ba70b37868f625e0acfc5c1c22d5df775c (patch) | |
| tree | d042555298ef2beb8feb3db1cca2320c41657fb9 /packages/backend/src/server/api/endpoints/admin/update-meta.ts | |
| parent | fix test (diff) | |
| download | misskey-5efd01ba70b37868f625e0acfc5c1c22d5df775c.tar.gz misskey-5efd01ba70b37868f625e0acfc5c1c22d5df775c.tar.bz2 misskey-5efd01ba70b37868f625e0acfc5c1c22d5df775c.zip | |
feat: サーバーサイレンス機能を追加 (#12031)
* feat : サーバーサイレンスを追加
* Update CHANGELOG.md
* Update CHANGELOG.md
* Update locale
* Update instance-info.vue
* update misskey-js.api.md
* lint fix
* migration fix
* 既存のものを使うように
* fix
* 色々直した
* Update packages/frontend/src/pages/admin/instance-block.vue
* Update packages/frontend/src/pages/admin/instance-block.vue
* Update packages/frontend/src/components/MkInstanceCardMini.vue
* Update packages/backend/src/core/entities/InstanceEntityService.ts
* Update packages/backend/src/core/entities/InstanceEntityService.ts
* Update packages/backend/src/core/entities/InstanceEntityService.ts
* Update packages/backend/src/core/UserFollowingService.ts
* Update packages/backend/src/core/UserFollowingService.ts
* fix: サイレンスされてるサーバーからの投稿は全部ホームにする
* fix: undefinedでfalseを返すようにした
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/server/api/endpoints/admin/update-meta.ts')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/admin/update-meta.ts | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 7db25e659f..72c4936c13 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -20,18 +20,26 @@ export const paramDef = { type: 'object', properties: { disableRegistration: { type: 'boolean', nullable: true }, - pinnedUsers: { type: 'array', nullable: true, items: { - type: 'string', - } }, - hiddenTags: { type: 'array', nullable: true, items: { - type: 'string', - } }, - blockedHosts: { type: 'array', nullable: true, items: { - type: 'string', - } }, - sensitiveWords: { type: 'array', nullable: true, items: { - type: 'string', - } }, + pinnedUsers: { + type: 'array', nullable: true, items: { + type: 'string', + }, + }, + hiddenTags: { + type: 'array', nullable: true, items: { + type: 'string', + }, + }, + blockedHosts: { + type: 'array', nullable: true, items: { + type: 'string', + }, + }, + sensitiveWords: { + type: 'array', nullable: true, items: { + type: 'string', + }, + }, themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' }, mascotImageUrl: { type: 'string', nullable: true }, bannerUrl: { type: 'string', nullable: true }, @@ -67,9 +75,11 @@ export const paramDef = { proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true }, maintainerName: { type: 'string', nullable: true }, maintainerEmail: { type: 'string', nullable: true }, - langs: { type: 'array', items: { - type: 'string', - } }, + langs: { + type: 'array', items: { + type: 'string', + }, + }, summalyProxy: { type: 'string', nullable: true }, deeplAuthKey: { type: 'string', nullable: true }, deeplIsPro: { type: 'boolean' }, @@ -115,6 +125,13 @@ export const paramDef = { perUserHomeTimelineCacheMax: { type: 'integer' }, perUserListTimelineCacheMax: { type: 'integer' }, notesPerOneAd: { type: 'integer' }, + silencedHosts: { + type: 'array', + nullable: true, + items: { + type: 'string', + }, + }, }, required: [], } as const; @@ -147,7 +164,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- if (Array.isArray(ps.sensitiveWords)) { set.sensitiveWords = ps.sensitiveWords.filter(Boolean); } - + if (Array.isArray(ps.silencedHosts)) { + let lastValue = ''; + set.silencedHosts = ps.silencedHosts.sort().filter((h) => { + const lv = lastValue; + lastValue = h; + return h !== '' && h !== lv && !set.blockedHosts?.includes(h); + }); + } if (ps.themeColor !== undefined) { set.themeColor = ps.themeColor; } |