* Move to use initial manager as default
* Add Changeset Entry
* Move mangement room options up in the default config
They are more important than the other bullshit
* Improve clarity of management room options in default.yaml
---------
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
Today i got reminded about that our config still thinks various wrong things like that the management room is excluded from protect all rooms when the management room is always protected.
So this PR fixes a few of these config errors.
* Update Configuration file wording.
* Add Changeset Entry
Starts us down the path of fixing https://github.com/the-draupnir-project/Draupnir/issues/1023
This PR gets us Zero Touch Provisioning support for AS mode and Bot mode. If your env can take usr and pswd and turn it into access tokens or however you want to do that then well we dont need to do PSWD Auth at all.
If you dont PSWD auth is useful for this and is probably what i will resort to in mdad for Zero Touch Provisioning.
Draft as this PR is very much not even mx-tested because mx-tester decided to say nope cat.
* Zero Touch Provisioning Support
* Update Account data keys to Gnuxie Suggested Values
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
* Refine ZTD
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Refine Config validation
* Run Prettier
* Fix Test Linting
* Refine ZTD Branch by removing leftover config values.
* Remove fallback management room value as it breaks ZTP
* Fix config validation having Truthy problems
* Fix dangling import.
* Fix config validation error.
* Revert "Fix config validation error."
This reverts commit c313dcbb52.
* Remove fake cast on config.initialManager
* note only available in develop while we fix shit
* Stop tests from accessing config.managementRoom directly.
---------
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
* Add Avatar Command to bot mode and AS mode
* Add changesets
* Move MXC URI validation to matrix basic types
* Fix MediaID being mixed case when its exempt from usual case rules.
* Update changeset
* Integrate Gnuxie Review Feedback
* Fix linting errors
* Fix having forgotten to run prettier.
* Integrate Gnuxie review feedback.
* Fix version.txt.tmp files
* Tighten ActionException wrapping to only accept Error.
For months we had a bug where the "exception kind" enum was being
provided as the error instead of the wrapped error in bot sdk wrapper
code. This exception kind enum was optional in the factory method
being used for the MatrixException type and so this resulted in
draupnir reporting simply `undefined` when there were errors. Which
was a major issue because not only did it make it difficult to track
problems down, but it made the software look like shit. Remarkably we
were still able to remotely diagnose problems essentially blind here.
But it was caused by the ActionException accepting `unknown` for Error
in order to tolerate a number of causes. We figure that this is
unacceptable because it allows for these kinds of bugs and also that
it delays finding out where we are calling broken apis.
Closes https://github.com/the-draupnir-project/Draupnir/issues/759.
Closes https://github.com/the-draupnir-project/planning/issues/137.
* Flakey test idk.
It is a pain in the ass to write the checks but the information itself
is still valuable when refactoring. So I'd rather we still encourage
people to write this shit down even if they don't write the checks.
Closes https://github.com/the-draupnir-project/planning/issues/132
* Make Appservice register and setup basic profile information.
Basic Profile information being setting a display name if none exists.
* Add changeset information
* Relocate Profile logic to after initialisation.
* Clean up Appservice Bot Reg and Profile Set code
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Workaround bug with ensureRegistered in matrix-appservice-bridge.
https://github.com/matrix-org/matrix-appservice-bridge/issues/525
* Clarify that this is mostly dead code
---------
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
This makes it so we use caching across the CI for all our unit tests / integration tests. Supposedly mx-tester was already doing this but now we are also doing it for npm packages.
* Be more precise about licensing.
I've added a root LICENSE file describing the use of multiple licenses
in the repository, especially given that it is now monorepo.
This does not change any licensing terms or introduce new requirements
It makes the existing setup more explicit and easier to understand for
users and downstream distributors. And reflects the existing REUSE
compliant setup.
* Be more comprehensive in our description.
* Add Version command to AS mode admin room
This replicates the status command output giving version string data in a convenient format to AS Admins.
* Add Provision Limit and Force Provision Command
* Add SelfServiceProvisioning Config Flag that defaults to False
This defaults to false due to the currently known problem where Self Service Provisioning ACLs are broken.
So this config exists to allow that codepath to be disabled while we work on fixing it.
* Add Copyright Headers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Split Version Command integration test out into new file.
* Fix Self Service Provision Message
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
* FIx AS.TS
* Clean up Cat's tests
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
* Add sourcemaps to entrypoint
* Make entrypoint run Draupnir relative to the script.
This is important for running draupnir from source either directly in
the directory, from ExecStart in systemd, or from inside the docker
image.
And we're making this change so that we can have better control over
the arguments we start Draupnir with in the different environments
without having to make disruptive changes.
Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
* Add changeset for source installs.
We're gonna write up a proper change log but this is just so we don't forger.
Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
We had to move it but it has virtually no effect downstream as we
distribute the news on the filesystem too.
If something critical happens we can just put a shim on the repo in
the old spot.
Closes https://github.com/the-draupnir-project/planning/issues/111
Looks like this:
```
TypeError: Could not create Draupnir
caused by: @mjolnir:localhost:9999 doesn't have the power level required to send state events in the management room. Please make the Draupnir user an administrator
at ResultError.toExpectError (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:200:12)
at ExpectError (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:128:24)
at Object.expect (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:137:10)
at makeBotModeToggle (/home/user/experiments/Draupnir/apps/draupnir/test/integration/mjolnirSetupUtils.ts:194:5)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at async /home/user/experiments/Draupnir/apps/draupnir/test/integration/manualLaunchScript.ts:23:18
```
Fixes https://github.com/the-draupnir-project/Draupnir/issues/1025
Closes https://github.com/the-draupnir-project/planning/issues/108
* Fix test:manual deleting the prior management room
The old behaviour of leaving any stale management
room active was intentional, to be able to inspect
failed tests and restart the bot quickly to check
changes.
* Check Draupnir can send state to the management room at startup.
Fixes https://github.com/the-draupnir-project/Draupnir/issues/1025
Part of https://github.com/the-draupnir-project/planning/issues/108
* Fix small bug in PowerLevelsMirror.
It was checking the wrong entries for regular events.
Discovered as part of https://github.com/the-draupnir-project/planning/issues/108
* Fix typos in privileged creator APIs
Fixed during https://github.com/the-draupnir-project/planning/issues/108
* Notify management room of lack of state_default permission.
* Update Dockerignore
Updates dockerignore to protect against cache contamination so we can more effectively utilise the full potential of our Cache system.
* Implement Caching strategy support in dockerfile
* Implement Caching for CI to massively speed up warm builds
* Fix Wildcard funkyness breaking docker builds.
* Fix FROM AS style guideline violations
There's a style guideline that says you shouldn't mix the case of FROM and AS in a FROM AS statement. So we fix this violation in this commit.
You can also force it all to lowercase but considering all our other keywords are uppercase why not go uppercase only for consistency.
We're going to try using https://github.com/changesets/changesets to manage our apps/packages changelogs. This won't effect the CHANGELOG.md in the project root, which we will probably still write manually.
The main reason we want this is because it becomes a pain in the ass tracking what sorts of changes have been made over time between package releases. And as package releases will no longer happen for changes to merge onto main (like they had to before), unreleased changes are going to be a lot more common.
* Move src to apps/draupnir/src
https://github.com/the-draupnir-project/planning/issues/100
* Move package.json
https://github.com/the-draupnir-project/planning/issues/100
* Add matrix-basic-types to monorepo.
Get everything working including linting and prettier :3
https://github.com/the-draupnir-project/planning/issues/100
* Add interface-manager to monorepo.
This was a bitch because apparently we forgot to delete node_modules
before creating the workspace package.json. So it had linked a bunch
of local stuff like was in node_modules for Draupnir...
Anyways i think we're still on track.
https://github.com/the-draupnir-project/planning/issues/100
* idk why there are prettier changes in apps but there are.
* Add matrix-protection-suite to monorepo.
https://github.com/the-draupnir-project/planning/issues/100
* Add matrix-protection-suite-for-matrix-bot-sdk
https://github.com/the-draupnir-project/planning/issues/100
We will need to add the real upstreams and versions and remove the
file links as we publish the packages.
* Move mps-interface-adaptor into monorepo
https://github.com/the-draupnir-project/planning/issues/100
Wohoo, i think only draupnir is left now?
* Move Draupnir test files to draupnir directory smh smh smh.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript config for tests and eslint.
Now we get proper linting and type checking of tests.
https://github.com/the-draupnir-project/planning/issues/100
* WIP Integrating draupnir into monorepo tooling...
https://github.com/the-draupnir-project/planning/issues/100
We need to stop aliasing bot-sdk but we should first check that
upstream is using a consistent name too.
* Remove matrix-bot-sdk alias for vector fork.
https://github.com/the-draupnir-project/planning/issues/100
* Add top command description type and weave through API.
A more recent version of typescript meant that the exectutor's
contravariance got checked which destroyed the API so we had to make a
top type for command descriptions and parametrise some of the API.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript errors related to class property initialisation changes.
https://www.typescriptlang.org/tsconfig/#useDefineForClassFields
Seems like they were using defineProperty before which meant
properites were initialised after the constructor ran.
Honestly i like that more but we're going to stick with what they
intend to be the default.
https://github.com/the-draupnir-project/planning/issues/100
* Fix tests lacking fixtures context.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript errors related to error destructuring in tests.
https://github.com/the-draupnir-project/planning/issues/100
* Pin postgres package to workaround upstream issue
https://github.com/porsager/postgres/issues/1150
Documented in DEPENDENCIES.md
https://github.com/the-draupnir-project/planning/issues/100
* Fix contravariance issue in hash store helper.
Part of the TS 5.9 upgrade fallout.
https://github.com/the-draupnir-project/planning/issues/100
* Fix minor typescript 5.9 migration issuess
All typescript errors finished, yay.
* Fix REUSE missing headers.
* Fix assets script in draupnir app.
* Add Draupnir to eslint scope
* Remove the appservice web API.
There are too many eslint errors here to do with unsafe parsing of
properties from the body etc. And there's actually no consumers to
this API. It's also a widget API, and all it does is provision the bot
and nothing more.
* Fix eslint config for DeadDocumentJSX.
It wasn't working well with the jsx templates.
We should probably delete the tsconfig.eslint.json shite now.
* Update src/utils.ts for eslint.
This shit is legacy i hate it.
* Fix eslint errors in config.
Really this is paint over rot since the config doesn't have a schema,
and we can't really make one either.
* Fix eslint issues in ReportManager.
This code is diabolical. It hasn't really been fixed that will take
refactoring and making sure people don't write this sorts of bad code
ever again. Which thankfully we have process in place for.
* Fix clientHelper eslint issues.
* Fix eslint for ImportCommand.
* Grinding eslint fml.
* Fix miscellaneous eslint issues.
* allow no-deprecate for logMessage.
shit's being annoying.
* Fix remaining eslint issues...
We also deleted one of the scripts used to evaluate the performance of
various endpoints, which we were not using.
* Give bot toggle asyncDispose for code consistency.
* Fix package.json access issues.
* Adjust Docker and CI for new app location in monorepo.
* Fix broken integration tests.
* Remove prepare script from matrix-protection-suite package.
Isn't needed anymore
* Fix build:all script missing base files.
* Remove test script from matrix-protection-suite-for-matrix-bot-sdk
It doesn't have any tests :/
* Order of setup is wrong in integration test workflows.
* Fix mps interface adaptor doesn't have any tests.
* Fix appservice registration for test harness.
* Fix matrix-basic-types jest configuration
* Fix no build step in mjolnir.yaml
* Transfer common dev dependencies to the workspace root.
They were just wrong.
* GHCR Separate Workflows
* GHCR Standalone Publishing Refinements
* Docker Hub Publishing Refinements
* Add Development Build Artefact Generation and Publishing
This only runs against non Excluded branches as to be practical.
* Fix GHCR Deployment due to Uppercase Names and Main Branch Exclusion
* Fix Github ignoring Branch filters for Develop Workflow
* Harmonise Development Artifact Workflows
* Improve Docker Hub Development Artefact Metadata
The keys on the capability provider set are arbritrary property names
set by the protection, not the interface names as there can be
multiple capabilities that share the same interface.
* fix spurious error log line regarding room takedowns when the room has already been taken down.
This is normal, and while generally the bot shouldn't attempt to take down the same rooms which succeeded in the past, there's no way of knowing that the room hasn't
been unblocked by the synapse admin API while draupnir was offline.
Because there's no endpoint to get only the blocked rooms, we have to attempt to block them all again, but what we can do is lower that from critical severity to debug, since it's not actually a fatal error at all.
* prettier
---------
Co-authored-by: esoteric_programmer <nomail@no.email>