482 Commits

Author SHA1 Message Date
Connor Davis
269d8bb0e1
Add more icons to GitHub messages (#795)
* Add more icons to GitHub messages

* Add merged icon

* Lint

* Add changelog
2023-07-11 13:42:05 +00:00
Tadeusz Sośnierz
1c54506f6e
Sort feed list alphabetically in bot command response (#791)
* Sort feed list alphabetically in bot command response

Fixes GH-790

* Changelog

* Linting

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
2023-07-03 12:24:58 +00:00
Charlotte Van Petegem
4351a37131
Try to find an HTML-type link first when parsing atom feeds (#784)
Signed-off-by: Charlotte Van Petegem <charlotte@vanpetegem.me>
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-06-28 15:35:06 +00:00
Will Hunt
3217b9eecf
Performance improvements to Feeds (#786)
* Various smaller changes

* Drop account data entirely

* Use max feed items

* Commit known working improvements

* Better status handlingh

* changelog

* Update changelog

* Add a note on Redis.

* Add proper HTTP tests

* Linty lint

* Tweaks

* New metrics woah

* Tweaks
2023-06-28 15:29:54 +00:00
Will Hunt
172ae30a73
Enable feeds to be polled concurrently (#779)
* Add support for concurrent RSS feed reading

* Add feed concurrency polling

* Actually load all workers

* Ensure feed just sleeps if there are no urls to poll

* Fix map

* Update default config

* Update src/feeds/FeedReader.ts

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

* Update src/feeds/FeedReader.ts

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

---------

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2023-06-14 12:41:14 +00:00
Justin Carlson
96c398ce74
Fix crash from exceptions in handlers (#771)
* Fix crash from exceptions in handlers

* Fix withScope usage

* Add changelog
2023-06-05 16:25:19 +00:00
Will Hunt
6ca2b51893
Don't match issue comment notices on issue event type (#757)
* Don't match issue comment notices on issue event type

* changelog
2023-05-24 13:28:28 +00:00
Justin Carlson
0c4a493c56
Add support for uploading avatars (#767)
* Add uploading configured avatar images

* Add avatar assets

* Update docs and sample config

* Add changelog

* Fix sample config

* Add removing avatars when none configured
2023-05-24 13:16:37 +00:00
Christian Paul
00771d88c3
Fix #598; setup issues when the bot has PL 0 and room default isn't 0 (#755)
* Fix #598

If the bot has PL 0, the bot incorrectly used the default power level.

* Create 755.bugfix
2023-05-18 19:18:15 +00:00
Marcel
b91ca94249
fix: Make sure that the blockquote markdown for github issue comments are valid commonmark (#746)
* fix: Make sure that the blockquote mardkown for github issue comments are valid commonmark

* Add changelog file
2023-05-18 19:18:04 +00:00
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
b9313cd140
Add Sentry support (#754)
* Add sentry support

* Add basic listening for errors on express.

* Additional event types

* Add a default config

* changelog

* Improve wording

* Add docs
2023-05-18 11:05:23 +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
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
Marcel
409a8b83a7
Apply cargo clippy suggestions to reduce not needed allocations (#750)
* Apply cargo clippy suggestions to reduce not needed allocations

* Add changelog entry
2023-05-17 14:53:42 +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
01159fa0d1
Update yaml dependency (#728)
* Update yaml dependency

* changelog
2023-04-25 15:52:57 +00: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
Andrew Ferrazzutti
9bd46e4dc5
Fix hang in crypto reset script when E2EE is off (#723)
Ensure that the bridge storage is always disconnected
2023-04-21 23:57:40 +09:00
Andrew Ferrazzutti
f29fac7584
Allow usage of the SQLite-based crypto store (#714)
* Allow usage of the SQLite-based crypto store

Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>

* Add changelog

* Log when crypto storage is initialized

* Add yarn script for resetting crypto state

Also document its usage & when it may be necessary to use it.

* Minor style improvements

- add trailing semicolons
- remove redundant `Promise.resolve`s

* Change logging in crypto reset script

- Move error object to parameter
- Rename logger

* Add method to close the Redis store

and call it to let the process exit cleanly

* Update matrix-bot-sdk

Use release with SQLite crypto store support

---------

Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
2023-04-21 23:18:27 +09: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
c6a04c2ebd
Fix case where GitHub repos aren't connectable if the GitHub App was manually approved (#718)
* Fix GitHub connections failing if the installation cache is stale

* changelog
2023-04-21 09:27:57 +00:00
Will Hunt
eda6fc8c26
Use rss crate for RSS feed parsing (#709)
* Refactor annoying type difference

* Add rss

* Add support for parsing RSS feeds

* Add rss lib

* Add Cargo project

* Lint rust

* changelog

* Add support for new fields
2023-04-17 11:48:03 +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
Justin Carlson
cafe05b0a2
Add hookshot_ prefix on hookshot specific metrics (#701)
* Add hookshot_ prefix on all metrics

* Only add prefix to hookshot specific metrics

* Add old metric names as deprecated

* Fix feeds metrics names

* Update metrics docs

---------

Co-authored-by: Will Hunt <will@half-shot.uk>
2023-04-11 16:58:51 +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
7eef384563
Add support for using guid as a feed link (#700)
* Move statics above instance fields, and add new url praser

* uncomment out

* add comment

* Create 700.feature
2023-04-03 14:24:36 +00:00
Tadeusz Sośnierz
0ce06c4ea7
Allow users to import other people's go-neb services (#695)
* Allow room admins to import other people's go-neb services

This requires us to guess what these other people's MXIDs were,
so we scroll through the list of room members and make educated guesses
about which of them are Scalar+go-neb bots, and which users they were set up by.

* Relax our requirements for scraping others' go-neb connections

* Changelog

* Linting

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
2023-04-03 16:13:43 +02: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
77ac90180f
RSS Spam fix (#694)
* Fix spammy RSS feeds

* changelog
2023-03-28 14:57:48 +00:00
Will Hunt
c861ce51fe
Fix grants supplying the wrong state (#672)
* Fix grants supplying the wrong state

* changelog
2023-03-28 11:25:21 +01:00
Will Hunt
44eea7f7c3
Staggered RSS feed polling (#685)
* Ensure we poll feeds equally

* Ensure we poll at least once

* Create 685.misc

* Tidy up
2023-03-28 10:13:57 +00:00
Tadeusz Sośnierz
507b014bd5
Make sure we're not treating garbage data in feed item as guids (#689)
* Make sure we're not treating garbage data in feed item as guids

Some of these would parse as `{ '$': { isPermaLink: 'false' } }` or similar,
which would then surprise us very much when assuming that it's a string stored in accountData.

* Changelog

* Exclude empty strings when looking for viable guids

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

* Hash seen feed entry guids for storing and checking

This saves a little bit of space in the common case,
and prevents bloating the storage were someone to feed us obnoxiously long guids.

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Co-authored-by: Christian Paul <christianp@matrix.org>
2023-03-28 09:06:30 +00: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
037674115a
Wrap createConnectionForState/ensureGrant in a try/catch (#680)
* Fix thrown exception when the state is not granted

* changelog

* make it an error

* Typing
2023-03-24 14:39:19 +00:00
Tadeusz Sośnierz
6c4bbc7150
When setting up a FeedConnection, check if the feed loads and parses rather than just checking the Content-Type (#684)
* When setting up a FeedConnection, check if the feed loads and parses rather than just checking the Content-Type

* Don't create a new Parser each time we fetch a feed

* Create 684.bugfix

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-03-24 14:22:10 +00:00
Tadeusz Sośnierz
5ccd64acd8
Undo XML parser customizations (#683)
* Undo XML parser customizations

These did more harm then good, breaking many legit feeds in weird ways.

* Undo changelog

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-03-24 14:16:54 +00:00
Will Hunt
f6475a5182
Do more to shut down quickly and start RSS feeds later (#671)
* Only load RSS feeds once all connections have loaded

* Clear various timeouts

* changelog
2023-03-24 14:13:51 +00:00
Will Hunt
5d27f173a6
Add a ready probe to each listener and start the listeners immediately (#676)
* Put a ready probe on all listeners

* Start the listener early, and add ready probes to each listener

* Apply to the other two listeners
2023-03-24 14:09:09 +00:00
Will Hunt
d12a05d0fa
Add feeds failing metric (#681)
* Track failing feeds in a metric

* Update docs

* changelog
2023-03-24 13:12:50 +00:00
Will Hunt
61f25fae36
Make the feed parser less strict on HTML data. (#670)
* Less strict parser

* changelog

* Instantiate parser once
2023-03-22 20:17:28 +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
Will Hunt
61ede0b97a
Fix GitHub grant checker not checking the correct ID (#665)
* Remove the need for a grant key

* changelog
2023-03-20 22:38:44 +00:00
Will Hunt
7f34d69cfa
Don't remove the oauth state on polling the status of the auth request (#663)
* Fix unused ?.

* Don't remove the state from the tokenStore when polling

* changelog
2023-03-20 17:03:37 +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
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
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