mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Add a no-op mode
This commit is contained in:
parent
7501e3123a
commit
adec9f58a6
@ -14,7 +14,7 @@ Phase 1:
|
||||
|
||||
Phase 2:
|
||||
* [x] Pantalaimon support
|
||||
* [ ] No-op mode (for verifying behaviour)
|
||||
* [x] No-op mode (for verifying behaviour)
|
||||
* [ ] Redact messages on ban (optionally)
|
||||
* [x] More useful spam in management room
|
||||
* [ ] Command to import ACLs, etc from rooms
|
||||
|
@ -42,6 +42,11 @@ syncOnStartup: true
|
||||
# resets, etc) before Mjolnir is needed.
|
||||
verifyPermissionsOnStartup: true
|
||||
|
||||
# If true, Mjolnir won't actually ban users or apply server ACLs, but will
|
||||
# think it has. This is useful to see what it does in a scenario where the
|
||||
# bot might not be trusted fully, yet. Default false (do bans/ACLs).
|
||||
noop: false
|
||||
|
||||
# A list of rooms to protect (matrix.to URLs)
|
||||
protectedRooms:
|
||||
- "https://matrix.to/#/#yourroom:example.org"
|
||||
|
@ -51,7 +51,9 @@ export async function applyServerAcls(lists: BanList[], roomIds: string[], mjoln
|
||||
await mjolnir.client.sendNotice(mjolnir.managementRoomId, `Applying ACL in ${roomId}`);
|
||||
}
|
||||
|
||||
if (!config.noop) {
|
||||
await mjolnir.client.sendStateEvent(roomId, "m.room.server_acl", "", finalAcl);
|
||||
}
|
||||
} catch (e) {
|
||||
errors.push({roomId, errorMessage: e.message || (e.body ? e.body.error : '<no message>')});
|
||||
}
|
||||
|
@ -58,7 +58,10 @@ export async function applyUserBans(lists: BanList[], roomIds: string[], mjolnir
|
||||
await mjolnir.client.sendNotice(mjolnir.managementRoomId, `Banning ${member['state_key']} in ${roomId} for: ${userRule.reason}`);
|
||||
}
|
||||
|
||||
if (!config.noop) {
|
||||
await mjolnir.client.banUser(member['state_key'], roomId, userRule.reason);
|
||||
}
|
||||
|
||||
banned = true;
|
||||
break;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ interface IConfig {
|
||||
verboseLogging: boolean;
|
||||
syncOnStartup: boolean;
|
||||
verifyPermissionsOnStartup: boolean;
|
||||
noop: boolean;
|
||||
protectedRooms: string[]; // matrix.to urls
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user