64 Commits

Author SHA1 Message Date
Will Hunt
066d908b4f
Fix feeds config UI not allowing notifyOnFailure to be toggled. (#865)
* Fix feeds config UI not allowing notifyOnFailure to be toggled.

* changelog

* amend changelog to be cohierent

* Actual fixes.
2023-12-27 15:25:30 +00:00
Will Hunt
30bb52fc59
Better support for dark mode in widgets (#863)
* Major package upgrades

* Update rust deps and fix a few things

* Drop 18 testing

* Use node 20

* lint rust

* lint

* changelog

* Drop usage of SVGs, use compound elements.

* Update widget API

* Drop usage of SVGs, use compound elements.

* Add dark mode for widgets

* changelog

* Remove yarn-error.log
2023-12-22 15:44:00 +00:00
Will Hunt
b96b45d98c
Drop Node 18, start testing Node 21 & update dependencies. (#862)
* Major package upgrades

* Update rust deps and fix a few things

* Drop 18 testing

* Use node 20

* lint rust

* lint

* changelog

* Drop usage of SVGs, use compound elements.

* Update widget API
2023-12-22 15:36:49 +00:00
Will Hunt
95738ed844
Warn if the bot cannot send a message in the widget (#852)
* Add a warning when the room does not have permission to post messages.

* Update warning

* changelog
2023-12-07 10:28:16 +00:00
Will Hunt
f8b71ea8b2
Add ability to respond to webhooks. (#838)
* Add ability to respond to webhooks.

* Refactor hook handling code for simplicity

* Cleanup checkbox

* Ensure we can send a response even we send no content.

* Add docs

* changelog

* Reflect local and global state in the UI

* Revert CHANGELOG for now

* Emphasize Slack the service in webhooks docs

and not time slack

* Guard against falsey non-string values

---------

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2023-11-20 12:41:06 +00:00
Will Hunt
dc126afa6a
Replace vm2 with quickjs (#817)
* quickjs test

* Replace vm2 with quickjs

* initalise -> initialise

* Remove unused transformation timeout time

* Don't assume quickModule is set

Also use whether it's set as the indicator of whether transformation
functions are allowed, instead of checking the config

* Refactor GenericHookConnectionState validation

- Do it in the constructor instead of in callers
- Make hookId mandatory so as to not drop it on some state updates
- Conflate a state event's state key with a connection state's name,
  which was already the case in practice

* Refactor validateState

* Drop explicit any

Better to infer the type instead

* Always validate transformation fn

* Fix test

* Add changelog

* Fix disposal, validation, and printing

* Fix transformation error string formatting

Also refactor similar code

* Let invalid transformations run & fail

instead of pretending that one was never set

* Restore transformation timeout time

* Don't execute transformation fn when validating it

Instead, only compile it

* Revert unrelated changes

---------

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2023-09-25 14:55:15 +00:00
Will Hunt
af90e840e4
Add support for Gitlab individual review notifications (#736)
* Add support for individual reviews

* Document support + add frontend support

* changelog

* Remove redundant checks
2023-05-18 10:52:19 +00:00
Will Hunt
4bb4b56875
Include 'update' state in oauth page (#717)
* Include 'update' state in ouath page

* changelog

* words

* Update 717.bugfix

* Update oauth.tsx
2023-04-24 08:14:20 +00:00
Will Hunt
a9537c7961
Add option to enable/disable feed failure notices. (#716)
* Add new notifyOnFailure option

* Disable state buttons when updating is set

* Linting
2023-04-21 10:47:29 +00:00
Will Hunt
6345ad2347
Add support for templating feed messages (#702)
* Add support for specifying a template for feeds

* Remove unused params

* use the correct url

* make URL visible.

It was annoying me

* Update src/Connections/FeedConnection.ts

Co-authored-by: Tadeusz Sośnierz <tadzik@tadzik.net>

* Support migrations

* Hopefully support migrations now

* lint

---------

Co-authored-by: Tadeusz Sośnierz <tadzik@tadzik.net>
2023-04-11 15:24:00 +00:00
Will Hunt
c7ca2ba94d
Add support for showing GitHub issue comments (#697)
* Add support for issue/PR comments.

* changelog

* Quote message

* Truncate messages too
2023-04-04 13:28:51 +01:00
Will Hunt
76e2b53cf0
Support GitHub push events in repo connections (#696)
* Support pushed commits on GitHub

* Add a nice way to see changes in the event content

* changelog

* Fix typing

* Fixing git freaking out
2023-03-31 09:20:06 +01:00
Will Hunt
74a577a97f
Ensure joined to room when checking widget API permissions. (#691)
* Add an ensureJoined to assertUserPermissions

* Ensure web component retries connection fetches

* Ensure errors are caught and logged as JSON on the widget API

* changelog

* non-linear retry timer

* lint

* Use retry

* Make getBotUserInRoom try to join the room

* Make this fn safe to handle
2023-03-27 17:56:37 +01:00
Will Hunt
05b23127d8
Don't hide form elements in GitHub component if we're not checking auth (#675)
* Don't check authentication if we're not requesting you to login

* changelog
2023-03-24 12:06:37 +00:00
Will Hunt
b5b86d45da
Continue even if localstorage is inaccessible (#678)
* Ignore storage failures

* changelog
2023-03-23 13:56:46 +00:00
Will Hunt
c6f975b390
Refactor oauth response page and show a pending state for GitHub installations (#666)
* Show a sensible message for pending GitHub installations

* Clean up grammar

* changelog

* Update Webhooks.ts
2023-03-21 10:46:08 +00:00
Justin Carlson
8071243696
Fix add instance link grammar (#664)
* Fix add instance link grammar

* Add changelog
2023-03-20 14:48:18 -04: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
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
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
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
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
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
Christian Paul
8eab1ff750
Improve webhook code editor performance (#601)
* Improve webhook code editor performance

* Add newsfile
2023-01-06 12:02:13 +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
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
Will Hunt
0c9bbf6410 Disable GitHub workflow events by default (#528)
* Add a HookFilter class

* Use the HookFilter class

* Support default hooks in the web UI

* Update documentation

* changelog

* Allow all GitLab events by default

* bits of cleanup
2022-10-21 11:30:16 -04:00
Andrew Ferrazzutti
505c083f5f
Add support for Jira version events (#534)
- Support version created/updated/released events
- Look up project ID if missing when subscribing to version events
- Properly format version event notices
- Prioritize project URL over ID in debug strings
2022-10-21 09:24:35 -04:00
Andrew Ferrazzutti
d82e0d7d91
Fix & refactor Jira issue event handling (#543)
- Refactor Jira event handling to be more like GitHub & GitLab
- Fix silently-ignored Jira events due to expecting wrong type strings
- Update UI for Jira events
2022-10-21 09:16:00 -04:00
Will Hunt
3263565cac
Add checkboxes for workflow run statues in UI (#524)
* Add a note to use `help`

* Add event checkboxes for the workflow run hooks

* Create 524.bugfix

* Fix padding issue

* Fix a specific error edge case
2022-10-10 10:40:58 +00:00
Andrew Ferrazzutti
31aa5e90ad
Don't send empty query string in widget API reqs (#518) 2022-10-04 18:04:28 -04:00
Andrew Ferrazzutti
4d3567b05a
Add label to GitLab widget's comment body toggle (#517)
* Add label to GitLab widget's comment body toggle

Also ensure that the label is part of the click region

* Add changelog

Copied from #500's changelog
2022-10-04 18:02:21 -04:00
Andrew Ferrazzutti
c29c67fc2b
Fix command prefix field in widgets (#515)
* Read-your-writes consistency on connection update

Allow updates to connections made via config widgets to be reflected
immediately upon save in the widget UI.

* Use HTML elements as `ref`s in widgets

Fixes #422

* Add changelog

* Let widgets use new connection config on save

After a connection config is updated, but before a widget requests the
latest config from the bridge, make the widget display the just-saved
config instead of what the config was before being updated.

* Use input placeholder as prefix default

Otherwise, leaving the prefix field blank would apply no prefix, and
violate prefix length requirements.
2022-10-04 17:19:21 -04:00
Andrew Ferrazzutti
3ca61b9e02
Reorganize the GitHub config widget (#508)
- Group repos by org
- Paginate repo requests
- Remove redundant label next to chosen repo
- Remove redundant repo field below connected repo
- Include repos that user has doesn't have admin permissions for, to
  achieve parity with results from provisioning API
2022-10-03 10:43:16 -04:00
Andrew Ferrazzutti
50fa037d9a
Fix Jira widget request loop for logged-out users (#507)
* Fix Jira widget request loop for logged-out users

* Add changelog file

(copied from #502)
2022-10-03 10:30:11 -04:00
Andrew Ferrazzutti
80a26283e9
Make various typechecking improvements (#505)
* Make various typechecking improvements

* Use `Record<never, never>` to cover `{}`
2022-09-30 13:50:38 -04:00
Andrew Ferrazzutti
911a73abba
Move web tsconfig to let TS language server work (#506)
* Move `web` tsconfig to let TS language server work

* Assign typing to images

This removes type errors on imported images.
2022-09-30 12:35:53 -04:00
Andrew Ferrazzutti
0111f4bfa3
Add Jira widget (#502)
* Add Jira widget

* Jira widget UI for no login vs no instances

* Update changelog wording
2022-09-30 11:52:31 -04:00
Will Hunt
4c33c60d7a
Support GitLab MR comment bodies (optionally) (#500)
* Add backend support

* Add frontend support

* Update docs

* changelog

* Update src/Connections/GitlabRepo.ts

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

* Update docs/usage/room_configuration/gitlab_project.md

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

* Tweak functions

Co-authored-by: Christian Paul <christianp@matrix.org>
2022-09-30 16:33:09 +01:00
Will Hunt
5ee267f013
Update codemirror, remove opensans (#489)
* Update codemirror, remove opensans

* changelog

* Remove our one usage of sans

* Update JS dependency too
2022-09-16 13:23:43 +00:00
Will Hunt
23eae91737
Support notifying when a GitLab MR is ready for review (#480)
* Support ready for review GitLab

* Create 480.feature

* Change event name

* Fix name

* Fix typo
2022-09-12 11:51:04 +01:00
Will Hunt
63ab457b45
Refactor feed errors and error presentation (#459)
* Add support for setting a global feed timeout

* Track failures, and don't show the first non-serious error

* Tidy up error reporting

* Make a prettier error pane

* Use the prettier event pane

* Show failed feed attempts in the widget

* Ensure we catch connection resets

* Add styling file

* Ensure we only track one result per fetch

* changelog

* Refactor to use better status codes

* Make feed results cheaper

* splice
2022-08-31 14:01:43 +01:00
Justin Carlson
49bc94e9ad
Add query parameter to scope room config widget to a particular service (#441)
* Add query parameter to scope room config widget to a particular service

* Add changelog
2022-08-18 10:47:03 -04:00
Andrew Ferrazzutti
e9613225be
Add GitHub widget (#420)
* Add GitHub widget

Also make assorted fixes to help push this along

* Remove unused import

* Resolve new linter warnings

* Undo testing-only change

Didn't mean to commit this

* Use "org/repo" as GitHub repo names in widget

* Update src/ConnectionManager.ts

Co-authored-by: Will Hunt <will@half-shot.uk>

* Don't use null assertions

* Use block scope in switch cases

* Fix some BridgeAPI imports

* Actually validate connection state

* Return only GitHub repos with admin permissions

Co-authored-by: Will Hunt <will@half-shot.uk>
2022-07-29 10:05:21 -04:00
Will Hunt
8cf8c8eff3
Add requireClient capability to widgets (#370)
* Add requireClient

* changelog
2022-06-07 14:12:01 +01:00
Tadeusz Sośnierz
d1494ff373
Add Feed configuration widget (#345)
* Refactor RoomConfigView slightly to reduce duplication

* Add Feed configuration widget

* Drop an unused parameter in FeedConnection

Co-authored-by: Will Hunt <will@half-shot.uk>

* Add a key to connection listing in RoomConfigView

Co-authored-by: Will Hunt <will@half-shot.uk>

* Be more explicit when checking for feeds enabledness

Co-authored-by: Will Hunt <will@half-shot.uk>

* Erase state when removing FeedConnection

* Tone down logging in FeedReader

* Strenghten validation of feed URLs

* Drop an unnecessary non-null assertion

* Allow adding labels to feeds

* Add changelog for #345

* Fix lint-found errors

* Improve feed setup widget changelog

Co-authored-by: Will Hunt <will@half-shot.uk>

* Validate feed URLs with HEAD if possible

* Don't log.error feed validation failures in SetupConnection

* Remove extra space

Co-authored-by: Will Hunt <will@half-shot.uk>

* Wrap errors from FeedConnection.provisionConnection in ApiErrors

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Co-authored-by: Will Hunt <will@half-shot.uk>
2022-05-12 12:06:20 +01:00
Half-Shot
f3ad4a0d7d Fix broken headerImgs 2022-05-06 15:59:46 +01:00