1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-12 05:38:12 +09:00

enhance: 禁止ワードはリモートノートも対象に (#13280)

Resolve #13279
This commit is contained in:
tamaina 2024-02-13 04:54:01 +09:00 committed by GitHub
parent e12369ac13
commit 32c5c43b6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 6 deletions

View File

@ -263,10 +263,8 @@ export class NoteCreateService implements OnApplicationShutdown {
} }
} }
if (!user.host) { if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) {
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) { throw new NoteCreateService.ContainsProhibitedWordsError();
throw new NoteCreateService.ContainsProhibitedWordsError();
}
} }
const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host); const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host);

View File

@ -663,7 +663,7 @@ describe('Note', () => {
assert.strictEqual(note2.body.error.code, 'CONTAINS_PROHIBITED_WORDS'); assert.strictEqual(note2.body.error.code, 'CONTAINS_PROHIBITED_WORDS');
}); });
test('禁止ワードを含んでいてもリモートノートはエラーにならない', async () => { test('禁止ワードを含んでるリモートノートもエラーになる', async () => {
const prohibited = await api('admin/update-meta', { const prohibited = await api('admin/update-meta', {
prohibitedWords: [ prohibitedWords: [
'test', 'test',
@ -678,7 +678,7 @@ describe('Note', () => {
text: 'hogetesthuge', text: 'hogetesthuge',
}, tom); }, tom);
assert.strictEqual(note1.status, 200); assert.strictEqual(note1.status, 400);
}); });
}); });

View File

@ -100,6 +100,7 @@ describe('ActivityPub', () => {
perRemoteUserUserTimelineCacheMax: 100, perRemoteUserUserTimelineCacheMax: 100,
blockedHosts: [] as string[], blockedHosts: [] as string[],
sensitiveWords: [] as string[], sensitiveWords: [] as string[],
prohibitedWords: [] as string[],
} as MiMeta; } as MiMeta;
let meta = metaInitial; let meta = metaInitial;