Commit Graph

1098 Commits

Author SHA1 Message Date
gnuxie
a45d308597 Refactor and improve the unban command.
We no longer want to accept an argument for the list. We will just
find all appropriate policies and remove them, like we do with the
unban prompt (which we still might want to update to use the new
`--no-confirm` prompt later).

We fix the bugs where the unban command was inviting users regardless
of whether the `--invite` option was provided.

The unban command now uses a preview which shows all the policies that
will have to be removed to unban a user, all the rooms they will need
to be unbanned from, and any rooms that they will be invited to if the
`--invite` option is used.
2025-02-28 12:19:59 +00:00
Gnuxie
9587d6fcba Update for simulated capabilities from MPS v2.10.0 and add their renderers, commands. (#727)
* Set renderers and glue for new simulated capabilities.

https://github.com/the-draupnir-project/planning/issues/2.

* Distinguish simulated capability messages when rendering.

* Update for MPS 2.10.0

* Add `!protections capability reset <protection name>`  command.

This will allow you to use the default capabilities for a protection.

* Update CHANGELOG for simulated capabilities.
2025-02-12 12:51:44 +00:00
Gnuxie
d3b55a879a Add !rules matching members command. (#726)
This shows all the rules that are matching members in the protected
rooms set, but probably cannot be actioned either due to permission
limitations or ACL leakage.
2025-02-11 11:13:24 +00:00
Gnuxie
94f41d70ae Merge pull request #725 from the-draupnir-project/gnuxie/revision-feedback
Show the time of the last `RoomStateRevision` for each room in the `!draupnir rooms` command. 

We also do this for policy lists.

https://github.com/the-draupnir-project/Draupnir/issues/718
2025-02-10 20:33:11 +00:00
gnuxie
30ad9f098b Remove spurious error wrapping around status info. 2025-02-10 19:59:22 +00:00
gnuxie
f5ef75844c Update to MPS v2.9.0.
This gives us the `WatchedPolicyRooms` feature.
2025-02-10 18:11:07 +00:00
gnuxie
2f7c598266 Use the new WatchedPolicyRooms MPS feature.
This simplifies anything to do with the way policy rooms are watched.
There was a lot of weird glue code around finding policy rooms and
revisions that has just been whipped out into the WatchedPolicyRooms
abstraction.
2025-02-10 16:39:03 +00:00
gnuxie
5d727d7114 Modify 'listInfo' from status command.
This function now distinguishes between lists we are watching, lists
that are protected, and lists that we have parted from.

I don't like it. This should exist on the `PolicyRoomsManager` and
this is a complete and total mess. I don't know if there is time to
fix it yet.
2025-02-10 10:07:51 +00:00
gnuxie
e9e163e9f3 Show when rooms were last updated in the rooms list command.
https://github.com/the-draupnir-project/Draupnir/issues/718.
2025-02-09 12:39:44 +00:00
Gnuxie
711b9b7413 tidy config properties (#724)
* Remove `syncOnStartup` option since it no longer does anything.

We always 'sync' on startup, not that we have a concept of syncing
anymore. https://github.com/the-draupnir-project/Draupnir/issues/504.

* remove `verboseLogging`.

yeah, cya later pal. https://github.com/the-draupnir-project/Draupnir/issues/504.
2025-02-06 13:43:00 +00:00
Gnuxie
3ec98e7ad1 Show a protection's compatible capability providers in the capability set section of !draupnir protections show. (#723)
Currently looks like this, we just don't have alternative capabilities yet: 
![image](https://github.com/user-attachments/assets/24c1040c-54df-4895-b8b7-37d261254bf9)


* Include compatible capability providers in capability set.

* Update to MPS v2.8.0

This gives us the function to find compatible capability providers for
a capability interface.

* Improve description of capability providers some more.

* Iterate capability provider UX some more.
2025-02-03 16:32:39 +00:00
Gnuxie
24824027c4 Merge documentation and current value rendering into one componenet (#722)
* Condense config documentation and status to show in one block.

* Swap things around to make the current value prominent.

Before:

![image](https://github.com/user-attachments/assets/e554b0f7-408a-4ea6-9ffa-8df53119feac)


After:

![image](https://github.com/user-attachments/assets/26bcc16b-f85b-4639-9b8f-43f820158c7e)
2025-02-03 11:20:01 +00:00
gnuxie
69cf36b090 Fix typo in recover command. 2025-02-03 09:48:30 +00:00
gnuxie
4f5ec25f78 Consistent use of config.dataPath for backing store. 2025-02-03 09:37:35 +00:00
Gnuxie
a497821ba9 Fix lack of error handling in parts of backing store. (#717)
Errors propagating here could cause the bot to have only partially
synced by propagating all the way up to the sync response handling in
the bot-sdk.

https://github.com/the-draupnir-project/Draupnir/issues/691.
2025-02-03 09:29:09 +00:00
gnuxie
bcfdfdfd03 v2.1.0 v2.1.0 2025-02-02 11:06:57 +00:00
Gnuxie
81cb3e5f09 Update to interface-manager v4.0.1 (#715)
- The signature of the `CommandDispatcher` `prefixExtractor` callback has been changed so that it is possible to transform the entire command body with a `commandNormaliser`.  This was changed primarily to fix https://github.com/the-draupnir-project/Draupnir/issues/707.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/707.
2025-02-02 10:47:10 +00:00
Gnuxie
5d49bddd74 Be a little more accepting of servers choking on profile. (#714)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/703.
2025-02-01 23:16:58 +00:00
gnuxie
02bcebd597 Make the rooms list command show unprotected and unjoined rooms. 2025-02-01 23:02:54 +00:00
Gnuxie
acf0a406de Add functionality for config.protectAllJoinedRooms via a protection + adjacent changes. (#711)
* Initial ProtectAllJoinedRoomsProtection.

We need something like this to implement `config.protectAllJoinedRooms`,
we also need something to go alongside that removes rooms as they
are added or removed.

it will probably be a behaviour of the same protection that we will
split out.

* Move it cos i cba and we need to merge with a protection to unprotect

on leave and ban.

* IDK i keep getting distracted i need my notebook back aaaa.

* Create RoomsSetBehaviourProtection out of redundant protections.

* Add toggle for RoomsSetBehaviour.

* Enable the RoomsSetBehaviour protection by default.

* Add the behaviour protection to protections index.

* Whoopsie unprotected parted rooms should actually call itself.

* Fix bugs meow.

* handleExternalInvite -> handleExternalMembership

* Make sure leave events get propagated in bot mode.

* Add batcher to ProtectJoinedRooms component.

* Hook into handleExternalMembership for RoomsSetBehaviour.

* Remove crap from fixtures.ts

* leave all rooms when starting integration tests.

* Change how protections are informed of membership.

* Add test for Joinig and protecting rooms on invite.

* Tidy up UnprotectPartedRooms rendering.

* Update for MPS v2.7.0

Added

- Generic item batching is now available for protections to use by
  using the `StandardBatcher`.

Changed

- `Task` has been improved to be more liberal in the closures it
  accepts.  And `Task` now has more options for logging how tasks have
  failed.

- The `Protection` callback `handleExternalInvite` has been renamed to
  `handleExternalMembership`.

Fixed

- An issue where adding rooms to the protected rooms set more than
  once could sometimes cause duplicate events to be propagated.

* Fix typo mare.

* Stop protecting rooms automatically when config.protectAllJoinedRooms is false.

* Update CHANGELOG.md
2025-02-01 17:53:10 +00:00
Gnuxie
b4bf6b2c0b Make mx-tester have consistent use of yarn. (#710)
CI was broken because of this shite https://github.com/nodejs/corepack/issues/612
2025-01-31 17:06:48 +00:00
Gnuxie
057d2c1f82 Make sure to dispose of the protected rooms set properly. (#709)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/687.
2025-01-31 16:20:51 +00:00
gnuxie
8764a17430 v2.0.2 v2.0.2 2025-01-24 16:27:02 +00:00
Gnuxie
0eb8546067 Update to MPS v2.6.0. (#700)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/314.
2025-01-24 15:57:36 +00:00
Gnuxie
bd1cf645d1 Command prefix fixes (#699)
We have added a "command normaliser" to interface-manager that can cover all the edge cases for pinging the bot or prefixing a command.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/678
Fixes https://github.com/the-draupnir-project/Draupnir/issues/686

* Use interface-manager's command normaliser.

There's still work to be done to make sure we can get ahold of the
displyaname.

* Fetch displayname for Draupnir for the command normaliser.

* Update to interface-manager@4.0.0

This gives us the new command normaliser
2025-01-22 15:25:34 +00:00
Gnuxie
5a0305f46a Remove unused dependencies. (#698)
These dependencies aren't used anywhere.

@sentry/tracing
await-lock
humanize-duration
humanize-duration-ts
parse-duration
shell-quote
typescript-formatter
ulidx

@types/humanize-duration
@types/shell-quote
2025-01-20 12:40:35 +00:00
Rory&
a0270575cd Trim spaces and newlines from secret files (#696)
Purely a UX change for admins, since most text editors append a newline to written files.
* Trim spaces and newlines from secret files
* Extract only the first line from secret files.

---------

Signed-off-by: Rory& <root@rory.gay>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2025-01-20 12:38:25 +00:00
Gnuxie
420aaff776 Add an issue template for bug reports. (#695) 2025-01-19 18:52:34 +00:00
nexy7574
0e2f81e971 Fix the individual request rate-limit (#694)
* Fix the individual request rate-limit

This fixes the first problem raised in #693

---------

Signed-off-by: nexy7574 <git@nexy7574.co.uk>
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
2025-01-19 18:32:55 +00:00
nexy7574
2300b1eef3 Add --invite to unban command (#666)
This PR closes #622 by adding a `--invite` flag to the `unban` command.

* Add --invite to `unban` command (untested)

* Use RoomInviter to invite users in unban command.

* Condense unban(+invite) log message

---------

Signed-off-by: nexy7574 <git@nexy7574.co.uk>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2025-01-19 16:05:23 +00:00
gnuxie
2ee9f35876 v2.0.1 v2.0.1 2025-01-18 01:00:42 +00:00
Gnuxie
8a17cfed5d Update for MPS 2.5.2 (#683)
* Test UnbanCommand and UnbanPrompt have unbanned as a side effect.

You'd think it would be obvious, but clearly it hasn't been.  Part of
the reason for it is just how un-ergonomic it used to be to verify
room state.  Fortunately it's quite straight forward to do since MPS
has picked up. So now we can do it easily.

* Update for MPS 2.5.2.

- Fix SchemedMatrixData putting the wrong version number into data.
  Sadly a complication of
  https://github.com/the-draupnir-project/Draupnir/issues/560.

- Fix an issue where the implementation of the RoomUnbanner capability
  was actually calling `/ban`.
2025-01-18 00:54:25 +00:00
gnuxie
a16fb7b2c0 v2.0.0 v2.0.0 2025-01-16 19:09:07 +00:00
gnuxie
7184dcfeac v2.0.0 CHANGELOG.
Feel like I'm about to screw up the actual releasing so here goes.
2025-01-16 19:08:41 +00:00
gnuxie
b1a22dbffa v2.0.0-beta.11 v2.0.0-beta.11 2025-01-16 15:14:49 +00:00
Gnuxie
c1cb3e8dff Update README for 2.0.0. (#676)
* Update README for 2.0.0.

* Mjolnir link.

Thanks to feedback from @mahdi1234.

* Update antispam plugin link.

* Typo in sentance

Thanks to @ll-SKY-ll for spotting meow.
2025-01-15 22:59:01 +00:00
Catalan Lover
0d42cd30f4 Cleanup Integration Test Config. (#675) 2025-01-15 19:01:21 +00:00
Catalan Lover
69b666e56d Make Room state backing store be default enabled. (#673)
* Make Room state backing store be default enabled.

* Disable Room State Backing Store for Integration Tests
2025-01-15 19:01:06 +00:00
Catalan Lover
c3552d0c59 Remove confirmWildcardBan config option (#672)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/671
2025-01-15 17:58:11 +00:00
Catalan Lover
731a944a90 Remove Faster membership checks config entry. (#670)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/669
2025-01-15 17:57:41 +00:00
Catalan Lover
b9c12b74d7 Remove Protected Rooms config option (#674) 2025-01-15 17:50:07 +00:00
Gnuxie
8d73f6b794 Update for MPS v2.5.1. (#668)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/667.
[2.5.1] - 2025-01-14

Fixed

- An issue with the `SetRoomMembershipRevisionIssuer` that would allow
  duplicate listeners to be added to rooms that were already in the
  set. This would cause lots of issues with downstream revision
  listeners. We've hardened code downstream, e.g.  with the
  `MembershipPolicyRevisionIssuer`, in case this happens again.
2025-01-14 13:54:37 +00:00
nexy7574
9d80b44871 Don't send the banned word in the ban reason (#665)
This change makes the ban reason when a user sends a banned word generic, and instead sends the banned word in the management room directly. This prevents the banned word from persisting in the room timeline after redacting the original event.

Signed-off-by: nexy7574 <git@nexy7574.co.uk>
2025-01-11 23:37:52 +00:00
Gnuxie
c0d4627c62 Add unique member count to status command. (#663) 2025-01-10 17:24:11 +00:00
Gnuxie
fa5ce9ad9c Fix report poller (#662)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/258
Fixes https://github.com/the-draupnir-project/Draupnir/issues/408
Fixes https://github.com/the-draupnir-project/Draupnir/issues/409

* Create a way to only forward reports in WebAPIs.

Honestly, I'm going to revert this because I think I have found a
better way of testing the report poller.

* Begin improving and fixing the report poller.

We need to change the ReportManager so that we can interface it out
for testing. The reason being that the report poller is inactive
in the harness and so we can't use that with a protection handle
to test. Instead I want to instantiate a report poller with
a mocked report manager.

* Update integration test nginx to mirror reports to synapse.

We need this so that we can test the report poller without needing to
do gymnastics to selectively forward reports.

* Interface out ReportManager.

Needed so we can test the report poller without doing gymnastics with
setting up fake protections.

* Fix report poller from paginating over the same reports.

https://github.com/the-draupnir-project/planning/issues/38.

* Revert "Create a way to only forward reports in WebAPIs."

This reverts commit 59b335f658.
We don't need this anymore.

* Update for MPS v2.4.0

Gives us the synapse admin client, updates schema, and gives us the fix for https://github.com/the-draupnir-project/Draupnir/issues/560
2025-01-10 17:06:54 +00:00
Gnuxie
2655572cfc Merge pull request #661 from the-draupnir-project/gnuxie/protection-settings-fixes
Handle broken protection settings better

Fixes https://github.com/the-draupnir-project/Draupnir/issues/658

![image](https://github.com/user-attachments/assets/90653c7a-7333-4e9c-9997-8ba1679b450f)
2025-01-10 11:36:44 +00:00
gnuxie
bb5b5e21e0 Add a protections config reset command.
Part of https://github.com/the-draupnir-project/Draupnir/issues/658.
2025-01-10 11:31:35 +00:00
gnuxie
6bbac2abe5 Show config errors when enabling protections with invalid config.
Part of https://github.com/the-draupnir-project/Draupnir/issues/658.
2025-01-10 11:17:16 +00:00
gnuxie
a4603181a2 v2.0.0-beta.10 v2.0.0-beta.10 2025-01-09 18:18:03 +00:00
renovate[bot]
0ea80d3658 Update Production Dependencies (#617)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-09 17:32:16 +00:00