Commit Graph

607 Commits

Author SHA1 Message Date
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 Suomalainen 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 Lover 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
gnuxie 89e25786f5 Support matrix.to URLs as MatrixRoomReferences in CommandReader. 2023-05-30 11:14:49 +01:00
gnuxie 006ba3dd1e Improve error reporting of CommandException 2023-05-30 11:14:49 +01:00
Gnuxie 8e1f930240 Merge pull request #52 from Gnuxie/gnuxie/update-to-node-18
Update to node 18.
2023-05-13 15:45:30 +01:00
Gnuxie 3ad7079216 Appservice test: postgres container networking.
The docker network is ipv4 but we tell node it can use `localhost`
which it then tries to connect to via ipv6.
2023-05-13 15:32:17 +01:00
Gnuxie c16c5d29e1 Integration tests convenience nginx should listen to ipv6 too. 2023-05-13 15:21:21 +01:00
gnuxie 3c007083f7 v1.82.0 v1.82.0 2023-05-13 03:09:38 +01:00
Gnuxie 88bf0acf5e Add the sender when showing a policy rule change. (#51)
![image](https://github.com/Gnuxie/Draupnir/assets/50846879/1e445d60-d816-4bd1-bec2-c6b4128793d7)

Mainly useful for Community Moderation Effort.
2023-05-10 23:07:32 +01:00
gnuxie c14fbeb183 Update github actions workflows to use node 18. 2023-05-10 20:10:13 +01:00
gnuxie 74312e43f6 Update to node 18.
End of life was moved forwards by 7 months so we don't have a choice.
https://nodejs.org/en/blog/announcements/nodejs16-eol.
2023-05-10 19:57:17 +01:00
Gnuxie 9f43e1186b Incorperate Do not interrupt redact sequences due to error when backfilling (#50)
* Do not interrupt redact sequences due to error when backfilling

... Mainly timeouts.

* Change caught redaction error LogLevel from DEBUG to ERROR.

From matrix-org/mjolnir#479

---------

Co-authored-by: Marco Cirillo <marco.cirillo@aria-net.org>
2023-05-03 16:56:17 +01:00
Gnuxie 99e6f168ca Appservice convenience (#47)
Canonicalise the existence of the "admin room" for managing the appservice and Draupnir instances

* Add utilities for managing users in the admin room

* Merge the appservice admin room and access control list.

The majority of admins will need to use the draupnir admin commands
to manage the list.

* Utility methods for creating generic rules in PolicyLists.

* Commands for managing appservice users.
2023-05-03 16:31:28 +01:00
Gnuxie 449e48b486 Detail about important Draupnir concepts and context. (#48)
* Detail about important Draupnir concepts and context.

Stuff that is essential to understand if there's any hope of
maintaining this shit.

* Notes about the ban command.

* link to context in CONTRIBUTING.
2023-05-03 16:25:41 +01:00
dependabot[bot] 4e0e832855 Bump yaml from 2.1.1 to 2.2.2 (#49)
Bumps [yaml](https://github.com/eemeli/yaml) from 2.1.1 to 2.2.2.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.1.1...v2.2.2)

---
updated-dependencies:
- dependency-name: yaml
  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-04-28 22:30:02 +01:00
Gnuxie 9e8783312a Use matrix-appservice-bridge's PostgreSQL datastore for Draupnir appservice (#46)
* use matrix-appservice-bridge support for postgres

* upgrade matrix-appservice-bridge to include postgres fixes.

These are unreleased and a specific develop commit, but we're the only ones
who have made changes so far to the develop branch,
so should be fine.

* Upgrade matrix-appservice-bridge to 8.1.1.

8.0.1 was never added to npm for some weird reason.
2023-03-31 18:16:23 +01:00
gnuxie d8ef8a94d9 v1.81.4 v1.81.4 2023-03-28 22:01:47 +01:00
gnuxie 2d78cbbee5 Remember to resolve policy lists where we can. 2023-03-28 22:00:50 +01:00
gnuxie 7de96bda34 v1.81.3 v1.81.3 2023-03-28 20:01:27 +01:00
Gnuxie 924bed5813 PolicyListManager watch/unwatch should use MatrixRoomReferences. (#42) 2023-03-28 19:55:34 +01:00
gnuxie 0f8826f810 v1.81.2 v1.81.2 2023-03-28 14:03:00 +01:00
gnuxie 7750773a7f Glue was calling shutdown room rather than deactivate user. 2023-03-28 13:53:58 +01:00
gnuxie 1fbeda0d4c Stop MatrixReactionHandler reacting to itself. 2023-03-24 18:57:25 +00:00
gnuxie 492230d61d Update references to a now non-existant IProtection in tests. 2023-03-24 18:57:25 +00:00
gnuxie 81b0c9a20d Yeah i don't have to spoons for this test matey.
If you're reading this commit and this is the hill you want to die on
for judging Gnuxie then lol go die on it.
2023-03-24 18:57:25 +00:00
gnuxie 1a73492178 Update protectionSettingsTest for Protection changes.
Worried about when IProtection existed and when it was removed??
Idk but this wasn't going great to begin with.
2023-03-24 18:57:25 +00:00
gnuxie 06b3f71c92 Update BanPropagationProtection to use MatrixReactionHandler. 2023-03-24 18:57:25 +00:00
gnuxie f565b010a4 Add MatrixReactionHandler that allows us to create advanced prompts.
These prompts don't have a timeout and don't need a backing store,
so this is ideal for the ban propagation protection.
2023-03-24 18:57:25 +00:00
gnuxie d390ce8772 Allow protections to hook into mjolnir startup. 2023-03-24 18:57:25 +00:00
gnuxie 009ece3281 v1.81.1 v1.81.1 2023-03-16 20:36:41 +00:00
gnuxie ffcc3c6804 Bugfix: !draupnir status was matching against !draupnir joins. 2023-03-14 13:42:59 +00:00
gnuxie a0ffb0d315 Github release action won't sync tags with remote. 2023-03-14 12:53:04 +00:00