Skip to content

Commit

Permalink
弾く弾かないの挙動決定をdefault.ymlにやらせる
Browse files Browse the repository at this point in the history
  • Loading branch information
na2na-p authored and icalo35 committed Dec 1, 2024
1 parent 92c3074 commit b0fb15a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,7 @@ signToActivityPubGet: true

# PID File of master process
#pidFile: /tmp/misskey.pid

# ローカル宛てのメンション、リプライ、引用ノートの発行元が、ローカルユーザーにフォローされていない場合に投稿を拒否するかどうか
# default: false
# misskeyBlockMentionsFromUnfamiliarRemoteUsers: false
3 changes: 3 additions & 0 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type Source = {
perUserNotificationsMaxCount?: number;
deactivateAntennaThreshold?: number;
pidFile: string;
misskeyBlockMentionsFromUnfamiliarRemoteUsers?: boolean;
};

export type Config = {
Expand Down Expand Up @@ -182,6 +183,7 @@ export type Config = {
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;
pidFile: string;
misskeyBlockMentionsFromUnfamiliarRemoteUsers: boolean;
};

const _filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -293,6 +295,7 @@ export function loadConfig(): Config {
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
pidFile: config.pidFile,
misskeyBlockMentionsFromUnfamiliarRemoteUsers: config.misskeyBlockMentionsFromUnfamiliarRemoteUsers ?? false,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class NoteCreateService implements OnApplicationShutdown {

const willCauseNotification = mentionedUsers.filter(u => u.host === null).length > 0 || data.reply?.userHost === null || data.renote?.userHost === null;

if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) {
if (this.config.misskeyBlockMentionsFromUnfamiliarRemoteUsers === true && user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id });
if ((userEntity?.followersCount ?? 0) === 0) {
throw new Error('Temporarily, notes including mentions, replies and renotes to local-user from remote users which is not followed by local-users are not allowed');
Expand Down

0 comments on commit b0fb15a

Please sign in to comment.