Skip to content

Commit 738b4d6

Browse files
committed
feat: 自分のサーバーで誰もフォローしていない、リモートユーザーからのメンションを拒否するように
1 parent 2c3689e commit 738b4d6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/backend/src/core/NoteCreateService.ts

+9
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,15 @@ export class NoteCreateService implements OnApplicationShutdown {
359359
mentionedUsers = data.apMentions ?? await this.extractMentionedUsers(user, combinedTokens);
360360
}
361361

362+
// #region Shrimpia
363+
if (user.host != null && mentionedUsers.some(u => u.host !== null)) {
364+
const userEntity = await this.usersRepository.findOneByOrFail({ id: user.id });
365+
if (userEntity.followersCount === 0) {
366+
throw new Error('Temporarily, notes including mentions from remote users which no followers are not allowed');
367+
}
368+
}
369+
// #endregion
370+
362371
tags = tags.filter(tag => Array.from(tag).length <= 128).splice(0, 32);
363372

364373
if (data.reply && (user.id !== data.reply.userId) && !mentionedUsers.some(u => u.id === data.reply!.userId)) {

0 commit comments

Comments
 (0)