From a77adcd962c584f0c1a4957690e368397de61ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 19 Mar 2024 07:41:50 +0900 Subject: [PATCH 1/6] Bump up version to 2024.3.1-io.2 (MisskeyIO#540) --- package.json | 2 +- packages/misskey-js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f531b2f10..fb00be66b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.3.1-io.1c", + "version": "2024.3.1-io.2", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index cac7254ce..0d8fdb061 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "misskey-js", - "version": "2024.3.1-io.1c", + "version": "2024.3.1-io.2", "description": "Misskey SDK for JavaScript", "types": "./built/dts/index.d.ts", "exports": { From 41ea48688175a1c59bf033ed56f270fda9952dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:41:33 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix(ci):=20=E3=82=BF=E3=82=B0=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E6=99=82=E3=81=AEworkflow=E3=81=AE=E6=95=B4=E5=82=99?= =?UTF-8?q?=20(MisskeyIO#542)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-beta.yml | 2 -- .github/workflows/docker-host.yml | 51 +++++++++++++++++++++++++++++++ .github/workflows/docker-io.yml | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker-host.yml diff --git a/.github/workflows/docker-beta.yml b/.github/workflows/docker-beta.yml index b4ccd9253..ca497500b 100644 --- a/.github/workflows/docker-beta.yml +++ b/.github/workflows/docker-beta.yml @@ -4,8 +4,6 @@ on: push: branches: - beta - tags: - - "**" workflow_dispatch: jobs: diff --git a/.github/workflows/docker-host.yml b/.github/workflows/docker-host.yml new file mode 100644 index 000000000..40ac20b58 --- /dev/null +++ b/.github/workflows/docker-host.yml @@ -0,0 +1,51 @@ +name: Publish Docker image (host) + +on: + push: + branches: + - host + tags: + - '[0-9.]+-host.*' + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-22.04 + if: github.repository == 'MisskeyIO/misskey' + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/misskeyio/misskey + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare image tags + run: | + echo "FORMATTED_BRANCH_NAME=$(echo ${{ github.ref_name }} | sed -e 's/\//-/g' )" >> $GITHUB_ENV + - name: Build and Push to GitHub Container Registry + uses: docker/build-push-action@v5 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + push: true + platforms: ${{ steps.buildx.outputs.platforms }} + provenance: false + labels: ${{ env.FORMATTED_BRANCH_NAME }} + cache-from: type=registry,ref=ghcr.io/misskeyio/misskey:host-buildcache + cache-to: type=registry,ref=ghcr.io/misskeyio/misskey:host-buildcache,mode=max + tags: | + ghcr.io/misskeyio/misskey:host + ghcr.io/misskeyio/misskey:${{ env.FORMATTED_BRANCH_NAME }} diff --git a/.github/workflows/docker-io.yml b/.github/workflows/docker-io.yml index aea2a00a4..4a2d038ea 100644 --- a/.github/workflows/docker-io.yml +++ b/.github/workflows/docker-io.yml @@ -5,7 +5,7 @@ on: branches: - io tags: - - "**" + - '[0-9.]+-io.*' workflow_dispatch: jobs: From daf297c9c092ee9b7f1439baad0205b26b29b444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:42:20 +0900 Subject: [PATCH 3/6] =?UTF-8?q?enhance(frontend):=20=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E7=99=BA=E7=94=9F=E6=99=82=E3=81=AE=E3=83=80=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=83=AD=E3=82=B0=E3=81=AB=E8=A9=B3=E7=B4=B0=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E3=82=92=E8=BC=89=E3=81=9B=E3=82=8B=20(MisskeyIO#543)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/server/api/ApiCallService.ts | 16 ++++++---------- packages/backend/src/server/api/endpoint-base.ts | 2 +- .../src/server/api/endpoints/admin/emoji/copy.ts | 8 +++----- .../server/api/endpoints/drive/files/create.ts | 6 ++---- packages/backend/src/server/api/error.ts | 6 +++--- packages/frontend/src/components/MkDialog.vue | 16 ++++++++++++++-- packages/frontend/src/os.ts | 9 ++++++++- 7 files changed, 37 insertions(+), 26 deletions(-) diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts index 1954d435c..d8e792051 100644 --- a/packages/backend/src/server/api/ApiCallService.ts +++ b/packages/backend/src/server/api/ApiCallService.ts @@ -389,11 +389,9 @@ export class ApiCallService implements OnApplicationShutdown { id: err.id, }, { - e: { - message: err.message, - code: err.name, - id: err.id, - }, + message: err.message, + code: err.name, + id: err.id, }, ); } else { @@ -416,11 +414,9 @@ export class ApiCallService implements OnApplicationShutdown { kind: 'server', }, { - e: { - message: err.message, - code: err.name, - id: errId, - }, + message: err.message, + code: err.name, + id: errId, }, ); } diff --git a/packages/backend/src/server/api/endpoint-base.ts b/packages/backend/src/server/api/endpoint-base.ts index e061aa3a8..a549e48f2 100644 --- a/packages/backend/src/server/api/endpoint-base.ts +++ b/packages/backend/src/server/api/endpoint-base.ts @@ -63,7 +63,7 @@ export abstract class Endpoint { id: '3d81ceae-475f-4600-b2a8-2bc116157532', }, { param: errors[0].schemaPath, - reason: errors[0].message, + reason: errors[0].message ?? 'Invalid', }); return Promise.reject(err); } diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index e8c39fe73..b6e2bd5ae 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -85,11 +85,9 @@ export default class extends Endpoint { // eslint- id: '5c77c4d7-0f68-48f9-8694-8453a2294840', }, { - e: { - message: err.message, - code: err.name, - } - } + message: err.message, + code: err.name, + }, ); } diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index ad2d11fcb..9083ef15f 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -191,10 +191,8 @@ export default class extends Endpoint { // eslint- id: '6708863c-6791-4487-aa01-2d682c6e7db0', }, { - e: { - message: err.message, - code: err.name, - }, + message: err.message, + code: err.name, }, ); } finally { diff --git a/packages/backend/src/server/api/error.ts b/packages/backend/src/server/api/error.ts index 67a819e8d..b05447050 100644 --- a/packages/backend/src/server/api/error.ts +++ b/packages/backend/src/server/api/error.ts @@ -11,15 +11,15 @@ export class ApiError extends Error { public id: string; public kind: string; public httpStatusCode?: number; - public info?: any; + public info?: Record; - constructor(err: E, info?: any | null | undefined) { + constructor(err: E, info?: Record | null | undefined) { super(err.message); this.message = err.message; this.code = err.code; this.id = err.id; this.kind = err.kind ?? 'client'; this.httpStatusCode = err.httpStatusCode; - this.info = info; + this.info = info ?? undefined; } } diff --git a/packages/frontend/src/components/MkDialog.vue b/packages/frontend/src/components/MkDialog.vue index e4a8a6625..a1cecfbc2 100644 --- a/packages/frontend/src/components/MkDialog.vue +++ b/packages/frontend/src/components/MkDialog.vue @@ -48,6 +48,15 @@ SPDX-License-Identifier: AGPL-3.0-only +
+ {{ i18n.ts.details }} +
+ + + + +
+
{{ okText ?? ((showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt) }} {{ cancelText ?? i18n.ts.cancel }} @@ -66,6 +75,7 @@ import MkButton from '@/components/MkButton.vue'; import MkInput from '@/components/MkInput.vue'; import MkSelect from '@/components/MkSelect.vue'; import MkTextarea from '@/components/MkTextarea.vue'; +import MkKeyValue from '@/components/MkKeyValue.vue'; import { i18n } from '@/i18n.js'; type Input = { @@ -89,11 +99,12 @@ type Result = string | number | true | null; const props = withDefaults(defineProps<{ type?: 'success' | 'error' | 'warning' | 'info' | 'question' | 'waiting'; + icon?: string; title?: string | null; text?: string | null; input?: Input; select?: Select; - icon?: string; + details?: Record; actions?: { text: string; primary?: boolean, @@ -107,11 +118,12 @@ const props = withDefaults(defineProps<{ cancelText?: string; }>(), { type: 'info', + icon: undefined, title: undefined, text: undefined, input: undefined, select: undefined, - icon: undefined, + details: undefined, actions: undefined, showOkButton: true, showCancelButton: false, diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index aa238d04c..d63faa551 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -47,6 +47,7 @@ export const apiWithDialog = (( } else { alert({ type: 'error', - text: err, + title: err.message, + text: err.id, + details: err.info, }); } }); @@ -217,6 +221,7 @@ export function alert(props: { type?: 'error' | 'info' | 'success' | 'warning' | 'waiting' | 'question'; title?: string | null; text?: string | null; + details?: Record; }): Promise { return new Promise(resolve => { popup(MkDialog, props, { @@ -231,6 +236,7 @@ export function confirm(props: { type: 'error' | 'info' | 'success' | 'warning' | 'waiting' | 'question'; title?: string | null; text?: string | null; + details?: Record; okText?: string; cancelText?: string; }): Promise<{ canceled: boolean }> { @@ -257,6 +263,7 @@ export function actions; actions: T; }): Promise<{ canceled: true; result: undefined; From c45edf2564718e4381465d6fd95dd59e1cdf8b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:15:21 +0900 Subject: [PATCH 4/6] =?UTF-8?q?fix(SSO):=20=E3=83=A1=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=82=A2=E3=83=89=E3=83=AC=E3=82=B9=E3=81=8B=E3=82=89=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=83=BB=E3=82=BF=E3=82=B0=E3=82=92?= =?UTF-8?q?=E9=99=A4=E5=A4=96=20(MisskeyIO#544)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/misc/normalize-email-address.ts | 5 ++++ .../server/sso/JWTIdentifyProviderService.ts | 3 ++- .../server/sso/SAMLIdentifyProviderService.ts | 27 +++++++------------ 3 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 packages/backend/src/misc/normalize-email-address.ts diff --git a/packages/backend/src/misc/normalize-email-address.ts b/packages/backend/src/misc/normalize-email-address.ts new file mode 100644 index 000000000..126eefa7e --- /dev/null +++ b/packages/backend/src/misc/normalize-email-address.ts @@ -0,0 +1,5 @@ +const specialCharactersRegexp = /(\(.*?\)|(\+.*(?=@)))/gu; + +export function normalizeEmailAddress(email: string | null): string | null { + return email?.replaceAll(specialCharactersRegexp, '') ?? null; +} diff --git a/packages/backend/src/server/sso/JWTIdentifyProviderService.ts b/packages/backend/src/server/sso/JWTIdentifyProviderService.ts index 03ee7a729..182b6af04 100644 --- a/packages/backend/src/server/sso/JWTIdentifyProviderService.ts +++ b/packages/backend/src/server/sso/JWTIdentifyProviderService.ts @@ -22,6 +22,7 @@ import type { MiLocalUser } from '@/models/User.js'; import { CacheService } from '@/core/CacheService.js'; import { LoggerService } from '@/core/LoggerService.js'; import { RoleService } from '@/core/RoleService.js'; +import { normalizeEmailAddress } from '@/misc/normalize-email-address.js'; import type { FastifyInstance } from 'fastify'; @Injectable() @@ -175,7 +176,7 @@ export class JWTIdentifyProviderService { preferred_username: user.username, profile: `${this.config.url}/@${user.username}`, picture: user.avatarUrl ?? undefined, - email: profile.emailVerified ? profile.email : undefined, + email: profile.emailVerified ? normalizeEmailAddress(profile.email) : undefined, email_verified: profile.emailVerified, mfa_enabled: profile.twoFactorEnabled, updated_at: Math.floor((user.updatedAt?.getTime() ?? user.createdAt.getTime()) / 1000), diff --git a/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts b/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts index b5f35ddf3..96c32291f 100644 --- a/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts +++ b/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts @@ -26,6 +26,7 @@ import { RoleService } from '@/core/RoleService.js'; import type { MiLocalUser } from '@/models/User.js'; import { bindThis } from '@/decorators.js'; import { DI } from '@/di-symbols.js'; +import { normalizeEmailAddress } from '@/misc/normalize-email-address.js'; import type { FastifyInstance } from 'fastify'; @Injectable() @@ -440,7 +441,7 @@ export class SAMLIdentifyProviderService { }, 'saml:Subject': { 'saml:NameID': profile.emailVerified - ? { '@Format': 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress', '#text': profile.email } + ? { '@Format': 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress', '#text': normalizeEmailAddress(profile.email) } : { '@Format': 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', '#text': user.id }, 'saml:SubjectConfirmation': { '@Method': 'urn:oasis:names:tc:SAML:2.0:cm:bearer', @@ -531,24 +532,14 @@ export class SAMLIdentifyProviderService { '#text': user.avatarUrl, }, }] : []), - ...(profile.emailVerified ? [ - { - '@Name': 'mail', - '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', - 'saml:AttributeValue': { - '@xsi:type': 'xs:string', - '#text': profile.email, - }, + ...(profile.emailVerified ? [{ + '@Name': 'email', + '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', + 'saml:AttributeValue': { + '@xsi:type': 'xs:string', + '#text': normalizeEmailAddress(profile.email), }, - { - '@Name': 'email', - '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', - 'saml:AttributeValue': { - '@xsi:type': 'xs:string', - '#text': profile.email, - }, - }, - ] : []), + }] : []), { '@Name': 'email_verified', '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', From a95ce067c6cf0a93647e358aabc984bdbe99e952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:28:19 +0900 Subject: [PATCH 5/6] =?UTF-8?q?enhance(antenna):=20Bot=E3=81=AE=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E3=82=92=E9=99=A4=E5=A4=96=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20(MisskeyIO#545)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en-US.yml | 1 + locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + locales/ko-KR.yml | 1 + .../migration/1710919614510-antenna-exclude-bots.js | 11 +++++++++++ packages/backend/src/core/AntennaService.ts | 6 ++++-- .../backend/src/core/entities/AntennaEntityService.ts | 1 + packages/backend/src/models/Antenna.ts | 5 +++++ packages/backend/src/models/json-schema/antenna.ts | 5 +++++ .../processors/ExportAntennasProcessorService.ts | 1 + .../processors/ImportAntennasProcessorService.ts | 2 ++ .../src/server/api/endpoints/antennas/create.ts | 2 ++ .../src/server/api/endpoints/antennas/update.ts | 2 ++ packages/backend/test/e2e/antennas.ts | 2 ++ packages/frontend/src/pages/my-antennas/create.vue | 1 + packages/frontend/src/pages/my-antennas/editor.vue | 3 +++ packages/misskey-js/src/autogen/types.ts | 4 ++++ 17 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 packages/backend/migration/1710919614510-antenna-exclude-bots.js diff --git a/locales/en-US.yml b/locales/en-US.yml index 104dcadcf..1fb581d8d 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -406,6 +406,7 @@ name: "Name" antennaSource: "Antenna source" antennaKeywords: "Keywords to listen to" antennaExcludeKeywords: "Keywords to exclude" +antennaExcludeBots: "Exclude bots" antennaKeywordsDescription: "Separate with spaces for an AND condition or with line breaks for an OR condition." notifyAntenna: "Notify about new notes" withFileAntenna: "Only notes with files" diff --git a/locales/index.d.ts b/locales/index.d.ts index 80d6334e2..44b24d83c 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1640,6 +1640,10 @@ export interface Locale extends ILocale { * 除外キーワード */ "antennaExcludeKeywords": string; + /** + * Botアカウントを除外 + */ + "antennaExcludeBots": string; /** * スペースで区切るとAND指定になり、改行で区切るとOR指定になります */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 02d38f086..fd84e0318 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -406,6 +406,7 @@ name: "名前" antennaSource: "受信ソース" antennaKeywords: "受信キーワード" antennaExcludeKeywords: "除外キーワード" +antennaExcludeBots: "Botアカウントを除外" antennaKeywordsDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります" notifyAntenna: "新しいノートを通知する" withFileAntenna: "ファイルが添付されたノートのみ" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index 3b186bf99..5b3d5538a 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -405,6 +405,7 @@ name: "이름" antennaSource: "받을 소스" antennaKeywords: "받을 검색어" antennaExcludeKeywords: "제외할 검색어" +antennaExcludeBots: "봇 제외" antennaKeywordsDescription: "공백으로 구분하는 경우 AND, 줄바꿈으로 구분하는 경우 OR로 지정됩니다" notifyAntenna: "새로운 노트를 알림" withFileAntenna: "파일이 첨부된 노트만" diff --git a/packages/backend/migration/1710919614510-antenna-exclude-bots.js b/packages/backend/migration/1710919614510-antenna-exclude-bots.js new file mode 100644 index 000000000..7516cbb5d --- /dev/null +++ b/packages/backend/migration/1710919614510-antenna-exclude-bots.js @@ -0,0 +1,11 @@ +export class AntennaExcludeBots1710919614510 { + name = 'AntennaExcludeBots1710919614510' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "antenna" ADD "excludeBots" boolean NOT NULL DEFAULT false`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "excludeBots"`); + } +} diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts index c148cf547..0ac6f7038 100644 --- a/packages/backend/src/core/AntennaService.ts +++ b/packages/backend/src/core/AntennaService.ts @@ -97,7 +97,7 @@ export class AntennaService implements OnApplicationShutdown { } @bindThis - public async addNoteToAntennas(note: MiNote, noteUser: { id: MiUser['id']; username: string; host: string | null; }): Promise { + public async addNoteToAntennas(note: MiNote, noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise { const antennas = await this.getAntennas(); const antennasWithMatchResult = await Promise.all(antennas.map(antenna => this.checkHitAntenna(antenna, note, noteUser).then(hit => [antenna, hit] as const))); const matchedAntennas = antennasWithMatchResult.filter(([, hit]) => hit).map(([antenna]) => antenna); @@ -121,10 +121,12 @@ export class AntennaService implements OnApplicationShutdown { // NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている @bindThis - public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; }): Promise { + public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise { if (note.visibility === 'specified') return false; if (note.visibility === 'followers') return false; + if (antenna.excludeBots && noteUser.isBot) return false; + if (antenna.localOnly && noteUser.host != null) return false; if (!antenna.withReplies && note.replyId != null) return false; diff --git a/packages/backend/src/core/entities/AntennaEntityService.ts b/packages/backend/src/core/entities/AntennaEntityService.ts index 64d6a3c97..3ec8efa6b 100644 --- a/packages/backend/src/core/entities/AntennaEntityService.ts +++ b/packages/backend/src/core/entities/AntennaEntityService.ts @@ -39,6 +39,7 @@ export class AntennaEntityService { caseSensitive: antenna.caseSensitive, localOnly: antenna.localOnly, notify: antenna.notify, + excludeBots: antenna.excludeBots, withReplies: antenna.withReplies, withFile: antenna.withFile, isActive: antenna.isActive, diff --git a/packages/backend/src/models/Antenna.ts b/packages/backend/src/models/Antenna.ts index 91c2c8b77..a54c935af 100644 --- a/packages/backend/src/models/Antenna.ts +++ b/packages/backend/src/models/Antenna.ts @@ -79,6 +79,11 @@ export class MiAntenna { }) public caseSensitive: boolean; + @Column('boolean', { + default: false, + }) + public excludeBots: boolean; + @Column('boolean', { default: false, }) diff --git a/packages/backend/src/models/json-schema/antenna.ts b/packages/backend/src/models/json-schema/antenna.ts index 74622b619..78cf6d3ba 100644 --- a/packages/backend/src/models/json-schema/antenna.ts +++ b/packages/backend/src/models/json-schema/antenna.ts @@ -76,6 +76,11 @@ export const packedAntennaSchema = { type: 'boolean', optional: false, nullable: false, }, + excludeBots: { + type: 'boolean', + optional: false, nullable: false, + default: false, + }, withReplies: { type: 'boolean', optional: false, nullable: false, diff --git a/packages/backend/src/queue/processors/ExportAntennasProcessorService.ts b/packages/backend/src/queue/processors/ExportAntennasProcessorService.ts index af48bad41..1d8e90f36 100644 --- a/packages/backend/src/queue/processors/ExportAntennasProcessorService.ts +++ b/packages/backend/src/queue/processors/ExportAntennasProcessorService.ts @@ -81,6 +81,7 @@ export class ExportAntennasProcessorService { }) : null, caseSensitive: antenna.caseSensitive, localOnly: antenna.localOnly, + excludeBots: antenna.excludeBots, withReplies: antenna.withReplies, withFile: antenna.withFile, notify: antenna.notify, diff --git a/packages/backend/src/queue/processors/ImportAntennasProcessorService.ts b/packages/backend/src/queue/processors/ImportAntennasProcessorService.ts index 951b56059..ff1c04de0 100644 --- a/packages/backend/src/queue/processors/ImportAntennasProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportAntennasProcessorService.ts @@ -44,6 +44,7 @@ const validate = new Ajv().compile({ } }, caseSensitive: { type: 'boolean' }, localOnly: { type: 'boolean' }, + excludeBots: { type: 'boolean' }, withReplies: { type: 'boolean' }, withFile: { type: 'boolean' }, notify: { type: 'boolean' }, @@ -88,6 +89,7 @@ export class ImportAntennasProcessorService { users: (antenna.src === 'list' && antenna.userListAccts !== null ? antenna.userListAccts : antenna.users).filter(Boolean), caseSensitive: antenna.caseSensitive, localOnly: antenna.localOnly, + excludeBots: antenna.excludeBots, withReplies: antenna.withReplies, withFile: antenna.withFile, notify: antenna.notify, diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index ba767d5c6..1181998a3 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -65,6 +65,7 @@ export const paramDef = { } }, caseSensitive: { type: 'boolean' }, localOnly: { type: 'boolean' }, + excludeBots: { type: 'boolean' }, withReplies: { type: 'boolean' }, withFile: { type: 'boolean' }, notify: { type: 'boolean' }, @@ -125,6 +126,7 @@ export default class extends Endpoint { // eslint- users: ps.users, caseSensitive: ps.caseSensitive, localOnly: ps.localOnly, + excludeBots: ps.excludeBots, withReplies: ps.withReplies, withFile: ps.withFile, notify: ps.notify, diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 6e154430f..d962db317 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -64,6 +64,7 @@ export const paramDef = { } }, caseSensitive: { type: 'boolean' }, localOnly: { type: 'boolean' }, + excludeBots: { type: 'boolean' }, withReplies: { type: 'boolean' }, withFile: { type: 'boolean' }, notify: { type: 'boolean' }, @@ -121,6 +122,7 @@ export default class extends Endpoint { // eslint- users: ps.users, caseSensitive: ps.caseSensitive, localOnly: ps.localOnly, + excludeBots: ps.excludeBots, withReplies: ps.withReplies, withFile: ps.withFile, notify: ps.notify, diff --git a/packages/backend/test/e2e/antennas.ts b/packages/backend/test/e2e/antennas.ts index 34d5b4739..215cf652d 100644 --- a/packages/backend/test/e2e/antennas.ts +++ b/packages/backend/test/e2e/antennas.ts @@ -45,6 +45,7 @@ describe('アンテナ', () => { users: [''], withFile: false, withReplies: false, + excludeBots: false, }; let root: User; @@ -159,6 +160,7 @@ describe('アンテナ', () => { users: [''], withFile: false, withReplies: false, + excludeBots: false, localOnly: false, }; assert.deepStrictEqual(response, expected); diff --git a/packages/frontend/src/pages/my-antennas/create.vue b/packages/frontend/src/pages/my-antennas/create.vue index 8b3b3cfbf..2d026d2fa 100644 --- a/packages/frontend/src/pages/my-antennas/create.vue +++ b/packages/frontend/src/pages/my-antennas/create.vue @@ -26,6 +26,7 @@ const draft = ref({ users: [], keywords: [], excludeKeywords: [], + excludeBots: false, withReplies: false, caseSensitive: false, localOnly: false, diff --git a/packages/frontend/src/pages/my-antennas/editor.vue b/packages/frontend/src/pages/my-antennas/editor.vue index c6dcbadd9..97edbc44c 100644 --- a/packages/frontend/src/pages/my-antennas/editor.vue +++ b/packages/frontend/src/pages/my-antennas/editor.vue @@ -26,6 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only + {{ i18n.ts.antennaExcludeBots }} {{ i18n.ts.withReplies }} @@ -78,6 +79,7 @@ const keywords = ref(props.antenna.keywords.map(x => x.join(' ')).join(' const excludeKeywords = ref(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n')); const caseSensitive = ref(props.antenna.caseSensitive); const localOnly = ref(props.antenna.localOnly); +const excludeBots = ref(props.antenna.excludeBots); const withReplies = ref(props.antenna.withReplies); const withFile = ref(props.antenna.withFile); const notify = ref(props.antenna.notify); @@ -94,6 +96,7 @@ async function saveAntenna() { name: name.value, src: src.value, userListId: userListId.value, + excludeBots: excludeBots.value, withReplies: withReplies.value, withFile: withFile.value, notify: notify.value, diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 7ccd3e3bb..17adb4b41 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -4586,6 +4586,8 @@ export type components = { localOnly: boolean; notify: boolean; /** @default false */ + excludeBots: boolean; + /** @default false */ withReplies: boolean; withFile: boolean; isActive: boolean; @@ -10618,6 +10620,7 @@ export type operations = { users: string[]; caseSensitive: boolean; localOnly?: boolean; + excludeBots?: boolean; withReplies: boolean; withFile: boolean; notify: boolean; @@ -10899,6 +10902,7 @@ export type operations = { users?: string[]; caseSensitive?: boolean; localOnly?: boolean; + excludeBots?: boolean; withReplies?: boolean; withFile?: boolean; notify?: boolean; From ba439c7371d8d018201b8630b85b39a463fae9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:28:35 +0900 Subject: [PATCH 6/6] Bump up version to 2024.3.1-io.2a (MisskeyIO#546) --- package.json | 2 +- packages/misskey-js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fb00be66b..21fb66700 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.3.1-io.2", + "version": "2024.3.1-io.2a", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index 0d8fdb061..36d279a00 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "misskey-js", - "version": "2024.3.1-io.2", + "version": "2024.3.1-io.2a", "description": "Misskey SDK for JavaScript", "types": "./built/dts/index.d.ts", "exports": {