Commit Graph

962 Commits

Author SHA1 Message Date
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 bd209848a3 Fix integration test fixtures now safe mode toggle controls draupnir. 2024-09-18 15:37:45 +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
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 86b7a51992 Fix broken link in readme and references to default command.
thanks again Sky.
2024-09-14 13:56:26 +01:00
gnuxie 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
Gnuxie 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 d3fe508db3 v2.0.0-beta.6 v2.0.0-beta.6 2024-09-11 18:08:23 +01:00
Gnuxie a978618b9d Merge pull request #553 from the-draupnir-project/gnuxie/kick-command-wtf
disbelief, but basically Mocha is an asshole and was suppressing uncaught promise rejections, and then the throttling queue was catching errors in kick command unit test. So between them the test for glob kicks looked like it was passing, when it was actually causing an assertion failure that we couldn't see. And this meant that we couldn't tell that glob kicks were always banning everyone and everything no matter what. This seems to effect all `v2.0.0-beta.*` releases, but I don't think there is a release where the kick command will actually run without some other error happening first.
2024-09-11 17:19:44 +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
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
renovate[bot] 6b6be66a8c Update dependency body-parser to v1.20.3 [SECURITY] (#543)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-11 10:58:20 +01:00
renovate[bot] bbca4fcaeb Update dependency express to v4.20.0 [SECURITY] (#546)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-11 10:53:02 +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 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
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 c34eff59db Merge pull request #538 from the-draupnir-project/gnuxie/commands-unit-tests
Allow command executors to be unit tested.

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

Only testing Watch/Unwatch command for now to prove that it works.
- Kick command will require a tiny MPS patch to expose kicking as a capability (I don't know if we're going to use the word Kick though).
- Kick command also will require the throttling queue to be hooked up and working again.
- Ban command should be pretty straight forward.
2024-09-09 13:35:33 +01:00
gnuxie bdf0ed0bcc Re-add the unit test CI step.
This reverts commit 0854aec780.
But also we edit it so that the command is correct again.
2024-09-09 13:28:16 +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 3df3e0eccb unit test Draupnir watch/unwatch commands. 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 ecac66e8c6 Merge pull request #536 from the-draupnir-project/gnuxie/interface-manager-rework
Extract the `@the-draupnir-project/interface-manager` system to its own library where it can be better tested and improved.
2024-09-06 17:22:37 +01:00
gnuxie 0854aec780 Temporarily disable unit tests because...
We moved these tests to @the-draupnir-project/interface-manager.

We will get some more unit tests shortly...
2024-09-06 17:18:53 +01:00
gnuxie 4613e88517 Update to interface-manager 1.0.0. 2024-09-06 17:18:53 +01:00
gnuxie bdbfadc095 Move to @the-draupnir-project/interface-manager for defining commands. 2024-09-06 17:18:53 +01:00
gnuxie 79a0320044 Add the result library directly so that we don't have to type out ActionResult. 2024-09-06 13:23:14 +01:00
gnuxie a4d836bf91 Update to MPS 1.1.0. so we can get RoomMessageSender capability. 2024-09-06 13:23:14 +01:00
gnuxie 9654ba6ca9 Add @the-draupnir-project/interface-manager to begin integration. 2024-09-06 13:23:14 +01:00
Aminda Suomalainen ⚧ 5c2eebd5a5 Replace dependabot with renovate (#526) 2024-09-02 19:00:04 +03:00
gnuxie 272d1094ec v2.0.0-beta.5 v2.0.0-beta.5 2024-08-26 12:10:33 +01:00
Gnuxie 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
Gnuxie 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
Marcel 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
Gnuxie 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
Gnuxie 07667c71dd Add supporters information to footer. (#506)
* Add NLnet support information to footer.

* Try fixy image width.

Special shoutout to https://github.com/DavidWells/advanced-markdown.
2024-08-12 16:37:47 +01:00
Gnuxie d1c5d012e4 Experimental new joiner protection. (#495)
This protection allows room moderators to ban new users from servers (matrix.org). Existing users will be able to participate normally, and if they are accidentally banned, once unbanned rejoining will be unaffected.

This is intended to be used during periods of instability. The protection may be removed entirely or modified in a future release. We will add a documentation page shortly.
2024-07-27 16:48:55 +01:00
Gnuxie 6162517ba1 Some test harness related files were not gitignored. (#494) 2024-07-27 14:11:23 +01:00