Commit Graph

710 Commits

Author SHA1 Message Date
MTRNord 246aa14554 Debug failing admin commands 2023-10-20 15:16:36 +02:00
MTRNord 55bd72d6bf Add missing package.json to image and update to node 20 2023-09-14 09:53:09 +02:00
MTRNord 632cac5baf Fix repository path 2023-09-14 09:50:33 +02:00
MTRNord a84fa884bd Make Dockerfile more reliable for multiarch 2023-09-14 09:49:33 +02:00
MTRNord daa8d4091d Merge commit 'efe842cc9f6fc67185702169933ecf7408bcb2e8' into MTRNord/draupnir4all 2023-09-13 11:09:13 +02:00
gnuxie efe842cc9f v1.85.1 v1.85.1 2023-09-12 11:58:14 +01:00
Gnuxie 69b7209739 Fix RoomUpdateError roomId argument typo (#123)
We were clearly in the process of deleting the
member decleration to just have the decleration be in the constructor.

When we were distracted, leaving a property named `readonly`, which
shouldn't be possible imo, need to add some rule for that prompto.
2023-09-12 11:57:50 +01:00
dependabot[bot] 272d81946b Bump config and @types/config (#118)
Bumps [config](https://github.com/node-config/node-config) and [@types/config](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/config). These dependencies needed to be updated together.

Updates `config` from 3.3.8 to 3.3.9
- [Release notes](https://github.com/node-config/node-config/releases)
- [Changelog](https://github.com/node-config/node-config/blob/master/History.md)
- [Commits](https://github.com/node-config/node-config/compare/v3.3.8...v3.3.9)

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

---
updated-dependencies:
- dependency-name: config
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: "@types/config"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 15:08:49 +01:00
Aminda Suomalainen 6694bf547e dependabot.yml: rename everything to github-actions (#120)
I didn't know the "everything" would be visible in PR title like that and it bothers me as it's not really "everything", it's just github-actions.
2023-09-11 15:04:28 +01:00
dependabot[bot] a328f52558 Bump yaml from 2.2.2 to 2.3.2 (#111)
Bumps [yaml](https://github.com/eemeli/yaml) from 2.2.2 to 2.3.2.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.2.2...v2.3.2)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 15:03:58 +01:00
dependabot[bot] 2330ddc719 Bump the everything group with 4 updates (#115)
Bumps the everything group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [docker/login-action](https://github.com/docker/login-action) and [baptiste0928/cargo-install](https://github.com/baptiste0928/cargo-install).


Updates `actions/checkout` from 2 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

Updates `docker/setup-buildx-action` from 2.6.0 to 2.10.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.6.0...v2.10.0)

Updates `docker/login-action` from 1 to 2
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v2)

Updates `baptiste0928/cargo-install` from 1 to 2
- [Release notes](https://github.com/baptiste0928/cargo-install/releases)
- [Changelog](https://github.com/baptiste0928/cargo-install/blob/main/CHANGELOG.md)
- [Commits](https://github.com/baptiste0928/cargo-install/compare/v1...v2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: everything
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: everything
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: everything
- dependency-name: baptiste0928/cargo-install
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: everything
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 14:44:16 +01:00
dependabot[bot] 0112a995b7 Bump the development-dependencies group with 9 updates (#116)
Bumps the development-dependencies group with 9 updates:

| Package | From | To |
| --- | --- | --- |
| [@types/crypto-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/crypto-js) | `4.0.2` | `4.1.2` |
| [@types/nedb](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/nedb) | `1.8.12` | `1.8.13` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `18.16.7` | `20.6.0` |
| [eslint](https://github.com/eslint/eslint) | `7.32.0` | `8.49.0` |
| [expect](https://github.com/jestjs/jest/tree/HEAD/packages/expect) | `27.2.4` | `29.6.4` |
| [mocha](https://github.com/mochajs/mocha) | `9.2.2` | `10.2.0` |
| [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) | `9.0.0` | `10.0.1` |
| [ts-mocha](https://github.com/piotrwitek/ts-mocha) | `9.0.2` | `10.0.0` |
| [typescript](https://github.com/Microsoft/TypeScript) | `5.1.6` | `5.2.2` |


Updates `@types/crypto-js` from 4.0.2 to 4.1.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/crypto-js)

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

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

Updates `eslint` from 7.32.0 to 8.49.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/v7.32.0...v8.49.0)

Updates `expect` from 27.2.4 to 29.6.4
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v29.6.4/packages/expect)

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

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

Updates `ts-mocha` from 9.0.2 to 10.0.0
- [Release notes](https://github.com/piotrwitek/ts-mocha/releases)
- [Changelog](https://github.com/piotrwitek/ts-mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/piotrwitek/ts-mocha/commits)

Updates `typescript` from 5.1.6 to 5.2.2
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.2.2)

---
updated-dependencies:
- dependency-name: "@types/crypto-js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: "@types/nedb"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development-dependencies
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: expect
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: ts-mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: development-dependencies
- dependency-name: typescript
  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>
2023-09-11 13:38:45 +01:00
Aminda Suomalainen ee33c9aa18 .github/dependabot.yml: attempt to group updates (#114)
* .github/dependabot.yml: first attempt at grouping production & development dependencies

Resolves: #113

* dependabot: don't group production depedencies

* dependabot: group GitHub actions
2023-09-11 13:28:38 +01:00
Aminda Suomalainen fe7f388d0e .github/dependabot.yml: explicitly configure dependabot (#103) 2023-09-11 11:15:06 +01:00
Marcel 645dd8950f Upgrade matrix-appservice bridge to ^9.0.1 (#102) 2023-09-11 11:08:16 +01:00
MTRNord ab7dd7f03e Cache the own profile 2023-09-10 16:05:05 +02:00
MTRNord 3a7f581441 fix typo 2023-09-09 16:13:14 +02:00
MTRNord 96177b113f Use similar logic from main command handler in appservice command handler to make it more reliable with displaynames 2023-09-09 16:08:40 +02:00
MTRNord f2fe0b984c Add missing await 2023-09-09 15:55:41 +02:00
MTRNord b3d4bcb6ed Get logging for admin commands 2023-09-09 15:53:00 +02:00
MTRNord 6560be1cc7 Make admin commands work if the displayname was changed 2023-09-09 15:38:57 +02:00
MTRNord f78d69530e Update D4All to matrix-appservice-bridge@9.0.1 2023-09-09 12:30:32 +02:00
gnuxie fb0199fdc9 v1.85.0 v1.85.0 2023-09-07 16:00:02 +01:00
Gnuxie 26468afcde Only CommandExceptions should log at creation. (#99)
Before CommandError's where and they are used
liberally for validating command arguments by
returning a CommandResult for several possible
options. Which gives a lot of spam. It's not necessary
anyways since these should only be used for known errors.
2023-09-07 15:59:20 +01:00
Gnuxie 4b656306ed Deprecate config.verboseLogging (#98)
Shouldn't change what is being logged to the log file,
but it does change what gets sent to the management room.
I've been meaning to disable this for some time as it generally
confuses new users and it makes the bot feel very confusing and
low quality. It also means you are likely to miss more important
messages in the magement room.

Another problem it causes is an inconsistent view when testing
the software and it's an unreasonable burden to test for both
settings.

It's not clear what the value of this setting is apart from
providing comfort to some users who want to see the ACL readout.
But even then it's a very inefficient way of doing that,
so i'd rather another feature be requested by users that want to see that.
2023-09-07 15:27:00 +01:00
Gnuxie bef21850e8 Use --forbid-only flag in integration test suite. (#97)
Yes this has happened again, at least we know how to fix it now.
2023-09-07 14:13:26 +01:00
MTRNord a924a19666 Replace loop with generator 2023-09-06 11:24:19 +02:00
gnuxie 9d841697b2 Rework RoomUpdateErrors to be CommandErrors or CommandExceptions
https://github.com/Gnuxie/Draupnir/pull/93/
2023-09-05 19:53:02 +01:00
gnuxie 3ec37e3fe8 Introduce concept of Known and Unknown exceptions.
Sometimes we don't need exceptions to be reported on the error level.
This is especially true when the user does something out of order
and there's a permission error.
If we're aware of that possibility as developers and have accounted
for it, then it's unnecessary for it to be treated the same way
as a fatal error.

We also decided to log CommandExceptions and CommandErrors as
early as possible.

https://github.com/Gnuxie/Draupnir/pull/93/
2023-09-05 19:53:02 +01:00
gnuxie 73601687a8 Add UnbanPropagation BanPropagationProtection.
https://github.com/Gnuxie/Draupnir/pull/93/
2023-09-05 19:53:02 +01:00
MTRNord 3f06a25477 Add missing await 2023-09-05 20:34:30 +02:00
MTRNord 0c85d32098 try to speedup starting the bots 2023-09-05 17:30:21 +02:00
gnuxie 29a8bec086 Bring various documentation up to date with current events. 2023-09-04 20:44:11 +01:00
gnuxie 2a4829dc1e Use <details> for error detail.
https://matrix.to/#/!IaWNErZAgQUhGqJXjX:matrix.org/$634tyYnNJK_zpNb4wH1zHbYeMOsDBHMpwdWPg1GdAEU?via=matrix.org&via=the-apothecary.club&via=envs.net
2023-09-04 15:25:35 +01:00
gnuxie e8847a2524 Allow Draupnir to ignore m.room.server_acl
https://github.com/Gnuxie/Draupnir/pull/85
2023-09-04 15:25:35 +01:00
gnuxie 1e82c15d82 Add font tag to DeadDocument
https://github.com/Gnuxie/Draupnir/pull/85
2023-09-04 15:25:35 +01:00
gnuxie ea49b0a536 Use JSX for the protected rooms set's printActionResult.
We've done this to make the implementation a lot cleaner and
managable. However, we've taken the opportunity to simplify
all of the client code that would use this method.

Some of these simplifications might come at a small cost.
Updating server ACL, member bans and checking power levels
would all be clearly titled as seperate checks.
However, it should still be obvious what has gone wrong,
since any error would have to give a more detailed explanation.
And not everything is going to fail all at once (and if it does,
there are bigger issues).

a lot cleaner
https://github.com/Gnuxie/Draupnir/pull/85
2023-09-04 15:25:35 +01:00
gnuxie 601aa33bc6 Remove Mjolnir's ErrorCache.
A bizarre contraption.
The ErrorCache was seemingly introduced to reduce the number of errors
in the management room.
https://github.com/matrix-org/mjolnir/commit/82214c6cd88d83abed05fec4a871a874e6e0265b
It makes sense why it was added if you consider that many admins
will run Draupnir without giving it the permission to manage server
ACL in its rooms. Though, I'm not sure why then you would add the error
cache rather than properly supporting that use case.
So perhaps there were other reasons.
Either way, what is drawing the line for me is that the ErrorCache
will suppress any error within rooms that is not a permission error,
if there was any error that was not a permission error within a
15 minute window.
Considering the typical Draupnir will not even sync
for hours at a time, even in large communities.
It does present a problem for rooms with a lot of join/leave events.
I think that's probably why the error cache was added.

Ahh, well, fuck.

Well what is the real solution to this?

The real solution when the kind is acl is to allow the bot to run
without applying ACLs.

Ok fine but, hey wait a minute.
Why would there be any other kind of persistent error
when banning someone that would be unimportant enough to silently
hide in an ErrorCache??

IDK let's just add an opttion to disable server ACL,
since they might want to use another tool for that anyhow.

Out of scope for the current work though.
https://github.com/Gnuxie/Draupnir/pull/85
2023-09-04 15:25:35 +01:00
MTRNord 54eea7972d Fix merge conflicts 2023-09-04 14:23:08 +02:00
Aminda Suomalainen bc0fc7c25a package.json: refer to https clone url (#90)
Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
2023-09-04 12:38:07 +01:00
dependabot[bot] c9cc5693ac Bump matrix-appservice-bridge from 8.1.1 to 8.1.2 (#71)
Bumps [matrix-appservice-bridge](https://github.com/matrix-org/matrix-appservice-bridge) from 8.1.1 to 8.1.2.
- [Release notes](https://github.com/matrix-org/matrix-appservice-bridge/releases)
- [Changelog](https://github.com/matrix-org/matrix-appservice-bridge/blob/8.1.2/CHANGELOG.md)
- [Commits](https://github.com/matrix-org/matrix-appservice-bridge/compare/8.1.1...8.1.2)

---
updated-dependencies:
- dependency-name: matrix-appservice-bridge
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 12:37:09 +01:00
Marcel 0de9ad3333 Add command that allows to easily set the Displayname of a bot (#91)
This adds the `displayname` command which just sets the displayname of the user.

-----

* Add command that allows to easily set the Displayname of a bot

* Only set the displayname once

* Add missing matrix interface adaptor and use CommandError

* Make displaynames with spaces work
2023-09-04 12:34:26 +01:00
Marcel f55d8a453d Add health endpoint to appservice and add metrics via prometheus (#70)
This adds a `/healthz` endpoint to the appservice which allows this to work more nicely in kubernetes.

It also adds some metrics for tracking the provisioning state.

Grafana result:
![image](https://github.com/Gnuxie/Draupnir/assets/1374914/9426c8e6-2c1c-469c-8902-1b9e2b6db529)

Note: The ts-ignore are sadly required since the `_getValue` method is not public :/ I didnt find another solution apart from tracking it maybe elsewhere.

* Add health endpoint to appservice and add metrics via prometheus

* Ensure that we dont have duplicate metrics when the appservice is registered multiple times

* Move gauge modifications to utils function

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

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

* Fix typo
2023-09-04 12:32:26 +01:00
Marcel 2ea8ddf864 Use the new help style on the appservice commands and add missing descriptions for the arguments (#69)
* Use the new help style on the appservice commands and add missing descriptions for the arguments

* Make the first letter of the table name uppercase in the help table
2023-09-04 12:30:50 +01:00
MTRNord 0204fb5139 Return the trace id instead of a random UUID if there is one available 2023-09-03 16:17:41 +02:00
MTRNord f03ad33e99 Make displaynames with spaces work 2023-09-03 15:48:45 +02:00
MTRNord 80e3578011 Make displaynames with spaces work 2023-09-03 15:44:47 +02:00
MTRNord b67bae2cd1 Add missing matrix interface adaptor and use CommandError 2023-09-03 15:37:22 +02:00
MTRNord 4f4487c58e Only set the displayname once 2023-09-03 15:18:55 +02:00
MTRNord 493f7a9d6b Make sure we catch the 404 2023-09-03 14:55:36 +02:00