889 Commits

Author SHA1 Message Date
Michael Weimann
46e1008942
Fix widget config detection (#657)
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-03-17 14:05:04 +00:00
Half-Shot
0d0cc6b3da fix push 2023-03-17 13:57:50 +00:00
Half-Shot
0dc2512e10 only log in if we're pushing 2023-03-17 13:55:15 +00:00
Will Hunt
7faa3f031e
Run docker CI for pull requests too (#662)
* Do a docker build for pull requests too

* drop branch limit for push

* changelog
2023-03-17 13:51:24 +00:00
Tadeusz Sośnierz
7cd59f3774
Add a go-neb migrator (#647)
* Add a go-neb migrator, capable of migrating RSS/Atom feeds to hookshot (so far)

* Add forgotten file

* Fix useCallback() usage

* Gracefully handle go-neb not being configured

* Make Feed URLs not editable when they're being migrated over from go-neb

https://github.com/matrix-org/matrix-hookshot/pull/647#discussion_r1131615944

* Changelog

* Linting

* Add the ability to migrate Github repo connections from go-neb (#651)

* Add the ability to migrate Github repo connections from go-neb

* Gracefully handle the lack of go-neb migrator

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>

* Handle Scalar-style go-neb service IDs (#656)

* Add the ability to migrate Github repo connections from go-neb

* Handle Scalar-style go-neb service IDs

* Make service type in service ID match the Scalar-generated one

https://github.com/matrix-org/matrix-hookshot/pull/656#discussion_r1131647595

* Safeguard against undefined hardcoded service IDs

https://github.com/matrix-org/matrix-hookshot/pull/656#discussion_r1131646578

* Rename a variable

https://github.com/matrix-org/matrix-hookshot/pull/656#discussion_r1131710225

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>

* Linting

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
2023-03-17 14:25:35 +01:00
Will Hunt
b8bb51fd1f
Fix service bots not rejecting invites on incoming DMs (#659)
* Manually send a reason on a leave for now

* changelog
2023-03-14 22:35:16 +00:00
Will Hunt
55529d7128
Add support for OAuth login to GitHub via widget (including adding new installations) (#661)
* WIP

* Update vite

* Add oauth landing page

* Add API support for GitHub oauthing

* Remove console.logs

* Add support for logging and and out of GitHub

* Add bridge API methods

* Add base link styling

* Sugar syntax main get

* Update vite

* changelog

* Review changes

* Use instance to match UI

* lint

---------

Co-authored-by: Justin Carlson <justinc@element.io>
2023-03-14 10:50:46 +00:00
Will Hunt
d602c895f3
Fix hookshot showing connections as editable when the user has no permission (#660)
* Fix getConnectionsForRequest reporting canEdit=true if the user has the
default or greater PL

* changelog
2023-03-14 10:48:53 +00:00
Justin Carlson
7575f93f67
Improve widget style (#652)
* Add widget card style and background

* Add padding and header based on embed type parameter

* Add changelog

* Add loading spinner component

* Add loading spinners
2023-03-08 09:20:13 -05:00
Kim Brose
1b80bd8f40
Register namespace for sample serviceBot in registration.sample.yml (#643)
* Update service_bots.md

* Update registration.sample.yml

* Create 643.doc
2023-02-13 12:29:19 +00:00
Will Hunt
80ccb0c877
Use replace uuid package with crypto.randomUUID (#640)
* Use randomUUID over uuid

* changelog

* Fix mess
2023-02-10 11:14:21 +00:00
Half-Shot
e846f3f19b 2.7.0 2.7.0 2023-01-20 13:27:25 +00:00
Will Hunt
88273a249b
New project picker component for room configs (#624)
* Implement new Dropdown component

* Apply field styling to search too

* General improvements to GitLabClient

* Add support for storing small base64 files in the storage provider

* Refactor GitLab repo to use new connection provider

* Start trying to deduplicate code

* Begin refactor to support ConnectionSearch

* Add support for GitHub searching

* Refactor GitLab/GitHub into components

* Port Jira to ConnectionSearch

* Drop unused functions

* Hide connection list if no connections are present.

* Cleanups

* Cleanup abort controller

* changelog

* Update JIRA for search powers
2023-01-20 13:16:11 +00:00
Half-Shot
b08ca20803 2.6.1 2.6.1 2023-01-16 16:08:28 +00:00
Half-Shot
66d5abb5d8 2.6.0 2023-01-16 16:07:43 +00:00
Michael Weimann
1b51189db1
Fix generic webhook 'user is already in the room error' (#627)
* Fix generic webhook 'user is already in the room error'

* Add changelog

* Cleanup to support usecases without slamming the homeserver.

* Fix fallthrough

* Add some tests

* Add tests for intentutils

* Refactor the rest of the app

Co-authored-by: Half-Shot <will@half-shot.uk>
2023-01-16 14:58:23 +00:00
Michael Weimann
469e88f9ba
Add webhook name and room to admin info (#620)
* Add webhook name and room to admin info

* Add changelog

* Escape room Id in webhook admin message

Co-authored-by: Will Hunt <will@half-shot.uk>
2023-01-16 10:51:36 +00:00
Michael Weimann
e7a6cfcef4
Fix state update validation (#628)
* Fix state update validation

* Add changelog
2023-01-16 10:48:24 +00:00
Christian Paul
67fc55af93
Change URL protocol in the ocumentation and sample configs to HTTPS (#623)
* Config: Use variables for similar values
* Configs and Documentation: http -> https, except for localhost
2023-01-13 16:39:34 +01:00
Justin Carlson
9a7839ce42
Implement separate bot users per service (#573)
* Add service bots config

* Add joined rooms manager and keep track of joined rooms

* Add bot users manager and ensure registration and profiles

* Improve joined rooms manager and set up already joined rooms

* Handle invites with service bots

* Handle messages with service bots

* Use service bots for connections

* Use service bots in widget and provisioning APIs

* Use service bots in setup connections

* Use service bots for feed connections

* Handle admin rooms for service bots

* Fix confused event type and service type in provisioning and widget APIs

* Fix generic webhooks service name

* Fix enabled services config

* Handle power level change

* Create widgets with service scope

* Use service bots for gitlab repo connections

* Use service bots for gitlab issue connections

* Use service bots for generic webhook connections

* Use service bots for figma file connections

* Use service bots when verifying state events

* Use service bots for github repo connections

* Use service bots for github discussion connections

* Use service bots for github discussion space connections

* Use service bots for github project connections

* Use service bots for github issue connections

* Use service bots for github user space connections

* Use service bots for jira connections

* Make sure ghost users are invited for gitlab issue comments

* Configure one service per service bot

* Add changelog

* Update tests

* Fix up following rebase

* Fix comment

* Use getter for enabled services

* Ensure homeserver can be reached before registering bots

* Add intent getter on bot user

* Update config comment

* Merge joined rooms manager with bot users manager

* Remove unused localpart from bot user class

* Refactor to pass in bot users manager

* Improve priority sort function

Co-authored-by: Christian Paul <christianp@matrix.org>

* Fix priority sort

Higher priority should come first

* Add debug log when invites are rejected

* Use different state key for scoped setup widgets

* Use different subtitles to differentiate service bots setup widgets

* Refactor bot user setup into bot users manager

* Refactor to reduce duplication in widget API

* Consistent room ID and intent args order

* Add docs and update changelog

* Add overrideUserId deprecation warning

* Add service bots link

Co-authored-by: Christian Paul <christianp@matrix.org>
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-01-13 15:32:09 +00:00
Christian Paul
46467ac810
Correctly apply CSS for recent RSS feed changes (#604)
* Button: Extend HTMLButton prop types
* Use className prop instad of styles
* Move style prop into scss file
2023-01-13 14:44:07 +01:00
Will Hunt
1e8a112a28
Drop ignoreHooks configuration. (#592)
* Refactor HookFilter to only support enabledEvents (and add a function to convert)

* Convert connections to deprecate ignoreHooks

* Update documentation

* Split out EventHookCheckbox

* Refactor frontend to support enableHooks only mode

* drop old field name

* changelog

* Fix enabledHooks for widgets

* Fixes across the board

* Update test description

* Cleanup

* Fix HookFilter

* Fixup checkboxes

* Cleanup
2023-01-10 17:08:50 +00:00
Will Hunt
4048cc8b01
Check the GitLab instance name when looking for existing connections (#617)
* Check the GitLab instance name when looking for existing connections

* changelog
2023-01-10 10:42:05 +00:00
Will Hunt
a5ea88578c
Decrease connection creation concurrency when starting up (#614)
* Add a queue system for loading connections on startup

* Retry state requests

* Add ability to retry on some matrix failures

* Add the queue

* changelog

* Add docstring
2023-01-09 17:57:24 +00:00
Christian Paul
188eb4004e
A11y: Add alt tags to all images (#602)
* A11y: Add alt tags to all images

* Add newsfile
2023-01-08 12:04:40 +01:00
Will Hunt
707ce0de2d
Cache yarn dependencies (#615)
* Cache yarn dependencies

* changelog
2023-01-06 17:21:08 +00:00
Christian Paul
8eab1ff750
Improve webhook code editor performance (#601)
* Improve webhook code editor performance

* Add newsfile
2023-01-06 12:02:13 +00:00
dependabot[bot]
8e8a1a6958
Bump json5 from 2.2.0 to 2.2.3 (#611)
Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.0...v2.2.3)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 12:02:01 +00:00
Will Hunt
abe4fefda4
Mark encryption as experimental (#610)
* Update config to mark encryption support as experimental

* Mention encryption as experimental in docs

* changelog

* Hide empty values from config

* transmuate snakes into camels
2023-01-05 16:25:48 +00:00
Will Hunt
2eadc1c9d7
Increase maximum size of webhook payload. (#606)
* Increase maximum size of webhook payload.

* Create 606.misc
2023-01-04 12:04:58 +00:00
Kim Brose
ad6076cbb4
Clarify GitLab setup docs (#350)
* Update gitlab.md

* Create 350.doc

* Update gitlab_project.md
2023-01-02 17:02:59 +01:00
Will Hunt
c962f17a91
Add support for native e2ee (#299)
* Add support for native e2ee

* Various temps to coax it into working

* Formatting nitpicks

* Include stable registration config key for msc2409

* Update default config with encryption options

* Manage admin rooms with bot-sdk DMs

This also enables encryption for new admin rooms when appropriate.

* Update config comments for encryption settings

- Add comment to clarify Redis (the `queue` section) must be configured
  in order for encryption to work
- Mention that the `encryption` section is optional, and omitting it
  will disable encryption support

* Update docs for encryption support

* Add changelog

* Add to docs some notes about encryption state

* Move all post-join logic to onRoomJoin

* Block post-join actions on crypto setup

Requires https://github.com/turt2live/matrix-bot-sdk/pull/269

* Fix linter error

* Update encryption docs and changelog

- Mention that worker mode isn't supported with encryption yet
- Mention removal of Pantalaimon-based encryption

* Update worker docs with encryption config notice

* Share main appservice config with feed bots

This is required to safely enable encryption for the bots that post
GenericHook messages.

* Make slight clarification for queue config

* Minor fixes

* Block post-join actions on feed bot crypto setup

Same as a9e6e11d but for the sub-bots that post GenericHook messages.

* Get joined rooms from intent instead of bot

This refreshes the list of known rooms for crypto events.

* Use Element fork of bot-sdk for crypto fixes

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2022-12-09 10:25:36 -05:00
Will Hunt
0eabb9e3a7
Ensure unknown keys are retained when connection state is altered via widget (#587)
* Handle enable hooks in validation too

* Allow unknown keys in provisioner updates.

* Fixup error

* Finally fix Ajv moaning about types

* changelog

* Apply changes to all connection types

* remove null
2022-12-08 16:33:56 +00:00
Will Hunt
b6ae8f9106
Split out GitHub release events into created and drafted (#582)
* Support published events

* Changelog

* Improve comments

* Add frontend support

* Change func names
2022-12-08 02:48:56 +00:00
Will Hunt
7d74f1b1a8
Support filtering workflow run on workflow names (#588)
* Filter workflow events on specific workflow names

* Document new key

* changelog

* Change to a allow/deny list as per feedback
2022-12-08 01:52:51 +00:00
dependabot[bot]
423dbb11fd
Bump express from 4.17.2 to 4.17.3 (#590)
Bumps [express](https://github.com/expressjs/express) from 4.17.2 to 4.17.3.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.2...4.17.3)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-08 01:52:35 +00:00
Will Hunt
c3e1649a3c
Add support for cached responses (ETags/LastModified) for RSS feeds (#583)
* Support not modified responses.

* Support using last modified / etags

* changelog
2022-12-07 17:48:41 +00:00
Will Hunt
07e4129156
Only build arm64 docker images on push (#589)
* Only build ARM on push to main

* changelog

* Add concurrency, fix tertary

* Divide up push jobs

* Try it again

* String false

* 'true'
2022-12-07 17:12:26 +00:00
Will Hunt
f7ccacb429
Check GitLab Repo access level via a better API (#539)
* Check access level via a better API

* remove unused import

* Fixup APIs

* bugfix

* Validate data type
2022-12-02 14:48:40 +00:00
Half-Shot
231597c964 2.5.0 2.5.0 2022-12-02 13:47:18 +00:00
Andrew Ferrazzutti
2c5f248d77
Save bot-created admin rooms in profile data (#578)
* Save bot-created admin rooms in profile data

This prevents a process restart from causing bot-created admin rooms
to be forgotten.

* Clarify changelog
2022-11-25 17:19:32 +00:00
Will Hunt
93e2dbe7ed
Increase feed.pollTimeoutSeconds from 10s to 30s (#483)
* Increase feed.pollTimeoutSeconds from 10s to 30s

* Drop pointless default

* changelog
2022-11-25 14:46:06 +00:00
Andrew Ferrazzutti
16c052e5b9
Harden against unauthorized changes to room state (#565)
* Harden against unauthorized changes to room state

If an unauthorized change to connection-related room state is detected,
deny the new connection settings & attempt to revert the state change.

Also catch an otherwise-uncaught error on authentication failure.

* `any`->`unknown` for some StateEvent content types

* Limit how far back in state to look when restoring

* Explicitly drop unneeded return value of promise

* Add reason to redacted state events

* Rename & document the fn to revert room state

* Move connection state check to ConnectionManager

* Don't rollback bad room state on startup
2022-11-22 11:50:47 -05:00
Christian Paul
caf545f1a4
Misspelling: occured -> occurred (#576)
* Typo: occured -> occurred

* Add newsfile 576
2022-11-22 15:17:43 +01:00
Christian Paul
80010f7b9b
Misspelling: to setup -> to set up (#572)
* Typo: to setup -> to set up

* Add newsfile
2022-11-21 18:38:50 +01:00
Andrew Ferrazzutti
db8221b60a
Allow GitLab connections without hook permissions (#567)
* Allow GitLab connections without hook permissions

Warn instead of fail when connecting a GitLab project that Hookshot
cannot provision a webhook for.

* Mention manual "Secret token" for GitLab webhooks

* Refactor warning pane into a separate component

* Recolour warning pane for better contrast
2022-11-08 10:19:41 -05:00
Andrew Ferrazzutti
7fc0b5b8ed
Update some doc links & formatting (#568) 2022-11-07 09:19:46 -05:00
Will Hunt
c9a9a54e95
Increase SANITIZE_MAX_BREADTH/SANITIZE_MAX_DEPTH for GenericHook (#560)
* Increase SANITIZE_MAX_BREADTH/SANITIZE_MAX_DEPTH

I suspect #559 is failing because the body falls just outside our safe range. The safe ranges were chosen arbitrarily, but we can probably increase them without a huge perf penalty.

* Automatically JSONify anything exceeding the breadth or depth

* Create 560.bugfix

* Update GenericHook.ts

* Cleanup

* optimise newDepth
2022-11-07 12:02:46 +00:00
Will Hunt
28235547d2
Prevent users without permissions from inviting the bot (#561)
* Add filter

* tweak

* changelog

* Kick the right user

* Update src/Bridge.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Update src/Bridge.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Update changelog.d/561.bugfix

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Cleanup underlyingClient

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2022-11-03 12:55:48 +00:00
Andrew Ferrazzutti
cf10cf47a2
Don't provision command-created connections twice (#558) 2022-11-02 19:34:32 +00:00