Commit Graph
584 Commits
Author SHA1 Message Date
gnuxie 98c1822013 Give some flexibility for when to enter safe mode. 2024-10-02 11:32:04 +01:00
gnuxie bd6c3c4455 WebAPIs.stop/start method was accidentally and implicitly async, fixed.
This was leading to integration test failures on CI, when the webserver
hadn't been stopped before it was started again in tests.
2024-10-02 11:32:04 +01:00
gnuxie ba6ec9bb9a Enter safe mode by default.
However, we still need to consider whether all errors should enter
safe mode or only errors that we know are recoverable.
2024-10-02 11:32:04 +01:00
gnuxie 756d9c8491 Update DraupnirProtectedRoomsSet for more recoverable configs.
Added policy list config and protection settings.
2024-10-01 11:54:28 +01:00
gnuxie 6b0e252e2a Make StandardDraupnirManager boot into safe mode too.
Appservice bots won't boot into safe mode otherwise.
2024-09-30 12:14:00 +01:00
gnuxie 2c8c2892ba Allow safe mode to be configured in appservice mode. 2024-09-30 12:14:00 +01:00
gnuxie 3c1cb07aa6 Create a fresh safe mode instance when restarting Draupnir.
Specifically, when restart Draupnir fails, and safe mode is already
running, we will want to create a fresh safe mode instance that
contains the relevant recovery options, from the new cause of failure.
2024-09-30 12:14:00 +01:00
gnuxie 9ff0f54ff8 Automatically complete prompts from partial commands.
Fixes https://github.com/the-draupnir-project/Draupnir/issues/585.
2024-09-30 12:14:00 +01:00
gnuxie 8c74023374 Allow DraupnirSafeMode to respond to prompts. 2024-09-30 12:14:00 +01:00
gnuxie d4598d9c02 Add recover prompts to the safe mode status info. 2024-09-27 16:31:49 +01:00
gnuxie f9ff3ffdb3 Allow recover options to be used.
Now we just need to anotate the status information/command with
a partial command that calls the recover command.
2024-09-27 14:51:49 +01:00
gnuxie c556b21ac5 Display recovery options in safe mode status information. 2024-09-27 12:25:33 +01:00
fbdd146106 Harden MentionLimitProtection after Mjolnir's introduction of the protection.
From https://github.com/matrix-org/mjolnir/pull/524.

Co-authored-by: Half-Shot <will@half-shot.uk>
2024-09-20 16:09:31 +01:00
GnuxieandGitHub 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
4658ba2e60 Add a welcome flow to Draupnir4All (#568)
* Add a welcome flow to Draupnir4All

* Fix english

Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>

* Use invitations instead of invites

---------

Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
2024-09-20 09:45:26 +02:00
ee1fad567c Start draupnir bots in batches when running in appservice mode (#569)
* Start draupnir bots in batches when running in appservice mode

* Simplify and add clarity.

---------

Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2024-09-20 09:44:44 +02:00
gnuxie 4c0e093c77 Fix draupnir manager for safe mode. 2024-09-19 20:12:07 +01:00
gnuxie 8f95c987ad Create a test for turning provisioned Draupnir to safe mode and back
Currently failing because the appservice draupnir manager is broken.
2024-09-19 17:52:53 +01:00
gnuxie f1a6c8cfbf Change Draupnir['start'] to be synchronous. 2024-09-19 12:46:57 +01:00
gnuxie b52948b353 Forgot to start Draupnir listening in appservice.
We need to look at Draupnir's .start method and make it `void`.
The report poller should just throw if it fails without being
caught by `Task`.

We also need to test the `toggle` in appservice in integration
tests.
2024-09-19 12:27:39 +01:00
gnuxie 334aaa7233 Give safe mode config option a better name. 2024-09-18 19:53:58 +01:00
gnuxie 35ccf94794 Make integration test harness use the BotModeToggle. 2024-09-18 18:29:49 +01:00
gnuxie a92c95a0dd Make src/index.ts use the BotModeToggle to manage the bot.
Now we need to change the integration test's makeMjolnir do the same.
2024-09-18 18:08:36 +01:00
gnuxie d82a0b0731 Print status information when booting from and to safe mode. 2024-09-18 16:19:47 +01:00
gnuxie 4db7ce3872 Find a way to print draupnir status on startup from the toggle.
without disrupting e2ee.
2024-09-18 16:04:49 +01:00
gnuxie de6e4d7416 Add restart command to safe mode.
Currently integration tests will be broken because we took control
over "who starts Draupnir?" away and gave it to the `SafeModeToggle`.

So we need to fix that.
2024-09-18 15:28:05 +01:00
gnuxie 4f1b789501 Add a status command to safe mode. 2024-09-18 12:45:52 +01:00
gnuxie ed7b976404 Allow safe mode bot to respond to commands. 2024-09-17 19:15:39 +01:00
gnuxie 28718ca89b Remember to start the safe mode bot. 2024-09-17 19:13:34 +01:00
gnuxie 6b1b44259c Add draupnir command to switch to safe mode.
Works, but safe mode isn't hooked up to respond to any events.
2024-09-17 18:31:02 +01:00
gnuxie 9959431da8 Pass the SafeModeToggle to Draupnir.
Something that is going to be broken for sure are the guages on the
appservice manager, since toggling is controlled by the base manager.

I have no idea what these guages are even for except the legacy
draupnir4all work.
2024-09-17 18:18:13 +01:00
gnuxie c9a0d60eaf Migrate bot mode to use the safe mode toggle, but only for draupnir. 2024-09-17 17:27:08 +01:00
gnuxie 47468e1155 SafeModeDraupnir (not plugged in). 2024-09-17 15:27:45 +01:00
gnuxie be1c2903fb Simplify Draupnir manager by always listening. 2024-09-17 14:50:47 +01:00
gnuxieandGnuxie 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
gnuxieandGnuxie 7c9d817270 WordListProtection had a typo in it.
This is going to require the protection to be restarted for
those who have already enabled it, so rememeber to warn in the release.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/557.
2024-09-14 13:56:26 +01:00
GnuxieandGitHub d0e3cbe324 Remember to intern Draupnir protections command. (#556)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/555.
2024-09-13 13:51:16 +01:00
gnuxie 8482df6f1b Stop --glob on kick command kicking everyone. 2024-09-11 17:09:55 +01:00
gnuxie 6c23c747de ThrottlingQueue was supressing errors in unit tests. 2024-09-11 17:08:00 +01:00
GnuxieandGitHub 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
GnuxieandGitHub 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
GnuxieandGitHub 986afb7e2b Enable strictPropertyInitialization in tsconfig.json. (#541)
This will stop situations where the throttling queue was uninitialized in the Draupnir instances.

We should really enable `strict` for typescript.

The blocker for that is `useUnknownInCatchVariables` around legacy code (which should be minor).
And also `strictFunctionTypes`, which `interface-manager` exacerbates by not providing the right generics for `describeRenderer` and other methods. 

https://github.com/the-draupnir-project/Draupnir/issues/496
2024-09-09 19:15:41 +01:00
GnuxieandGitHub 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
GnuxieandGitHub 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 3df3e0eccb unit test Draupnir watch/unwatch commands. 2024-09-09 13:28:16 +01:00
gnuxie bdbfadc095 Move to @the-draupnir-project/interface-manager for defining commands. 2024-09-06 17:18:53 +01:00
GnuxieandGitHub 7150b21035 Add Experimental MentionLimitProtection. (#518)
Based on https://github.com/the-draupnir-project/Draupnir/pull/495/files.
Documentation pending.
2024-08-24 23:04:24 +01:00
GnuxieandGitHub 74ec70df74 StandardEventConsequencesRenderer was named wrong. (#517)
The name of the renderer needs to match the name of the associated capability. Otherwise when a protection asks for the capability you will get an obscure error about not being able to find a renderer for the cap.
2024-08-24 22:41:01 +01:00
MarcelGitHubpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
7146216188 Fix the bot-sdk crypto by initializing the bot-sdk earlier (#512)
* Fix the bot-sdk crypto by initializing the bot-sdk earlier

Signed-off-by: MTRNord <mtrnord1@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix formatting

Signed-off-by: MTRNord <mtrnord1@gmail.com>

* Instead of moving the sync start we move the one message causing issues. This makes sure we are actually ready for incoming messages

Signed-off-by: MTRNord <mtrnord1@gmail.com>

* Add a comment on why the startupComplete method is public

---------

Signed-off-by: MTRNord <mtrnord1@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-17 22:55:54 +01:00
GnuxieandGitHub cc9d4cb9d5 Move to @the-draupnir-project/basic-matrix-types. (#508)
We split out some utility types from the matrix-protection-suite into a library https://github.com/the-draupnir-project/matrix-basic-types



I can't believe that like the extra lines from 

```
import {
} from ...
```

are adding up so much but whatever. 

* Move to @the-draupnir-project/basic-matrix-types.

* Whoopsie missed a test.
2024-08-16 19:12:21 +01:00