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
This commit is contained in:
Will Hunt 2023-12-22 15:36:49 +00:00 committed by GitHub
parent 8cac2f100c
commit b96b45d98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 3259 additions and 2834 deletions

View File

@ -64,7 +64,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
node_version: [18, 20]
node_version: [20, 21]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node_version }}

View File

@ -1 +1 @@
18
20

365
Cargo.lock generated
View File

@ -26,6 +26,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "as_variant"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38fa22307249f86fb7fad906fcae77f2564caeb56d7209103c551cd1cf4798f"
[[package]]
name = "assign"
version = "1.1.1"
@ -86,49 +92,25 @@ checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "block-buffer"
version = "0.7.3"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
]
[[package]]
name = "block-padding"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [
"byte-tools",
]
[[package]]
name = "bumpalo"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "bytemuck"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.5.0"
@ -195,13 +177,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "ctor"
version = "0.2.5"
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "ctor"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e"
dependencies = [
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -272,11 +264,12 @@ dependencies = [
[[package]]
name = "digest"
version = "0.8.1"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"generic-array",
"block-buffer",
"crypto-common",
]
[[package]]
@ -400,11 +393,12 @@ dependencies = [
[[package]]
name = "generic-array"
version = "0.12.4"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
]
[[package]]
@ -436,19 +430,13 @@ dependencies = [
"futures-sink",
"futures-util",
"http",
"indexmap 2.1.0",
"indexmap",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.3"
@ -494,9 +482,9 @@ dependencies = [
[[package]]
name = "http-body"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
dependencies = [
"bytes",
"http",
@ -517,9 +505,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "0.14.27"
version = "0.14.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
dependencies = [
"bytes",
"futures-channel",
@ -532,7 +520,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"socket2 0.4.10",
"socket2",
"tokio",
"tower-service",
"tracing",
@ -568,17 +556,6 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"serde",
]
[[package]]
name = "indexmap"
version = "2.1.0"
@ -586,7 +563,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
"hashbrown",
"serde",
]
[[package]]
@ -597,9 +575,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
[[package]]
name = "itoa"
version = "1.0.9"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
@ -628,28 +606,6 @@ dependencies = [
"serde",
]
[[package]]
name = "konst"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330f0e13e6483b8c34885f7e6c9f19b1a7bd449c673fbb948a51c99d66ef74f4"
dependencies = [
"konst_macro_rules",
"konst_proc_macros",
]
[[package]]
name = "konst_macro_rules"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
[[package]]
name = "konst_proc_macros"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "984e109462d46ad18314f10e392c286c3d47bce203088a09012de1015b45b737"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -658,9 +614,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.150"
version = "0.2.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
[[package]]
name = "libloading"
@ -716,7 +672,7 @@ dependencies = [
[[package]]
name = "matrix-hookshot"
version = "4.6.0"
version = "4.7.0"
dependencies = [
"atom_syndication",
"contrast",
@ -737,13 +693,12 @@ dependencies = [
[[package]]
name = "md-5"
version = "0.8.0"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8"
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
dependencies = [
"block-buffer",
"cfg-if",
"digest",
"opaque-debug",
]
[[package]]
@ -769,9 +724,9 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.9"
version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
"wasi",
@ -796,29 +751,29 @@ dependencies = [
[[package]]
name = "napi-build"
version = "1.2.1"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd4419172727423cf30351406c54f6cc1b354a2cfb4f1dba3e6cd07f6d5522b"
checksum = "d4b4532cf86bfef556348ac65e561e3123879f0e7566cca6d43a6ff5326f13df"
[[package]]
name = "napi-derive"
version = "2.14.2"
version = "2.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0cca5738c6e81eb5ffd2c8ff2b4f05ece9c4c60c7e2b36cec6524492cf7f330"
checksum = "9b5af262f1d8e660742eb722abc7113a5b3c3de4144d0ef23ede2518672ceff1"
dependencies = [
"cfg-if",
"convert_case",
"napi-derive-backend",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.42",
]
[[package]]
name = "napi-derive-backend"
version = "1.0.55"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35960e5f33228192a9b661447d0dfe8f5a3790ff5b4058c4d67680ded4f65b91"
checksum = "4ea236321b521d6926213a2021e407b0562e28a257c037a45919e414d2cdb4f8"
dependencies = [
"convert_case",
"once_cell",
@ -826,7 +781,7 @@ dependencies = [
"quote",
"regex",
"semver",
"syn 1.0.109",
"syn 2.0.42",
]
[[package]]
@ -898,21 +853,15 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openssl"
version = "0.10.61"
version = "0.10.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45"
checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671"
dependencies = [
"bitflags 2.4.1",
"cfg-if",
@ -931,7 +880,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -942,9 +891,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.97"
version = "0.9.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b"
checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
dependencies = [
"cc",
"libc",
@ -1040,7 +989,7 @@ dependencies = [
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -1075,9 +1024,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.27"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
[[package]]
name = "ppv-lite86"
@ -1093,19 +1042,19 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
dependencies = [
"once_cell",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "proc-macro2"
version = "1.0.70"
version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
dependencies = [
"unicode-ident",
]
@ -1199,9 +1148,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "reqwest"
version = "0.11.22"
version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
dependencies = [
"base64",
"bytes",
@ -1258,32 +1207,31 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.8.2"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6429e3fae5d6ab07742bcf9a1705f68f97d082801cc5afe9290579bf7abcf053"
checksum = "2779c38df072964c63476259d9300efb07d0d1a7178c6469893636ce0c547a36"
dependencies = [
"assign",
"js_int",
"js_option",
"ruma-common",
"ruma-events",
"ruma-html",
]
[[package]]
name = "ruma-common"
version = "0.11.3"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3b4ec3f70ea9afeae96a6c1e5eb86ed02760d5c28a167b5d9a433cefaaf815c"
checksum = "3bca4c33c50e47b4cdceeac71bdef0c04153b0e29aa992d9030ec14a62323e85"
dependencies = [
"as_variant",
"base64",
"bytes",
"form_urlencoded",
"html5ever",
"indexmap 1.9.3",
"indexmap",
"js_int",
"js_option",
"konst",
"percent-encoding",
"phf 0.11.2",
"regex",
"ruma-identifiers-validation",
"ruma-macros",
@ -1296,6 +1244,43 @@ dependencies = [
"wildmatch",
]
[[package]]
name = "ruma-events"
version = "0.27.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d20a52770e5a9fb30b7a1c14ba8b3dcf76dadc01674e58e40094f78e6bd5e3f1"
dependencies = [
"as_variant",
"indexmap",
"js_int",
"js_option",
"percent-encoding",
"regex",
"ruma-common",
"ruma-html",
"ruma-identifiers-validation",
"ruma-macros",
"serde",
"serde_json",
"thiserror",
"tracing",
"url",
"wildmatch",
]
[[package]]
name = "ruma-html"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9674a149b1a6965fe2174ba528c89ee201258abd9209bbe74953df7073a83a5b"
dependencies = [
"as_variant",
"html5ever",
"phf 0.11.2",
"tracing",
"wildmatch",
]
[[package]]
name = "ruma-identifiers-validation"
version = "0.9.3"
@ -1308,9 +1293,9 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.11.3"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e883799456b6213da90fe065d4234f282b89afe161af3e5fcc854e44e8f582"
checksum = "0280534a4b3e34416f883285fac4f9c408cd0b737890ae66f3e7a7056d14be80"
dependencies = [
"once_cell",
"proc-macro-crate",
@ -1318,7 +1303,7 @@ dependencies = [
"quote",
"ruma-identifiers-validation",
"serde",
"syn 1.0.109",
"syn 2.0.42",
"toml",
]
@ -1330,9 +1315,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustix"
version = "0.38.26"
version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [
"bitflags 2.4.1",
"errno",
@ -1343,9 +1328,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.15"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
[[package]]
name = "schannel"
@ -1408,7 +1393,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -1418,7 +1403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224e6a14f315852940f3ec103125aa6482f0e224732ed91ed3330ed633077c34"
dependencies = [
"form_urlencoded",
"indexmap 2.1.0",
"indexmap",
"itoa",
"ryu",
"serde",
@ -1437,9 +1422,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
version = "0.6.4"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
dependencies = [
"serde",
]
@ -1477,16 +1462,6 @@ version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "socket2"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "socket2"
version = "0.5.5"
@ -1542,9 +1517,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.39"
version = "2.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8"
dependencies = [
"proc-macro2",
"quote",
@ -1598,22 +1573,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.50"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -1633,9 +1608,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.34.0"
version = "1.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
dependencies = [
"backtrace",
"bytes",
@ -1643,7 +1618,7 @@ dependencies = [
"mio",
"num_cpus",
"pin-project-lite",
"socket2 0.5.5",
"socket2",
"windows-sys 0.48.0",
]
@ -1673,9 +1648,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.7.8"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
dependencies = [
"serde",
"serde_spanned",
@ -1685,20 +1660,20 @@ dependencies = [
[[package]]
name = "toml_datetime"
version = "0.6.5"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.15"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap 2.1.0",
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
@ -1730,7 +1705,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
]
[[package]]
@ -1744,9 +1719,9 @@ dependencies = [
[[package]]
name = "try-lock"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "typenum"
@ -1756,9 +1731,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "unicode-bidi"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
[[package]]
name = "unicode-ident"
@ -1804,6 +1779,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "want"
version = "0.3.1"
@ -1840,7 +1821,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
"wasm-bindgen-shared",
]
@ -1874,7 +1855,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.42",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -1897,31 +1878,9 @@ dependencies = [
[[package]]
name = "wildmatch"
version = "2.1.1"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee583bdc5ff1cf9db20e9db5bb3ff4c3089a8f6b8b31aff265c9aba85812db86"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
checksum = "ffa44a4268d649eba546544ed45fd9591059d9653a0e584efe030b56d8172b58"
[[package]]
name = "windows-sys"
@ -2057,9 +2016,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winnow"
version = "0.5.25"
version = "0.5.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e87b8dfbe3baffbe687eef2e164e32286eff31a5ee16463ce03d991643ec94"
checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
dependencies = [
"memchr",
]

View File

@ -15,12 +15,12 @@ serde = "1"
serde_derive = "1"
contrast = "0"
rgb = "0"
md-5 = "0.8.0"
hex = "0.4.3"
rss = "2.0.3"
md-5 = "0.10"
hex = "0.4"
rss = "2.0"
atom_syndication = "0.12"
ruma = { version = "0.8.2", features = ["events", "unstable-sanitize"] }
ruma = { version = "0.9", features = ["events", "html"] }
reqwest = "0.11"
[build-dependencies]
napi-build = "1"
napi-build = "2"

1
changelog.d/862.removal Normal file
View File

@ -0,0 +1 @@
Drop support for Node 18 and start supporting Node 21.

View File

@ -10,7 +10,7 @@
"name": "matrix-hookshot-rs"
},
"engines": {
"node": ">=18"
"node": ">=20"
},
"scripts": {
"build:web": "vite build",
@ -32,6 +32,7 @@
"start:matrixsender": "node --require source-map-support/register lib/App/MatrixSenderApp.js",
"start:resetcrypto": "node --require source-map-support/register lib/App/ResetCryptoStore.js",
"test": "mocha -r ts-node/register tests/init.ts tests/*.ts tests/**/*.ts",
"test:e2e": "mocha -r ts-node/register tests/init.ts tests/*.ts tests/**/*.ts",
"test:cover": "nyc --reporter=lcov --reporter=text yarn test",
"lint": "yarn run lint:js && yarn run lint:rs",
"lint:js": "eslint -c .eslintrc.js 'src/**/*.ts' 'tests/**/*.ts' 'web/**/*.ts' 'web/**/*.tsx'",
@ -42,55 +43,57 @@
},
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"@octokit/auth-app": "^3.3.0",
"@octokit/auth-token": "^2.4.5",
"@octokit/rest": "^18.10.0",
"@octokit/webhooks": "^9.1.2",
"@octokit/auth-app": "^6.0.2",
"@octokit/auth-token": "^4.0.0",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks": "^12.0.10",
"@sentry/node": "^7.52.1",
"@vector-im/compound-design-tokens": "^0.1.0",
"@vector-im/compound-web": "^0.9.4",
"ajv": "^8.11.0",
"axios": "^1.6.2",
"cors": "^2.8.5",
"express": "^4.17.3",
"express": "^4.18.2",
"figma-js": "^1.14.0",
"http-status-codes": "^2.2.0",
"ioredis": "^5.2.3",
"jira-client": "^8.0.0",
"markdown-it": "^12.3.2",
"jira-client": "^8.2.2",
"markdown-it": "^14.0.0",
"matrix-appservice-bridge": "^9.0.1",
"matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.6.7-element.1",
"matrix-widget-api": "^1.0.0",
"micromatch": "^4.0.4",
"mime": "^3.0.0",
"node-emoji": "^1.11.0",
"nyc": "^15.1.0",
"matrix-widget-api": "^1.6.0",
"micromatch": "^4.0.5",
"mime": "^4.0.1",
"node-emoji": "^2.1.3",
"p-queue": "^6.6.2",
"prom-client": "^14.2.0",
"quickjs-emscripten": "^0.23.0",
"reflect-metadata": "^0.1.13",
"preact-render-to-string": "^6.3.1",
"prom-client": "^15.1.0",
"quickjs-emscripten": "^0.24.0",
"reflect-metadata": "^0.2.1",
"source-map-support": "^0.5.21",
"string-argv": "^0.3.1",
"tiny-typed-emitter": "^2.1.0",
"winston": "^3.3.3",
"xml2js": "^0.5.0",
"yaml": "^2.2.2"
"vite-plugin-magical-svg": "^1.0.3",
"winston": "^3.11.0",
"xml2js": "^0.6.2",
"yaml": "^2.3.4"
},
"devDependencies": {
"@codemirror/lang-javascript": "^6.0.2",
"@napi-rs/cli": "^2.13.2",
"@preact/preset-vite": "^2.2.0",
"@tsconfig/node18": "^2.0.0",
"@rollup/plugin-alias": "^5.1.0",
"@tsconfig/node18": "^18.2.2",
"@types/ajv": "^1.0.0",
"@types/chai": "^4.2.22",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
"@types/jira-client": "^7.1.0",
"@types/markdown-it": "^12.2.3",
"@types/markdown-it": "^13.0.7",
"@types/micromatch": "^4.0.1",
"@types/mime": "^2.0.3",
"@types/mocha": "^9.0.0",
"@types/node": "18",
"@types/node-emoji": "^1.8.1",
"@types/uuid": "^8.3.3",
"@types/mime": "^3.0.4",
"@types/mocha": "^10.0.6",
"@types/node": "20.10.5",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
@ -100,13 +103,13 @@
"eslint-config-preact": "^1.3.0",
"eslint-plugin-mocha": "^10.1.0",
"mini.css": "^3.0.1",
"mocha": "^8.2.1",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"preact": "^10.5.15",
"rimraf": "^3.0.2",
"rimraf": "^5.0.5",
"sass": "^1.51.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
"vite": "^4.1.5",
"vite-svg-loader": "^4.0.0"
"vite": "^5.0.10"
}
}

View File

@ -1,11 +1,11 @@
import markdown from "markdown-it";
import stringArgv from "string-argv";
import { ApiError } from "./api";
import { CommandError } from "./errors";
import { MatrixMessageContent } from "./MatrixEvent";
import { BridgePermissionLevel } from "./config/Config";
import { PermissionCheckFn } from "./Connections";
const stringArgv = import("string-argv");
const md = new markdown();
export const botCommandSymbol = Symbol("botCommandMetadata");
@ -124,7 +124,7 @@ export async function handleCommand(
}
command = command.substring(prefix.length);
}
const parts = stringArgv(command);
const parts = (await stringArgv).parseArgsStringToArgv(command);
for (let i = parts.length; i > 0; i--) {
const prefix = parts.slice(0, i).join(" ").toLowerCase();
// We have a match!

View File

@ -1,6 +1,5 @@
import { Appservice } from "matrix-bot-sdk";
import markdown from "markdown-it";
import mime from "mime";
import emoji from "node-emoji";
import { MatrixMessageContent, MatrixEvent } from "./MatrixEvent";
import { Logger } from "matrix-appservice-bridge";
@ -14,6 +13,7 @@ const REGEX_MATRIX_MENTION = /<a href="https:\/\/matrix\.to\/#\/(.+)">(.*)<\/a>/
const REGEX_IMAGES = /!\[.*]\((.*\.(\w+))\)/gm;
const md = new markdown();
const log = new Logger("CommentProcessor");
const mime = import('mime');
interface IMatrixCommentEvent extends MatrixMessageContent {
// eslint-disable-next-line camelcase
@ -131,7 +131,7 @@ export class CommentProcessor {
let match = REGEX_IMAGES.exec(bodyCopy);
while (match) {
bodyCopy = bodyCopy.replace(match[1], "");
const contentType = mime.getType(match[1]) || "none";
const contentType = (await mime).default.getType(match[1]) || "none";
if (
!contentType.startsWith("image") &&
!contentType.startsWith("video") &&
@ -145,7 +145,7 @@ export class CommentProcessor {
try {
const { data, headers } = await axios.get(rawUrl, {responseType: "arraybuffer"});
const imageData = data;
const contentType = headers["content-type"] || mime.getType(rawUrl) || "application/octet-stream";
const contentType = headers["content-type"] || (await mime).default.getType(rawUrl) || "application/octet-stream";
let url;
if (convertToMxc) {
url = await this.as.botIntent.underlyingClient.uploadContent(imageData, contentType);

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { Appservice, Intent, IRichReplyMetadata, StateEvent } from "matrix-bot-sdk";
import { BotCommands, botCommand, compileBotCommands, HelpFunction } from "../BotCommands";
import { CommentProcessor } from "../CommentProcessor";
@ -13,14 +12,14 @@ import { IssuesOpenedEvent, IssuesReopenedEvent, IssuesEditedEvent, PullRequestO
import { MatrixMessageContent, MatrixEvent, MatrixReactionContent } from "../MatrixEvent";
import { MessageSenderClient } from "../MatrixSender";
import { CommandError, NotLoggedInError } from "../errors";
import { NAMELESS_ORG_PLACEHOLDER, ReposGetResponseData } from "../github/Types";
import { ReposGetResponseData } from "../github/Types";
import { UserTokenStore } from "../UserTokenStore";
import axios, { AxiosError } from "axios";
import emoji from "node-emoji";
import { emojify } from "node-emoji";
import { Logger } from "matrix-appservice-bridge";
import markdown from "markdown-it";
import { CommandConnection } from "./CommandConnection";
import { GithubInstance } from "../github/GithubInstance";
import { getNameForGitHubAccount, GithubInstance } from "../github/GithubInstance";
import { GitHubIssueConnection } from "./GithubIssue";
import { BridgeConfigGitHub } from "../config/Config";
import { ApiError, ErrCode, ValidatorApiError } from "../api";
@ -322,7 +321,8 @@ const WORKFLOW_CONCLUSION_TO_NOTICE: Record<WorkflowRunCompletedEvent["workflow_
cancelled: "was cancelled 🙅",
timed_out: "timed out ⏰",
action_required: "requires further action 🖱️",
stale: "completed, but is stale 🍞"
stale: "completed, but is stale 🍞",
skipped: "skipped ⏭️"
}
const TRUNCATE_COMMENT_SIZE = 256;
@ -669,7 +669,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
if (this.showIssueRoomLink) {
message += ` [Issue Room](https://matrix.to/#/${this.as.getAlias(GitHubIssueConnection.generateAliasLocalpart(this.org, this.repo, issue.number))})`;
}
const content = emoji.emojify(message);
const content = emojify(message);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content ,
@ -698,7 +698,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
)
);
// Typescript is dumb.
// @ts-ignore - property is used
// @ts-expect-error - property is used
const reviewEvent = reviewKey && EMOJI_TO_REVIEW_STATE[reviewKey];
if (body && repoInfo && pullRequestId && reviewEvent) {
log.info(`Handling reply to PR ${pullRequestId}`);
@ -886,7 +886,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
const orgRepoName = event.repository.full_name;
const icon = '📥';
let message = emoji.emojify(`${icon} **${event.issue.user.login}** created new issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${event.issue.title}"`);
let message = emojify(`${icon} **${event.issue.user.login}** created new issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${event.issue.title}"`);
message += (event.issue.assignee ? ` assigned to ${event.issue.assignee.login}` : '');
if (this.showIssueRoomLink) {
const appInstance = await this.githubInstance.getSafeOctokitForRepo(this.org, this.repo);
@ -896,7 +896,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
log.warn(`Cannot show issue room link, no app install for ${orgRepoName}`);
}
}
const content = emoji.emojify(message);
const content = emojify(message);
const labels = FormatUtil.formatLabels(event.issue.labels?.map(l => ({ name: l.name, description: l.description || undefined, color: l.color || undefined })));
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
@ -913,7 +913,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
const icon = '🗣';
let message = emoji.emojify(`${icon} **${event.comment.user.login}** [commented](${event.issue.html_url}) on [${event.repository.full_name}#${event.issue.number}](${event.issue.html_url}) `);
let message = emojify(`${icon} **${event.comment.user.login}** [commented](${event.issue.html_url}) on [${event.repository.full_name}#${event.issue.number}](${event.issue.html_url}) `);
message += "\n> " + event.comment.body.substring(0, TRUNCATE_COMMENT_SIZE) + (event.comment.body.length > TRUNCATE_COMMENT_SIZE ? "…" : "");
await this.intent.sendEvent(this.roomId, {
@ -963,7 +963,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
}
const icon = state === 'reopened' ? '🔷' : '⬛';
const content = emoji.emojify(`${icon} **${event.sender.login}** ${state} issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emoji.emojify(event.issue.title)}"${withComment}`);
const content = emojify(`${icon} **${event.sender.login}** ${state} issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emojify(event.issue.title)}"${withComment}`);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -983,7 +983,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
log.info(`onIssueEdited ${this.roomId} ${this.org}/${this.repo} #${event.issue.number}`);
const orgRepoName = event.repository.full_name;
const icon = '✏';
const content = emoji.emojify(`${icon} **${event.sender.login}** edited issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emoji.emojify(event.issue.title)}"`);
const content = emojify(`${icon} **${event.sender.login}** edited issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emojify(event.issue.title)}"`);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -1015,7 +1015,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
const orgRepoName = event.repository.full_name;
const {plain, html} = FormatUtil.formatLabels(event.issue.labels?.map(l => ({ name: l.name, description: l.description || undefined, color: l.color || undefined })));
const icon = '🗃';
const content = emoji.emojify(`${icon} **${event.sender.login}** labeled issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emoji.emojify(event.issue.title)}"`);
const content = emojify(`${icon} **${event.sender.login}** labeled issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emojify(event.issue.title)}"`);
this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content + (plain.length > 0 ? ` with labels ${plain}`: ""),
@ -1073,7 +1073,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
}
const icon = verb === 'opened' ? '🔵' : '⚪';
const content = emoji.emojify(`${icon} **${event.sender.login}** ${verb} a new PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"`);
const content = emojify(`${icon} **${event.sender.login}** ${verb} a new PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"`);
const labels = FormatUtil.formatLabels(event.pull_request.labels?.map(l => ({ name: l.name, description: l.description || undefined, color: l.color || undefined })));
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
@ -1098,7 +1098,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
const orgRepoName = event.repository.full_name;
const icon = '🔬';
const content = emoji.emojify(`${icon} **${event.sender.login}** has marked [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}) as ready to review "${event.pull_request.title}"`);
const content = emojify(`${icon} **${event.sender.login}** has marked [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}) as ready to review "${event.pull_request.title}"`);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -1131,7 +1131,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
// We don't recongnise this state, run away!
return;
}
const content = emoji.emojify(`${emojiForReview} **${event.sender.login}** ${event.review.state.toLowerCase()} [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}) "${event.pull_request.title}"`);
const content = emojify(`${emojiForReview} **${event.sender.login}** ${event.review.state.toLowerCase()} [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}) "${event.pull_request.title}"`);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -1178,7 +1178,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
const icon = verb === 'merged' ? '✳' : '⚫';
const content = emoji.emojify(`${icon} **${event.sender.login}** ${verb} PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"${withComment}`);
const content = emojify(`${icon} **${event.sender.login}** ${verb} PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"${withComment}`);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -1206,7 +1206,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
const orgRepoName = event.repository.full_name;
const icon = '📣';
let content = emoji.emojify(`${icon} **${event.sender.login}** released [${event.release.name ?? event.release.tag_name}](${event.release.html_url}) for ${orgRepoName}`);
let content = emojify(`${icon} **${event.sender.login}** released [${event.release.name ?? event.release.tag_name}](${event.release.html_url}) for ${orgRepoName}`);
if (event.release.body) {
content += `\n\n${event.release.body}`
}
@ -1233,7 +1233,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
}
const icon = '📝';
const orgRepoName = event.repository.full_name;
let content = emoji.emojify(`${icon} **${event.sender.login}** drafted release [${event.release.name ?? event.release.tag_name}](${event.release.html_url}) for ${orgRepoName}`);
let content = emojify(`${icon} **${event.sender.login}** drafted release [${event.release.name ?? event.release.tag_name}](${event.release.html_url}) for ${orgRepoName}`);
if (event.release.body) {
content += `\n\n${event.release.body}`
}
@ -1270,7 +1270,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
log.info(`onWorkflowCompleted ${this.roomId} ${this.org}/${this.repo} '${workflowRun.id}'`);
const orgRepoName = event.repository.full_name;
const icon = '☑';
const content = emoji.emojify(`${icon} Workflow **${event.workflow.name}** [${WORKFLOW_CONCLUSION_TO_NOTICE[workflowRun.conclusion]}](${workflowRun.html_url}) for ${orgRepoName} on branch \`${workflowRun.head_branch}\``);
const content = emojify(`${icon} Workflow **${event.workflow.name}** [${WORKFLOW_CONCLUSION_TO_NOTICE[workflowRun.conclusion]}](${workflowRun.html_url}) for ${orgRepoName} on branch \`${workflowRun.head_branch}\``);
await this.intent.sendEvent(this.roomId, {
msgtype: "m.notice",
body: content,
@ -1430,7 +1430,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
for (const install of installs.data.installations) {
if (install.account) {
results.push({
name: install.account.login || NAMELESS_ORG_PLACEHOLDER, // org or user name
name: getNameForGitHubAccount(install.account), // org or user name
});
} else {
log.debug(`Skipping install ${install.id}, has no attached account`);

View File

@ -1,8 +1,5 @@
/* eslint-disable camelcase */
import { ProjectsListResponseData } from './github/Types';
import emoji from "node-emoji";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { emojify } from "node-emoji";
import { JiraIssue } from './jira/Types';
import { formatLabels, getPartialBodyForJiraIssue, hashId, getPartialBodyForGithubIssue, getPartialBodyForGithubRepo, MinimalGitHubIssue } from "./libRs";
@ -32,11 +29,11 @@ export type LooseMinimalGitHubRepo = {
export class FormatUtil {
public static formatIssueRoomName(issue: MinimalGitHubIssue, repository: { full_name: string}) {
return emoji.emojify(`${repository.full_name}#${issue.number}: ${issue.title}`);
return emojify(`${repository.full_name}#${issue.number}: ${issue.title}`);
}
public static formatRepoRoomName(repo: LooseMinimalGitHubRepo) {
return emoji.emojify(repo.description ? `${repo.full_name}: ${repo.description}` : repo.full_name);
return emojify(repo.description ? `${repo.full_name}: ${repo.description}` : repo.full_name);
}
public static formatRoomTopic(repo: {state: string, html_url: string}) {

View File

@ -1,11 +1,11 @@
import { promises as fs } from "fs";
import axios from "axios";
import mime from "mime";
import { Appservice, Intent } from "matrix-bot-sdk";
import { Logger } from "matrix-appservice-bridge";
import { BridgeConfig } from "../config/Config";
const mime = import('mime');
const log = new Logger("BotUsersManager");
export class BotUser {
@ -154,7 +154,7 @@ export default class BotUsersManager {
contentType: string,
};
try {
const contentType = mime.getType(botUser.avatar);
const contentType = (await mime).default.getType(botUser.avatar);
if (!contentType) {
throw new Error("Could not determine content type");
}

View File

@ -33,7 +33,7 @@ export class LocalMQ extends EventEmitter implements MessageQueue {
public async pushWait<T, X>(message: MessageQueueMessage<T>,
timeout: number = DEFAULT_RES_TIMEOUT): Promise<X> {
let resolve: (value: X) => void;
let timer: NodeJS.Timer;
let timer: NodeJS.Timeout;
const p = new Promise<X>((res, rej) => {
resolve = res;

View File

@ -87,7 +87,7 @@ export class RedisMQ extends EventEmitter implements MessageQueue {
public async pushWait<T, X>(message: MessageQueueMessage<T>,
timeout: number = DEFAULT_RES_TIMEOUT): Promise<X> {
let resolve: (value: X) => void;
let timer: NodeJS.Timer;
let timer: NodeJS.Timeout;
const p = new Promise<X>((res, rej) => {
resolve = res;

View File

@ -6,9 +6,7 @@ use md5::{Digest, Md5};
use napi::bindgen_prelude::*;
use napi_derive::napi;
use rgb::RGB;
use ruma::events::room::message::sanitize::{
sanitize_html, HtmlSanitizerMode, RemoveReplyFallback,
};
use ruma::html::{sanitize_html, HtmlSanitizerMode, RemoveReplyFallback};
use std::fmt::Write;
#[derive(Serialize, Debug, Deserialize)]
@ -171,8 +169,8 @@ pub fn get_partial_body_for_jira_issue(jira_issue: JiraIssue) -> Result<JiraIssu
#[napi]
pub fn hash_id(id: String) -> Result<String> {
let mut hasher = Md5::new();
hasher.input(id);
Ok(hex::encode(hasher.result()))
hasher.update(id);
Ok(hex::encode(hasher.finalize()))
}
#[napi(js_name = "sanitizeHtml")]

View File

@ -3,7 +3,7 @@ import { Octokit } from "@octokit/rest";
import { Logger } from "matrix-appservice-bridge";
import { DiscussionQLResponse, DiscussionQL } from "./Discussion";
import * as GitHubWebhookTypes from "@octokit/webhooks-types";
import { GitHubOAuthErrorResponse, GitHubOAuthTokenResponse, InstallationDataType } from "./Types";
import { GitHubOAuthErrorResponse, GitHubOAuthTokenResponse, InstallationDataType, NAMELESS_ORG_PLACEHOLDER } from "./Types";
import axios from "axios";
import UserAgent from "../UserAgent";
@ -18,9 +18,15 @@ export class GitHubOAuthError extends Error {
}
}
export function getNameForGitHubAccount(account: {login: string}|{name?: string}) {
return ('login' in account) ? account.login : account.name ?? NAMELESS_ORG_PLACEHOLDER;
}
interface Installation {
account: {
login?: string;
} | {
name: string;
} | null;
id: number;
repository_selection: "selected"|"all";
@ -155,8 +161,8 @@ export class GithubInstance {
private async addInstallation(install: InstallationDataType, repos?: {full_name: string}[]) {
let matchesRepository: string[] = [];
if (install.repository_selection === "all") {
matchesRepository = [`${install.account?.login}/*`.toLowerCase()];
if (install.repository_selection === "all" && install.account && 'login' in install.account) {
matchesRepository = [`${install.account.login}/*`.toLowerCase()];
} else if (repos) {
matchesRepository = repos.map(r => r.full_name.toLowerCase());
} else {

View File

@ -74,8 +74,9 @@ export class GitHubProvisionerRouter {
const installs = await octokit.apps.listInstallationsForAuthenticatedUser({page: page, per_page: perPage});
for (const install of installs.data.installations) {
if (install.account) {
const name = ('login' in install.account) ? install.account.login : install.account.name ?? NAMELESS_ORG_PLACEHOLDER;
organisations.push({
name: install.account.login || NAMELESS_ORG_PLACEHOLDER, // org or user name
name, // org or user name
avatarUrl: install.account.avatar_url,
});
} else {

View File

@ -1,21 +0,0 @@
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import svgLoader from 'vite-svg-loader'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact(), svgLoader({ defaultImport: 'url'})],
root: 'web',
base: '',
build: {
outDir: '../public',
rollupOptions: {
input: {
main: resolve('web', 'index.html'),
oauth: resolve('web', 'oauth.html'),
}
},
emptyOutDir: true,
},
})

34
vite.config.mjs Normal file
View File

@ -0,0 +1,34 @@
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import { resolve } from 'path'
import alias from '@rollup/plugin-alias'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact()],
root: 'web',
base: '',
optimizeDeps: {
exclude: ['@vector-im/compound-web'],
},
build: {
outDir: '../public',
rollupOptions: {
input: {
main: resolve('web', 'index.html'),
oauth: resolve('web', 'oauth.html'),
},
plugins: [
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
]
})
]
},
emptyOutDir: true,
},
})

View File

@ -4,9 +4,10 @@ import WA, { MatrixCapabilities } from 'matrix-widget-api';
import { BridgeAPI, BridgeAPIError, EmbedType, embedTypeParameter } from './BridgeAPI';
import { BridgeRoomState } from '../src/Widgets/BridgeWidgetInterface';
import { LoadingSpinner } from './components/elements/LoadingSpinner';
import { Card, ErrorPane } from './components/elements';
import { Card } from './components/elements';
import AdminSettings from './components/AdminSettings';
import RoomConfigView from './components/RoomConfigView';
import { Alert } from '@vector-im/compound-web';
interface IMinimalState {
error: string|null,
@ -31,7 +32,7 @@ function parseFragment() {
return new URLSearchParams(fragmentString.substring(Math.max(fragmentString.indexOf('?'), 0)));
}
function assertParam(fragment, name) {
function assertParam(fragment: URLSearchParams, name: string) {
const val = fragment.get(name);
if (!val) throw new Error(`${name} is not present in URL - cannot load widget`);
return val;
@ -59,7 +60,7 @@ export default class App extends Component<void, IState> {
const serviceScope = qs.get('serviceScope');
const embedType = qs.get(embedTypeParameter);
// Fetch via config.
this.widgetApi = new WA.WidgetApi(widgetId);
this.widgetApi = new WA.WidgetApi(widgetId, 'http://localhost');
this.widgetApi.requestCapability(MatrixCapabilities.RequiresClient);
this.widgetApi.on("ready", () => {
console.log("Widget ready:", this);
@ -112,7 +113,7 @@ export default class App extends Component<void, IState> {
// Return the App component.
let content;
if (this.state.error) {
content = <ErrorPane>{this.state.error}</ErrorPane>;
content = <Alert type="critical" title="An error occured">{this.state.error}</Alert>;
} else if (this.state.busy) {
content = <Card>
<LoadingSpinner />

View File

@ -1,8 +1,8 @@
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
import { BridgeAPIError } from "../../BridgeAPI";
import { DropdownSearch, DropItem } from "./DropdownSearch";
import { ErrorPane } from "./ErrorPane";
import { InputField } from "./InputField";
import { Alert } from "@vector-im/compound-web";
interface Instance {
name: string;
@ -121,7 +121,7 @@ export function ConnectionSearch({
return <div>
{!searchError && instances === null && <p> Loading {serviceName} instances. </p>}
{searchError && <ErrorPane header="Search error"> {searchError} </ErrorPane> }
{searchError && <Alert type="critical" title="Search error"> {searchError} </Alert> }
<InputField visible={!!instances?.length} label={`${serviceName} Instance`} noPadding={true}>
<select onChange={onInstancePicked}>
{instanceListResults}

View File

@ -1,4 +0,0 @@
.errorPane {
max-width: 480px;
color: #FF4B55;
}

View File

@ -1,9 +0,0 @@
import { FunctionComponent } from "preact";
import ErrorBadge from "../../icons/error-badge.svg";
import style from "./ErrorPane.module.scss";
export const ErrorPane: FunctionComponent<{header?: string}> = ({ children, header }) => {
return <div class={`card error ${style.errorPane}`}>
<p><strong><img alt="error" src={ErrorBadge} /> { header || "Error occurred during widget load" }</strong>: {children}</p>
</div>;
};

View File

@ -1,4 +0,0 @@
.warningPane {
max-width: 480px;
color: #FF812D;
}

View File

@ -1,9 +0,0 @@
import { FunctionComponent } from "preact";
import WarningBadge from "../../icons/warning-badge.svg";
import style from "./WarningPane.module.scss";
export const WarningPane: FunctionComponent<{header?: string}> = ({ children, header }) => {
return <div class={`card error ${style.warningPane}`}>
<p><strong><img alt="warning" src={WarningBadge} /> { header || "Problem occurred during widget load" }</strong>: {children}</p>
</div>;
};

View File

@ -1,7 +1,5 @@
export * from "./Button";
export * from "./ButtonSet";
export * from "./Card";
export * from "./ErrorPane";
export * from "./InputField";
export * from "./ListItem";
export * from "./WarningPane";

View File

@ -1,13 +1,14 @@
import { FunctionComponent } from "preact";
import { useCallback, useEffect, useReducer, useState } from "preact/hooks"
import { BridgeAPI, BridgeAPIError } from "../../BridgeAPI";
import { ErrorPane, ListItem, WarningPane, Card } from "../elements";
import { ListItem, Card } from "../elements";
import style from "./RoomConfig.module.scss";
import { GetConnectionsResponseItem } from "../../../src/provisioning/api";
import { IConnectionState } from "../../../src/Connections";
import { LoadingSpinner } from '../elements/LoadingSpinner';
import { ErrCode } from "../../../src/api";
import { retry } from "../../../src/PromiseUtil";
import { Alert } from "@vector-im/compound-web";
export interface ConnectionConfigurationProps<SConfig, ConnectionType extends GetConnectionsResponseItem, ConnectionState extends IConnectionState> {
serviceConfig: SConfig;
loginLabel?: string;
@ -153,24 +154,21 @@ export const RoomConfig = function<SConfig, ConnectionType extends GetConnection
return <Card>
<main>
{
error &&
(!error.isWarning
? <ErrorPane header={error.header || "Error"}>{error.message}</ErrorPane>
: <WarningPane header={error.header || "Warning"}>{error.message}</WarningPane>
)
}
{ showHeader &&
<header className={style.header}>
<img alt="" src={headerImg} />
<h1>{text.header}</h1>
</header>
}
{
error &&
<Alert type="critical" text={error.header || error.isWarning ? "Warning" : "Error"}>{error.message}</Alert>
}
{ !canSendMessages && canEditRoom &&
<WarningPane header={"Misconfigured permissions"}>
<Alert type="info" title={"Misconfigured permissions"}>
This room does not permit the bot to send messages.
Please go to the room settings in your client and adjust permissions.
</WarningPane>
</Alert>
}
{ canEditRoom && <section>
<h2>{text.createNew}</h2>

View File

@ -1,5 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="#FF4B55"/>
<rect x="7" y="3" width="2" height="6" rx="1" fill="white"/>
<rect x="7" y="11" width="2" height="2" rx="1" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 271 B

View File

@ -1,5 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="#FF812D"/>
<rect x="7" y="3" width="2" height="6" rx="1" fill="white"/>
<rect x="7" y="11" width="2" height="2" rx="1" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 271 B

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GitHub Bridge Widget</title>
</head>
<body>
<body class="cpd-theme-light">
<main id="root"></main>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/index.tsx"></script>

View File

@ -3,6 +3,8 @@ import 'preact/devtools';
import App from './App';
import "./fonts/fonts.scss"
import "./styling.scss";
import "@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css";
import '@vector-im/compound-web/dist/style.css';
const [ root ] = document.getElementsByTagName('main');

View File

@ -1,8 +1,4 @@
declare module "*.png" {
const content: string
export = content
}
declare module "*.svg" {
const content: string
export = content
}

5426
yarn.lock

File diff suppressed because it is too large Load Diff