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/core/UtilityService.ts | |
| parent | fix test (diff) | |
| download | sharkey-5efd01ba70b37868f625e0acfc5c1c22d5df775c.tar.gz sharkey-5efd01ba70b37868f625e0acfc5c1c22d5df775c.tar.bz2 sharkey-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/core/UtilityService.ts')
| -rw-r--r-- | packages/backend/src/core/UtilityService.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index d2d2776bd2..b95e41167b 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -36,6 +36,12 @@ export class UtilityService { } @bindThis + public isSilencedHost(silencedHosts: string[] | undefined, host: string | null): boolean { + if (!silencedHosts || host == null) return false; + return silencedHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`)); + } + + @bindThis public extractDbHost(uri: string): string { const url = new URL(uri); return this.toPuny(url.hostname); |