51 Commits

Author SHA1 Message Date
Will Hunt
466ab6d5e3
Allow sanitized HTML from feed summaries (#738)
* Add a function to sanitize html output

* Allow some HTML in feed messages

* Update cargo

* changelog

* lint

* Saved a ton of code by just using ruma.

* Reverse order of rs:apply

* Lint

* Update src/Connections/FeedConnection.ts

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

* Apply suggestions from code review

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

* Add a test for partial html

---------

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2023-05-18 18:59:58 +00:00
Will Hunt
d772a4050c
Run Clippy in CI (#753)
* Clippy fixes

* Refactor to make rust linter happy

* Enable warnings since we have none

* Tidy up tests

* changelog
2023-05-18 11:38:59 +01:00
Will Hunt
7223a86b2b
Fix message format for feed items with no title or link (#737)
* Allow empty title on feed item

* Allow bare URL

* Add tests for new format.

* changelog
2023-05-04 09:34:25 +01:00
Will Hunt
43176adf7a
Fallback to parsing feeds as atom format if rss format fails. (#721)
* Support atom feeds in rust parser

* Add an apply linting command

* Add changelog

* Fixup

* Add tests for atom feeds + remove redundant code

* Remove unused rss-parser

* Tests for all formats.

* Move hashing logic into rust to save cross-context calls

* lint my rust

* Use a String::from

* Ensure guids are not repeated
2023-04-25 15:45:55 +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
Tadeusz Sośnierz
bc57dbbc83
Don't process feed/item titles that aren't actually strings (#708)
* Don't process feed/item titles that aren't actually strings

Another case of empty-tag with attributes, these would occasionally parse
into non-string objects and make us crash when trying to stripHtml on them.

* Changelog

* Add tests for not-quite-empty <title> tags in feeds

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
2023-04-12 17:52:10 +02: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
6233aa19c9
Refactor hookshot to include permission grant system (#655)
* Add support for checking connection grants

* Make this less noisy

* Remove import

* Trying to generic-ize the grant system

* Implement for Figma

* More grant reformatting

* Add tests

* changelog

* Fix todo

* Refactor grants

* Add logging to grant checkers

* Ensure we provide a sender
2023-03-17 16:38:39 +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
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
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
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
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
Will Hunt
db3caeae03 Use matrix-appservice-bridge logging (#488)
* Use matrix-appservice-bridge logger

* Update to be in line with bridge sdk

* Update packages

* changelog

* nits
2022-10-06 09:30:31 +01:00
Will Hunt
d85f2fd540
Add Logger tests (#478)
* More json logger safety

* Don't log undefined

* typo

* Split out the static logger to it's own class for testing

* Refactor logger usage slightly

* Add a test for the logger wrapper

* changelog

* Update LogWrapper.ts

* Drop ?
2022-09-14 11:26:34 +00:00
Will Hunt
00e5bfe332
Fix markdown paragraphs not rendering properly (#443)
* Fix markdown paragraphs not rendering properly

* changelog
2022-08-18 15:41:07 +01:00
Will Hunt
ff1079aa3b
Fix floating values breaking generic webhooks (#396)
* Convert floats to strings for generic webhook payloads

* document the change

* Create 396.bugfix
2022-07-07 17:44:11 +01:00
Will Hunt
c36a5e7d60
Fix oauth login urls for GitHub cloud having the wrong domain (#377)
* Ensure we use a single function for generating oauth urls

* Add tests

* changelog

* Fix test
2022-06-27 15:17:01 +01:00
Tadeusz Sośnierz
86b9a83b97
Add Admin command from listing and disconnecting connections (#367)
* Add Admin command from listing and disconnecting connections

(Only lists Github for now).

* Require connectionManager permissions to manipulate connections

Gives connection management its own config section and switches
AdminRoom categories to be enums.

* Fail more descriptively if connectionManager is not up in time for adminRoom

* Fix Github API URLs (#366)

* Fix Github API URLs

* Add changelog entry

* Fixes

* Tidyup

Co-authored-by: Will Hunt <will@half-shot.uk>
Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>

* Fix URLs *again*

* Block private repos from being publically bridged

* Ensure check looks at service type

* Finish up deleting connections impl

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Co-authored-by: Will Hunt <will@half-shot.uk>
2022-06-08 15:50:09 +00:00
Will Hunt
21b6d79c3f
Support GitHub Enterprise (#364)
* Support GitHub Enterprise

* Add default config

* Fixes

* Hide enterprise key
2022-05-25 11:07:07 +01:00
Will Hunt
9b216afd2b
Fix GitHub/GitLab state config not being honoured (#346)
* 1.6.1

* Add new error type for validation errors

* Validate state for GitHubRepo properly

* Add tests to check labels

* Also check GitLab repo

* changelog

* add mock store

* remove nullable

* Be less strict for existing state

* Improve test coverage

* Improve expect error text

* ValidationApiError now takes falsey objects and errors on them

* Remove UserTokenMockStore

* Actually commit the new tests

* Whoops we need to include github
2022-05-12 11:28:55 +01:00
Will Hunt
b23e516aa5
Statically define connection creation and provisioing (#330)
* Statically define connection creation and provisioing

* Tidy up

* Drop JIRA

* Convert other connections to new system

* Small linting fixes

* Fixes

* changelog

* Fix bridge

* Fix JIRA instance naming

* Fix JIRA config

* Drop unnessacery check
2022-05-06 13:58:39 +00:00
Half-Shot
3a766190f5 fix a test 2022-04-08 16:35:55 +01:00
Will Hunt
aa9e066530
Add Generic Webhooks Widget interface (#140)
* Start work on improved widget interface for admin room

* Add changes needed for InviteView

* More widget bits

* Lots more work to support setup widgets

* Redesign work

* Fix build order for web

* Remove unused invite code

* Update configs

* Cleanup

* Support widget branding

* Tidy up web app

* Support generic service config lookup

* Stronger typings for configuration

* Improve error text

* fix patch

* changelog

* First pass on documentation

* Fix tests

* fixes

* Don't require room state / admin rooms for room config requests

* Fix no render when secrets isn't provided

* rework if logic

* Fixes after feedback

* more review fixes

* Cleanup unused code

* fix indent

* Update matrix-appservice-bridge to 4.0.1

* Update widget API
2022-04-08 16:16:12 +01:00
Will Hunt
7837cbb0f2
Refactor JIRA to support on-prem (#187)
* JIRA refactors

* Support JIRA onprem

* Fix webhooks

* More JIRA docs --- PLEASE REWRITE MEEEE ---

* Drop manifest code for now

* Add on-prem instructions

* Remove incomplete command

* Update sample config

* Remove null url
2022-03-04 14:34:44 +00:00
Will Hunt
f6cbc9481e
Prettify JSON output of generic hooks (#224)
* Pretty print JSON output from webhooks

* Fixup supported body encodings

* changelog

* Fix tests
2022-03-04 13:36:08 +00:00
Will Hunt
01d3d96f12
Add support for a "v2" webhook transformation API (#223)
* Add support for a "v2" webhook transformation API

* changelog
2022-03-03 19:16:17 +00:00
Half-Shot
7e2ffdd2df Argh permissions bug 2022-01-17 10:04:23 +00:00
Will Hunt
5b294bc05f
Add support for a tiered permission system (#167)
* Add basic permission model

* Add permission mapping implementation

* Start integrating config checks

* Add permission checking for commands

* Add warnings for legacy behaviour

* changelog

* Linting

* Fix config build step

* Tests

* Add documentation

* Add complete tests

* Add documentation

* Add room for room membership permissions

* Fixup error

* Update sampleConfig
2022-01-14 17:44:15 +00:00
Will Hunt
0c4b911a70
Support categorising bot commands (#143)
* Support categorising bot commands

* changelog

* Fix tests
2022-01-10 21:41:54 +00:00
Will Hunt
5e497d7371
Support html key on generic webhooks (#130)
* Add support for `html` key on generic webhooks

* Document key

* changelog

* Add tests
2022-01-06 13:20:29 +00:00
Will Hunt
9030581de2
Port getPartialBodyForGithubIssue to rust (#126)
* Port getPartialBodyForGithubIssue to rust

* Port repo function too

* Improve safety

* changelog
2022-01-05 10:54:32 +00:00
Will Hunt
d575e5fb2f
Add documentation on various things (#90)
* Add details on webhooks

* More doc things

* More docs

* More documentation changes

* Tidy tidy

* Lots more documentation

* Support defaults for all GitHub configuration options

* Add metrics changes

* s/Added/Add
2021-12-21 16:41:19 +00:00
Will Hunt
e8525e7431 Add some tests for GenericHook 2021-12-18 16:58:23 +00:00
Will Hunt
68ea138d63 Fix tests 2021-12-02 13:37:46 +00:00
Will Hunt
b6e37947bd Refactor code to use BaseConnection and make the connectionIds simpler 2021-12-02 12:34:43 +00:00
Will Hunt
ce26efeca3 Make CI happy 2021-11-25 11:12:29 +00:00
Will Hunt
40a75fa4d3 Rename project 2021-11-22 16:02:07 +00:00
Will Hunt
80dda1ca1a Many refactors 2021-11-22 11:32:25 +00:00
Will Hunt
9748fe09cf More tweaking 2021-11-21 16:51:04 +00:00
Will Hunt
39c6e81cbb Lots of changes 2021-11-21 12:34:56 +00:00
Will Hunt
a6676d4d4f Fix tests 2021-11-17 14:22:44 +00:00
Will Hunt
8842aba1fc Fix test 2021-04-11 18:15:13 +01:00
Will Hunt
fefe9da5fe More fiddling 2020-11-29 19:55:21 +00:00
Will Hunt
80f4795c82 tests 2020-11-29 19:55:21 +00:00
Will Hunt
cad9320752 Huge changes:
- Update all packages
- Move to EsLint
- Update to @octokit/types
- Fix linting
- Fix the notifications code to not depend soley on GitHub
2020-11-29 19:55:21 +00:00
Half-Shot
c888dadd1c Remove issue title from topic 2020-02-26 13:50:38 +00:00
Half-Shot
af907ce134 Try to implement the ability for the MQ to target one worker 2020-02-25 13:25:21 +00:00
Half-Shot
1513e873ee Remove notif test 2020-02-24 13:08:08 +00:00
Half-Shot
b132ca87f8 Calculate issue diffs 2020-02-21 16:58:02 +00:00