mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00
Rename project
This commit is contained in:
parent
c5541ed877
commit
40a75fa4d3
504
Cargo.lock
generated
504
Cargo.lock
generated
@ -2,45 +2,18 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "contrast"
|
||||
version = "0.1.0"
|
||||
@ -51,12 +24,6 @@ dependencies = [
|
||||
"rgb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.0.1"
|
||||
@ -67,155 +34,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"futures-core",
|
||||
"futures-macro",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"proc-macro-hack",
|
||||
"proc-macro-nested",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.3"
|
||||
@ -227,61 +45,12 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.108"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.9"
|
||||
@ -289,52 +58,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||
|
||||
[[package]]
|
||||
name = "matrix-github"
|
||||
name = "matrix-hookshot"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"contrast",
|
||||
"futures-util",
|
||||
"hyper",
|
||||
"napi",
|
||||
"napi-build",
|
||||
"napi-derive",
|
||||
"rgb",
|
||||
"routerify",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.7.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"miow",
|
||||
"ntapi",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "napi"
|
||||
version = "1.7.10"
|
||||
@ -342,10 +79,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9050238b713b3c5dd5ae1613da1ccefe4061c03992f9e9bbe43b7d473ba4bd3c"
|
||||
dependencies = [
|
||||
"napi-sys",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
@ -372,15 +107,6 @@ version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67cf20e0081fea04e044aa4adf74cfea8ddc0324eec2894b1c700f4cafc72a56"
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.14"
|
||||
@ -390,77 +116,12 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.32"
|
||||
@ -479,32 +140,6 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.29"
|
||||
@ -514,31 +149,12 @@ dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "routerify"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c6bb49594c791cadb5ccfa5f36d41b498d40482595c199d10cd318800280bd9"
|
||||
dependencies = [
|
||||
"http",
|
||||
"hyper",
|
||||
"lazy_static",
|
||||
"percent-encoding",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.130"
|
||||
@ -567,37 +183,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.81"
|
||||
@ -624,83 +209,6 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"tokio-macros",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"pin-project-lite",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.7"
|
||||
@ -734,16 +242,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "matrix-github"
|
||||
name = "matrix-hookshot"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
12
Dockerfile
12
Dockerfile
@ -18,15 +18,15 @@ RUN yarn build
|
||||
# Stage 1: The actual container
|
||||
FROM node:16
|
||||
|
||||
COPY --from=builder /src/lib/ /bin/matrix-github/
|
||||
COPY --from=builder /src/public/ /bin/matrix-github/public/
|
||||
COPY --from=builder /src/package.json /bin/matrix-github/
|
||||
COPY --from=builder /src/yarn.lock /bin/matrix-github/
|
||||
WORKDIR /bin/matrix-github
|
||||
COPY --from=builder /src/lib/ /bin/matrix-hookshot/
|
||||
COPY --from=builder /src/public/ /bin/matrix-hookshot/public/
|
||||
COPY --from=builder /src/package.json /bin/matrix-hookshot/
|
||||
COPY --from=builder /src/yarn.lock /bin/matrix-hookshot/
|
||||
WORKDIR /bin/matrix-hookshot
|
||||
RUN yarn --production
|
||||
|
||||
VOLUME /data
|
||||
EXPOSE 9993
|
||||
EXPOSE 7775
|
||||
|
||||
CMD ["node", "/bin/matrix-github/App/BridgeApp.js", "/data/config.yml", "/data/registration.yml"]
|
||||
CMD ["node", "/bin/matrix-hookshot/App/BridgeApp.js", "/data/config.yml", "/data/registration.yml"]
|
||||
|
@ -1,6 +1,8 @@
|
||||
matrix-github
|
||||
matrix-hookshot
|
||||
=============
|
||||
|
||||
*Previously matrix-github*
|
||||
|
||||
[](https://matrix.to/#/#github-bridge:half-shot.uk)
|
||||
|
||||
|
||||
@ -12,12 +14,12 @@ This bridge requires at least Node 12, and Rust installed. If you do not have ru
|
||||
|
||||
To set up the bridge, simply clone this repository.
|
||||
|
||||
` git clone git@github.com:Half-Shot/matrix-github.git`
|
||||
` git clone git@github.com:Half-Shot/matrix-hookshot.git`
|
||||
|
||||
then you will need to install the dependencies
|
||||
|
||||
```sh
|
||||
cd matrix-github
|
||||
cd matrix-hookshot
|
||||
yarn
|
||||
```
|
||||
|
||||
|
@ -15,7 +15,7 @@ services:
|
||||
environment:
|
||||
CFG_QUEUE_MONOLITHIC: "false"
|
||||
CFG_QUEUE_HOST: "redis"
|
||||
command: node /bin/matrix-github/App/GithubWebhookApp.js /data/config.yml /data/registration.yml
|
||||
command: node /bin/matrix-hookshot/App/GithubWebhookApp.js /data/config.yml /data/registration.yml
|
||||
sender:
|
||||
build:
|
||||
context: .
|
||||
@ -27,7 +27,7 @@ services:
|
||||
environment:
|
||||
CFG_QUEUE_MONOLITHIC: "false"
|
||||
CFG_QUEUE_HOST: "redis"
|
||||
command: node /bin/matrix-github/App/MatrixSenderApp.js /data/config.yml /data/registration.yml
|
||||
command: node /bin/matrix-hookshot/App/MatrixSenderApp.js /data/config.yml /data/registration.yml
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
@ -41,4 +41,4 @@ services:
|
||||
environment:
|
||||
CFG_QUEUE_MONOLITHIC: "false"
|
||||
CFG_QUEUE_HOST: "redis"
|
||||
command: node /bin/matrix-github/App/BridgeApp.js /data/config.yml /data/registration.yml
|
||||
command: node /bin/matrix-hookshot/App/BridgeApp.js /data/config.yml /data/registration.yml
|
||||
|
@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "matrix-github",
|
||||
"name": "matrix-hookshot",
|
||||
"version": "0.1.0",
|
||||
"description": "A bridge that displays GitHub issues/PRs as rooms.",
|
||||
"main": "lib/app.js",
|
||||
"repository": "https://github.com/Half-Shot/matrix-github",
|
||||
"repository": "https://github.com/Half-Shot/matrix-hookshot",
|
||||
"author": "Half-Shot",
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"napi": {
|
||||
"name": "matrix-github-rs"
|
||||
"name": "matrix-hookshot-rs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
@ -1,4 +1,4 @@
|
||||
id: matrix-github # This can be anything, but must be unique within your homeserver
|
||||
id: matrix-hookshot # This can be anything, but must be unique within your homeserver
|
||||
as_token: aaaaaaaaaa # This again can be a random string
|
||||
hs_token: aaaaaaaaaa # ..as can this
|
||||
namespaces:
|
||||
|
@ -26,10 +26,13 @@ type ProjectsListForUserResponseData = Endpoints["GET /users/{username}/projects
|
||||
const md = new markdown();
|
||||
const log = new LogWrapper('AdminRoom');
|
||||
|
||||
export const BRIDGE_ROOM_TYPE = "uk.half-shot.matrix-github.room";
|
||||
export const BRIDGE_NOTIF_TYPE = "uk.half-shot.matrix-github.notif_state";
|
||||
export const BRIDGE_GITLAB_NOTIF_TYPE = "uk.half-shot.matrix-github.gitlab.notif_state";
|
||||
export const LEGACY_BRIDGE_ROOM_TYPE = "uk.half-shot.matrix-github.room";
|
||||
export const LEGACY_BRIDGE_NOTIF_TYPE = "uk.half-shot.matrix-github.notif_state";
|
||||
export const LEGACY_BRIDGE_GITLAB_NOTIF_TYPE = "uk.half-shot.matrix-github.gitlab.notif_state";
|
||||
|
||||
export const BRIDGE_ROOM_TYPE = "uk.half-shot.matrix-hookshot.github.room";
|
||||
export const BRIDGE_NOTIF_TYPE = "uk.half-shot.matrix-hookshot.github.notif_state";
|
||||
export const BRIDGE_GITLAB_NOTIF_TYPE = "uk.half-shot.matrix-hookshot.gitlab.notif_state";
|
||||
export interface AdminAccountData {
|
||||
// eslint-disable-next-line camelcase
|
||||
admin_user: string;
|
||||
@ -109,19 +112,29 @@ export class AdminRoom extends EventEmitter {
|
||||
public async getNotifSince(type: "github"|"gitlab", instanceName?: string) {
|
||||
if (type === "gitlab") {
|
||||
try {
|
||||
const { since } = await this.botIntent.underlyingClient.getRoomAccountData(
|
||||
`${BRIDGE_GITLAB_NOTIF_TYPE}:${instanceName}`, this.roomId
|
||||
let accountData: null|{since: number} = await this.botIntent.underlyingClient.getSafeRoomAccountData(
|
||||
`${BRIDGE_GITLAB_NOTIF_TYPE}:${instanceName}`, this.roomId, null
|
||||
);
|
||||
return since;
|
||||
if (!accountData) {
|
||||
accountData = await this.botIntent.underlyingClient.getSafeRoomAccountData(
|
||||
`${LEGACY_BRIDGE_GITLAB_NOTIF_TYPE}:${instanceName}`, this.roomId, { since: 0 }
|
||||
);
|
||||
}
|
||||
return accountData.since;
|
||||
} catch {
|
||||
// TODO: We should look at this error.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
try {
|
||||
const { since } = await this.botIntent.underlyingClient.getRoomAccountData(BRIDGE_NOTIF_TYPE, this.roomId);
|
||||
log.debug(`Got ${type} notif-since to ${since}`);
|
||||
return since;
|
||||
let accountData: null|{since: number} = await this.botIntent.underlyingClient.getSafeRoomAccountData(BRIDGE_NOTIF_TYPE, this.roomId, { since: 0 });
|
||||
if (!accountData) {
|
||||
accountData = await this.botIntent.underlyingClient.getSafeRoomAccountData(
|
||||
`${LEGACY_BRIDGE_NOTIF_TYPE}:${instanceName}`, this.roomId, { since: 0 }
|
||||
);
|
||||
}
|
||||
log.debug(`Got ${type} notif-since to ${accountData.since}`);
|
||||
return accountData.since;
|
||||
} catch (ex) {
|
||||
log.warn(`Filed to get ${type} notif-since`, ex);
|
||||
// TODO: We should look at this error.
|
||||
@ -506,7 +519,7 @@ export class AdminRoom extends EventEmitter {
|
||||
const users = parameters.filter(param => param.toLowerCase().startsWith("users:")).map(param => param.toLowerCase().substring("users:".length).split(",")).flat();
|
||||
const repos = parameters.filter(param => param.toLowerCase().startsWith("repos:")).map(param => param.toLowerCase().substring("repos:".length).split(",")).flat();
|
||||
if (orgs.length + users.length + repos.length === 0) {
|
||||
return this.sendNotice("You must specify some filter options like 'orgs:matrix-org,half-shot', 'users:Half-Shot' or 'repos:matrix-github'");
|
||||
return this.sendNotice("You must specify some filter options like 'orgs:matrix-org,half-shot', 'users:Half-Shot' or 'repos:matrix-hookshot'");
|
||||
}
|
||||
this.notifFilter.setFilter(name, {
|
||||
orgs,
|
||||
@ -533,9 +546,10 @@ export class AdminRoom extends EventEmitter {
|
||||
}
|
||||
|
||||
private async saveAccountData(updateFn: (record: AdminAccountData) => AdminAccountData) {
|
||||
const oldData: AdminAccountData = await this.botIntent.underlyingClient.getRoomAccountData(
|
||||
BRIDGE_ROOM_TYPE, this.roomId,
|
||||
);
|
||||
let oldData: AdminAccountData|null = await this.botIntent.underlyingClient.getSafeRoomAccountData(BRIDGE_ROOM_TYPE, this.roomId, null);
|
||||
if (!oldData) {
|
||||
oldData = await this.botIntent.underlyingClient.getSafeRoomAccountData(LEGACY_BRIDGE_ROOM_TYPE, this.roomId, {admin_user: this.userId});
|
||||
}
|
||||
const newData = updateFn(oldData);
|
||||
await this.botIntent.underlyingClient.setRoomAccountData(BRIDGE_ROOM_TYPE, this.roomId, newData);
|
||||
this.emit("settings.changed", this, oldData, newData);
|
||||
|
@ -18,7 +18,7 @@ const log = new LogWrapper("CommentProcessor");
|
||||
interface IMatrixCommentEvent extends MatrixMessageContent {
|
||||
// eslint-disable-next-line camelcase
|
||||
external_url: string;
|
||||
"uk.half-shot.matrix-github.comment": {
|
||||
"uk.half-shot.matrix-hookshot.github.comment": {
|
||||
id: number;
|
||||
};
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ const TRANSFORMATION_TIMEOUT_MS = 2000;
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GenericHookConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.generic.hook";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.generic.hook";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.generic.hook";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GenericHookConnection.CanonicalEventType,
|
||||
GenericHookConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
public get hookId() {
|
||||
|
@ -27,10 +27,12 @@ const md = new markdown();
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubDiscussionConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.discussion";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.discussion";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.discussion";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubDiscussionConnection.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitHubDiscussionConnection.CanonicalEventType,
|
||||
GitHubDiscussionConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static readonly QueryRoomRegex = /#github_disc_(.+)_(.+)_(\d+):.*/;
|
||||
@ -131,7 +133,7 @@ export class GitHubDiscussionConnection implements IConnection {
|
||||
formatted_body: md.render(data.comment.body),
|
||||
msgtype: 'm.text',
|
||||
external_url: data.comment.html_url,
|
||||
'uk.half-shot.matrix-github.discussion.comment_id': data.comment.id,
|
||||
'uk.half-shot.matrix-hookshot.github.discussion.comment_id': data.comment.id,
|
||||
});
|
||||
}
|
||||
}
|
@ -17,10 +17,12 @@ export interface GitHubDiscussionSpaceConnectionState {
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubDiscussionSpace implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.discussion.space";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.discussion.space";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.discussion.space";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubDiscussionSpace.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitHubDiscussionSpace.CanonicalEventType,
|
||||
GitHubDiscussionSpace.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static readonly QueryRoomRegex = /#github_disc_(.+)_(.+):.*/;
|
||||
@ -64,9 +66,6 @@ export class GitHubDiscussionSpace implements IConnection {
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
log.info(`uploading ${profile.data.avatar_url}`);
|
||||
// This does exist, but headers is silly and doesn't have content-type.
|
||||
// tslint:disable-next-line: no-any
|
||||
console.log(res.headers);
|
||||
const contentType: string = res.headers["content-type"];
|
||||
const mxcUrl = await opts.as.botClient.uploadContent(
|
||||
Buffer.from(res.data as ArrayBuffer),
|
||||
|
@ -38,10 +38,12 @@ interface IQueryRoomOpts {
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubIssueConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.bridge";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.issue";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.bridge";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubIssueConnection.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitHubIssueConnection.CanonicalEventType,
|
||||
GitHubIssueConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static readonly QueryRoomRegex = /#github_(.+)_(.+)_(\d+):.*/;
|
||||
@ -84,9 +86,6 @@ export class GitHubIssueConnection implements IConnection {
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
log.info(`uploading ${profile.data.avatar_url}`);
|
||||
// This does exist, but headers is silly and doesn't have content-type.
|
||||
// tslint:disable-next-line: no-any
|
||||
console.log(res.headers);
|
||||
const contentType: string = res.headers["content-type"];
|
||||
const mxcUrl = await opts.as.botClient.uploadContent(
|
||||
Buffer.from(res.data as ArrayBuffer),
|
||||
|
@ -14,10 +14,12 @@ const log = new LogWrapper("GitHubProjectConnection");
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubProjectConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.project";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.project";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.project";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubProjectConnection.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitHubProjectConnection.CanonicalEventType,
|
||||
GitHubProjectConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static async onOpenProject(project: ProjectsGetResponseData, as: Appservice, inviteUser: string): Promise<GitHubProjectConnection> {
|
||||
|
@ -58,10 +58,12 @@ function compareEmojiStrings(e0: string, e1: string, e0Index = 0) {
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubRepoConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.repository";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.repository";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.repository";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubRepoConnection.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitHubRepoConnection.CanonicalEventType,
|
||||
GitHubRepoConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static readonly QueryRoomRegex = /#github_(.+)_(.+):.*/;
|
||||
@ -101,9 +103,6 @@ export class GitHubRepoConnection implements IConnection {
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
log.info(`uploading ${profile.data.avatar_url}`);
|
||||
// This does exist, but headers is silly and doesn't have content-type.
|
||||
// tslint:disable-next-line: no-any
|
||||
console.log(res.headers);
|
||||
const contentType: string = res.headers["content-type"];
|
||||
const mxcUrl = await opts.as.botClient.uploadContent(
|
||||
Buffer.from(res.data as ArrayBuffer),
|
||||
@ -481,7 +480,7 @@ ${event.release.body}`;
|
||||
// eslint-disable-next-line camelcase
|
||||
const {event_id, key} = (evt.content as MatrixReactionContent)["m.relates_to"];
|
||||
const ev = await this.as.botClient.getEvent(this.roomId, event_id);
|
||||
const issueContent = ev.content["uk.half-shot.matrix-github.issue"];
|
||||
const issueContent = ev.content["uk.half-shot.matrix-hookshot.github.issue"];
|
||||
if (!issueContent) {
|
||||
log.debug('Reaction to event did not pertain to a issue');
|
||||
return; // Not our event.
|
||||
|
@ -16,7 +16,8 @@ export interface GitHubUserSpaceConnectionState {
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitHubUserSpace implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.user.space";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.github.user.space";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.user.space";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitHubUserSpace.CanonicalEventType, // Legacy event, with an awful name.
|
||||
|
@ -33,10 +33,12 @@ const log = new LogWrapper("GitLabIssueConnection");
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitLabIssueConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.gitlab.issue";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.gitlab.issue";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.gitlab.issue";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitLabIssueConnection.CanonicalEventType,
|
||||
GitLabIssueConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static readonly QueryRoomRegex = /#gitlab_(.+)_(.+)_(\d+):.*/;
|
||||
@ -104,7 +106,6 @@ export class GitLabIssueConnection implements IConnection {
|
||||
|
||||
public async onCommentCreated(event: IGitLabWebhookNoteEvent) {
|
||||
log.info(`${this.toString()} onCommentCreated ${event.object_attributes.noteable_id}`);
|
||||
console.log(event);
|
||||
if (event.repository) {
|
||||
// Delay to stop comments racing sends
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
@ -23,10 +23,12 @@ const md = new markdown();
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class GitLabRepoConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.gitlab.repository";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.gitlab.repository";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.gitlab.repository";
|
||||
|
||||
static readonly EventTypes = [
|
||||
GitLabRepoConnection.CanonicalEventType, // Legacy event, with an awful name.
|
||||
GitLabRepoConnection.CanonicalEventType,
|
||||
GitLabRepoConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static botCommands: BotCommands;
|
||||
|
@ -22,10 +22,12 @@ const md = new markdownit();
|
||||
* Handles rooms connected to a github repo.
|
||||
*/
|
||||
export class JiraProjectConnection implements IConnection {
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-github.jira.project";
|
||||
static readonly CanonicalEventType = "uk.half-shot.matrix-hookshot.jira.project";
|
||||
static readonly LegacyCanonicalEventType = "uk.half-shot.matrix-github.jira.project";
|
||||
|
||||
static readonly EventTypes = [
|
||||
JiraProjectConnection.CanonicalEventType,
|
||||
JiraProjectConnection.LegacyCanonicalEventType,
|
||||
];
|
||||
|
||||
static getTopicString(authorName: string, state: string) {
|
||||
|
@ -152,7 +152,7 @@ pub fn get_partial_body_for_jira_issue(ctx: CallContext) -> Result<JsObject, Nap
|
||||
.create_string_from_std(jira_issue.fields.project._self)?,
|
||||
)?;
|
||||
|
||||
body.set_named_property("uk.half-shot.matrix-github.jira.issue", jira_issue_result)?;
|
||||
body.set_named_property("uk.half-shot.matrix-github.jira.project", jira_project)?;
|
||||
body.set_named_property("uk.half-shot.matrix-hookshot.jira.issue", jira_issue_result)?;
|
||||
body.set_named_property("uk.half-shot.matrix-hookshot.jira.project", jira_project)?;
|
||||
Ok(body)
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import { ProjectsListResponseData } from './Github/Types';
|
||||
import emoji from "node-emoji";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
import { contrastColor } from "contrast-color";
|
||||
import { JiraIssue } from './Jira/Types';
|
||||
import { format_util } from "./libRs";
|
||||
|
||||
@ -50,7 +49,7 @@ export class FormatUtil {
|
||||
public static getPartialBodyForRepo(repo: IMinimalRepository) {
|
||||
return {
|
||||
"external_url": repo.html_url,
|
||||
"uk.half-shot.matrix-github.repo": {
|
||||
"uk.half-shot.matrix-hookshot.github.repo": {
|
||||
id: repo.id,
|
||||
name: repo.full_name,
|
||||
url: repo.html_url,
|
||||
@ -62,7 +61,7 @@ export class FormatUtil {
|
||||
return {
|
||||
...FormatUtil.getPartialBodyForRepo(repo),
|
||||
"external_url": issue.html_url,
|
||||
"uk.half-shot.matrix-github.issue": {
|
||||
"uk.half-shot.matrix-hookshot.github.issue": {
|
||||
id: issue.id,
|
||||
number: issue.number,
|
||||
title: issue.title,
|
||||
@ -78,7 +77,7 @@ export class FormatUtil {
|
||||
return {
|
||||
...(issue && repo ? FormatUtil.getPartialBodyForIssue(repo, issue) : undefined),
|
||||
"external_url": comment.html_url,
|
||||
"uk.half-shot.matrix-github.comment": {
|
||||
"uk.half-shot.matrix-hookshot.github.comment": {
|
||||
id: comment.id,
|
||||
},
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ import { DiscussionQLResponse, DiscussionQL } from "./Discussion";
|
||||
|
||||
const log = new LogWrapper("GithubInstance");
|
||||
|
||||
const USER_AGENT = "matrix-github v0.0.1";
|
||||
const USER_AGENT = "matrix-hookshot v0.0.1";
|
||||
export class GithubInstance {
|
||||
private internalOctokit!: Octokit;
|
||||
|
||||
|
@ -518,7 +518,14 @@ export class GithubBridge {
|
||||
roomId, NotifFilter.StateType, "",
|
||||
);
|
||||
} catch (ex) {
|
||||
// No state yet
|
||||
try {
|
||||
notifContent = await this.as.botIntent.underlyingClient.getRoomStateEvent(
|
||||
roomId, NotifFilter.LegacyStateType, "",
|
||||
);
|
||||
}
|
||||
catch (ex) {
|
||||
// No state yet
|
||||
}
|
||||
}
|
||||
const adminRoom = await this.setupAdminRoom(roomId, accountData, notifContent || NotifFilter.getDefaultContent());
|
||||
// Call this on startup to set the state
|
||||
@ -596,8 +603,8 @@ export class GithubBridge {
|
||||
// This might be a reply to a notification
|
||||
try {
|
||||
const ev = metadata.realEvent;
|
||||
const splitParts: string[] = ev.content["uk.half-shot.matrix-github.repo"]?.name.split("/");
|
||||
const issueNumber = ev.content["uk.half-shot.matrix-github.issue"]?.number;
|
||||
const splitParts: string[] = ev.content["uk.half-shot.matrix-hookshot.github.repo"]?.name.split("/");
|
||||
const issueNumber = ev.content["uk.half-shot.matrix-hookshot.github.issue"]?.number;
|
||||
if (splitParts && issueNumber) {
|
||||
log.info(`Handling reply for ${splitParts}${issueNumber}`);
|
||||
const connections = this.connectionManager.getConnectionsForGithubIssue(splitParts[0], splitParts[1], issueNumber);
|
||||
|
@ -23,7 +23,7 @@ export class GitLabClient {
|
||||
return {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${this.token}`,
|
||||
"User-Agent": "matrix-github v0.0.1",
|
||||
"User-Agent": "matrix-hookshot v0.0.1",
|
||||
},
|
||||
baseURL: this.instanceUrl
|
||||
};
|
||||
|
@ -17,7 +17,8 @@ export interface NotificationFilterStateContent {
|
||||
* A notification filter is a set of keys that define what should be sent to the user.
|
||||
*/
|
||||
export class NotifFilter {
|
||||
static readonly StateType = "uk.half-shot.matrix-github.notif-filter"
|
||||
static readonly StateType = "uk.half-shot.matrix-github.notif-filter";
|
||||
static readonly LegacyStateType = "uk.half-shot.matrix-hookshot.notif-filter";
|
||||
|
||||
static getDefaultContent(): NotificationFilterStateContent {
|
||||
return {
|
||||
|
@ -5,15 +5,24 @@ import LogWrapper from "./LogWrapper";
|
||||
import { GitLabClient } from "./Gitlab/Client";
|
||||
import { GithubInstance } from "./Github/GithubInstance";
|
||||
|
||||
const ACCOUNT_DATA_TYPE = "uk.half-shot.matrix-github.password-store:";
|
||||
const ACCOUNT_DATA_GITLAB_TYPE = "uk.half-shot.matrix-github.gitlab.password-store:";
|
||||
const log = new LogWrapper("UserTokenStore");
|
||||
const ACCOUNT_DATA_TYPE = "uk.half-shot.matrix-hookshot.github.password-store:";
|
||||
const ACCOUNT_DATA_GITLAB_TYPE = "uk.half-shot.matrix-hookshot.gitlab.password-store:";
|
||||
|
||||
function tokenKey(type: "github"|"gitlab", userId: string, instanceUrl?: string) {
|
||||
const LEGACY_ACCOUNT_DATA_TYPE = "uk.half-shot.matrix-github.password-store:";
|
||||
const LEGACY_ACCOUNT_DATA_GITLAB_TYPE = "uk.half-shot.matrix-github.gitlab.password-store:";
|
||||
|
||||
const log = new LogWrapper("UserTokenStore");
|
||||
type TokenType = "github"|"gitlab"|"jira";
|
||||
const AllowedTokenTypes = ["github", "gitlab", "jira"];
|
||||
|
||||
function tokenKey(type: TokenType, userId: string, legacy = false, instanceUrl?: string) {
|
||||
if (type === "github") {
|
||||
return `${ACCOUNT_DATA_TYPE}${userId}`;
|
||||
return `${legacy ? LEGACY_ACCOUNT_DATA_TYPE : ACCOUNT_DATA_TYPE}${userId}`;
|
||||
}
|
||||
return `${ACCOUNT_DATA_GITLAB_TYPE}${instanceUrl}${userId}`;
|
||||
if (!instanceUrl) {
|
||||
throw Error(`Expected instanceUrl for ${type}`);
|
||||
}
|
||||
return `${legacy ? LEGACY_ACCOUNT_DATA_GITLAB_TYPE : ACCOUNT_DATA_GITLAB_TYPE}${instanceUrl}${userId}`;
|
||||
}
|
||||
|
||||
export class UserTokenStore {
|
||||
@ -28,8 +37,8 @@ export class UserTokenStore {
|
||||
this.key = await fs.readFile(this.keyPath);
|
||||
}
|
||||
|
||||
public async storeUserToken(type: "github"|"gitlab", userId: string, token: string, instanceUrl?: string): Promise<void> {
|
||||
const key = tokenKey(type, userId, instanceUrl);
|
||||
public async storeUserToken(type: TokenType, userId: string, token: string, instanceUrl?: string): Promise<void> {
|
||||
const key = tokenKey(type, userId, false, instanceUrl);
|
||||
const data = {
|
||||
encrypted: publicEncrypt(this.key, Buffer.from(token)).toString("base64"),
|
||||
instance: instanceUrl,
|
||||
@ -40,18 +49,19 @@ export class UserTokenStore {
|
||||
log.debug(`Stored`, data);
|
||||
}
|
||||
|
||||
public async getUserToken(type: "github"|"gitlab", userId: string, instanceUrl?: string): Promise<string|null> {
|
||||
const key = tokenKey(type, userId, instanceUrl);
|
||||
public async getUserToken(type: TokenType, userId: string, instanceUrl?: string): Promise<string|null> {
|
||||
const key = tokenKey(type, userId, false, instanceUrl);
|
||||
const existingToken = this.userTokens.get(key);
|
||||
if (existingToken) {
|
||||
return existingToken;
|
||||
}
|
||||
try {
|
||||
let obj;
|
||||
if (type === "github") {
|
||||
obj = await this.intent.underlyingClient.getAccountData<{encrypted: string}>(key);
|
||||
} else if (type === "gitlab") {
|
||||
obj = await this.intent.underlyingClient.getAccountData<{encrypted: string}>(key);
|
||||
if (AllowedTokenTypes.includes(type)) {
|
||||
obj = await this.intent.underlyingClient.getSafeAccountData<{encrypted: string}>(key);
|
||||
if (!obj) {
|
||||
obj = await this.intent.underlyingClient.getAccountData<{encrypted: string}>(tokenKey(type, userId, true, instanceUrl));
|
||||
}
|
||||
} else {
|
||||
throw Error('Unknown type');
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ import { JiraIssue } from "./Jira/Types";
|
||||
let rootModule;
|
||||
try {
|
||||
// In production, we expect it co-located
|
||||
rootModule = require('./matrix-github-rs.node');
|
||||
rootModule = require('./matrix-hookshot-rs.node');
|
||||
} catch (ex) {
|
||||
// When running under ts-node, it may not be co-located.
|
||||
rootModule = require('../lib/matrix-github-rs.node');
|
||||
rootModule = require('../lib/matrix-hookshot-rs.node');
|
||||
}
|
||||
|
||||
interface FormatUtil {
|
||||
|
@ -89,12 +89,12 @@ describe("FormatUtilTest", () => {
|
||||
it("should correctly format a JIRA issue", () => {
|
||||
expect(FormatUtil.getPartialBodyForJiraIssue(SIMPLE_JIRA_ISSUE)).to.deep.equal({
|
||||
"external_url": "http://example-api.url.com/browse/TEST-001",
|
||||
"uk.half-shot.matrix-github.jira.issue": {
|
||||
"uk.half-shot.matrix-hookshot.jira.issue": {
|
||||
"api_url": "http://example-api.url.com/issue-url",
|
||||
"id": "test-issue",
|
||||
"key": "TEST-001",
|
||||
},
|
||||
"uk.half-shot.matrix-github.jira.project": {
|
||||
"uk.half-shot.matrix-hookshot.jira.project": {
|
||||
"api_url": "http://example-api.url.com/project-url",
|
||||
"id": "test-project",
|
||||
"key": "TEST",
|
||||
|
@ -1979,11 +1979,6 @@ content-type@1.0.4, content-type@~1.0.4:
|
||||
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
|
||||
integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==
|
||||
|
||||
contrast-color@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/contrast-color/-/contrast-color-1.0.1.tgz#15fd7b444f43ccb7d6175d7e131d095623a9f146"
|
||||
integrity sha512-XeTV/LiyWrf/OWnODTqve2YGBfg32N6zlLqQjJKmEY+ffDqIfecgdmluVz7tky1D4VEaweZgoeRJJT87gDSDCQ==
|
||||
|
||||
convert-source-map@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
|
||||
|
Loading…
x
Reference in New Issue
Block a user