Commit Graph

939 Commits

Author SHA1 Message Date
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
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 10528943a6 request response was typed incorrectly leading to checks being omitted. (#492)
Issue was reported by @daedric7 in the support room.  https://matrix.to/#/%21IaWNErZAgQUhGqJXjX%3Amatrix.org/%24KJt2FOE9PLM2oqUgwTt5JxIAWbXPWZi03SlBZgwX7P8?via=matrix.org&via=envs.net&via=ubuntu.com
2024-07-26 10:31:29 +01:00
Gnuxie 337a6a3b76 Add reuse.software (#486)
We have a lot of verbose headers, and i think now is the best opportunity we have to become reuse compliant given that we just did two other similar maintenance changes (prettier, typescirpt5 & eslint9 & typescript-eslint).

* synapse_antispam resuse headers.

* delete old unused tslint.json.

* Add REUSE to pre-commit config.

* reuse info for config directory.
2024-07-25 10:58:40 +01:00
Gnuxie 96889fb7b7 Merge pull request #484 from the-draupnir-project/gnuxie/prettier-3 Add prettier
This is probably going to be the best opportunity that we have to add and run prettier given that we just added typescript-eslint strict and we're coming out of a huge refactor.
2024-07-22 19:29:14 +01:00
gnuxie 20150c46ee Ignore the commit that we used to first run prettier. 2024-07-22 19:15:48 +01:00
pre-commit-ci[bot] 3b2036c2db prettier all files 2024-07-22 19:13:57 +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
Marcel 87222588f9 Remove the attest step until we figure out how it is meant to work (#479)
* Remove the attest step until we figure out how it is meant to work

* Fix end of files
2024-07-19 09:53:56 +01:00
Marcel d334912706 Ensure that we use the correct docker registry (#478)
This is stated at https://github.com/actions/attest-build-provenance/blob/456d685447f4ceab20b87f8042f8f14bbb71dafc/README.md?plain=1#L187-L188 but I missed it.
2024-07-18 10:01:46 +01:00
Marcel 337d7c72a6 Add SBOM and Attestation to the Docker release process (#477)
* feat: Add SBOM and Attestation to the Docker release process. Also ensure we only deploy platforms on the qemu action as needed and update versions.

This also limits the permissions used

* fix: Make sure there is an empty line at the end of the file

* Fix the qemu platforms
2024-07-18 09:44:56 +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
morguldir 7f01383974 Avoid invalid createRoom calls when making a list as the draupnir user (#471)
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-07-01 17:44:52 +01:00
dependabot[bot] c1a4d6147d Bump ws from 8.16.0 to 8.17.1 (#457)
Bumps [ws](https://github.com/websockets/ws) from 8.16.0 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.16.0...8.17.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 13:33:40 +01:00
dependabot[bot] 459917febd Bump braces from 3.0.2 to 3.0.3 (#459)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 12:51:17 +01:00
Gnuxie 908f558cc4 Stop declaring typescript JSX config as global. (#455) 2024-06-17 13:13:25 +01:00
Gnuxie 54437ee000 Merge pull request #454 from the-draupnir-project/gnuxie/dead-document
TypeCheck JSX expressions, children, and attributes ^-^
2024-06-15 20:56:11 +01:00
gnuxie d0cc9caea9 Bugs caught by the new JSX type checker x3 2024-06-15 20:29:10 +01:00
gnuxie 3b969b1c5a Add type checking for org.matrix.custom.html in DeadDocument.
Awesome.

The documentation was not very explicit, I had to play around
a lot to figure it out but I'm so happy that this works.
https://www.typescriptlang.org/docs/handbook/jsx.html.

Please note that `undefined` as a child will not be caught
yet, as we need to enable `exactOptionalPropertyTypes` for
this to work.
2024-06-15 20:29:10 +01:00
Aminda Suomalainen ⚧ c4ac8ad4ee .pre-commit-config.yaml: add local hook to run linting (#87)
Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
2024-06-08 17:57:56 +01:00
dependabot[bot] 27e058711e Bump actions/github-script from 6 to 7 in the github-actions group (#398)
Bumps the github-actions group with 1 update: [actions/github-script](https://github.com/actions/github-script).


Updates `actions/github-script` from 6 to 7
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-29 14:56:23 +01:00