Commit Graph

23 Commits

Author SHA1 Message Date
Aminda Suomalainen e4c02b96cd Add pre-commit configuration (#34)
* add .pre-commit-config.yaml

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>

* .editorconfig: decrease indent size for text

* .pre-commit-config.yaml: remove prettier

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>

* .editorconfig consistency.

* .pre-commit-config.yaml: restore sample hooks

* .editorconfig: disable indent_size for LICENSE & NOTICE

* pre-commit run --all-files

* tsconfig.json: tabs to spaces

* .pre-commit-config.yaml: update editorconfig-checker to 2.7.2

* .editorconfig: disable indent_size for markdown

* mjolnir-entrypoint.sh: retab

* .editorconfig: also exclude json from indent checking

* test/nginx.conf: retab

* test/integration/commands/redactCommandTest.ts: remove leading space

* retab or remove leading whitespaces for the rest of the files

* src/appservice/datastore.ts remove newlines

* test/integration/commands/roomTest.ts: remove leading space.

---------

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2023-08-29 13:38:00 +01:00
Gnuxie c11fb6ef06 Fix an issue where protected rooms could not be removed. (#65)
This was introduced in https://github.com/Gnuxie/Draupnir/pull/54/ (and therefore 1.83.0). Essentially we forgot to remove the room from the protected rooms set, when the remove command was used.

Ontop of this something to note is that during testing it is clear that the protected rooms set is loaded when configuring mjolnir, not when starting it. This is problematic as it means setup code in `fixtures.ts` does not actually wipe the protected rooms set.
2023-07-04 17:19:03 +01:00
Gnuxie 5414c46c36 Ban Propagation protection (that is enabled by default) (#36)
* Experimental Protection to propagate room level bans to policies.

- Needs an automated option
- I really want this to be enabled by default
- It needs to be easily configurable and very visible because it's a really useful feature.
- Need to check that they are not already banned on a policy list.
- Allow possibility to rely last message like a report behind spoiler text.

* Use MatrixDataManager for enabled protections.

This will allow us to create "enabled by default" protections
via a schema migration.

* Enable BanPropagationProtection by default

* BanPropagation: only prompt when user is not already banned.

* Test for BanPropagationProtection.

* clearTimeout for prompt reactions if we got a reaction.

* Allow renderMatrixAndSend to not need a reply.

* document getFirstEventMatching
2023-02-22 16:43:24 +00:00
David Teller 9e9b48700d This should hopefully fix some startup woes (#462)
Splitting PolicyListManager from Mjolnir, making it more resilient to startup errors
2023-01-31 20:12:04 +00:00
gnuxie 5164e48149 Rename MakeRoomAdminCommand to HijackRoomCommand 2023-01-31 20:00:14 +00:00
gnuxie 277140240a Catch exceptions from commands better by giving them a uuid.
They can then be used as a reference to look for in the logs.
The MakeAdminCommand has been refactored as an example.
2023-01-31 19:57:56 +00:00
gnuxie 7a076033a3 Protect Draupnir from matrix-bot-sdk 2023-01-31 18:25:42 +00:00
Gnuxie 704bb660c2 Refactor how we listen for matrix events. (#446)
* Refactor Matrix event listener in Mjolnir and ManagedMjolnir.

closes https://github.com/matrix-org/mjolnir/issues/411.

Issue #411 says that we have to be careful about room.join,
but this was before we figured how to make matrix-appservice-bridge
echo events sent by its own intents.

* Remove MatrixClientListener since it isn't actually needed.

* Protect which config values can be used for ManagedMjolnirs.

* Introduce MatrixSendClient

so listeners aren't accidentally added to a MatrixClient instead
of MatrixEmitter.

* doc

* Move provisioned mjolnir config to src/config.

This just aids maintance so whenever someone goes to change the config
of the bot they will see this and update it.

* doc for matrix intent listener.
2022-12-06 17:17:40 +00:00
Jess Porter 4376679b99 load config yaml manually, remove more references to static config (#347) 2022-08-16 15:51:18 +01:00
Jonathan de Jong cc9f393ed7 fix CI (#282)
ts-mocha has also been updated to make running locally possible (else it gives a confusing error that tsconfig.json is not "json" or the likes)
2022-05-03 11:20:40 +01:00
David Teller e05616b327 New command !mjolnir since <date or duration> <kick | ban | show> <limit> [reason] [...rooms] (#238)
A new command `since` to affect all users who have joined a protected room since a given date.
2022-03-21 10:39:15 +01:00
David Teller 26ae55cd24 A command to show when users in a given room have joined (#225) 2022-03-07 11:34:25 +01:00
Marco Cirillo 97df4d5f61 Add command to elevate a user (or the bot) as room administrator (#219) 2022-03-07 10:14:06 +01:00
jesopo 65af82d46f send whole channel shutdown reason, not just the first word 2022-03-02 10:20:43 +00:00
Gnuxie e52b59df6e Fix bad teardowns that hang in tests. (#202)
* Fix bad teardowns and hanging test.
2022-01-28 11:03:20 +00:00
gnuxie f481ec84d3 Make sure we stop clients after they have started, not before.
Yeah it's a long story.
2022-01-26 16:25:43 +00:00
David Teller c7a96a3afe Retry requests in case of throttling (#178)
* Retry requests in case of throttling


Co-authored-by: gnuxie <gnuxie@element.io>
2022-01-25 12:19:44 +00:00
gnuxie 4537cf0d8a Add test for ruleserver policy consumption.
Ensures that the consumer of the ruleserver rules is enforcing them.
2022-01-21 12:13:04 +00:00
gnuxie 7ee3ce1dd2 rename onReactionTo to getFirstReaction 2022-01-21 12:13:04 +00:00
Jess Porter 941d10b015 never mutate config.managementRoom in-place (#184) 2022-01-17 16:24:12 +00:00
David Teller c48a1e8ffc Let's make sure that we can still check for errors with concise error handling 2022-01-07 14:06:10 +01:00
gnuxie c52084c58a Stop managing client from utils and require the caller to (tests)
Specifically `onReactionTo` was starting and stopping the client
argument it was given, which could be problematic if the caller
didn't expect that or didn't want it to.
2021-10-20 11:44:25 +01:00
gnuxie 6c1a502f34 Integration tests for redaction commands.
This is important now that both timeline pagination and
how the callbacks are now awaited during pagination
have been changed.
2021-10-20 11:00:44 +01:00