improvement: upgrade dependencies, fix timeline reload bug

next
Timo Kösters 2020-12-05 21:03:43 +01:00
parent 164b1633d8
commit 45086b54b3
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
8 changed files with 202 additions and 148 deletions

168
Cargo.lock generated
View File

@ -61,9 +61,12 @@ dependencies = [
[[package]] [[package]]
name = "atomic" name = "atomic"
version = "0.4.6" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "atty" name = "atty"
@ -163,9 +166,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.65" version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -192,15 +195,6 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "cloudabi"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "color_quant" name = "color_quant"
version = "1.1.0" version = "1.1.0"
@ -211,7 +205,7 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
name = "conduit" name = "conduit"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"base64 0.12.3", "base64 0.13.0",
"directories", "directories",
"http", "http",
"image", "image",
@ -256,9 +250,8 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]] [[package]]
name = "cookie" name = "cookie"
version = "0.14.3" version = "0.15.0-dev"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/SergioBenitez/cookie-rs.git?rev=1c3ca83#1c3ca838543b60a4448d279dc4b903cc7a2bc22a"
checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
"time 0.2.23", "time 0.2.23",
@ -328,7 +321,7 @@ dependencies = [
[[package]] [[package]]
name = "devise" name = "devise"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047"
dependencies = [ dependencies = [
"devise_codegen", "devise_codegen",
"devise_core", "devise_core",
@ -337,7 +330,7 @@ dependencies = [
[[package]] [[package]]
name = "devise_codegen" name = "devise_codegen"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047"
dependencies = [ dependencies = [
"devise_core", "devise_core",
"quote", "quote",
@ -346,7 +339,7 @@ dependencies = [
[[package]] [[package]]
name = "devise_core" name = "devise_core"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"proc-macro2", "proc-macro2",
@ -408,6 +401,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "figment"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b13e2d266426f89e45fc544117ade84fad2a58ff676f34cc34e123fe4391b856"
dependencies = [
"pear",
"serde",
"toml",
"uncased",
"version_check",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@ -846,9 +852,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.45" version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -1009,9 +1015,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.6.22" version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"fuchsia-zircon", "fuchsia-zircon",
@ -1197,12 +1203,11 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.8.0" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" checksum = "d7c6d9b8427445284a09c55be860a15855ab580a417ccad9da88f5a06787ced0"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"cloudabi",
"instant", "instant",
"libc", "libc",
"redox_syscall", "redox_syscall",
@ -1218,8 +1223,9 @@ checksum = "7151b083b0664ed58ed669fcdd92f01c3d2fdbf10af4931a301474950b52bfa9"
[[package]] [[package]]
name = "pear" name = "pear"
version = "0.2.0-dev" version = "0.2.0"
source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09f612cbd0f9dd03f5dd28a191c48e4148c3b027e41207b32eee130373c6c941"
dependencies = [ dependencies = [
"inlinable_string", "inlinable_string",
"pear_codegen", "pear_codegen",
@ -1228,8 +1234,9 @@ dependencies = [
[[package]] [[package]]
name = "pear_codegen" name = "pear_codegen"
version = "0.2.0-dev" version = "0.2.0"
source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602cf1780ee9bbca663ea75769e05643e16fe87d7c8ac9f4f385a2ed8940a75c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"proc-macro2-diagnostics", "proc-macro2-diagnostics",
@ -1357,8 +1364,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2-diagnostics" name = "proc-macro2-diagnostics"
version = "0.1.0" version = "0.9.1"
source = "git+https://github.com/SergioBenitez/proc-macro2-diagnostics.git?rev=13fbb43#13fbb43db72034b6f9660a9b00e338cebd8dcf44" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1542,9 +1550,9 @@ dependencies = [
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.16.18" version = "0.16.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70017ed5c555d79ee3538fc63ca09c70ad8f317dcadc1adc2c496b60c22bb24f" checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -1558,24 +1566,28 @@ dependencies = [
[[package]] [[package]]
name = "rocket" name = "rocket"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/timokoesters/Rocket.git?branch=empty_parameters#f6d40ecd5d871d97837b3116eb670fb3c06d95b9" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=1f1f44f336e5a172361fc1860461bb03667b1ed2#1f1f44f336e5a172361fc1860461bb03667b1ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"atomic", "atomic",
"atty", "atty",
"binascii", "binascii",
"either",
"figment",
"futures", "futures",
"log", "log",
"memchr", "memchr",
"num_cpus", "num_cpus",
"pear", "parking_lot",
"rand",
"ref-cast", "ref-cast",
"rocket_codegen", "rocket_codegen",
"rocket_http", "rocket_http",
"serde",
"state", "state",
"time 0.2.23", "time 0.2.23",
"tokio", "tokio",
"toml", "ubyte",
"version_check", "version_check",
"yansi", "yansi",
] ]
@ -1583,7 +1595,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_codegen" name = "rocket_codegen"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/timokoesters/Rocket.git?branch=empty_parameters#f6d40ecd5d871d97837b3116eb670fb3c06d95b9" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=1f1f44f336e5a172361fc1860461bb03667b1ed2#1f1f44f336e5a172361fc1860461bb03667b1ed2"
dependencies = [ dependencies = [
"devise", "devise",
"glob", "glob",
@ -1595,14 +1607,16 @@ dependencies = [
[[package]] [[package]]
name = "rocket_http" name = "rocket_http"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/timokoesters/Rocket.git?branch=empty_parameters#f6d40ecd5d871d97837b3116eb670fb3c06d95b9" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=1f1f44f336e5a172361fc1860461bb03667b1ed2#1f1f44f336e5a172361fc1860461bb03667b1ed2"
dependencies = [ dependencies = [
"cookie", "cookie",
"either",
"http", "http",
"hyper", "hyper",
"indexmap", "indexmap",
"log", "log",
"mime", "mime",
"parking_lot",
"pear", "pear",
"percent-encoding", "percent-encoding",
"ref-cast", "ref-cast",
@ -1611,7 +1625,9 @@ dependencies = [
"time 0.2.23", "time 0.2.23",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls",
"uncased",
"unicode-xid", "unicode-xid",
"version_check",
] ]
[[package]] [[package]]
@ -1952,9 +1968,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.59" version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -2022,9 +2038,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.5.0" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
[[package]] [[package]]
name = "socket2" name = "socket2"
@ -2480,6 +2496,24 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "ubyte"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42756bb9e708855de2f8a98195643dff31a97f0485d90d8467b39dc24be9e8fe"
dependencies = [
"serde",
]
[[package]]
name = "uncased"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "369fa7fd7969c5373541d3c9a40dc1b76ce676fc87aba30d87c0ad3b97fad179"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.6.0" version = "2.6.0"
@ -2573,11 +2607,11 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.68" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"serde", "serde",
"serde_json", "serde_json",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -2585,9 +2619,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.68" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -2600,11 +2634,11 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.18" version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
@ -2612,9 +2646,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.68" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -2622,9 +2656,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.68" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2635,15 +2669,15 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.68" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]] [[package]]
name = "wasm-bindgen-test" name = "wasm-bindgen-test"
version = "0.3.18" version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34d1cdc8b98a557f24733d50a1199c4b0635e465eecba9c45b214544da197f64" checksum = "0355fa0c1f9b792a09b6dcb6a8be24d51e71e6d74972f9eb4a44c4c004d24a25"
dependencies = [ dependencies = [
"console_error_panic_hook", "console_error_panic_hook",
"js-sys", "js-sys",
@ -2655,9 +2689,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-test-macro" name = "wasm-bindgen-test-macro"
version = "0.3.18" version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585" checksum = "27e07b46b98024c2ba2f9e83a10c2ef0515f057f2da299c1762a2017de80438b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2665,9 +2699,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.45" version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -2675,9 +2709,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki" name = "webpki"
version = "0.21.3" version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
dependencies = [ dependencies = [
"ring", "ring",
"untrusted", "untrusted",

View File

@ -14,8 +14,8 @@ edition = "2018"
[dependencies] [dependencies]
# Used to handle requests # Used to handle requests
# TODO: This can become optional as soon as proper configs are supported # TODO: This can become optional as soon as proper configs are supported
#rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "8d779caa22c63b15a6c3ceb75d8f6d4971b2eb67", default-features = false, features = ["tls"] } # Used to handle requests rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "1f1f44f336e5a172361fc1860461bb03667b1ed2", features = ["tls"] } # Used to handle requests
rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] } #rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] }
# Used for matrix spec type definitions and helpers # Used for matrix spec type definitions and helpers
ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks", "unstable-exhaustive-types"], rev = "e8882fe8142d7b55ed4c8ccc6150946945f9e237" } ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks", "unstable-exhaustive-types"], rev = "e8882fe8142d7b55ed4c8ccc6150946945f9e237" }
@ -27,10 +27,10 @@ ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api",
state-res = { git = "https://github.com/ruma/state-res", branch = "timo-spec-comp", features = ["unstable-pre-spec", "gen-eventid"] } state-res = { git = "https://github.com/ruma/state-res", branch = "timo-spec-comp", features = ["unstable-pre-spec", "gen-eventid"] }
# state-res = { path = "../../state-res", features = ["unstable-pre-spec", "gen-eventid"] } # state-res = { path = "../../state-res", features = ["unstable-pre-spec", "gen-eventid"] }
# Used for long polling # Used for long polling and federation sender, should be the same as rocket::tokio
tokio = "0.2.22" tokio = { version = "0.2.23" }
# Used for storing data permanently # Used for storing data permanently
sled = { version = "0.34.4", default-features = false } sled = { version = "0.34.6", default-features = false }
# Used for emitting log entries # Used for emitting log entries
log = "0.4.11" log = "0.4.11"
# Used for rocket<->ruma conversions # Used for rocket<->ruma conversions
@ -40,25 +40,25 @@ directories = "3.0.1"
# Used for number types for ruma # Used for number types for ruma
js_int = "0.1.9" js_int = "0.1.9"
# Used for ruma wrapper # Used for ruma wrapper
serde_json = { version = "1.0.57", features = ["raw_value"] } serde_json = { version = "1.0.60", features = ["raw_value"] }
# Used for pdu definition # Used for pdu definition
serde = "1.0.116" serde = "1.0.117"
# Used for secure identifiers # Used for secure identifiers
rand = "0.7.3" rand = "0.7.3"
# Used to hash passwords # Used to hash passwords
rust-argon2 = "0.8.2" rust-argon2 = "0.8.3"
# Used to send requests # Used to send requests
reqwest = "0.10.8" reqwest = "0.10.9"
# Used for conduit::Error type # Used for conduit::Error type
thiserror = "1.0.20" thiserror = "1.0.22"
# Used to generate thumbnails for images # Used to generate thumbnails for images
image = { version = "0.23.9", default-features = false, features = ["jpeg", "png", "gif"] } image = { version = "0.23.12", default-features = false, features = ["jpeg", "png", "gif"] }
# Used to encode server public key # Used to encode server public key
base64 = "0.12.3" base64 = "0.13.0"
# Used when hashing the state # Used when hashing the state
ring = "0.16.15" ring = "0.16.19"
# Used when querying the SRV record of other servers # Used when querying the SRV record of other servers
trust-dns-resolver = "0.19.5" trust-dns-resolver = "0.19.6"
[features] [features]
default = ["conduit_bin"] default = ["conduit_bin"]

View File

@ -13,12 +13,39 @@ use crate::{Error, Result};
use directories::ProjectDirs; use directories::ProjectDirs;
use futures::StreamExt; use futures::StreamExt;
use log::info; use log::info;
use rocket::{ use rocket::futures::{self, channel::mpsc};
futures::{self, channel::mpsc}, use ruma::{DeviceId, ServerName, UserId};
Config, use serde::Deserialize;
}; use std::{convert::TryInto, fs::remove_dir_all};
use ruma::{DeviceId, UserId};
use std::{convert::TryFrom, fs::remove_dir_all}; #[derive(Clone, Deserialize)]
pub struct Config {
#[serde(default = "default_server_name")]
server_name: Box<ServerName>,
database_path: Option<String>,
#[serde(default = "default_cache_capacity")]
cache_capacity: u64,
#[serde(default = "default_max_request_size")]
max_request_size: u32,
#[serde(default)]
registration_disabled: bool,
#[serde(default)]
encryption_disabled: bool,
#[serde(default)]
federation_enabled: bool,
}
fn default_server_name() -> Box<ServerName> {
"localhost".try_into().expect("")
}
fn default_cache_capacity() -> u64 {
1024 * 1024 * 1024
}
fn default_max_request_size() -> u32 {
20 * 1024 * 1024 // Default to 20 MB
}
#[derive(Clone)] #[derive(Clone)]
pub struct Database { pub struct Database {
@ -49,19 +76,18 @@ impl Database {
} }
/// Load an existing database or create a new one. /// Load an existing database or create a new one.
pub fn load_or_create(config: &Config) -> Result<Self> { pub fn load_or_create(config: Config) -> Result<Self> {
let server_name = config.get_str("server_name").unwrap_or("localhost");
let path = config let path = config
.get_str("database_path") .database_path
.map(|x| Ok::<_, Error>(x.to_owned())) .clone()
.unwrap_or_else(|_| { .map(Ok::<_, Error>)
.unwrap_or_else(|| {
let path = ProjectDirs::from("xyz", "koesters", "conduit") let path = ProjectDirs::from("xyz", "koesters", "conduit")
.ok_or_else(|| { .ok_or_else(|| {
Error::bad_config("The OS didn't return a valid home directory path.") Error::bad_config("The OS didn't return a valid home directory path.")
})? })?
.data_dir() .data_dir()
.join(server_name); .join(config.server_name.as_str());
Ok(path Ok(path
.to_str() .to_str()
@ -71,15 +97,8 @@ impl Database {
let db = sled::Config::default() let db = sled::Config::default()
.path(&path) .path(&path)
.cache_capacity( .cache_capacity(config.cache_capacity)
u64::try_from( .print_profile_on_drop(true)
config
.get_int("cache_capacity")
.unwrap_or(1024 * 1024 * 1024),
)
.map_err(|_| Error::bad_config("Cache capacity needs to be a u64."))?,
)
.print_profile_on_drop(false)
.open()?; .open()?;
info!("Opened sled database at {}", path); info!("Opened sled database at {}", path);

View File

@ -49,8 +49,6 @@ impl Admin {
Some(event) = receiver.next() => { Some(event) = receiver.next() => {
match event { match event {
AdminCommand::SendTextMessage(message) => { AdminCommand::SendTextMessage(message) => {
println!("{:?}", message);
if let Some(conduit_room) = &conduit_room { if let Some(conduit_room) = &conduit_room {
db.rooms.build_and_append_pdu( db.rooms.build_and_append_pdu(
PduBuilder { PduBuilder {

View File

@ -1,7 +1,7 @@
use crate::{utils, Error, Result}; use crate::{database::Config, utils, Error, Result};
use log::error; use log::error;
use ruma::ServerName; use ruma::ServerName;
use std::{convert::TryInto, sync::Arc}; use std::sync::Arc;
pub const COUNTER: &str = "c"; pub const COUNTER: &str = "c";
@ -10,15 +10,11 @@ pub struct Globals {
pub(super) globals: sled::Tree, pub(super) globals: sled::Tree,
keypair: Arc<ruma::signatures::Ed25519KeyPair>, keypair: Arc<ruma::signatures::Ed25519KeyPair>,
reqwest_client: reqwest::Client, reqwest_client: reqwest::Client,
server_name: Box<ServerName>, config: Config,
max_request_size: u32,
registration_disabled: bool,
encryption_disabled: bool,
federation_enabled: bool,
} }
impl Globals { impl Globals {
pub fn load(globals: sled::Tree, config: &rocket::Config) -> Result<Self> { pub fn load(globals: sled::Tree, config: Config) -> Result<Self> {
let bytes = &*globals let bytes = &*globals
.update_and_fetch("keypair", utils::generate_keypair)? .update_and_fetch("keypair", utils::generate_keypair)?
.expect("utils::generate_keypair always returns Some"); .expect("utils::generate_keypair always returns Some");
@ -57,20 +53,7 @@ impl Globals {
globals, globals,
keypair: Arc::new(keypair), keypair: Arc::new(keypair),
reqwest_client: reqwest::Client::new(), reqwest_client: reqwest::Client::new(),
server_name: config config,
.get_str("server_name")
.unwrap_or("localhost")
.to_string()
.try_into()
.map_err(|_| Error::bad_config("Invalid server_name."))?,
max_request_size: config
.get_int("max_request_size")
.unwrap_or(20 * 1024 * 1024) // Default to 20 MB
.try_into()
.map_err(|_| Error::bad_config("Invalid max_request_size."))?,
registration_disabled: config.get_bool("registration_disabled").unwrap_or(false),
encryption_disabled: config.get_bool("encryption_disabled").unwrap_or(false),
federation_enabled: config.get_bool("federation_enabled").unwrap_or(false),
}) })
} }
@ -102,22 +85,22 @@ impl Globals {
} }
pub fn server_name(&self) -> &ServerName { pub fn server_name(&self) -> &ServerName {
self.server_name.as_ref() self.config.server_name.as_ref()
} }
pub fn max_request_size(&self) -> u32 { pub fn max_request_size(&self) -> u32 {
self.max_request_size self.config.max_request_size
} }
pub fn registration_disabled(&self) -> bool { pub fn registration_disabled(&self) -> bool {
self.registration_disabled self.config.registration_disabled
} }
pub fn encryption_disabled(&self) -> bool { pub fn encryption_disabled(&self) -> bool {
self.encryption_disabled self.config.encryption_disabled
} }
pub fn federation_enabled(&self) -> bool { pub fn federation_enabled(&self) -> bool {
self.federation_enabled self.config.federation_enabled
} }
} }

View File

@ -21,7 +21,7 @@ use rocket::{fairing::AdHoc, routes};
fn setup_rocket() -> rocket::Rocket { fn setup_rocket() -> rocket::Rocket {
// Force log level off, so we can use our own logger // Force log level off, so we can use our own logger
std::env::set_var("ROCKET_LOG", "off"); std::env::set_var("ROCKET_LOG_LEVEL", "off");
rocket::ignite() rocket::ignite()
.mount( .mount(
@ -123,9 +123,9 @@ fn setup_rocket() -> rocket::Rocket {
client_server::get_pushers_route, client_server::get_pushers_route,
client_server::set_pushers_route, client_server::set_pushers_route,
client_server::upgrade_room_route, client_server::upgrade_room_route,
server_server::get_server_version, server_server::get_server_version_route,
server_server::get_server_keys, server_server::get_server_keys_route,
server_server::get_server_keys_deprecated, server_server::get_server_keys_deprecated_route,
server_server::get_public_rooms_route, server_server::get_public_rooms_route,
server_server::get_public_rooms_filtered_route, server_server::get_public_rooms_filtered_route,
server_server::send_transaction_message_route, server_server::send_transaction_message_route,
@ -133,8 +133,10 @@ fn setup_rocket() -> rocket::Rocket {
server_server::get_profile_information_route, server_server::get_profile_information_route,
], ],
) )
.attach(AdHoc::on_attach("Config", |mut rocket| async { .attach(AdHoc::on_attach("Config", |rocket| async {
let data = Database::load_or_create(rocket.config().await).expect("valid config"); let data =
Database::load_or_create(rocket.figment().extract().expect("config is valid"))
.expect("config is valid");
data.sending.start_handler(&data.globals, &data.rooms); data.sending.start_handler(&data.globals, &data.rooms);
log::set_boxed_logger(Box::new(ConduitLogger { log::set_boxed_logger(Box::new(ConduitLogger {

View File

@ -15,7 +15,8 @@ use {
log::warn, log::warn,
rocket::{ rocket::{
data::{ data::{
Data, FromDataFuture, FromTransformedData, Transform, TransformFuture, Transformed, ByteUnit, Data, FromDataFuture, FromTransformedData, Transform, TransformFuture,
Transformed,
}, },
http::Status, http::Status,
outcome::Outcome::*, outcome::Outcome::*,
@ -97,7 +98,7 @@ where
} }
let limit = db.globals.max_request_size(); let limit = db.globals.max_request_size();
let mut handle = data.open().take(limit.into()); let mut handle = data.open(ByteUnit::Byte(limit.into()));
let mut body = Vec::new(); let mut body = Vec::new();
handle.read_to_end(&mut body).await.unwrap(); handle.read_to_end(&mut body).await.unwrap();

View File

@ -193,6 +193,8 @@ where
} }
} }
let status = reqwest_response.status();
let body = reqwest_response let body = reqwest_response
.bytes() .bytes()
.await .await
@ -201,17 +203,27 @@ where
Vec::new().into() Vec::new().into()
}) // TODO: handle timeout }) // TODO: handle timeout
.into_iter() .into_iter()
.collect(); .collect::<Vec<_>>();
if status != 200 {
warn!(
"Server returned bad response {} ({}): {} {:?}",
destination,
url,
status,
utils::string_from_bytes(&body)
);
}
let response = T::IncomingResponse::try_from( let response = T::IncomingResponse::try_from(
http_response http_response
.body(body) .body(body)
.expect("reqwest body is valid http body"), .expect("reqwest body is valid http body"),
); );
response.map_err(|e| { response.map_err(|_| {
warn!( warn!(
"Server returned bad response {} ({}): {:?}", "Server returned invalid response bytes {} ({})",
destination, url, e destination, url
); );
Error::BadServerResponse("Server returned bad response.") Error::BadServerResponse("Server returned bad response.")
}) })
@ -221,7 +233,9 @@ where
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/federation/v1/version"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/federation/v1/version"))]
pub fn get_server_version(db: State<'_, Database>) -> ConduitResult<get_server_version::Response> { pub fn get_server_version_route(
db: State<'_, Database>,
) -> ConduitResult<get_server_version::Response> {
if !db.globals.federation_enabled() { if !db.globals.federation_enabled() {
return Err(Error::bad_config("Federation is disabled.")); return Err(Error::bad_config("Federation is disabled."));
} }
@ -236,7 +250,7 @@ pub fn get_server_version(db: State<'_, Database>) -> ConduitResult<get_server_v
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server"))]
pub fn get_server_keys(db: State<'_, Database>) -> Json<String> { pub fn get_server_keys_route(db: State<'_, Database>) -> Json<String> {
if !db.globals.federation_enabled() { if !db.globals.federation_enabled() {
// TODO: Use proper types // TODO: Use proper types
return Json("Federation is disabled.".to_owned()); return Json("Federation is disabled.".to_owned());
@ -278,8 +292,8 @@ pub fn get_server_keys(db: State<'_, Database>) -> Json<String> {
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))]
pub fn get_server_keys_deprecated(db: State<'_, Database>) -> Json<String> { pub fn get_server_keys_deprecated_route(db: State<'_, Database>) -> Json<String> {
get_server_keys(db) get_server_keys_route(db)
} }
#[cfg_attr( #[cfg_attr(
@ -464,6 +478,9 @@ pub async fn send_transaction_message_route<'a>(
let mut pdu_id = room_id.as_bytes().to_vec(); let mut pdu_id = room_id.as_bytes().to_vec();
pdu_id.push(0xff); pdu_id.push(0xff);
pdu_id.extend_from_slice(&count.to_be_bytes()); pdu_id.extend_from_slice(&count.to_be_bytes());
db.rooms.append_to_state(&pdu_id, &pdu)?;
db.rooms.append_pdu( db.rooms.append_pdu(
&pdu, &pdu,
&value, &value,