Commit Graph

219 Commits

Author SHA1 Message Date
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
f5ef75844c Update to MPS v2.9.0.
This gives us the `WatchedPolicyRooms` feature.
2025-02-10 18:11:07 +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
bcfdfdfd03 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
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
8764a17430 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
gnuxie
2ee9f35876 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 2025-01-16 19:09:07 +00:00
gnuxie
b1a22dbffa v2.0.0-beta.11 2025-01-16 15:14:49 +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
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
a4603181a2 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
Gnuxie
6fb22af343 Update for MPS v2.3.0 (#655)
* Update ServerACLConsequencesRenderer for updated interface.

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

* Update for MPS v2.3.0.

https://github.com/Gnuxie/matrix-protection-suite/releases/tag/v2.3.0
2025-01-08 17:12:58 +00:00
Gnuxie
3225d5d1d3 Update for MembershipPolicyRevision in MPS 2.2.0 (#650)
* Update for MembershipPolicyMatches in MPS 2.2.0.

* Update MPS to 2.2.0.

https://github.com/Gnuxie/matrix-protection-suite/releases/tag/v2.2.0
Fixes: https://github.com/the-draupnir-project/Draupnir/issues/498
Likely also fixes: https://github.com/the-draupnir-project/Draupnir/issues/451 (discovered and fixed bug in MPS)
2025-01-06 16:19:42 +00:00
gnuxie
56a36de654 v2.0.0-beta.9 2024-12-14 15:24:00 +00:00
Gnuxie
613792769f Fix protections config set/add/remove commands. (#638)
* Stop using `setSerializedValue` on protection settings.

We don't need it now that we've updated the command reader.

* Update interface-manager and MPS.

* Enable standard presentation type translators.

This will fix issues with the ban command reason.
2024-12-09 16:56:29 +00:00
Gnuxie
86c887b832 Fix inconsistency in package override for bot-sdk version. (#633) 2024-12-04 13:17:33 +00:00
Gnuxie
b952ee1042 Add a command to switch a protection's active capability provider. (#632)
* Add command to change the active capability provider of a protection.

* Update MPS for persistent capability set config.

The command will actually persist the chosen capabilities
across startup.
2024-12-04 12:11:06 +00:00
Gnuxie
0b531efb83 Make sure we use exact same version of bot-sdk as matrix-appservice-bridge. (#627)
I don't think this has been a problem but it messes up the dev environment
if you want to link all of draupnir's dependencies like matrix-protection-suite,
interface-manager and so on.
2024-11-28 13:30:28 +00:00
gnuxie
e53d178ecd update for MPS. 2024-11-28 12:35:23 +00:00
renovate[bot]
477ac53cf9 fix(deps): update production dependencies (#528)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-26 12:41:09 +01:00
gnuxie
e36fefb4ce v2.0.0-beta.8 2024-10-22 19:33:56 +01:00
gnuxie
164434d528 Prompt for confirmation of the recover command.
Update interface-manager for `--no-confirm` handling.
Update tests for recovery confirmation.
2024-10-11 11:23:48 +01:00
Gnuxie
039f1a8ef0 Improve the information we have about the management room. (#610)
We introduce a new interface `ManagementRoomDetail`, and our implementation of this has immediate access to the room members and room state. 

Immediately, this allows us to warn when the management room is public.

In the future, it gives us a nice place to decide things like decide whether membership of the management room is enough to be considered a moderator, introduce more redundancy in access control, and give capabilities a way to determine who is a moderator (and avoid enacting consequences against them).  

* Move management room to its own folder so we can start introspecting on it.

* Add ManagementRoomDetail.ts

This is just used to track who is a moderator and whether the
management room is public.

* Update ManagementRoomOutput to depend on ManagementRoomDetail.

This should allow us to implement the feature that warns when
the management room is public.

* Send a warning if the management room is public.

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

* Update to MPS 1.7.0 so we can get the join rule event.
2024-10-10 13:37:42 +01:00
Marcel
8b03d6448e Update matrix-appservice-bridge and use our own alias for matrix-bot-sdk (#609)
* Update matrix-appservice-bridge and use our own alias for matrix-bot-sdk

* Bump node version to support matrix-appservice-bridge

* Bump node version in CI

* Fix comments

* Add changelog entry
2024-10-10 12:11:26 +02:00
Gnuxie
2f9f05256c Improve recovery status message spacing (#603)
* Improve safe mode status rendering.

Feedback from @jimmackenzie.

* Update interface-manager.
2024-10-07 19:25:45 +01:00
Aminda Suomalainen ⚧
7e27b057fc Fix pre-commit run --all-files, add check for executables and shebangs (#599)
* pre-commit autoupdate

* pre-commit: check executables have shebangs and shebang files are executable

* .pre-commit-config.yaml: also add check for illegal windows names

* {package.json,.pre-commit-config.yaml}: fix yarn-lint

* prettier --write for yarn-lint pre-commit hook to pass

* package.json: unquiet eslint
2024-10-06 13:22:14 +01:00
Gnuxie
39eb2984c5 Display persistent configs in safe mode (#592)
* Initial attempt at this, but I don't like it.

We've managed to cnofuse rendering/command layer again just because
we started with the rendering rather than the command lol.

* Remove side effects from config renderers.

* Improve rendering of persistent configs in safe mode.

We should really also expand by default, and array properties in
details instead. Otherwise a new user might not expand by default and
might not know what's wrong.

* Remove <details> from configs themselves.

* Color blind indicators for config status.

* When config are bodged just render their reasons on the same line.

* Hide stack trace behind details.

* Update for MPS 1.6.0.
2024-10-04 17:30:05 +01:00
gnuxie
cb88aa52a1 v2.0.0-beta.7 2024-10-02 19:43:32 +01:00
Gnuxie
56627a417e Make sure config recovery handles vaild but unjoinable rooms. (#590)
* Make sure config recovery handles valid but unjoinable rooms.

Pretty sure that we missed this.

* Update to MPS 1.5.2 for more recovery options.
2024-10-02 19:12:26 +01:00
gnuxie
88bf45b404 Update to MPS 1.5.0 for PersistentConfigData features. 2024-10-02 11:32:04 +01:00
gnuxie
b9c05fbb6b Update interface-manager for better infrence on arbritrary renderers. 2024-09-30 12:14:00 +01:00
Gnuxie
6a6e24a7b6 Verify that commands have renderers and renderers have commands (#571)
* Upgrade to interface-manager@2.4.0.

* Verify that commands have renderers and renderers have commands.

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

* Fix appservice bot's missing renderers.
2024-09-20 12:55:16 +01:00
gnuxie
fd7114fd7d Skip calling /join for rooms we arleady know we are joined to.
https://github.com/Gnuxie/matrix-protection-suite/issues/61
https://github.com/the-draupnir-project/Draupnir/issues/561
2024-09-17 12:16:17 +01:00
gnuxie
d3fe508db3 v2.0.0-beta.6 2024-09-11 18:08:23 +01:00
gnuxie
6c23c747de ThrottlingQueue was supressing errors in unit tests. 2024-09-11 17:08:00 +01:00
Gnuxie
56e0c56eeb Use @gnuxie/typescript-result's expect where applicable instead of throwing garbage. (#552)
Part of https://github.com/the-draupnir-project/Draupnir/issues/547

* Update for MPS v1.3.0.

* Use @gnuxie/typescript-result's `expect` method where applicable.

* Update to @the-draupnir-project/interface-manager@2.3.0.
2024-09-11 14:57:37 +01:00
Gnuxie
a5afdbe9ad Unit tests for the ban and unban commands. (#542)
* Unit test Ban and UnbanCommands.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/441
will follow up with https://github.com/the-draupnir-project/interface-manager/issues/7.

Part of https://github.com/the-draupnir-project/planning/issues/22.

* Update to @the-draupnir-project/interface-manager@2.1.0.

* Rest parameters can only give one argument from prompts.

* Update to @the-draupnir-project/interface-manager@2.2.0.
2024-09-11 10:24:01 +01:00
Gnuxie
982f9c23c8 Give MatrixInterfaceAdaptor all of its required callbacks. (#540)
* Update to @the-draupnir-project/interface-manager@2.0.0.

The interface has been changed in `interface-manager` so that we can't forget them. 

Means that our little error renderer works again.
2024-09-09 18:08:14 +01:00
Gnuxie
8d1af843d3 Unit test the DraupnirKickCommand. (#539)
* Update to MPS v1.2.1.

This will allow us to use `describeProtectedRoomsSet` in unit tests.

* Update to @the-draupnir-project/interface-manager@1.1.1.

This allows for better type inference from the command and also for
partial keywords to be provided to commands as arguments.

* Unit test the DraupnirKickCommand.
2024-09-09 17:20:09 +01:00
gnuxie
dce8b289e3 Remove ts-mocha since we can just use ts-node (unmaintained package). 2024-09-09 13:28:16 +01:00
gnuxie
804bad5e37 Update to @the-draupnir-project/interface-manager@1.1.0
This includes a utility to help us unit test commands.
2024-09-09 13:28:16 +01:00
gnuxie
701f5da47f Add ts-auto-mock and ts-node and transformer for better mocks. 2024-09-09 13:27:41 +01:00
gnuxie
4613e88517 Update to interface-manager 1.0.0. 2024-09-06 17:18:53 +01:00