Commit Graph

11 Commits

Author SHA1 Message Date
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
pre-commit-ci[bot]
3b2036c2db prettier all files 2024-07-22 19:13:57 +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
gnuxie
c9db033043 fix utilsTest.ts 2024-04-06 20:03:37 +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
598f5483d9 type guards for updated Permalink helper 2023-03-09 15:20:52 +00:00
Gnuxie
77ad40e27a Refactor protected rooms. (#371)
* Attempt to factor out protected rooms from Mjolnir.

This is useful to the appservice because it means we don't
have to wrap a Mjolnir that is designed to sync.

It's also useful if we later on want to have specific
settings per space.

It's also just a nice seperation between Mjolnir's needs while
syncing via client-server and the behaviour of syncing policy rooms.

 ### Things that have changed

- `ErrorCache` no longer a static class (phew), gets used by `ProtectedRooms`.
- `ManagementRoomOutput` class gets created to handle logging back to the management room.
- Responsibilities for syncing member bans and server ACL are handled by `ProtectedRooms`.
- Responsibilities for watched lists should be moved to `ProtectedRooms` if they haven't been.
- `EventRedactionQueue` is moved to `ProtectedRooms` since this needs to happen after
  member bans.
- ApplyServerAcls moved to `ProtectedRooms`
- ApplyMemberBans move to `ProtectedRooms`
- `logMessage` and `replaceRoomIdsWithPills` moved to `ManagementRoomOutput`.
- `resyncJoinedRooms` has been made a little more clear, though I am concerned about how often it does run because it does seem expensive.


* ProtectedRooms is not supposed to track joined rooms.

The reason is because it is supposed to represent a specific
set of rooms to protect, not do horrible logic
for working out what rooms mjolnir is supposed to protect.
2022-09-29 14:49:09 +01:00
Jess Porter
10b7233e48 matrix.to urls for aliases don't need a via param (#348) 2022-08-18 09:37:30 +01:00
Jess Porter
4376679b99 load config yaml manually, remove more references to static config (#347) 2022-08-16 15:51:18 +01:00
Jess Porter
a58c7d3f1a move LogProxy.logMessage to Mjolnir.logMessage (#194) 2022-02-15 15:44:41 +00:00
Jess Porter
58e228be7d make roomIds param on replaceRoomIdsWithPills a Set<string> (#146) 2022-02-02 17:35:02 +00:00