diff --git a/Cargo.lock b/Cargo.lock index fa0b763..ae8eadc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,9 +56,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.2.2" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724" +checksum = "0070905b2c4a98d184c4e81025253cb192aa8a73827553f38e9410801ceb35bb" dependencies = [ "actix-codec", "actix-rt", @@ -66,7 +66,7 @@ dependencies = [ "actix-tls", "actix-utils", "ahash 0.7.6", - "base64", + "base64 0.21.0", "bitflags", "brotli", "bytes", @@ -88,6 +88,8 @@ dependencies = [ "rand", "sha1", "smallvec", + "tokio", + "tokio-util", "tracing", ] @@ -116,9 +118,9 @@ dependencies = [ [[package]] name = "actix-rt" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" +checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" dependencies = [ "actix-macros", "futures-core", @@ -127,9 +129,9 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" +checksum = "3e8613a75dd50cc45f473cee3c34d59ed677c0f7b44480ce3b8247d7dc519327" dependencies = [ "actix-rt", "actix-service", @@ -185,9 +187,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.2.1" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9" +checksum = "464e0fddc668ede5f26ec1f9557a8d44eda948732f40c6b0ad79126930eb775f" dependencies = [ "actix-codec", "actix-http", @@ -255,9 +257,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", "once_cell", @@ -303,13 +305,13 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "ap-relay" -version = "0.3.79" +version = "0.3.82" dependencies = [ "activitystreams", "activitystreams-ext", @@ -320,7 +322,7 @@ dependencies = [ "anyhow", "awc", "background-jobs", - "base64", + "base64 0.21.0", "bcrypt", "clap", "config", @@ -347,14 +349,12 @@ dependencies = [ "rustls-pemfile", "serde", "serde_json", - "sha2", - "signature", "sled", "teloxide", "thiserror", "time", "tokio", - "toml", + "toml 0.7.2", "tracing", "tracing-actix-web", "tracing-awc", @@ -385,27 +385,22 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "async-stream" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" dependencies = [ "proc-macro2", "quote", @@ -414,9 +409,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.60" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -431,9 +426,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "awc" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ca7ff88063086d2e2c70b9f3b29b2fcd999bac68ac21731e66781970d68519" +checksum = "0dff3fc64a176e0d4398c71b0f2c2679ff4a723c6ed8fcc68dfe5baa00665388" dependencies = [ "actix-codec", "actix-http", @@ -442,7 +437,7 @@ dependencies = [ "actix-tls", "actix-utils", "ahash 0.7.6", - "base64", + "base64 0.21.0", "bytes", "cfg-if", "derive_more", @@ -465,9 +460,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.1" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48" +checksum = "2bd379e511536bad07447f899300aa526e9bae8e6f66dc5e5ca45d7587b7c1ec" dependencies = [ "async-trait", "axum-core", @@ -494,9 +489,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" +checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34" dependencies = [ "async-trait", "bytes", @@ -565,6 +560,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "base64ct" version = "1.5.3" @@ -573,13 +574,14 @@ checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bcrypt" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e7c93a3fb23b2fdde989b2c9ec4dd153063ec81f408507f84c090cd91c6641" +checksum = "9df288bec72232f78c1ec5fe4e8f1d108aa0265476e93097593c803c8c02062a" dependencies = [ - "base64", + "base64 0.21.0", "blowfish", "getrandom", + "subtle", "zeroize", ] @@ -589,18 +591,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitvec" -version = "0.19.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.10.3" @@ -633,9 +623,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.2" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -643,9 +633,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytecount" @@ -661,9 +651,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "bytestring" @@ -676,9 +666,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -708,9 +698,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.32" +version = "4.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" dependencies = [ "bitflags", "clap_derive", @@ -723,9 +713,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" dependencies = [ "heck", "proc-macro-error", @@ -736,9 +726,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" dependencies = [ "os_str_bytes", ] @@ -752,13 +742,13 @@ dependencies = [ "async-trait", "json5", "lazy_static", - "nom 7.1.2", + "nom", "pathdiff", "ron", "rust-ini", "serde", "serde_json", - "toml", + "toml 0.5.11", "yaml-rust", ] @@ -872,13 +862,13 @@ dependencies = [ [[package]] name = "css-minify" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692b185e3b7c9af96b3195f3021f53a931d896968ed2ad3fb1cdb6558b30c9ab" +checksum = "874c6e2d19f8d4a285083b11a3241bfbe01ac3ed85f26e1e6b34888d960552bd" dependencies = [ "derive_more", "indexmap", - "nom 6.1.2", + "nom", ] [[package]] @@ -926,7 +916,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core 0.9.5", + "parking_lot_core 0.9.7", ] [[package]] @@ -987,15 +977,15 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ "cfg-if", ] @@ -1045,9 +1035,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] @@ -1093,12 +1083,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "funty" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" - [[package]] name = "futf" version = "0.1.5" @@ -1111,9 +1095,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1126,9 +1110,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1136,15 +1120,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1153,15 +1137,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1170,21 +1154,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1258,11 +1242,11 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.2", + "ahash 0.8.3", ] [[package]] @@ -1271,18 +1255,18 @@ version = "7.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8" dependencies = [ - "base64", + "base64 0.13.1", "byteorder", "flate2", - "nom 7.1.2", + "nom", "num-traits", ] [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1293,6 +1277,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "html5ever" version = "0.26.0" @@ -1309,9 +1299,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -1354,7 +1344,7 @@ dependencies = [ "actix-rt", "actix-web", "awc", - "base64", + "base64 0.13.1", "futures-util", "http-signature-normalization", "sha2", @@ -1385,9 +1375,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ "bytes", "futures-channel", @@ -1478,19 +1468,19 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "ipnet" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "iri-string" @@ -1504,14 +1494,14 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1540,9 +1530,9 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1573,19 +1563,6 @@ dependencies = [ "spin", ] -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec", - "bitflags", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.139" @@ -1653,7 +1630,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" dependencies = [ - "hashbrown 0.13.1", + "hashbrown 0.13.2", ] [[package]] @@ -1806,22 +1783,23 @@ dependencies = [ [[package]] name = "minify-html" -version = "0.10.3" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f84854d62363972a73c3d8331b85a479366a0871a83f2a01ac11b9ba787c10" +checksum = "7754d4669873379ea6a8a5b56e406eb83de713af8a791517ef35a0c832b1e7d5" dependencies = [ "aho-corasick", "css-minify", "lazy_static", "memchr", "minify-js", + "rustc-hash", ] [[package]] name = "minify-js" -version = "0.2.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe033709f5a1159736cf7e22748518ffb75af26f3a6264d52ecc8bb38c68c36" +checksum = "c300f90ba1138b5c5daf5d9441dc9bdc67b808aac22cf638362a2647bc213be4" dependencies = [ "lazy_static", "parse-js", @@ -1844,14 +1822,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1883,38 +1861,14 @@ dependencies = [ [[package]] name = "nom" -version = "6.1.2" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" -dependencies = [ - "bitvec", - "funty", - "lexical-core", - "memchr", - "version_check", -] - -[[package]] -name = "nom" -version = "7.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] -[[package]] -name = "nom_locate" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37794436ca3029a3089e0b95d42da1f0b565ad271e4d3bb4bad0c7bb70b10605" -dependencies = [ - "bytecount", - "memchr", - "nom 7.1.2", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1982,6 +1936,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -2002,15 +1957,15 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opentelemetry" @@ -2141,7 +2096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.5", + "parking_lot_core 0.9.7", ] [[package]] @@ -2160,22 +2115,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "parse-js" -version = "0.3.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66bb85ec60d22b9e6d4adac1e3dbdaf3903a4485f476c5f4dd7ed1285cbf4dad" +checksum = "30534759e6ad87aa144c396544747e1c25b1020bd133356fd758c8facec764e5" dependencies = [ "aho-corasick", "lazy_static", @@ -2211,9 +2166,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.2" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4" +checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660" dependencies = [ "thiserror", "ucd-trie", @@ -2221,9 +2176,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.2" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603" +checksum = "2ac3922aac69a40733080f53c1ce7f91dcf57e1a5f6c52f421fadec7fbdc4b69" dependencies = [ "pest", "pest_generator", @@ -2231,9 +2186,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.2" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7" +checksum = "d06646e185566b5961b4058dd107e0a7f56e77c3f484549fb119867773c0f202" dependencies = [ "pest", "pest_meta", @@ -2244,20 +2199,20 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.5.2" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065" +checksum = "e6f60b2ba541577e2a0c307c8f39d1439108120eb7903adeb6497fa880c59616" dependencies = [ "once_cell", "pest", - "sha1", + "sha2", ] [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -2375,9 +2330,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" +checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" dependencies = [ "proc-macro2", "syn", @@ -2409,18 +2364,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" +checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" dependencies = [ "bytes", "prost-derive", @@ -2428,9 +2383,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" +checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" dependencies = [ "bytes", "heck", @@ -2450,9 +2405,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" +checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" dependencies = [ "anyhow", "itertools 0.10.5", @@ -2463,11 +2418,10 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" +checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" dependencies = [ - "bytes", "prost", ] @@ -2496,12 +2450,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" - [[package]] name = "radix_trie" version = "0.2.1" @@ -2544,9 +2492,9 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.6.0" +version = "10.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6823ea29436221176fe662da99998ad3b4db2c7f31e7b6f5fe43adccd6320bb" +checksum = "c307f7aacdbab3f0adee67d52739a1d71112cc068d6fab169ddeb18e48877fad" dependencies = [ "bitflags", ] @@ -2571,9 +2519,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2595,22 +2543,13 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "reqwest" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64", + "base64 0.21.0", "bytes", "encoding_rs", "futures-core", @@ -2640,6 +2579,7 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", "webpki-roots", "winreg", @@ -2666,16 +2606,16 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ - "base64", + "base64 0.13.1", "bitflags", "serde", ] [[package]] name = "rsa" -version = "0.7.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "094052d5470cbcef561cb848a7209968c9f12dfa6d668f4bca048ac5de51099c" +checksum = "89b3896c9b7790b70a9aa314a30e4ae114200992a19c96cbe0ca6070edd32ab8" dependencies = [ "byteorder", "digest", @@ -2686,19 +2626,19 @@ dependencies = [ "pkcs1", "pkcs8", "rand_core", + "sha2", "signature", - "smallvec", "subtle", "zeroize", ] [[package]] name = "rsa-magic-public-key" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc035c92400b90ee471e0ea7e041bfadd4da26dd3e716a84053d0075ed9c159" +checksum = "a86cb93425d6e176cfa39d63e226289f13154173f18274fab609c71ff35ba3a0" dependencies = [ - "base64", + "base64 0.21.0", "num-bigint-dig", "rsa", "thiserror", @@ -2706,15 +2646,14 @@ dependencies = [ [[package]] name = "rsass" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "665387d3be91521de331a04cc7118c8c129ffe43c5f4e8a61e78990850046b5a" +checksum = "a43695dd28122f6c684273de89796a56a98e02e9694b8ab57b160fdc6e6d69af" dependencies = [ "arc-swap", "fastrand", "lazy_static", - "nom 7.1.2", - "nom_locate", + "nom", "num-bigint", "num-integer", "num-rational", @@ -2724,16 +2663,16 @@ dependencies = [ [[package]] name = "ructe" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85517cd381cf0c34694881d8aaf173107c6af7670e66cec18d7a1a8bfce3b758" +checksum = "79c86c1631418815c5947a34be5872806586c65398754ec91cc2df35a8e26ba8" dependencies = [ - "base64", + "base64 0.21.0", "bytecount", "itertools 0.10.5", "md5", "mime", - "nom 7.1.2", + "nom", "rsass", ] @@ -2747,6 +2686,12 @@ dependencies = [ "ordered-multimap", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2758,23 +2703,23 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.6" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", @@ -2784,11 +2729,11 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64", + "base64 0.21.0", ] [[package]] @@ -2847,15 +2792,24 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2913,18 +2867,18 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "signature" -version = "1.6.4" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" dependencies = [ "digest", "rand_core", @@ -2944,9 +2898,9 @@ checksum = "ceb945e54128e09c43d8e4f1277851bd5044c6fc540bbaa2ad888f60b3da9ae7" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2999,12 +2953,6 @@ dependencies = [ "der", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "string_cache" version = "0.8.4" @@ -3045,9 +2993,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3056,9 +3004,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "take_mut" @@ -3072,17 +3020,11 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20f34339676cdcab560c9a82300c4c2581f68b9369aedf0fae86f2ff9565ff3e" -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "teloxide" -version = "0.11.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c3b28292b33a57a8d71ce000c23fdaffeb0b4aec35fa9351d4be7ec6376a3f" +checksum = "c63345cf32a8850ebddcdd769dc2d5193d5e231262d5dada264b79da01a664da" dependencies = [ "aquamarine", "bytes", @@ -3106,9 +3048,9 @@ dependencies = [ [[package]] name = "teloxide-core" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9243a720aa9bddda324a7f90b4ab42887425524bf4d5d24a56b50bccb984b7c4" +checksum = "303db260110c238e3af77bb9dff18bf7a5b5196f783059b0852aab75f91d5a16" dependencies = [ "bitflags", "bytes", @@ -3137,9 +3079,9 @@ dependencies = [ [[package]] name = "teloxide-macros" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a5fc46d9004706ee23e3b73a0f53518f28498f7297813fa9a505a29638ffd6" +checksum = "0f1d653b093dba5e44cada57a516f572167df37b8a619443e59c8c517bb6d804" dependencies = [ "heck", "proc-macro2", @@ -3149,16 +3091,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall", - "remove_dir_all", - "winapi", + "rustix", + "windows-sys 0.42.0", ] [[package]] @@ -3174,9 +3115,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] @@ -3203,18 +3144,19 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.3.17" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa", "serde", @@ -3230,9 +3172,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" dependencies = [ "time-core", ] @@ -3248,15 +3190,15 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.23.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -3269,7 +3211,7 @@ dependencies = [ "socket2", "tokio-macros", "tracing", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -3306,9 +3248,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" dependencies = [ "futures-core", "pin-project-lite", @@ -3317,9 +3259,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", @@ -3331,13 +3273,47 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tonic" version = "0.8.3" @@ -3347,7 +3323,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64", + "base64 0.13.1", "bytes", "futures-core", "futures-util", @@ -3449,9 +3425,9 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16c2a0c52b267d46ea9a46012a28b3513ce166c28eaeaa875829ed2f8debd19" +checksum = "4082e4d81173e0b7ad3cfb71e9eaef0dd0cbb7b139fdb56394f488a3b0760b23" dependencies = [ "actix-web", "pin-project", @@ -3560,9 +3536,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" @@ -3587,9 +3563,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -3632,9 +3608,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "uuid" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" dependencies = [ "getrandom", "serde", @@ -3676,9 +3652,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3686,9 +3662,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -3701,9 +3677,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -3713,9 +3689,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3723,9 +3699,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -3736,15 +3712,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "wasm-streams" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -3771,9 +3760,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -3827,46 +3816,79 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" +name = "windows-sys" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "winnow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +dependencies = [ + "memchr", +] [[package]] name = "winreg" @@ -3877,12 +3899,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" - [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index e61fa5f..79dcc41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ap-relay" description = "A simple activitypub relay" -version = "0.3.79" +version = "0.3.82" authors = ["asonix "] license = "AGPL-3.0" readme = "README.md" @@ -33,8 +33,8 @@ activitystreams = "0.7.0-alpha.21" activitystreams-ext = "0.1.0-alpha.3" ammonia = "3.1.0" awc = { version = "3.0.0", default-features = false, features = ["rustls"] } -bcrypt = "0.13" -base64 = "0.13" +bcrypt = "0.14" +base64 = "0.21" clap = { version = "4.0.0", features = ["derive"] } config = "0.13.0" console-subscriber = { version = "0.1", optional = true } @@ -54,16 +54,14 @@ opentelemetry-otlp = "0.11" pin-project-lite = "0.2.9" quanta = "0.10.1" rand = "0.8" -rsa = "0.7" -rsa-magic-public-key = "0.6.0" +rsa = { version = "0.8", features = ["sha2"] } +rsa-magic-public-key = "0.7.0" rustls = "0.20.7" rustls-pemfile = "1.0.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sha2 = { version = "0.10", features = ["oid"] } -signature = "1.6.4" sled = "0.34.7" -teloxide = { version = "0.11.1", default-features = false, features = [ +teloxide = { version = "0.12.0", default-features = false, features = [ "ctrlc_handler", "macros", "rustls", @@ -100,8 +98,8 @@ version = "0.7.0" [build-dependencies] anyhow = "1.0" dotenv = "0.15.0" -ructe = { version = "0.15.0", features = ["sass", "mime03"] } -toml = "0.5.8" +ructe = { version = "0.16.0", features = ["sass", "mime03"] } +toml = "0.7.0" [profile.dev.package.rsa] opt-level = 3 diff --git a/README.md b/README.md index 4e0f8e2..f177075 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ _A simple and efficient activitypub relay_ If running docker, you can start the relay with the following command: ``` $ sudo docker run --rm -it \ - -v "./:/mnt/" \ + -v "$(pwd):/mnt/" \ -e ADDR=0.0.0.0 \ -e SLED_PATH=/mnt/sled/db-0.34 \ -p 8080:8080 \ @@ -182,11 +182,17 @@ example, if the server is `https://relay.my.tld`, the correct URL would be - Add {anything}, the Add {anything} is relayed verbatim to listening servers. Note that this activity will likely be rejected by the listening servers unless it has been signed with a JSON-LD signature +- Remove {anything}, the Remove {anything} is relayed verbatim to listening servers. + Note that this activity will likely be rejected by the listening servers unless it has been + signed with a JSON-LD signature ### Supported Discovery Protocols - Webfinger - NodeInfo +### Known issues +Pleroma and Akkoma do not support validating JSON-LD signatures, meaning many activities such as Delete, Update, Add, and Remove will be rejected with a message similar to `WARN: Response from https://example.com/inbox, "Invalid HTTP Signature"`. This is normal and not an issue with the relay. + ### Contributing Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the AGPLv3. diff --git a/src/build.rs b/src/build.rs index ebac904..f21d5bb 100644 --- a/src/build.rs +++ b/src/build.rs @@ -5,7 +5,7 @@ fn git_info() { if let Ok(output) = Command::new("git").args(["rev-parse", "HEAD"]).output() { if output.status.success() { let git_hash = String::from_utf8_lossy(&output.stdout); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + println!("cargo:rustc-env=GIT_HASH={git_hash}"); println!("cargo:rustc-env=GIT_SHORT_HASH={}", &git_hash[..8]) } } @@ -16,7 +16,7 @@ fn git_info() { { if output.status.success() { let git_branch = String::from_utf8_lossy(&output.stdout); - println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); + println!("cargo:rustc-env=GIT_BRANCH={git_branch}"); } } } @@ -32,11 +32,11 @@ fn version_info() -> Result<(), anyhow::Error> { let data: toml::Value = toml::from_str(&cargo_data)?; if let Some(version) = data["package"]["version"].as_str() { - println!("cargo:rustc-env=PKG_VERSION={}", version); + println!("cargo:rustc-env=PKG_VERSION={version}"); } if let Some(name) = data["package"]["name"].as_str() { - println!("cargo:rustc-env=PKG_NAME={}", name); + println!("cargo:rustc-env=PKG_NAME={name}"); } Ok(()) diff --git a/src/collector/stats.rs b/src/collector/stats.rs index c8d1812..91f235f 100644 --- a/src/collector/stats.rs +++ b/src/collector/stats.rs @@ -40,11 +40,11 @@ impl std::fmt::Display for Counter { let labels = self .labels .iter() - .map(|(k, v)| format!("{}: {}", k, v)) + .map(|(k, v)| format!("{k}: {v}")) .collect::>() .join(", "); - write!(f, "{} - {}", labels, self.value) + write!(f, "{labels} - {}", self.value) } } @@ -59,11 +59,11 @@ impl std::fmt::Display for Gauge { let labels = self .labels .iter() - .map(|(k, v)| format!("{}: {}", k, v)) + .map(|(k, v)| format!("{k}: {v}")) .collect::>() .join(", "); - write!(f, "{} - {}", labels, self.value) + write!(f, "{labels} - {}", self.value) } } @@ -78,7 +78,7 @@ impl std::fmt::Display for Histogram { let labels = self .labels .iter() - .map(|(k, v)| format!("{}: {}", k, v)) + .map(|(k, v)| format!("{k}: {v}")) .collect::>() .join(", "); @@ -87,15 +87,15 @@ impl std::fmt::Display for Histogram { .iter() .map(|(k, v)| { if let Some(v) = v { - format!("{}: {:.6}", k, v) + format!("{k}: {v:.6}") } else { - format!("{}: None,", k) + format!("{k}: None,") } }) .collect::>() .join(", "); - write!(f, "{} - {}", labels, value) + write!(f, "{labels} - {value}") } } @@ -172,18 +172,18 @@ impl Snapshot { continue; } - println!("\t{}", key); + println!("\t{key}"); for counter in counters { - println!("\t\t{}", counter); + println!("\t\t{counter}"); } } for (key, counters) in merging { - println!("\t{}", key); + println!("\t{key}"); for (_, counter) in counters { if let Some(counter) = counter.merge() { - println!("\t\t{}", counter); + println!("\t\t{counter}"); } } } @@ -192,10 +192,10 @@ impl Snapshot { if !self.gauges.is_empty() { println!("Gauges"); for (key, gauges) in self.gauges { - println!("\t{}", key); + println!("\t{key}"); for gauge in gauges { - println!("\t\t{}", gauge); + println!("\t\t{gauge}"); } } } @@ -203,10 +203,10 @@ impl Snapshot { if !self.histograms.is_empty() { println!("Histograms"); for (key, histograms) in self.histograms { - println!("\t{}", key); + println!("\t{key}"); for histogram in histograms { - println!("\t\t{}", histogram); + println!("\t\t{histogram}"); } } } diff --git a/src/config.rs b/src/config.rs index 848cc5b..db21f9d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,8 +12,8 @@ use activitystreams::{ }; use config::Environment; use http_signature_normalization_actix::prelude::VerifyDigest; +use rsa::sha2::{Digest, Sha256}; use rustls::{Certificate, PrivateKey}; -use sha2::{Digest, Sha256}; use std::{ io::BufReader, net::{IpAddr, SocketAddr}, @@ -170,7 +170,7 @@ impl Config { let config: ParsedConfig = config.try_deserialize()?; let scheme = if config.https { "https" } else { "http" }; - let base_uri = iri!(format!("{}://{}", scheme, config.hostname)).into_absolute(); + let base_uri = iri!(format!("{scheme}://{}", config.hostname)).into_absolute(); let tls = match (config.tls_key, config.tls_cert) { (Some(key), Some(cert)) => Some(TlsConfig { key, cert }), @@ -207,8 +207,8 @@ impl Config { let source_url = match Self::git_hash() { Some(hash) => format!( - "{}{}{}", - config.source_repo, config.repository_commit_base, hash + "{}{}{hash}", + config.source_repo, config.repository_commit_base ) .parse() .expect("constructed source URL is valid"), @@ -332,7 +332,7 @@ impl Config { match AdminConfig::build(api_token) { Ok(conf) => Some(actix_web::web::Data::new(conf)), Err(e) => { - tracing::error!("Error creating admin config: {}", e); + tracing::error!("Error creating admin config: {e}"); None } } @@ -371,7 +371,7 @@ impl Config { pub(crate) fn software_version() -> String { if let Some(git) = Self::git_version() { - return format!("v{}-{}", Self::version(), git); + return format!("v{}-{git}", Self::version()); } format!("v{}", Self::version()) @@ -381,7 +381,7 @@ impl Config { let branch = Self::git_branch()?; let hash = Self::git_short_hash()?; - Some(format!("{}-{}", branch, hash)) + Some(format!("{branch}-{hash}")) } fn name() -> &'static str { @@ -463,7 +463,7 @@ impl Config { resolved } UrlKind::Media(uuid) => FixedBaseResolver::new(self.base_uri.as_ref()) - .resolve(IriRelativeStr::new(&format!("media/{}", uuid))?.as_ref()) + .resolve(IriRelativeStr::new(&format!("media/{uuid}"))?.as_ref()) .try_to_dedicated_string()?, UrlKind::NodeInfo => FixedBaseResolver::new(self.base_uri.as_ref()) .resolve(IriRelativeStr::new("nodeinfo/2.0.json")?.as_ref()) diff --git a/src/data/actor.rs b/src/data/actor.rs index 784e99f..af6fb78 100644 --- a/src/data/actor.rs +++ b/src/data/actor.rs @@ -71,7 +71,7 @@ impl ActorCache { id: &IriString, requests: &Requests, ) -> Result { - let accepted_actor = requests.fetch::(id.as_str()).await?; + let accepted_actor = requests.fetch::(id).await?; let input_authority = id.authority_components().ok_or(ErrorKind::MissingDomain)?; let accepted_actor_id = accepted_actor diff --git a/src/data/node.rs b/src/data/node.rs index 4ba6eb5..ac89cdb 100644 --- a/src/data/node.rs +++ b/src/data/node.rs @@ -182,7 +182,7 @@ impl Node { let authority = url.authority_str().ok_or(ErrorKind::MissingDomain)?; let scheme = url.scheme_str(); - let base = iri!(format!("{}://{}", scheme, authority)); + let base = iri!(format!("{scheme}://{authority}")); Ok(Node { base, diff --git a/src/db.rs b/src/db.rs index 6d3064f..edf00c1 100644 --- a/src/db.rs +++ b/src/db.rs @@ -10,7 +10,10 @@ use rsa::{ use sled::{Batch, Tree}; use std::{ collections::{BTreeMap, HashMap}, - sync::Arc, + sync::{ + atomic::{AtomicU64, Ordering}, + Arc, + }, time::SystemTime, }; use time::OffsetDateTime; @@ -22,6 +25,8 @@ pub(crate) struct Db { } struct Inner { + healthz: Tree, + healthz_counter: Arc, actor_id_actor: Tree, public_key_id_actor_id: Tree, connected_actor_ids: Tree, @@ -242,6 +247,8 @@ impl Db { fn build_inner(restricted_mode: bool, db: sled::Db) -> Result { Ok(Db { inner: Arc::new(Inner { + healthz: db.open_tree("healthz")?, + healthz_counter: Arc::new(AtomicU64::new(0)), actor_id_actor: db.open_tree("actor-id-actor")?, public_key_id_actor_id: db.open_tree("public-key-id-actor-id")?, connected_actor_ids: db.open_tree("connected-actor-ids")?, @@ -273,6 +280,21 @@ impl Db { Ok(t) } + pub(crate) async fn check_health(&self) -> Result<(), Error> { + let next = self.inner.healthz_counter.fetch_add(1, Ordering::Relaxed); + self.unblock(move |inner| { + inner + .healthz + .insert("healthz", &next.to_be_bytes()[..]) + .map_err(Error::from) + }) + .await?; + self.inner.healthz.flush_async().await?; + self.unblock(move |inner| inner.healthz.get("healthz").map_err(Error::from)) + .await?; + Ok(()) + } + pub(crate) async fn mark_last_seen( &self, nodes: HashMap, @@ -334,12 +356,12 @@ impl Db { pub(crate) async fn info(&self, actor_id: IriString) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.actor_id_info.get(actor_id.as_str().as_bytes())? { - let info = serde_json::from_slice(&ivec)?; - Ok(Some(info)) - } else { - Ok(None) - } + inner + .actor_id_info + .get(actor_id.as_str().as_bytes())? + .map(|ivec| serde_json::from_slice(&ivec)) + .transpose() + .map_err(Error::from) }) .await } @@ -368,12 +390,12 @@ impl Db { pub(crate) async fn instance(&self, actor_id: IriString) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.actor_id_instance.get(actor_id.as_str().as_bytes())? { - let instance = serde_json::from_slice(&ivec)?; - Ok(Some(instance)) - } else { - Ok(None) - } + inner + .actor_id_instance + .get(actor_id.as_str().as_bytes())? + .map(|ivec| serde_json::from_slice(&ivec)) + .transpose() + .map_err(Error::from) }) .await } @@ -402,12 +424,12 @@ impl Db { pub(crate) async fn contact(&self, actor_id: IriString) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.actor_id_contact.get(actor_id.as_str().as_bytes())? { - let contact = serde_json::from_slice(&ivec)?; - Ok(Some(contact)) - } else { - Ok(None) - } + inner + .actor_id_contact + .get(actor_id.as_str().as_bytes())? + .map(|ivec| serde_json::from_slice(&ivec)) + .transpose() + .map_err(Error::from) }) .await } @@ -432,22 +454,20 @@ impl Db { pub(crate) async fn media_id(&self, url: IriString) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.media_url_media_id.get(url.as_str().as_bytes())? { - Ok(uuid_from_ivec(ivec)) - } else { - Ok(None) - } + Ok(inner + .media_url_media_id + .get(url.as_str().as_bytes())? + .and_then(uuid_from_ivec)) }) .await } pub(crate) async fn media_url(&self, id: Uuid) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.media_id_media_url.get(id.as_bytes())? { - Ok(url_from_ivec(ivec)) - } else { - Ok(None) - } + Ok(inner + .media_id_media_url + .get(id.as_bytes())? + .and_then(url_from_ivec)) }) .await } @@ -468,7 +488,7 @@ impl Db { pub(crate) async fn is_connected(&self, base_id: IriString) -> Result { let scheme = base_id.scheme_str(); let authority = base_id.authority_str().ok_or(ErrorKind::MissingDomain)?; - let prefix = format!("{}://{}", scheme, authority); + let prefix = format!("{scheme}://{authority}"); self.unblock(move |inner| { let connected = inner @@ -487,26 +507,22 @@ impl Db { public_key_id: IriString, ) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner + Ok(inner .public_key_id_actor_id .get(public_key_id.as_str().as_bytes())? - { - Ok(url_from_ivec(ivec)) - } else { - Ok(None) - } + .and_then(url_from_ivec)) }) .await } pub(crate) async fn actor(&self, actor_id: IriString) -> Result, Error> { self.unblock(move |inner| { - if let Some(ivec) = inner.actor_id_actor.get(actor_id.as_str().as_bytes())? { - let actor = serde_json::from_slice(&ivec)?; - Ok(Some(actor)) - } else { - Ok(None) - } + inner + .actor_id_actor + .get(actor_id.as_str().as_bytes())? + .map(|ivec| serde_json::from_slice(&ivec)) + .transpose() + .map_err(Error::from) }) .await } @@ -528,7 +544,7 @@ impl Db { } pub(crate) async fn remove_connection(&self, actor_id: IriString) -> Result<(), Error> { - tracing::debug!("Removing Connection: {}", actor_id); + tracing::debug!("Removing Connection: {actor_id}"); self.unblock(move |inner| { inner .connected_actor_ids @@ -540,7 +556,7 @@ impl Db { } pub(crate) async fn add_connection(&self, actor_id: IriString) -> Result<(), Error> { - tracing::debug!("Adding Connection: {}", actor_id); + tracing::debug!("Adding Connection: {actor_id}"); self.unblock(move |inner| { inner .connected_actor_ids diff --git a/src/error.rs b/src/error.rs index 2f9e658..c72b8b5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -30,6 +30,10 @@ impl Error { pub(crate) fn is_gone(&self) -> bool { matches!(self.kind, ErrorKind::Status(_, StatusCode::GONE)) } + + pub(crate) fn is_malformed_json(&self) -> bool { + matches!(self.kind, ErrorKind::Json(_)) + } } impl std::fmt::Debug for Error { @@ -99,13 +103,13 @@ pub(crate) enum ErrorKind { PrepareSign(#[from] PrepareSignError), #[error("Couldn't sign digest")] - Signature(#[from] signature::Error), + Signature(#[from] rsa::signature::Error), #[error("Couldn't read signature")] - ReadSignature(signature::Error), + ReadSignature(rsa::signature::Error), #[error("Couldn't verify signature")] - VerifySignature(signature::Error), + VerifySignature(rsa::signature::Error), #[error("Couldn't parse the signature header")] HeaderValidation(#[from] actix_web::http::header::InvalidHeaderValue), diff --git a/src/jobs/contact.rs b/src/jobs/contact.rs index a98ac8f..3c880af 100644 --- a/src/jobs/contact.rs +++ b/src/jobs/contact.rs @@ -42,7 +42,7 @@ impl QueryContact { let contact = match state .requests - .fetch::(self.contact_id.as_str()) + .fetch::(&self.contact_id) .await { Ok(contact) => contact, diff --git a/src/jobs/deliver.rs b/src/jobs/deliver.rs index 223608e..72f4aec 100644 --- a/src/jobs/deliver.rs +++ b/src/jobs/deliver.rs @@ -35,7 +35,7 @@ impl Deliver { #[tracing::instrument(name = "Deliver", skip(state))] async fn permform(self, state: JobState) -> Result<(), Error> { - if let Err(e) = state.requests.deliver(self.to, &self.data).await { + if let Err(e) = state.requests.deliver(&self.to, &self.data).await { if e.is_breaker() { tracing::debug!("Not trying due to failed breaker"); return Ok(()); diff --git a/src/jobs/instance.rs b/src/jobs/instance.rs index 2f1e5c7..59826b5 100644 --- a/src/jobs/instance.rs +++ b/src/jobs/instance.rs @@ -20,11 +20,41 @@ impl std::fmt::Debug for QueryInstance { } } +enum InstanceApiType { + Mastodon, + Misskey, +} + impl QueryInstance { pub(crate) fn new(actor_id: IriString) -> Self { QueryInstance { actor_id } } + async fn get_instance( + instance_type: InstanceApiType, + state: &JobState, + scheme: &str, + authority: &str, + ) -> Result { + match instance_type { + InstanceApiType::Mastodon => { + let mastodon_instance_uri = iri!(format!("{scheme}://{authority}/api/v1/instance")); + state + .requests + .fetch_json::(&mastodon_instance_uri) + .await + } + InstanceApiType::Misskey => { + let msky_meta_uri = iri!(format!("{scheme}://{authority}/api/meta")); + state + .requests + .fetch_json_msky::(&msky_meta_uri) + .await + .map(|res| res.into()) + } + } + } + #[tracing::instrument(name = "Query instance", skip(state))] async fn perform(self, state: JobState) -> Result<(), Error> { let contact_outdated = state @@ -45,23 +75,40 @@ impl QueryInstance { .authority_str() .ok_or(ErrorKind::MissingDomain)?; let scheme = self.actor_id.scheme_str(); - let instance_uri = iri!(format!("{}://{}/api/v1/instance", scheme, authority)); - let instance = match state - .requests - .fetch_json::(instance_uri.as_str()) - .await - { - Ok(instance) => instance, - Err(e) if e.is_breaker() => { - tracing::debug!("Not retrying due to failed breaker"); + // Attempt all endpoint. + let instance_futures = [ + Self::get_instance(InstanceApiType::Mastodon, &state, scheme, authority), + Self::get_instance(InstanceApiType::Misskey, &state, scheme, authority), + ]; + + let mut instance_result: Option = None; + for instance_future in instance_futures { + match instance_future.await { + Ok(instance) => { + instance_result = Some(instance); + break; + } + Err(e) if e.is_breaker() => { + tracing::debug!("Not retrying due to failed breaker"); + return Ok(()); + } + Err(e) if e.is_not_found() => { + tracing::debug!("Server doesn't implement instance endpoint"); + } + Err(e) if e.is_malformed_json() => { + tracing::debug!("Server doesn't returned proper json"); + } + Err(e) => return Err(e), + } + } + + let instance = match instance_result { + Some(instance) => instance, + None => { + tracing::debug!("Server doesn't implement all instance endpoint"); return Ok(()); } - Err(e) if e.is_not_found() => { - tracing::debug!("Server doesn't implement instance endpoint"); - return Ok(()); - } - Err(e) => return Err(e), }; let description = instance.short_description.unwrap_or(instance.description); @@ -144,12 +191,59 @@ struct Contact { avatar: IriString, } +#[derive(serde::Deserialize)] +#[serde(rename_all(deserialize = "camelCase"))] +struct MisskeyMeta { + name: Option, + description: Option, + version: String, + maintainer_name: Option, + // Yes, I know, this is instance URL... but we does not have any choice. + uri: IriString, + // Use instance icon as a profile picture... + icon_url: Option, + features: MisskeyFeatures, +} + +#[derive(serde::Deserialize)] +struct MisskeyFeatures { + registration: Boolish, // Corresponding to Mastodon registration +} + +impl From for Instance { + fn from(meta: MisskeyMeta) -> Self { + let contact = match (meta.maintainer_name, meta.icon_url) { + (Some(maintainer), Some(icon)) => Some(Contact { + username: maintainer.clone(), + display_name: maintainer, + url: meta.uri, + avatar: icon, + }), + (_, _) => None, + }; + + // Transform it into Mastodon Instance object + Instance { + title: meta.name.unwrap_or_else(|| "".to_owned()), + short_description: None, + description: meta.description.unwrap_or_else(|| "".to_owned()), + version: meta.version, + registrations: meta.features.registration, + approval_required: false, + contact, + } + } +} + #[cfg(test)] mod tests { use super::Instance; + use super::MisskeyMeta; const ASONIX_INSTANCE: &str = r#"{"uri":"masto.asonix.dog","title":"asonix.dog","short_description":"The asonix of furry mastodon. For me and a few friends. DM me somewhere if u want an account lol","description":"A mastodon server that's only for me and nobody else sorry","email":"asonix@asonix.dog","version":"4.0.0rc2-asonix-changes","urls":{"streaming_api":"wss://masto.asonix.dog"},"stats":{"user_count":7,"status_count":12328,"domain_count":5146},"thumbnail":"https://masto.asonix.dog/system/site_uploads/files/000/000/002/@1x/32f51462a2b2bf2d.png","languages":["dog"],"registrations":false,"approval_required":false,"invites_enabled":false,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":{"id":"1","username":"asonix","acct":"asonix","display_name":"Liom on Mane :antiverified:","locked":true,"bot":false,"discoverable":true,"group":false,"created_at":"2021-02-09T00:00:00.000Z","note":"\u003cp\u003e26, local liom, friend, rust (lang) stan, bi \u003c/p\u003e\u003cp\u003eicon by \u003cspan class=\"h-card\"\u003e\u003ca href=\"https://furaffinity.net/user/lalupine\" target=\"blank\" rel=\"noopener noreferrer\" class=\"u-url mention\"\u003e@\u003cspan\u003elalupine@furaffinity.net\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003cbr /\u003eheader by \u003cspan class=\"h-card\"\u003e\u003ca href=\"https://furaffinity.net/user/tronixx\" target=\"blank\" rel=\"noopener noreferrer\" class=\"u-url mention\"\u003e@\u003cspan\u003etronixx@furaffinity.net\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003eTestimonials:\u003c/p\u003e\u003cp\u003eStand: LIONS\u003cbr /\u003eStand User: AODE\u003cbr /\u003e- Keris (not on here)\u003c/p\u003e","url":"https://masto.asonix.dog/@asonix","avatar":"https://masto.asonix.dog/system/accounts/avatars/000/000/001/original/00852df0e6fee7e0.png","avatar_static":"https://masto.asonix.dog/system/accounts/avatars/000/000/001/original/00852df0e6fee7e0.png","header":"https://masto.asonix.dog/system/accounts/headers/000/000/001/original/8122ce3e5a745385.png","header_static":"https://masto.asonix.dog/system/accounts/headers/000/000/001/original/8122ce3e5a745385.png","followers_count":237,"following_count":474,"statuses_count":8798,"last_status_at":"2022-11-08","noindex":true,"emojis":[{"shortcode":"antiverified","url":"https://masto.asonix.dog/system/custom_emojis/images/000/030/053/original/bb0bc2e395b9a127.png","static_url":"https://masto.asonix.dog/system/custom_emojis/images/000/030/053/static/bb0bc2e395b9a127.png","visible_in_picker":true}],"fields":[{"name":"pronouns","value":"he/they","verified_at":null},{"name":"software","value":"bad","verified_at":null},{"name":"gitea","value":"\u003ca href=\"https://git.asonix.dog\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003egit.asonix.dog\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e","verified_at":null},{"name":"join my","value":"relay","verified_at":null}]},"rules":[]}"#; const HYNET_INSTANCE: &str = r#"{"approval_required":false,"avatar_upload_limit":2000000,"background_image":"https://soc.hyena.network/images/city.jpg","background_upload_limit":4000000,"banner_upload_limit":4000000,"description":"Akkoma: The cooler fediverse server","description_limit":5000,"email":"me@hyena.network","languages":["en"],"max_toot_chars":"5000","pleroma":{"metadata":{"account_activation_required":true,"features":["pleroma_api","mastodon_api","mastodon_api_streaming","polls","v2_suggestions","pleroma_explicit_addressing","shareable_emoji_packs","multifetch","pleroma:api/v1/notifications:include_types_filter","chat","shout","relay","safe_dm_mentions","pleroma_emoji_reactions","pleroma_chat_messages","exposable_reactions","profile_directory","custom_emoji_reactions"],"federation":{"enabled":true,"exclusions":false,"mrf_hashtag":{"federated_timeline_removal":[],"reject":[],"sensitive":["nsfw"]},"mrf_policies":["SimplePolicy","EnsureRePrepended","HashtagPolicy"],"mrf_simple":{"accept":[],"avatar_removal":[],"banner_removal":[],"federated_timeline_removal":["botsin.space"],"followers_only":[],"media_nsfw":["mstdn.jp","wxw.moe","knzk.me","vipgirlfriend.xxx","humblr.social","switter.at","kinkyelephant.com","sinblr.com","kinky.business","rubber.social"],"media_removal":[],"reject":["*.10minutepleroma.com","101010.pl","13bells.com","2.distsn.org","2hu.club","2ndamendment.social","434.earth","4chan.icu","4qq.org","7td.org","80percent.social","a.nti.social","aaathats3as.com","accela.online","amala.schwartzwelt.xyz","angrytoday.com","anime.website","antitwitter.moe","antivaxxer.icu","archivefedifor.fun","artalley.social","bae.st","bajax.us","baraag.net","bbs.kawa-kun.com","beefyboys.club","beefyboys.win","bikeshed.party","bitcoinhackers.org","bleepp.com","blovice.bahnhof.cz","brighteon.social","buildthatwallandmakeamericagreatagain.trumpislovetrumpis.life","bungle.online","cawfee.club","censorship.icu","chungus.cc","club.darknight-coffee.org","clubcyberia.co","cock.fish","cock.li","comfyboy.club","contrapointsfan.club","coon.town","counter.social","cum.salon","d-fens.systems","definitely-not-archivefedifor.fun","degenerates.fail","desuposter.club","detroitriotcity.com","developer.gab.com","dogwhipping.day","eientei.org","enigmatic.observer","eveningzoo.club","exited.eu","federation.krowverse.services","fedi.cc","fedi.krowverse.services","fedi.pawlicker.com","fedi.vern.cc","freak.university","freeatlantis.com","freecumextremist.com","freesoftwareextremist.com","freespeech.firedragonstudios.com","freespeech.host","freespeechextremist.com","freevoice.space","freezepeach.xyz","froth.zone","fuckgov.org","gab.ai","gab.polaris-1.work","gab.protohype.net","gabfed.com","gameliberty.club","gearlandia.haus","gitmo.life","glindr.org","glittersluts.xyz","glowers.club","godspeed.moe","gorf.pub","goyim.app","gs.kawa-kun.com","hagra.net","hallsofamenti.io","hayu.sh","hentai.baby","honkwerx.tech","hunk.city","husk.site","iddqd.social","ika.moe","isexychat.space","jaeger.website","justicewarrior.social","kag.social","katiehopkinspolitical.icu","kiwifarms.cc","kiwifarms.is","kiwifarms.net","kohrville.net","koyu.space","kys.moe","lain.com","lain.sh","leafposter.club","lets.saynoto.lgbt","liberdon.com","libertarianism.club","ligma.pro","lolis.world","masochi.st","masthead.social","mastodon.digitalsuccess.dev","mastodon.fidonet.io","mastodon.grin.hu","mastodon.ml","midnightride.rs","milker.cafe","mobile.tmediatech.io","moon.holiday","mstdn.foxfam.club","mstdn.io","mstdn.starnix.network","mulmeyun.church","nazi.social","neckbeard.xyz","neenster.org","neko.ci","netzsphaere.xyz","newjack.city","nicecrew.digital","nnia.space","noagendasocial.com","norrebro.space","oursocialism.today","ovo.sc","pawoo.net","paypig.org","pedo.school","phreedom.tk","pieville.net","pkteerium.xyz","pl.murky.club","pl.spiderden.net","pl.tkammer.de","pl.zombiecats.run","pleroma.nobodyhasthe.biz","pleroma.runfox.tk","pleroma.site","plr.inferencium.net","pmth.us","poa.st","pod.vladtepesblog.com","political.icu","pooper.social","posting.lolicon.rocks","preteengirls.biz","prout.social","qoto.org","rage.lol","rakket.app","raplst.town","rdrama.cc","ryona.agency","s.sneak.berlin","seal.cafe","sealion.club","search.fedi.app","sementerrori.st","shitposter.club","shortstackran.ch","silkhe.art","sleepy.cafe","soc.mahodou.moe","soc.redeyes.site","social.076.ne.jp","social.anoxinon.de","social.chadland.net","social.freetalklive.com","social.getgle.org","social.handholding.io","social.headsca.la","social.imirhil.fr","social.lovingexpressions.net","social.manalejandro.com","social.midwaytrades.com","social.pseudo-whiskey.bar","social.targaryen.house","social.teci.world","societal.co","society.oftrolls.com","socks.pinnoto.org","socnet.supes.com","solagg.com","spinster.xyz","springbo.cc","stereophonic.space","sunshinegardens.org","theautisticinvestors.quest","thechad.zone","theduran.icu","theosis.church","toot.love","toots.alirezahayati.com","traboone.com","truthsocial.co.in","truthsocial.com","tuusin.misono-ya.info","tweety.icu","unbound.social","unsafe.space","varishangout.net","video.nobodyhasthe.biz","voicenews.icu","voluntaryism.club","waifu.social","weeaboo.space","whinge.town","wolfgirl.bar","workers.dev","wurm.host","xiii.ch","xn--p1abe3d.xn--80asehdb","yggdrasil.social","youjo.love"],"reject_deletes":[],"report_removal":[]},"mrf_simple_info":{"federated_timeline_removal":{"botsin.space":{"reason":"A lot of bot content"}},"media_nsfw":{"humblr.social":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"kinky.business":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"kinkyelephant.com":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"knzk.me":{"reason":"Unmarked nsfw media"},"mstdn.jp":{"reason":"Not sure about the media policy"},"rubber.social":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"sinblr.com":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"switter.at":{"reason":"NSFW Instance, safe to assume most content is NSFW"},"vipgirlfriend.xxx":{"reason":"Unmarked nsfw media"},"wxw.moe":{"reason":"Unmarked nsfw media"}}},"quarantined_instances":[],"quarantined_instances_info":{"quarantined_instances":{}}},"fields_limits":{"max_fields":10,"max_remote_fields":20,"name_length":512,"value_length":2048},"post_formats":["text/plain","text/html","text/markdown","text/bbcode","text/x.misskeymarkdown"],"privileged_staff":false},"stats":{"mau":1},"vapid_public_key":"BMg4q-rT3rkMzc29F7OS5uM6t-Rx4HncMIB1NXrKwNlVRfX-W1kwgOuq5pDy-WhWmOZudaegftjBTCX3-pzdDFc"},"poll_limits":{"max_expiration":31536000,"max_option_chars":200,"max_options":20,"min_expiration":0},"registrations":"FALSE","shout_limit":5000,"stats":{"domain_count":1035,"status_count":7,"user_count":1},"thumbnail":"https://soc.hyena.network/instance/thumbnail.jpeg","title":"HyNET Social","upload_limit":16000000,"uri":"https://soc.hyena.network","urls":{"streaming_api":"wss://soc.hyena.network"},"version":"2.7.2 (compatible; Akkoma 3.0.0)"}"#; + const MISSKEY_BARE_INSTANCE: &str = r#"{"maintainerName":null,"maintainerEmail":null,"version":"12.119.2","name":null,"uri":"https://msky-lab-01.arewesecureyet.org","description":null,"langs":[],"tosUrl":null,"repositoryUrl":"https://github.com/misskey-dev/misskey","feedbackUrl":"https://github.com/misskey-dev/misskey/issues/new","disableRegistration":false,"disableLocalTimeline":false,"disableGlobalTimeline":false,"driveCapacityPerLocalUserMb":1024,"driveCapacityPerRemoteUserMb":32,"emailRequiredForSignup":false,"enableHcaptcha":false,"hcaptchaSiteKey":null,"enableRecaptcha":false,"recaptchaSiteKey":null,"swPublickey":null,"themeColor":null,"mascotImageUrl":"/assets/ai.png","bannerUrl":null,"errorImageUrl":"https://xn--931a.moe/aiart/yubitun.png","iconUrl":null,"backgroundImageUrl":null,"logoImageUrl":null,"maxNoteTextLength":3000,"emojis":[],"defaultLightTheme":null,"defaultDarkTheme":null,"ads":[],"enableEmail":false,"enableTwitterIntegration":false,"enableGithubIntegration":false,"enableDiscordIntegration":false,"enableServiceWorker":false,"translatorAvailable":false,"pinnedPages":["/featured","/channels","/explore","/pages","/about-misskey"],"pinnedClipId":null,"cacheRemoteFiles":true,"requireSetup":false,"proxyAccountName":null,"features":{"registration":true,"localTimeLine":true,"globalTimeLine":true,"emailRequiredForSignup":false,"elasticsearch":false,"hcaptcha":false,"recaptcha":false,"objectStorage":false,"twitter":false,"github":false,"discord":false,"serviceWorker":false,"miauth":true}}"#; + const MISSKEY_STELLA_INSTANCE: &str = r###"{"maintainerName":"Caipira","maintainerEmail":"caipira@sagestn.one","version":"12.120.0-alpha.8+cs","name":"Stella","uri":"https://stella.place","description":"
무수히 많은 별 중 하나인 인스턴스입니다.
\n
SINCE 2022. 5. 8. ~
\n
|
\n
Enable
\nCastella = Misskey fork (.....)","langs":[],"tosUrl":"https://docs.stella.place/tos","repositoryUrl":"https://github.com/misskey-dev/misskey","feedbackUrl":"https://github.com/misskey-dev/misskey/issues/new","disableRegistration":false,"disableLocalTimeline":false,"disableGlobalTimeline":false,"driveCapacityPerLocalUserMb":3072,"driveCapacityPerRemoteUserMb":32,"emailRequiredForSignup":true,"enableHcaptcha":true,"hcaptchaSiteKey":"94d629f6-a38e-4f24-83dd-63326c7e3bbf","enableRecaptcha":false,"recaptchaSiteKey":"6Lf-9dIfAAAAAF0Jp_QSsIlltyi371ZSU48Csisy","enableTurnstile":false,"turnstileSiteKey":"0x4AAAAAAAArrDq-OcfsyU-R","swPublickey":"BNTI1ms29LPGpdF8spPKa5khs6B2UYnVWa3KcO6e6JJoVXzbCBjdUdpkZHo-MK_AZfJxbTE8Z8C7g5kQChEkfp8","themeColor":"#df99f7","mascotImageUrl":"/assets/ai.png","bannerUrl":"https://cdn.stella.place/assets/bg.jpg","errorImageUrl":"https://xn--931a.moe/aiart/yubitun.png","iconUrl":"https://cdn.stella.place/assets/Stella.png","backgroundImageUrl":"https://cdn.stella.place/assets/bg.jpg","logoImageUrl":null,"maxNoteTextLength":3000,"emojis":[{"id":"97f9mubsmt","aliases":[""],"name":"big_blobhaj_hug","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/15d27c96-093a-4dc0-ae57-b848180b073b.png"},{"id":"97f9rzt5ok","aliases":[""],"name":"blobhaj","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/fb06df30-00d8-4b3b-ac8c-ee779ff06599.png"},{"id":"97f9rzjso5","aliases":[""],"name":"blobhaj_asparagus","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/35ed1236-8ebc-4c91-a793-0cfd04532148.png"},{"id":"97f9p8gtn3","aliases":[""],"name":"blobhaj_blanket_blue","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/d5876a69-1dd3-4e6a-b3cd-d497c06064fa.png"},{"id":"97f9p8gonf","aliases":[""],"name":"blobhaj_blanket_slate","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/43c461e7-f8af-4636-b72a-6d0ef40c2655.png"},{"id":"97f9rzl7nt","aliases":[""],"name":"blobhaj_blobby_hug","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/8a272ac5-b9d7-4554-ab18-7088f6132bc3.png"},{"id":"97f9rzmjo7","aliases":[""],"name":"blobhaj_full_body_hug","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/9f8251d0-c816-441e-9eef-2687502023fc.png"},{"id":"97f9rzl0ns","aliases":[""],"name":"blobhaj_heart","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/48ec936e-ae27-4b7c-94db-b673b628e231.png"},{"id":"97f9gwvvl8","aliases":[""],"name":"blobhaj_mdbook","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/56fdbaa3-06e6-4f5d-81d6-3e8e54ae059c.png"},{"id":"97f9rzk7nq","aliases":[""],"name":"blobhaj_mlem","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/03ea3ae0-2d40-4faf-8d3c-10f788a3de1d.png"},{"id":"97f9fpovkq","aliases":[""],"name":"blobhaj_octobook","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/6e992574-d8ca-4592-80a0-4f7bdff03cf8.png"},{"id":"97f9rzpjoc","aliases":[""],"name":"blobhaj_pride_heart","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/c397da98-dd44-484e-8de4-7db11a677e42.png"},{"id":"97f9rzjko4","aliases":[""],"name":"blobhaj_reach","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/e2c00652-a2f6-4ccf-bf0e-796f85b7854d.png"},{"id":"97f9rzjxo6","aliases":[""],"name":"blobhaj_sad_reach","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/bf36e678-20fd-49cc-8485-3ae5b8db033e.png"},{"id":"97f9rzqxod","aliases":[""],"name":"blobhaj_shock","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/ab9a3062-3bda-48c3-a91a-95beb86d56cc.png"},{"id":"97f9rzo0oa","aliases":[""],"name":"blobhaj_tiny_heart","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/aec32c7c-2b53-4251-b3ba-862587fa6ff6.png"},{"id":"97f9rznto8","aliases":[""],"name":"blobhaj_trans_pride_heart","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/e0dad2d0-9136-4310-8841-7bf3819ba152.png"},{"id":"97f9k7iqm2","aliases":[""],"name":"sir_blobhaj","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/70546774-e704-4a93-ab28-059ef3c54b65.png"},{"id":"97f9ikojll","aliases":[""],"name":"sir_blobhaj_stern","category":"Blobhaj Hub","host":null,"url":"https://cdn.stella.place/D1/2d69a377-a562-4769-8f60-b3ab8794b2a2.png"},{"id":"953ytptaah","aliases":[""],"name":"ysoyaboom","category":"Blue Archive","host":null,"url":"https://cdn.stella.place/D1/51240ea1-345e-4d43-a293-300dc968197a.gif"},{"id":"953ytpt8ag","aliases":[""],"name":"ysoyasnap","category":"Blue Archive","host":null,"url":"https://cdn.stella.place/D1/e95337b8-499b-47b2-811e-e1f4398efc69.gif"},{"id":"97q78i6ss2","aliases":[""],"name":"terminal_blinker","category":"Dev","host":null,"url":"https://cdn.stella.place/D1/a04022ea-d8dc-4861-a7fd-360d178bd01f.png"},{"id":"97v0x375vq","aliases":[],"name":"ff14_msq","category":"FF14","host":null,"url":"https://cdn.stella.place/D1/db14bccd-8f89-428b-b1b9-8da7e821656b.png"},{"id":"97v0x375jq","aliases":[],"name":"ff14_msq_done","category":"FF14","host":null,"url":"https://cdn.stella.place/D1/7be4bb6d-9271-4e40-abaf-24fe97ec9a76.png"},{"id":"97v0x37yjs","aliases":[],"name":"ff14_msq_locked","category":"FF14","host":null,"url":"https://cdn.stella.place/D1/e2c85711-032b-4a83-b933-24e8a96ece82.png"},{"id":"9542b9c4io","aliases":["사이노"],"name":"cyno_oops","category":"Genshin Impact","host":null,"url":"https://cdn.stella.place/D1/2507ad57-b042-407d-a84e-e676ea8710c5.gif"},{"id":"97lo6lbcin","aliases":["합니다"],"name":"kr_doing","category":"KR","host":null,"url":"https://cdn.stella.place/D1/eeee5f16-ac99-42e7-8c4c-c773150d4bd5.png"},{"id":"97lo6u3zqa","aliases":["정상"],"name":"kr_normal","category":"KR","host":null,"url":"https://cdn.stella.place/D1/29e82750-da88-4baf-a8ec-64b4bcafdf28.png"},{"id":"97lo7523j2","aliases":["우리"],"name":"kr_our","category":"KR","host":null,"url":"https://cdn.stella.place/D1/458304e1-72e3-4fd2-87d4-c05a6a152083.png"},{"id":"97lo6zujj0","aliases":["식당"],"name":"kr_restaurant","category":"KR","host":null,"url":"https://cdn.stella.place/D1/e257d140-e8fe-477a-b5be-4e7e29239544.png"},{"id":"97lo6q34ir","aliases":["영업"],"name":"kr_sales","category":"KR","host":null,"url":"https://cdn.stella.place/D1/2331cb3a-5ca5-42ae-b677-691f8fe3b4e4.png"},{"id":"96kc58706a","aliases":[""],"name":"Kirkland_Signature","category":"Logo","host":null,"url":"https://cdn.stella.place/D1/b24c722a-0cf3-485c-8bb6-e8385e2dcd2b.png"},{"id":"95dwescv8x","aliases":[""],"name":"ms_angry","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/08407ba0-eb70-4385-ad7e-7987a1b178b8.png"},{"id":"95dwdph489","aliases":[""],"name":"ms_balloon","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/d3e49618-d9fb-4142-b369-b8b0a19f6875.png"},{"id":"95dwcb0w7c","aliases":[""],"name":"ms_contempt","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/b89d5827-d4ca-40d8-b250-02de2ab44ed9.png"},{"id":"95dwe68v8j","aliases":[""],"name":"ms_lie","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/889a793d-07a7-4f1f-a6a8-a151ed4ce1e3.png"},{"id":"95dwa1yc5x","aliases":[""],"name":"ms_mastodon","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/75fce83f-50a4-4ae9-86f3-52882279ccfd.png"},{"id":"95dwgcp0a8","aliases":[""],"name":"ms_messgaki","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/a432b00e-0ba0-4e13-aa25-1b6b61469807.png"},{"id":"95dwfs4h9q","aliases":[""],"name":"ms_messgaki_normal","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/5b9e1a10-f4af-4d35-af4f-a1cca7df5454.png"},{"id":"95dwb9i26m","aliases":[""],"name":"ms_messtodon","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/a2c7ff09-3090-445d-be8b-68144ac59e5a.png"},{"id":"95dwdbym81","aliases":[""],"name":"ms_sleepy","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/bbf5648e-6deb-4f3d-9fc0-6f9d1bbccd40.png"},{"id":"95dwf76i98","aliases":[""],"name":"ms_small_messgaki","category":"Messtodon","host":null,"url":"https://cdn.stella.place/D1/430b9d2a-591e-4beb-a037-fea66c777319.png"},{"id":"97pjdnpp76","aliases":["42"],"name":"text_42","category":"TEXT","host":null,"url":"https://cdn.stella.place/D1/e253653a-94b0-4cad-9277-f9c8e1188c5f.png"},{"id":"96njxnbkgt","aliases":[""],"name":"yt_social_circle_dark","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-0e0615fe-c430-43c2-910b-c9eea6ebf5ab.png"},{"id":"96njxneyh4","aliases":[""],"name":"yt_social_circle_red","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-7780f3d7-c0ed-46c8-93f2-afa01c39c65e.png"},{"id":"96njxnazgp","aliases":[""],"name":"yt_social_circle_white","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-ce023618-077a-4e80-8c37-827bd1490803.png"},{"id":"96njxnb8gr","aliases":[""],"name":"yt_social_square_dark","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-c48f67f6-6b46-4101-a8ba-123f5fa2508d.png"},{"id":"96njxnc7gv","aliases":[""],"name":"yt_social_square_red","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-51e24c3e-d8a7-4f52-b342-718823fc9631.png"},{"id":"96njxngrh7","aliases":[""],"name":"yt_social_square_white","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-de69c7e1-7044-4eab-b53f-7629342bcb11.png"},{"id":"96njxnbags","aliases":[""],"name":"yt_social_squircle_dark","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-de763d0f-3659-463e-b9b4-f6975a007b37.png"},{"id":"96njxnh5ha","aliases":[""],"name":"yt_social_squircle_red","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-a7e847b3-23ad-40ad-a06e-f6eafe23e001.png"},{"id":"96njxnb4gq","aliases":[""],"name":"yt_social_squircle_white","category":"YouTube Brand resources","host":null,"url":"https://cdn.stella.place/D1/webpublic-7d1878a0-e2a8-4336-a6f8-094a4b44a759.png"},{"id":"937z342qj0","aliases":[""],"name":"blackverified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/496d2618-4a32-41a8-a1ba-df798a16f209.gif"},{"id":"937zd787m6","aliases":[""],"name":"blueviolet_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/357c3a1e-88d0-47f3-9812-5f1f15dec382.gif"},{"id":"937z127ui9","aliases":[""],"name":"freshair_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/7d10a1b1-8128-4400-af63-f28d4c3c9888.gif"},{"id":"937zkingmk","aliases":[""],"name":"fuchsia_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/5cf05079-8216-40ca-875d-8cacb546e1f9.gif"},{"id":"937zhe1mmg","aliases":[""],"name":"lightred_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/abd3c0f9-d046-4549-9d1e-f018d92982bf.gif"},{"id":"937zfpirmc","aliases":[""],"name":"mangotango_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/9c4de8ba-2c63-41bb-b581-e3e52e2017be.gif"},{"id":"937ziz3lmi","aliases":[""],"name":"middleyellow_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/86a74a5f-51e9-40f8-b2fd-de56927b72b0.gif"},{"id":"937zlhbumm","aliases":[""],"name":"palelavender_verifiedX","category":"verified","host":null,"url":"https://cdn.stella.place/D1/6364fb55-8c48-49b9-9cb9-2a06f50a920a.gif"},{"id":"937xqp173v","aliases":[""],"name":"pink_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/41f5eb90-86f5-4955-9de5-5439293b2a90.gif"},{"id":"937z46vbje","aliases":[""],"name":"red_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/bac2a25a-b79b-42db-bc75-f398dc18b2d1.gif"},{"id":"937yrlcvfv","aliases":[""],"name":"turquoise_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/2ff8d332-5563-4951-a2dc-c627fc5c1ff1.gif"},{"id":"937atf86py","aliases":[""],"name":"verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/654525f0-a8f3-415f-9051-c79739f72c31.gif"},{"id":"937yzdnihz","aliases":[""],"name":"vividred_verified","category":"verified","host":null,"url":"https://cdn.stella.place/D1/3d06e1ef-372b-4d22-9d80-02e836b911b1.gif"},{"id":"98px6gj0a9","aliases":["엘렐레"],"name":"gardeneel_ellelle","category":null,"host":null,"url":"https://cdn.stella.place/D1/c5810e07-57ad-4fd8-ae86-753e2dd799d1.png"},{"id":"98pw3pndpo","aliases":["메롱","엘렐레"],"name":"gardeneel_tongue","category":null,"host":null,"url":"https://cdn.stella.place/D1/877b2ca3-6540-4d77-a061-f1a5e047e147.png"},{"id":"97rs46kkuz","aliases":["자빠"],"name":"yum_1","category":null,"host":null,"url":"https://cdn.stella.place/D1/74d00105-84fc-4050-8bd0-28d16abba3dd.png"},{"id":"97rs4w2ubs","aliases":["지게"],"name":"yum_2","category":null,"host":null,"url":"https://cdn.stella.place/D1/8cd4b526-d42f-42af-b3a5-6f6502798866.png"},{"id":"97rs593z6t","aliases":["맛있ㅇ"],"name":"yum_3","category":null,"host":null,"url":"https://cdn.stella.place/D1/095eba74-7862-4719-aa09-5ad28aa7d29a.png"},{"id":"97rs5lph70","aliases":["ㅓ요"],"name":"yum_4","category":null,"host":null,"url":"https://cdn.stella.place/D1/1d28ee5a-dd45-4fb0-bb65-a96ee20ed971.png"}],"defaultLightTheme":null,"defaultDarkTheme":null,"ads":[],"enableEmail":true,"enableTwitterIntegration":false,"enableGithubIntegration":false,"enableDiscordIntegration":true,"enableServiceWorker":true,"translatorAvailable":false,"pinnedPages":["/featured","/channels","/explore","/pages","/about-misskey"],"pinnedClipId":null,"cacheRemoteFiles":true,"requireSetup":false,"proxyAccountName":"proxy","features":{"registration":true,"localTimeLine":true,"globalTimeLine":true,"emailRequiredForSignup":true,"elasticsearch":false,"hcaptcha":true,"recaptcha":false,"turnstile":false,"objectStorage":true,"twitter":false,"github":false,"discord":true,"serviceWorker":true,"miauth":true}}"###; #[test] fn deser_masto_instance_with_contact() { @@ -162,4 +256,30 @@ mod tests { let inst: Instance = serde_json::from_str(HYNET_INSTANCE).unwrap(); assert!(inst.contact.is_none()); } + + #[test] + fn deser_misskey_instance_without_contact() { + let meta: MisskeyMeta = serde_json::from_str(MISSKEY_BARE_INSTANCE).unwrap(); + assert!(meta.icon_url.is_none()); + } + + #[test] + fn deser_misskey_instance_with_contact() { + let meta: MisskeyMeta = serde_json::from_str(MISSKEY_STELLA_INSTANCE).unwrap(); + assert_eq!( + meta.icon_url.unwrap(), + "https://cdn.stella.place/assets/Stella.png" + ); + } + + #[test] + fn deser_misskey_instance_into() { + let meta: MisskeyMeta = serde_json::from_str(MISSKEY_STELLA_INSTANCE).unwrap(); + let inst: Instance = meta.into(); + + assert_eq!( + inst.contact.unwrap().avatar, + "https://cdn.stella.place/assets/Stella.png" + ); + } } diff --git a/src/jobs/nodeinfo.rs b/src/jobs/nodeinfo.rs index fe86ad8..fa4812f 100644 --- a/src/jobs/nodeinfo.rs +++ b/src/jobs/nodeinfo.rs @@ -39,11 +39,11 @@ impl QueryNodeinfo { .authority_str() .ok_or(ErrorKind::MissingDomain)?; let scheme = self.actor_id.scheme_str(); - let well_known_uri = iri!(format!("{}://{}/.well-known/nodeinfo", scheme, authority)); + let well_known_uri = iri!(format!("{scheme}://{authority}/.well-known/nodeinfo")); let well_known = match state .requests - .fetch_json::(well_known_uri.as_str()) + .fetch_json::(&well_known_uri) .await { Ok(well_known) => well_known, @@ -55,7 +55,7 @@ impl QueryNodeinfo { }; let href = if let Some(link) = well_known.links.into_iter().find(|l| l.rel.is_supported()) { - link.href + iri!(&link.href) } else { return Ok(()); }; @@ -168,7 +168,7 @@ impl<'de> serde::de::Visitor<'de> for SupportedVersionVisitor { type Value = SupportedVersion; fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "a string starting with '{}'", SUPPORTED_VERSIONS) + write!(f, "a string starting with '{SUPPORTED_VERSIONS}'") } fn visit_str(self, s: &str) -> Result @@ -187,7 +187,7 @@ impl<'de> serde::de::Visitor<'de> for SupportedNodeinfoVisitor { type Value = SupportedNodeinfo; fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "a string starting with '{}'", SUPPORTED_NODEINFO) + write!(f, "a string starting with '{SUPPORTED_NODEINFO}'") } fn visit_str(self, s: &str) -> Result diff --git a/src/main.rs b/src/main.rs index 39bba1d..22764a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,7 @@ use self::{ db::Db, jobs::create_workers, middleware::{DebugPayload, MyVerify, RelayResolver, Timings}, - routes::{actor, inbox, index, nodeinfo, nodeinfo_meta, statics}, + routes::{actor, healthz, inbox, index, nodeinfo, nodeinfo_meta, statics}, }; fn init_subscriber( @@ -273,6 +273,7 @@ async fn do_server_main( app.wrap(Compress::default()) .wrap(TracingLogger::default()) .wrap(Timings) + .route("/healthz", web::get().to(healthz)) .service(web::resource("/").route(web::get().to(index))) .service(web::resource("/media/{path}").route(web::get().to(routes::media))) .service( diff --git a/src/middleware/verifier.rs b/src/middleware/verifier.rs index a982563..4e1e364 100644 --- a/src/middleware/verifier.rs +++ b/src/middleware/verifier.rs @@ -6,10 +6,12 @@ use crate::{ }; use activitystreams::{base::BaseExt, iri, iri_string::types::IriString}; use actix_web::web; +use base64::{engine::general_purpose::STANDARD, Engine}; use http_signature_normalization_actix::{prelude::*, verify::DeprecatedAlgorithm}; -use rsa::{pkcs1v15::VerifyingKey, pkcs8::DecodePublicKey, RsaPublicKey}; -use sha2::{Digest, Sha256}; -use signature::{DigestVerifier, Signature}; +use rsa::{ + pkcs1v15::Signature, pkcs1v15::VerifyingKey, pkcs8::DecodePublicKey, sha2::Sha256, + signature::Verifier, RsaPublicKey, +}; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug)] @@ -65,15 +67,11 @@ impl MyVerify { actor_id } else { - match self - .0 - .fetch::(public_key_id.as_str()) - .await - { + match self.0.fetch::(&public_key_id).await { Ok(res) => res.actor_id().ok_or(ErrorKind::MissingId), Err(e) => { if e.is_gone() { - tracing::warn!("Actor gone: {}", public_key_id); + tracing::warn!("Actor gone: {public_key_id}"); return Ok(false); } else { return Err(e); @@ -127,13 +125,13 @@ async fn do_verify( let span = tracing::Span::current(); web::block(move || { span.in_scope(|| { - let decoded = base64::decode(signature)?; - let signature = Signature::from_bytes(&decoded).map_err(ErrorKind::ReadSignature)?; - let hashed = Sha256::new_with_prefix(signing_string.as_bytes()); + let decoded = STANDARD.decode(signature)?; + let signature = + Signature::try_from(decoded.as_slice()).map_err(ErrorKind::ReadSignature)?; - let verifying_key = VerifyingKey::new_with_prefix(public_key); + let verifying_key = VerifyingKey::::new_with_prefix(public_key); verifying_key - .verify_digest(hashed, &signature) + .verify(signing_string.as_bytes(), &signature) .map_err(ErrorKind::VerifySignature)?; Ok(()) as Result<(), Error> @@ -176,13 +174,13 @@ mod tests { #[test] fn handles_masto_keys() { - println!("{}", ASONIX_DOG_KEY); + println!("{ASONIX_DOG_KEY}"); let _ = RsaPublicKey::from_public_key_pem(ASONIX_DOG_KEY.trim()).unwrap(); } #[test] fn handles_pleromo_keys() { - println!("{}", KARJALAZET_KEY); + println!("{KARJALAZET_KEY}"); let _ = RsaPublicKey::from_public_key_pem(KARJALAZET_KEY.trim()).unwrap(); } diff --git a/src/requests.rs b/src/requests.rs index 9a1bc50..06c7450 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -5,12 +5,16 @@ use crate::{ use activitystreams::iri_string::types::IriString; use actix_web::http::header::Date; use awc::{error::SendRequestError, Client, ClientResponse}; +use base64::{engine::general_purpose::STANDARD, Engine}; use dashmap::DashMap; use http_signature_normalization_actix::prelude::*; use rand::thread_rng; -use rsa::{pkcs1v15::SigningKey, RsaPrivateKey}; -use sha2::{Digest, Sha256}; -use signature::RandomizedSigner; +use rsa::{ + pkcs1v15::SigningKey, + sha2::{Digest, Sha256}, + signature::RandomizedSigner, + RsaPrivateKey, +}; use std::{ cell::RefCell, rc::Rc, @@ -57,7 +61,7 @@ impl Breakers { if let Some(mut breaker) = self.inner.get_mut(authority) { breaker.fail(); if !breaker.should_try() { - tracing::warn!("Failed breaker for {}", authority); + tracing::warn!("Failed breaker for {authority}"); } false } else { @@ -225,13 +229,13 @@ impl Requests { self.reset_err(); - if !res.status().is_success() { + if res.status().is_server_error() { self.breakers.fail(&parsed_url); if let Ok(bytes) = res.body().await { if let Ok(s) = String::from_utf8(bytes.as_ref().to_vec()) { if !s.is_empty() { - tracing::warn!("Response from {}, {}", parsed_url, s); + tracing::warn!("Response from {parsed_url}, {s}"); } } } @@ -246,52 +250,48 @@ impl Requests { } #[tracing::instrument(name = "Fetch Json", skip(self), fields(signing_string))] - pub(crate) async fn fetch_json(&self, url: &str) -> Result + pub(crate) async fn fetch_json(&self, url: &IriString) -> Result where T: serde::de::DeserializeOwned, { self.do_fetch(url, "application/json").await } + #[tracing::instrument(name = "Fetch Json", skip(self), fields(signing_string))] + pub(crate) async fn fetch_json_msky(&self, url: &IriString) -> Result + where + T: serde::de::DeserializeOwned, + { + let mut res = self + .do_deliver( + url, + &serde_json::json!({}), + "application/json", + "application/json", + ) + .await?; + + let body = res + .body() + .await + .map_err(|e| ErrorKind::ReceiveResponse(url.to_string(), e.to_string()))?; + + Ok(serde_json::from_slice(body.as_ref())?) + } + #[tracing::instrument(name = "Fetch Activity+Json", skip(self), fields(signing_string))] - pub(crate) async fn fetch(&self, url: &str) -> Result + pub(crate) async fn fetch(&self, url: &IriString) -> Result where T: serde::de::DeserializeOwned, { self.do_fetch(url, "application/activity+json").await } - async fn do_fetch(&self, url: &str, accept: &str) -> Result + async fn do_fetch(&self, url: &IriString, accept: &str) -> Result where T: serde::de::DeserializeOwned, { - let parsed_url = url.parse::()?; - - if !self.breakers.should_try(&parsed_url) { - return Err(ErrorKind::Breaker.into()); - } - - let signer = self.signer(); - let span = tracing::Span::current(); - - let client: Client = self.client.borrow().clone(); - let res = client - .get(url) - .insert_header(("Accept", accept)) - .insert_header(Date(SystemTime::now().into())) - .signature( - self.config.clone(), - self.key_id.clone(), - move |signing_string| { - span.record("signing_string", signing_string); - span.in_scope(|| signer.sign(signing_string)) - }, - ) - .await? - .send() - .await; - - let mut res = self.check_response(&parsed_url, res).await?; + let mut res = self.do_fetch_response(url, accept).await?; let body = res .body() @@ -302,8 +302,16 @@ impl Requests { } #[tracing::instrument(name = "Fetch response", skip(self), fields(signing_string))] - pub(crate) async fn fetch_response(&self, url: IriString) -> Result { - if !self.breakers.should_try(&url) { + pub(crate) async fn fetch_response(&self, url: &IriString) -> Result { + self.do_fetch_response(url, "*/*").await + } + + pub(crate) async fn do_fetch_response( + &self, + url: &IriString, + accept: &str, + ) -> Result { + if !self.breakers.should_try(url) { return Err(ErrorKind::Breaker.into()); } @@ -313,7 +321,7 @@ impl Requests { let client: Client = self.client.borrow().clone(); let res = client .get(url.as_str()) - .insert_header(("Accept", "*/*")) + .insert_header(("Accept", accept)) .insert_header(Date(SystemTime::now().into())) .no_decompress() .signature( @@ -328,7 +336,7 @@ impl Requests { .send() .await; - let res = self.check_response(&url, res).await?; + let res = self.check_response(url, res).await?; Ok(res) } @@ -338,7 +346,27 @@ impl Requests { skip_all, fields(inbox = inbox.to_string().as_str(), signing_string) )] - pub(crate) async fn deliver(&self, inbox: IriString, item: &T) -> Result<(), Error> + pub(crate) async fn deliver(&self, inbox: &IriString, item: &T) -> Result<(), Error> + where + T: serde::ser::Serialize + std::fmt::Debug, + { + self.do_deliver( + inbox, + item, + "application/activity+json", + "application/activity+json", + ) + .await?; + Ok(()) + } + + async fn do_deliver( + &self, + inbox: &IriString, + item: &T, + content_type: &str, + accept: &str, + ) -> Result where T: serde::ser::Serialize + std::fmt::Debug, { @@ -353,8 +381,8 @@ impl Requests { let client: Client = self.client.borrow().clone(); let (req, body) = client .post(inbox.as_str()) - .insert_header(("Accept", "application/activity+json")) - .insert_header(("Content-Type", "application/activity+json")) + .insert_header(("Accept", accept)) + .insert_header(("Content-Type", content_type)) .insert_header(Date(SystemTime::now().into())) .signature_with_digest( self.config.clone(), @@ -371,9 +399,9 @@ impl Requests { let res = req.send_body(body).await; - self.check_response(&inbox, res).await?; + let res = self.check_response(inbox, res).await?; - Ok(()) + Ok(res) } fn signer(&self) -> Signer { @@ -390,7 +418,8 @@ struct Signer { impl Signer { fn sign(&self, signing_string: &str) -> Result { let signing_key = SigningKey::::new_with_prefix(self.private_key.clone()); - let signature = signing_key.try_sign_with_rng(thread_rng(), signing_string.as_bytes())?; - Ok(base64::encode(signature.as_ref())) + let signature = + signing_key.try_sign_with_rng(&mut thread_rng(), signing_string.as_bytes())?; + Ok(STANDARD.encode(signature.as_ref())) } } diff --git a/src/routes.rs b/src/routes.rs index d80a0a1..9afd38b 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -1,4 +1,5 @@ mod actor; +mod healthz; mod inbox; mod index; mod media; @@ -7,6 +8,7 @@ mod statics; pub(crate) use self::{ actor::route as actor, + healthz::route as healthz, inbox::route as inbox, index::route as index, media::route as media, diff --git a/src/routes/healthz.rs b/src/routes/healthz.rs new file mode 100644 index 0000000..f297ba5 --- /dev/null +++ b/src/routes/healthz.rs @@ -0,0 +1,7 @@ +use crate::{data::State, error::Error}; +use actix_web::{web, HttpResponse}; + +pub(crate) async fn route(state: web::Data) -> Result { + state.db.check_health().await?; + Ok(HttpResponse::Ok().finish()) +} diff --git a/src/routes/index.rs b/src/routes/index.rs index 835e2b8..d1b4b21 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -71,7 +71,7 @@ pub(crate) async fn route( let mut buf = BufWriter::new(Vec::new()); - crate::templates::index(&mut buf, &local, &nodes, &config)?; + crate::templates::index_html(&mut buf, &local, &nodes, &config)?; let html = buf.into_inner().map_err(|e| { tracing::error!("Error rendering template, {}", e.error()); ErrorKind::FlushBuffer diff --git a/src/routes/media.rs b/src/routes/media.rs index 8a9de62..7cc3ed9 100644 --- a/src/routes/media.rs +++ b/src/routes/media.rs @@ -11,7 +11,7 @@ pub(crate) async fn route( let uuid = uuid.into_inner(); if let Some(url) = media.get_url(uuid).await? { - let res = requests.fetch_response(url).await?; + let res = requests.fetch_response(&url).await?; let mut response = HttpResponse::build(res.status()); diff --git a/src/routes/nodeinfo.rs b/src/routes/nodeinfo.rs index a504496..66785e0 100644 --- a/src/routes/nodeinfo.rs +++ b/src/routes/nodeinfo.rs @@ -44,6 +44,8 @@ pub(crate) async fn route( .map(|s| s.to_owned()) .collect(); + let open_registrations = !config.restricted_mode(); + web::Json(NodeInfo { version: NodeInfoVersion, software: Software { @@ -55,7 +57,7 @@ pub(crate) async fn route( inbound: vec![], outbound: vec![], }, - open_registrations: false, + open_registrations, usage: Usage { users: Users { total: 1, diff --git a/src/telegram.rs b/src/telegram.rs index 270e1af..f3cce43 100644 --- a/src/telegram.rs +++ b/src/telegram.rs @@ -89,19 +89,19 @@ async fn answer(bot: Bot, msg: Message, cmd: Command, db: Db) -> ResponseResult< .await?; } Command::Block { domain } if db.add_blocks(vec![domain.clone()]).await.is_ok() => { - bot.send_message(msg.chat.id, format!("{} has been blocked", domain)) + bot.send_message(msg.chat.id, format!("{domain} has been blocked")) .await?; } Command::Unblock { domain } if db.remove_blocks(vec![domain.clone()]).await.is_ok() => { - bot.send_message(msg.chat.id, format!("{} has been unblocked", domain)) + bot.send_message(msg.chat.id, format!("{domain} has been unblocked")) .await?; } Command::Allow { domain } if db.add_allows(vec![domain.clone()]).await.is_ok() => { - bot.send_message(msg.chat.id, format!("{} has been allowed", domain)) + bot.send_message(msg.chat.id, format!("{domain} has been allowed")) .await?; } Command::Disallow { domain } if db.remove_allows(vec![domain.clone()]).await.is_ok() => { - bot.send_message(msg.chat.id, format!("{} has been disallowed", domain)) + bot.send_message(msg.chat.id, format!("{domain} has been disallowed")) .await?; } Command::ListAllowed => { diff --git a/templates/index.rs.html b/templates/index.rs.html index ab9bb9e..08f6549 100644 --- a/templates/index.rs.html +++ b/templates/index.rs.html @@ -1,7 +1,7 @@ @use crate::{ config::{Config, UrlKind}, data::Node, -templates::{info, instance, statics::index_css}, +templates::{info_html, instance_html, statics::index_css}, }; @(local: &[Node], nodes: &[Node], config: &Config) @@ -9,7 +9,7 @@ templates::{info, instance, statics::index_css}, - + @config.hostname() | Relais ActivityPub @@ -39,13 +39,13 @@ templates::{info, instance, statics::index_css}, @for node in local { @if let Some(inst) = node.instance.as_ref() {
  • - @:instance(inst, node.info.as_ref().map(|info| { info.software.as_ref() }), node.contact.as_ref(), + @:instance_html(inst, node.info.as_ref().map(|info| { info.software.as_ref() }), node.contact.as_ref(), &node.base)
  • } else { @if let Some(inf) = node.info.as_ref() {
  • - @:info(inf, &node.base) + @:info_html(inf, &node.base)
  • } } @@ -94,13 +94,13 @@ templates::{info, instance, statics::index_css}, @for node in nodes { @if let Some(inst) = node.instance.as_ref() {
  • - @:instance(inst, node.info.as_ref().map(|info| { info.software.as_ref() }), node.contact.as_ref(), + @:instance_html(inst, node.info.as_ref().map(|info| { info.software.as_ref() }), node.contact.as_ref(), &node.base)
  • } else { @if let Some(inf) = node.info.as_ref() {
  • - @:info(inf, &node.base) + @:info_html(inf, &node.base)
  • } } diff --git a/templates/instance.rs.html b/templates/instance.rs.html index e8e6ad8..3245a18 100644 --- a/templates/instance.rs.html +++ b/templates/instance.rs.html @@ -1,4 +1,4 @@ -@use crate::{db::{Contact, Instance}, templates::admin}; +@use crate::{db::{Contact, Instance}, templates::admin_html}; @use activitystreams::iri_string::types::IriString; @(instance: &Instance, software: Option<&str>, contact: Option<&Contact>, base: &IriString) @@ -32,8 +32,8 @@ } @if let Some(contact) = contact { -
    Administré par:
    - @:admin(contact, base) +
    Administré par:
    + @:admin_html(contact, base) } }