Commit Graph
637 Commits
Author SHA1 Message Date
gnuxie 0f014afbbb Add "*.gif" to git-lfs in prepearation for GIFs!! wohoo. 2023-09-14 16:48:51 +01:00
Marcel b38a4159a9 Bump the dockerfile to node 20 (#129)
* Bump the CI and dockerfile to node 20

* Revert bumping the CI
2023-09-13 22:05:31 +01:00
Marcel d620ffa206 Move to eslint (#88)
* Move to eslint

* Cleanup leftover tslint

* Cleanup the eslint config file
2023-09-13 12:26:51 +01:00
Aminda Suomalainen b21c0a1df9 Decrease dependency update check to weekly (#124)
* .pre-commit-config.yaml: check ci updates weekly

* dependabot.yml: check for updates weekly instead of daily
2023-09-12 13:24:29 +01: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
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
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
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
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
Aminda Suomalainen e3925afc3b .editorconfig: fix invalid value s/off/unset/g (#86)
* .editorconfig: s/off/unset/g

This was breaking prettier and neovim as apparently off was invalid value

* .editorconfig: merge the two unset rule blocks
2023-09-01 11:28:29 +01:00
Gnuxie 0a7305b8fa A simple script for testing room membership query. (#81)
https://github.com/Gnuxie/Draupnir/issues/80
2023-08-29 13:56:33 +01:00
Aminda Suomalainenandgnuxie e4c02b96cd Add pre-commit configuration (#34)
* add .pre-commit-config.yaml

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>

* .editorconfig: decrease indent size for text

* .pre-commit-config.yaml: remove prettier

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>

* .editorconfig consistency.

* .pre-commit-config.yaml: restore sample hooks

* .editorconfig: disable indent_size for LICENSE & NOTICE

* pre-commit run --all-files

* tsconfig.json: tabs to spaces

* .pre-commit-config.yaml: update editorconfig-checker to 2.7.2

* .editorconfig: disable indent_size for markdown

* mjolnir-entrypoint.sh: retab

* .editorconfig: also exclude json from indent checking

* test/nginx.conf: retab

* test/integration/commands/redactCommandTest.ts: remove leading space

* retab or remove leading whitespaces for the rest of the files

* src/appservice/datastore.ts remove newlines

* test/integration/commands/roomTest.ts: remove leading space.

---------

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2023-08-29 13:38:00 +01:00
Gnuxie 56ddbdf96c Failure to ban a single member should not stop other bans being applied. (#79)
Fixes https://github.com/Gnuxie/Draupnir/issues/74.
2023-08-28 16:38:24 +01:00
Catalan Loverandgnuxie 53d79f5ded D4A: Give the requesting user admin in management room at creation. (#73)
The requesting user would previously be unable to manage the room in order to change the room name etc.

Co-authored-by: gnuxie <Gnuxie@protonmail.com>
2023-08-28 12:38:48 +01:00
Marcel 39e2b50c13 Add a missing dash to the docker command in the appservice documentation (#61) 2023-08-22 17:40:37 +01:00
Marcel 1f9d37564b Update to typescript 5 (#68) 2023-08-19 14:46:23 +01:00
dependabot[bot] e64aded3bd Bump word-wrap from 1.2.3 to 1.2.4 (#67)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 12:39:04 +01:00
dependabot[bot] 18f5f59a4e Bump semver from 5.7.1 to 5.7.2 (#66)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 18:03:44 +01:00
gnuxie df432121de v1.84.0 v1.84.0 2023-07-04 17:31:46 +01:00
Gnuxie c11fb6ef06 Fix an issue where protected rooms could not be removed. (#65)
This was introduced in https://github.com/Gnuxie/Draupnir/pull/54/ (and therefore 1.83.0). Essentially we forgot to remove the room from the protected rooms set, when the remove command was used.

Ontop of this something to note is that during testing it is clear that the protected rooms set is loaded when configuring mjolnir, not when starting it. This is problematic as it means setup code in `fixtures.ts` does not actually wipe the protected rooms set.
2023-07-04 17:19:03 +01:00
Marcel 8894e29606 Multiarch CI fixes (#59)
* Also build arm images

* Increase docker timeout for qemu and install missing parts in CI for multiplatform building
2023-06-12 23:34:38 +01:00
Marcel b3f0c6e222 Also build arm images (#58)
Based on https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
https://github.com/docker/build-push-action and https://docs.docker.com/engine/reference/commandline/buildx_build/#platform
2023-06-12 15:09:00 +01:00
Gnuxie ea3947df9f Typo unwatching lists. (#55)
This is actually really bad.
For multiple reasons.
The best way for this to be avoided is to drop everything
and reload it when the account data for watched lists is changed.
Then there isn't a situation where you have to inform anyone
about a change in what lists are being watched.
2023-06-08 17:03:42 +01:00
Gnuxie bed8f72686 v1.83.0 v1.83.0 2023-05-31 17:44:11 +01:00
Gnuxie 17dedbd531 Merge pull request #54 from Gnuxie/gnuxie/rooms-command-upgrade
Use interface manager for "rooms", "rooms add" and "rooms remove" commands.
2023-05-30 11:28:22 +01:00
gnuxie fe349d42fb Clear up the "rooms add" error message when a room cannot be joined. 2023-05-30 11:14:49 +01:00
gnuxie e4689b1287 basic conversion of rooms commands to interface adaptor 2023-05-30 11:14:49 +01:00