Commit Graph

195 Commits

Author SHA1 Message Date
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
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
gnuxie 272d1094ec v2.0.0-beta.5 2024-08-26 12:10:33 +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 631274e1cb Update to MPS 0.23.4. (#493)
We updated the StringMatrixTypes, since the regexes were incorrect.
2024-07-27 14:11:10 +01:00
gnuxie 0faa91e750 Install and configure prettier. 2024-07-22 18:36:43 +01:00
dependabot[bot] 7bed134f48 Bump express from 4.18.2 to 4.19.2 (#309)
Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 18:05:45 +01:00
dependabot[bot] eaeeba7cca Bump the development-dependencies group across 1 directory with 6 updates (#481)
Bumps the development-dependencies group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) | `9.6.0` | `9.7.0` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `20.11.5` | `20.14.11` |
| [eslint](https://github.com/eslint/eslint) | `9.6.0` | `9.7.0` |
| [mocha](https://github.com/mochajs/mocha) | `10.2.0` | `10.7.0` |
| [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) | `10.0.6` | `10.0.7` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `7.15.0` | `7.16.1` |



Updates `@eslint/js` from 9.6.0 to 9.7.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.7.0/packages/js)

Updates `@types/node` from 20.11.5 to 20.14.11
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `eslint` from 9.6.0 to 9.7.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.6.0...v9.7.0)

Updates `mocha` from 10.2.0 to 10.7.0
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.2.0...v10.7.0)

Updates `@types/mocha` from 10.0.6 to 10.0.7
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

Updates `typescript-eslint` from 7.15.0 to 7.16.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.16.1/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development-dependencies
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 16:59:44 +01:00
Gnuxie 8973db487b Migrate to eslint-9 flat config, typescript 5, typescript-eslint strictTypeChecked (#476)
* Migrate to eslint-9 strictTypeChecked & typescript 5.

* Update to MPS 0.23.0.

Required for strict type checks.

* Looks like we found a test that was complete garbage, amazing really.

* FIXUP

* Well, the command handler was bugged previously...

The command handler used to always only return the command
without the prefix due to an operator precedence bug.
This meant that when we made the order of operations explicit,
we were now including the prefix of the command in the copy.
So when we parsed arguments the code wasn't expecting the prefix
to be there.

* update to MPS 0.23.1.

MPS 0.23.0 was bugged because we didn't enable
`noUncheckedIndexedAccess` while upgrading to typescript 5.

* Make sure eslint runs on all ts files.

* eslint fixes.

* enable `noUncheckedIndexedAccess` & `exactOptionalPropertyTypes`.

* eslint ignores is clearly not understood by me.

* Update SuperCoolStream for eslint and ts5.

* stricter eslint done i thinks

* Whoops, added on .only somewhere.

* Update MPS.

* fix broken test realted things.

* Well I guess that part of getMessagesByUserIn was part of the interface.

* Fix redactionCommandTest.

* Account for escapeHTML in tests.

* Fix tests.

* stuff not matching with .editorconfig fixes.

* Fix appservice webAPI test.

* Update for MPS 0.23.3.
2024-07-22 16:54:04 +01:00
Aminda Suomalainen ⚧ 8587280cdc [Yarn Classic] Enable corepack & fix pre-commit run --all-files (#472)
* Setup Yarn Classic through Corepack

* pre-commit: use corepack and silence warnings, add .eslintignore's

* .github/workflows/mjolnir.yml: use yarn through corepack

* mx-tester.yml: use corepack

* mx-tester.yml & package.json: replace references to npx and call corepack more

At least yarn build didn't break locally for me, so I think it's supported here too

* rm & gitignore .yarnrc

* mx-tester.yml & package.json: return to npx since yarn dlx doesn't exist in classic
2024-07-04 11:22:33 +01:00
gnuxie 4c2ea7f155 v2.0.0-beta.4 2024-05-29 12:35:18 +01:00
gnuxie 3b20fe1122 Update to MPS v0.22.0. 2024-05-20 16:56:46 +01:00
gnuxie d1950fbb54 Update for new MPS handleExternalInvite handle. 2024-05-13 16:23:26 +01:00
gnuxie 771edf387e v2.0.0-beta.3 2024-05-06 17:48:16 +01:00
Gnuxie be374755bb Update to MPS 0.20.0. (#399)
Part of https://github.com/the-draupnir-project/Draupnir/issues/380.
We've updated typebox and changed the way events are decoded.
2024-05-06 13:51:44 +01:00
gnuxie f8cbaee973 Update to MPS 0.19.1.
This contains a workaround for this issue https://github.com/the-draupnir-project/Draupnir/issues/380
please see https://github.com/Gnuxie/matrix-protection-suite/commit/e57f266da86165c49e5a7e82a25eb7cf2e4709c4.
2024-05-04 18:09:21 +01:00
gnuxie 9ea217c8ca Update for MPS 0.19.0. 2024-05-02 15:57:44 +01:00
gnuxie 005cf6e24f Update typebox to match MPS. 2024-05-02 15:57:44 +01:00
gnuxie 6e16cd7f6d Update for MPS v0.18.2.
This fixes a bug where we use the empty schema to validate
redacted content, which is really bad.
2024-04-22 19:13:09 +01:00
gnuxie a9effe2998 v2.0.0-beta.2 2024-04-22 15:58:50 +01:00
gnuxie 31a1cc7bc8 Update for MPS 0.18.1.
Fixes https://github.com/the-draupnir-project/Draupnir/issues/360
Fixes https://github.com/the-draupnir-project/Draupnir/issues/361
2024-04-22 15:58:09 +01:00
gnuxie 49c5ada4a8 v2.0.0-beta.1 2024-04-19 11:25:13 +01:00
Gnuxie 3d02c72401 Gnuxie/consequence renderer clarity (#356)
* Allow span attributes to be rendered.

* Update for MPS 0.18.0.

* Add some consistency to capability renderers.
2024-04-18 17:32:27 +01:00