From f85d40d8c6cc2f3b58d1e0ea7f0382db88fffd4e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 17 Jan 2023 22:28:35 +0100 Subject: refer to room name as secret instead --- server/src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'server/src') diff --git a/server/src/main.rs b/server/src/main.rs index d958d66..85f1854 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -44,11 +44,11 @@ async fn run() { let assets: _ = warp::path("assets").and(warp::fs::dir("../client-web/public/assets")); let sw_script: _ = warp::path("sw.js").and(warp::fs::file("../client-web/public/assets/sw.js")); let favicon: _ = warp::path!("favicon.ico").map(|| ""); - let old_format_redirect: _ = warp::path!("room" / String).map(|rname| { + let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( StatusCode::MOVED_PERMANENTLY, header::LOCATION, - format!("/room#{rname}?warn_redirect=true"), + format!("/room#{rsecret}?warn_redirect=true"), ) .into_response() }); @@ -106,20 +106,20 @@ async fn handle_rejection(err: Rejection) -> Result { Ok(warp::reply::with_status(json, code)) } -fn signaling_connect(rname: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { - async fn inner(sock: WebSocket, rname: String, rooms: Rooms) { +fn signaling_connect(rsecret: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { + async fn inner(sock: WebSocket, rsecret: String, rooms: Rooms) { debug!("ws upgrade"); let mut guard = rooms.write().await; let room = guard - .entry(rname.clone()) + .entry(rsecret.clone()) .or_insert_with(|| Default::default()) .to_owned(); drop(guard); room.client_connect(sock).await; if room.should_remove().await { - rooms.write().await.remove(&rname); + rooms.write().await.remove(&rsecret); } } - ws.on_upgrade(move |sock| inner(sock, rname, rooms)) + ws.on_upgrade(move |sock| inner(sock, rsecret, rooms)) } -- cgit v1.2.3-70-g09d2 From 9dfc929b709d4187dc307f68a42fa058eda7a4c1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 11 Feb 2023 10:29:02 +0100 Subject: standalone binary --- Cargo.lock | 250 ++++++++++++++++++++++++----------------- client-native-rift/src/main.rs | 1 - server/Cargo.toml | 7 +- server/src/assets.rs | 37 ++++++ server/src/main.rs | 9 +- 5 files changed, 195 insertions(+), 109 deletions(-) create mode 100644 server/src/assets.rs (limited to 'server/src') diff --git a/Cargo.lock b/Cargo.lock index 267b1b6..b3e1803 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5568a4aa5ba8adf5175c5c460b030e27d8893412976cc37bef0e4fbc16cfbba" +checksum = "fe21446ad43aa56417a767f3e2f3d7c4ca522904de1dd640529a76e9c5c3b33c" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -63,7 +63,7 @@ dependencies = [ "once_cell", "parking_lot", "paste", - "windows 0.42.0", + "windows", ] [[package]] @@ -212,9 +212,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", @@ -448,9 +448,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.61" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -605,18 +605,18 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4" +checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" dependencies = [ "proc-macro2", "quote", @@ -937,9 +937,9 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "crc" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ "crc-catalog", ] @@ -1112,12 +1112,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" dependencies = [ - "darling_core 0.14.2", - "darling_macro 0.14.2", + "darling_core 0.14.3", + "darling_macro 0.14.3", ] [[package]] @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ "fnv", "ident_case", @@ -1161,11 +1161,11 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" dependencies = [ - "darling_core 0.14.2", + "darling_core 0.14.3", "quote", "syn", ] @@ -1229,7 +1229,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" dependencies = [ - "darling 0.14.2", + "darling 0.14.3", "proc-macro2", "quote", "syn", @@ -1470,7 +1470,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" dependencies = [ - "darling 0.14.2", + "darling 0.14.3", "proc-macro2", "quote", "syn", @@ -1672,9 +1672,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", @@ -1703,9 +1703,9 @@ 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", @@ -1865,9 +1865,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", @@ -1889,42 +1889,42 @@ dependencies = [ [[package]] name = "glutin" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524d807cd49a0c56a53ef9a6738cd15e7c8c4e9d37a3b7fdb3c250c1cd5bf7a3" +checksum = "373e3fbcfa6b9c313faa03625a08268168ba9be1003d1ecfcebd5266388aa131" dependencies = [ "bitflags", "cfg_aliases", "cgl", - "cocoa", "core-foundation", + "dispatch", "glutin_egl_sys", "glutin_glx_sys", "glutin_wgl_sys", "libloading", - "objc", + "objc2", "once_cell", "raw-window-handle 0.5.0", "wayland-sys 0.30.1", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] [[package]] name = "glutin_egl_sys" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adbb8fec0e18e340f990c78f79f5f0e142d0d83f46b10909aaa7d251c00afdf" +checksum = "e5aaf0abb5c4148685b33101ae326a207946b4d3764d6cdc79f8316cdaa8367d" dependencies = [ "gl_generator", - "windows-sys 0.36.1", + "windows-sys 0.45.0", ] [[package]] name = "glutin_glx_sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947c4850c58211c9627969c2b4e2674764b81ae5b47bab2c9a477d7942f96e0f" +checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" dependencies = [ "gl_generator", "x11-dl", @@ -1932,9 +1932,9 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c33975a6c9d49d72c8f032a60079bf8df536954fbf9e4cee90396ace815c57" +checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" dependencies = [ "gl_generator", ] @@ -2002,9 +2002,9 @@ dependencies = [ [[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" @@ -2148,6 +2148,25 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "indexmap" version = "1.9.2" @@ -2266,9 +2285,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[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", ] @@ -2310,6 +2329,7 @@ dependencies = [ "env_logger", "futures-util", "hyper", + "include_dir", "listenfd", "log", "serde", @@ -2628,6 +2648,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -2670,18 +2699,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2794,9 +2823,9 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "owned_ttf_parser" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5f3c7ca08b6879e7965fb25e24d1f5eeb32ea73f9ad99b3854778a38c57e93" +checksum = "e25e9fb15717794fae58ab55c26e044103aad13186fbb625893f9a3bbcc24228" dependencies = [ "ttf-parser", ] @@ -3005,13 +3034,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -3401,9 +3429,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -3414,9 +3442,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc 0.2.139", @@ -3444,9 +3472,9 @@ 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", @@ -3547,9 +3575,9 @@ dependencies = [ [[package]] name = "sha256" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e334db67871c14c18fc066ad14af13f9fdf5f9a91c61af432d1e3a39c8c6a141" +checksum = "328169f167261957e83d82be47f9e36629e257c62308129033d7f7e7c173d180" dependencies = [ "hex", "sha2 0.9.9", @@ -3929,12 +3957,20 @@ dependencies = [ ] [[package]] -name = "toml" -version = "0.5.10" +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "serde", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] @@ -4248,9 +4284,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", @@ -4258,9 +4294,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", @@ -4273,9 +4309,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", @@ -4285,9 +4321,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", @@ -4295,9 +4331,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", @@ -4308,9 +4344,9 @@ 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 = "wayland-client" @@ -4399,9 +4435,9 @@ dependencies = [ [[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", @@ -4409,9 +4445,9 @@ dependencies = [ [[package]] name = "webbrowser" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74f5ff7786c4c21f61ba8e30ea29c9745f06fca0a4a02d083b3c662583399e8" +checksum = "97d1fa1e5c829b2bf9eb1e28fb950248b797cd6a04866fbdfa8bc31e5eef4c78" dependencies = [ "core-foundation", "dirs", @@ -4422,7 +4458,6 @@ dependencies = [ "raw-window-handle 0.5.0", "url", "web-sys", - "windows 0.43.0", ] [[package]] @@ -4721,21 +4756,6 @@ dependencies = [ "windows_x86_64_msvc 0.42.1", ] -[[package]] -name = "windows" -version = "0.43.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", -] - [[package]] name = "windows-implement" version = "0.42.0" @@ -4775,6 +4795,30 @@ dependencies = [ "windows_x86_64_msvc 0.42.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +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 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -4891,12 +4935,12 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.20.1" +version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" dependencies = [ - "lazy_static", "libc 0.2.139", + "once_cell", "pkg-config", ] diff --git a/client-native-rift/src/main.rs b/client-native-rift/src/main.rs index 201e91d..1f10b83 100644 --- a/client-native-rift/src/main.rs +++ b/client-native-rift/src/main.rs @@ -23,7 +23,6 @@ use std::{ atomic::{AtomicUsize, Ordering}, Arc, }, - time::Duration, }; use tokio::{ fs::{self, File}, diff --git a/server/Cargo.toml b/server/Cargo.toml index e2b0506..907b8c4 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -12,4 +12,9 @@ futures-util = "0.3.26" listenfd = "1.0.0" hyper = "0.14.24" serde = { version = "1.0.152", features = ["derive"] } -serde_json = "*" +serde_json = "1.0.93" +include_dir = "0.7.3" + +[features] +default = ["standalone"] +standalone = [] diff --git a/server/src/assets.rs b/server/src/assets.rs new file mode 100644 index 0000000..068bc0c --- /dev/null +++ b/server/src/assets.rs @@ -0,0 +1,37 @@ +#[cfg(not(feature = "standalone"))] +#[macro_export] +macro_rules! s_file { + ($path: literal) => { + warp::fs::file($path) + }; +} + +#[cfg(not(feature = "standalone"))] +#[macro_export] +macro_rules! s_asset_dir { + () => { + warp::fs::dir("client-web/public/assets") + }; +} + +#[cfg(feature = "standalone")] +#[macro_export] +macro_rules! s_file { + ($path: literal) => { + warp::get().map(|| include_str!(concat!("../../", $path))) + }; +} + +#[cfg(feature = "standalone")] +#[macro_export] +macro_rules! s_asset_dir { + () => {{ + use include_dir::{include_dir, Dir}; + const DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/../client-web/public/assets"); + warp::path::tail().and_then(|t: warp::path::Tail| async move { + DIR.get_file(t.as_str()) + .map(|f| f.contents_utf8().unwrap()) + .ok_or(warp::reject::not_found()) + }) + }}; +} diff --git a/server/src/main.rs b/server/src/main.rs index 413f23a..518ea99 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -3,6 +3,7 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2022 metamuffin */ +pub mod assets; pub mod protocol; pub mod room; @@ -41,10 +42,10 @@ async fn run() { .and(warp::ws()) .map(signaling_connect); - let index: _ = warp::path!().and(warp::fs::file("../client-web/public/start.html")); - let room: _ = warp::path!("room").and(warp::fs::file("../client-web/public/app.html")); - let assets: _ = warp::path("assets").and(warp::fs::dir("../client-web/public/assets")); - let sw_script: _ = warp::path("sw.js").and(warp::fs::file("../client-web/public/assets/sw.js")); + let index: _ = warp::path!().and(s_file!("client-web/public/start.html")); + let room: _ = warp::path!("room").and(s_file!("client-web/public/app.html")); + let assets: _ = warp::path("assets").and(s_asset_dir!()); + let sw_script: _ = warp::path("sw.js").and(s_file!("client-web/public/assets/sw.js")); let favicon: _ = warp::path!("favicon.ico").map(|| ""); let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( -- cgit v1.2.3-70-g09d2 From 389caf52b7a247301af71a61cc6a1259147efff3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 11 Feb 2023 10:47:25 +0100 Subject: fix standalone version (and avoid a compiler crash) --- Cargo.lock | 800 +++++++++++++++++++++---------------------- client-native-gui/Cargo.toml | 4 +- client-native-lib/Cargo.toml | 2 +- server/src/assets.rs | 23 +- server/src/main.rs | 6 +- 5 files changed, 420 insertions(+), 415 deletions(-) (limited to 'server/src') diff --git a/Cargo.lock b/Cargo.lock index b3e1803..036d078 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,19 +20,15 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3083ac5a97521e35388ca80cf365b6be5210962cc59f11ee238cd92ac2fa9524" -dependencies = [ - "enumset", - "kurbo", -] +checksum = "4803cf8c252f374ae6bfbb341e49e5a37f7601f2ce74a105927a663eba952c67" [[package]] name = "accesskit_consumer" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47393f706a2d2f9d1ebd109351f886afd256a09d2308861a6dec0853a625e2" +checksum = "cee8cf1202a4f94d31837f1902ab0a75c77b65bf59719e093703abe83efd74ec" dependencies = [ "accesskit", "parking_lot", @@ -40,9 +36,9 @@ dependencies = [ [[package]] name = "accesskit_macos" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabafb94d8a4dd6b20fe4112f943756ff8dc9778e3d742fb5478bf7f000a3282" +checksum = "10be25f2b27bc33aa1647072e86b948b41596f1af1ae43a2b4b9be5d2011cbda" dependencies = [ "accesskit", "accesskit_consumer", @@ -51,15 +47,31 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "accesskit_unix" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630e7ee8f93c6246478bf0df6760db899b28d9ad54353a5f2d3157138ba817fc" +dependencies = [ + "accesskit", + "accesskit_consumer", + "async-channel", + "atspi", + "futures-lite", + "parking_lot", + "serde", + "zbus", +] + [[package]] name = "accesskit_windows" -version = "0.10.4" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662496f45a2e2ddff05e28d0a9fc2b319cc4f886d3664e3469c3d30800598962" +checksum = "a13c462fabdd950ef14308a9390b07fa2e2e3aabccba1f3ea36ea2231bb942ab" dependencies = [ "accesskit", "accesskit_consumer", - "arrayvec 0.7.2", + "arrayvec", "once_cell", "parking_lot", "paste", @@ -68,12 +80,13 @@ dependencies = [ [[package]] name = "accesskit_winit" -version = "0.7.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f270416d033ab5b2a8fa72a976dfdad0db1ea194721f16cadbdb45ff219779f" +checksum = "17727888757ec027ec221db33070e226ee07df44425b583bc67684204d35eff9" dependencies = [ "accesskit", "accesskit_macos", + "accesskit_unix", "accesskit_windows", "parking_lot", "winit", @@ -230,6 +243,30 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-activity" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4165a1aef703232031b40a6e8908c2f9e314d495f11aa7f98db75d39a497cc6a" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni-sys", + "libc 0.2.139", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "anyhow" version = "1.0.69" @@ -266,12 +303,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -344,6 +375,17 @@ dependencies = [ "syn", ] +[[package]] +name = "async-broadcast" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b19760fa2b7301cf235360ffd6d3558b1ed4249edd16d6cca8d690cee265b95" +dependencies = [ + "event-listener", + "futures-core", + "parking_lot", +] + [[package]] name = "async-channel" version = "1.8.0" @@ -414,6 +456,17 @@ dependencies = [ "futures-lite", ] +[[package]] +name = "async-recursion" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-std" version = "1.12.0" @@ -469,6 +522,38 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "857253367827bd9d0fd973f0ef15506a96e79e41b0ad7aa691203a4e3214f6c8" +[[package]] +name = "atspi" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab84c09a770065868da0d713f1f4b35af85d96530a868f1c1a6c249178379187" +dependencies = [ + "async-recursion", + "async-trait", + "atspi-macros", + "enumflags2", + "futures-lite", + "serde", + "tracing", + "zbus", + "zbus_names", +] + +[[package]] +name = "atspi-macros" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ebc5a6f61f6996eca56a4cece7b3fe7da3b86f0473c7b71ab44e229f3acce4" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn", + "zbus", + "zbus_names", + "zvariant", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -653,6 +738,9 @@ name = "cc" version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +dependencies = [ + "jobserver", +] [[package]] name = "ccm" @@ -789,46 +877,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cmake" -version = "0.1.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" -dependencies = [ - "cc", -] - -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types 0.3.2", - "libc 0.2.139", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" -dependencies = [ - "bitflags", - "block", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc 0.2.139", - "objc", -] - [[package]] name = "combine" version = "4.6.6" @@ -892,7 +940,7 @@ dependencies = [ "bitflags", "core-foundation", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types", "libc 0.2.139", ] @@ -904,19 +952,7 @@ checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags", "core-foundation", - "foreign-types 0.3.2", - "libc 0.2.139", -] - -[[package]] -name = "core-text" -version = "19.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" -dependencies = [ - "core-foundation", - "core-graphics", - "foreign-types 0.3.2", + "foreign-types", "libc 0.2.139", ] @@ -978,29 +1014,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossfont" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45" -dependencies = [ - "cocoa", - "core-foundation", - "core-foundation-sys", - "core-graphics", - "core-text", - "dwrote", - "foreign-types 0.5.0", - "freetype-rs", - "libc 0.2.139", - "log", - "objc", - "once_cell", - "pkg-config", - "servo-fontconfig", - "winapi", -] - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -1100,38 +1113,14 @@ dependencies = [ "zeroize", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - [[package]] name = "darling" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" dependencies = [ - "darling_core 0.14.3", - "darling_macro 0.14.3", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", + "darling_core", + "darling_macro", ] [[package]] @@ -1148,24 +1137,13 @@ dependencies = [ "syn", ] -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core 0.13.4", - "quote", - "syn", -] - [[package]] name = "darling_macro" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" dependencies = [ - "darling_core 0.14.3", + "darling_core", "quote", "syn", ] @@ -1214,6 +1192,17 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "derive_builder" version = "0.11.2" @@ -1229,7 +1218,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" dependencies = [ - "darling 0.14.3", + "darling", "proc-macro2", "quote", "syn", @@ -1317,20 +1306,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" -[[package]] -name = "dwrote" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" -dependencies = [ - "lazy_static", - "libc 0.2.139", - "serde", - "serde_derive", - "winapi", - "wio", -] - [[package]] name = "ecdsa" version = "0.14.8" @@ -1345,18 +1320,18 @@ dependencies = [ [[package]] name = "ecolor" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691" +checksum = "1f99fe3cac305af9d6d92971af60d0f7ea4d783201ef1673571567b6699964d9" dependencies = [ "bytemuck", ] [[package]] name = "eframe" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea929ec5819fef373728bb0e55003ce921975039cfec3ca8305bb024e5b7b32" +checksum = "d07e59d9d5ba69e1d261c76e6aa88a95601375805ee473de5eb3163bf5a57704" dependencies = [ "bytemuck", "egui", @@ -1364,9 +1339,11 @@ dependencies = [ "egui_glow", "glow", "glutin", + "glutin-winit", "js-sys", "percent-encoding", - "raw-window-handle 0.5.0", + "raw-window-handle", + "thiserror", "tracing", "wasm-bindgen", "wasm-bindgen-futures", @@ -1376,9 +1353,9 @@ dependencies = [ [[package]] name = "egui" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65a5e883a316e53866977450eecfbcac9c48109c2ab3394af29feb83fcde4ea9" +checksum = "6412a21e0bde7c0918f7fb44bbbb86b5e1f88e63c026a4e747cc7af02f76dfbe" dependencies = [ "accesskit", "ahash", @@ -1389,11 +1366,12 @@ dependencies = [ [[package]] name = "egui-winit" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5696bdbe60898b81157f07ae34fe02dbfd522174bd6e620942c269cd7307901f" +checksum = "c13deffe034ab864042f00d0d1fa220b86bb9a230a7362b81844bb8d1dc6b899" dependencies = [ "accesskit_winit", + "android-activity", "arboard", "egui", "instant", @@ -1405,9 +1383,9 @@ dependencies = [ [[package]] name = "egui_glow" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4b5960cb1bae1c403a6c9027a745210a41913433b10c73b6e7d76a1017f8b4" +checksum = "8257332fb168a965b3dca81d6a344e053153773c889cabdba0b3b76f1629ae81" dependencies = [ "bytemuck", "egui", @@ -1442,9 +1420,9 @@ dependencies = [ [[package]] name = "emath" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0" +checksum = "b8ecd80612937e0267909d5351770fe150004e24dab93954f69ca62eecd3f77e" dependencies = [ "bytemuck", ] @@ -1456,21 +1434,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "enumset" -version = "1.0.12" +name = "enumflags2" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" dependencies = [ - "enumset_derive", + "enumflags2_derive", + "serde", ] [[package]] -name = "enumset_derive" -version = "0.6.1" +name = "enumflags2_derive" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" +checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" dependencies = [ - "darling 0.14.3", "proc-macro2", "quote", "syn", @@ -1491,9 +1469,9 @@ dependencies = [ [[package]] name = "epaint" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de14b65fe5e423e0058f77a8beb2c863b056d0566d6c4ce0d097aa5814cb705a" +checksum = "12e78b5c58a1f7f621f9d546add2adce20636422c9b251e29f749e8a2f713c95" dependencies = [ "ab_glyph", "ahash", @@ -1542,16 +1520,6 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "expat-sys" -version = "2.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" -dependencies = [ - "cmake", - "pkg-config", -] - [[package]] name = "fastpbkdf2" version = "0.1.0" @@ -1603,28 +1571,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "foreign-types-shared", ] [[package]] @@ -1633,12 +1580,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" version = "1.1.0" @@ -1648,28 +1589,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "freetype-rs" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" -dependencies = [ - "bitflags", - "freetype-sys", - "libc 0.2.139", -] - -[[package]] -name = "freetype-sys" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" -dependencies = [ - "cmake", - "libc 0.2.139", - "pkg-config", -] - [[package]] name = "futures" version = "0.3.26" @@ -1877,9 +1796,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "8edf6019dff2d92ad27c1e3ff82ad50a0aea5b01370353cc928bfdc33e95925c" dependencies = [ "js-sys", "slotmap", @@ -1904,12 +1823,24 @@ dependencies = [ "libloading", "objc2", "once_cell", - "raw-window-handle 0.5.0", + "raw-window-handle", "wayland-sys 0.30.1", "windows-sys 0.45.0", "x11-dl", ] +[[package]] +name = "glutin-winit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + [[package]] name = "glutin_egl_sys" version = "0.4.0" @@ -2283,6 +2214,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc 0.2.139", +] + [[package]] name = "js-sys" version = "0.3.61" @@ -2344,15 +2284,6 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" -[[package]] -name = "kurbo" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449" -dependencies = [ - "arrayvec 0.7.2", -] - [[package]] name = "kv-log-macro" version = "1.0.7" @@ -2559,7 +2490,7 @@ dependencies = [ "jni-sys", "ndk-sys", "num_enum", - "raw-window-handle 0.5.0", + "raw-window-handle", "thiserror", ] @@ -2569,35 +2500,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "libc 0.2.139", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", - "once_cell", - "parking_lot", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling 0.13.4", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "ndk-sys" version = "0.4.1+23.1.7779620" @@ -2630,6 +2532,7 @@ dependencies = [ "cfg-if", "libc 0.2.139", "memoffset", + "pin-utils", ] [[package]] @@ -2815,6 +2718,28 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "orbclient" +version = "0.3.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba683f1641c11041c59d5d93689187abcab3c1349dc6d9d70c550c9f9360802f" +dependencies = [ + "cfg-if", + "redox_syscall 0.2.16", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "ordered-stream" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360a24bdacdb7801a1a6af8500392864791c130ebe8bd9a063158cab00040c90" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "os_str_bytes" version = "6.4.1" @@ -2876,7 +2801,7 @@ checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if", "libc 0.2.139", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.42.0", ] @@ -3129,15 +3054,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - [[package]] name = "raw-window-handle" version = "0.5.0" @@ -3169,6 +3085,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb02a9aee8e8c7ad8d86890f1e16b49e0bbbffc9961ff3788c31d57c98bcbf03" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -3176,7 +3101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.8", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] @@ -3334,15 +3259,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" -[[package]] -name = "safe_arch" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" -dependencies = [ - "bytemuck", -] - [[package]] name = "safemem" version = "0.3.3" @@ -3391,12 +3307,13 @@ dependencies = [ [[package]] name = "sctk-adwaita" -version = "0.4.3" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" +checksum = "cc56402866c717f54e48b122eb93c69f709bc5a6359c403598992fd92f017931" dependencies = [ - "crossfont", + "ab_glyph", "log", + "memmap2", "smithay-client-toolkit", "tiny-skia", ] @@ -3459,6 +3376,18 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-xml-rs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0bf1ba0696ccf0872866277143ff1fd14d22eec235d2b23702f95e6660f7dfa" +dependencies = [ + "log", + "serde", + "thiserror", + "xml-rs", +] + [[package]] name = "serde_derive" version = "1.0.152" @@ -3481,6 +3410,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3493,27 +3433,6 @@ dependencies = [ "serde", ] -[[package]] -name = "servo-fontconfig" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" -dependencies = [ - "libc 0.2.139", - "servo-fontconfig-sys", -] - -[[package]] -name = "servo-fontconfig-sys" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" -dependencies = [ - "expat-sys", - "freetype-sys", - "pkg-config", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -3681,12 +3600,24 @@ dependencies = [ "der", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "str-buf" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" +[[package]] +name = "strict-num" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df65f20698aeed245efdde3628a6b559ea1239bbb871af1b6e3b58c413b2bd1" + [[package]] name = "strsim" version = "0.10.0" @@ -3759,7 +3690,7 @@ dependencies = [ "cfg-if", "fastrand", "libc 0.2.139", - "redox_syscall", + "redox_syscall 0.2.16", "remove_dir_all", "winapi", ] @@ -3822,27 +3753,27 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" +checksum = "bfef3412c6975196fdfac41ef232f910be2bb37b9dd3313a49a1a6bc815a5bdb" dependencies = [ "arrayref", - "arrayvec 0.5.2", + "arrayvec", "bytemuck", "cfg-if", "png", - "safe_arch", "tiny-skia-path", ] [[package]] name = "tiny-skia-path" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" +checksum = "a4b5edac058fc98f51c935daea4d805b695b38e2f151241cad125ade2a2ac20d" dependencies = [ "arrayref", "bytemuck", + "strict-num", ] [[package]] @@ -3988,9 +3919,21 @@ dependencies = [ "cfg-if", "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.30" @@ -4087,6 +4030,16 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uds_windows" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +dependencies = [ + "tempfile", + "winapi", +] + [[package]] name = "unicase" version = "2.6.0" @@ -4455,7 +4408,7 @@ dependencies = [ "log", "ndk-context", "objc", - "raw-window-handle 0.5.0", + "raw-window-handle", "url", "web-sys", ] @@ -4748,12 +4701,12 @@ checksum = "0286ba339aa753e70765d521bb0242cc48e1194562bfa2a2ad7ac8a6de28f5d5" dependencies = [ "windows-implement", "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -4767,19 +4720,6 @@ dependencies = [ "syn", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -4787,12 +4727,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -4811,12 +4751,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -4825,48 +4765,24 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -4879,12 +4795,6 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.42.1" @@ -4893,12 +4803,13 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winit" -version = "0.27.5" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +checksum = "0c4755d4ba0e3d30fc7beef2095e246b1e6a6fad0717608bcb87a2df4b003bcf" dependencies = [ + "android-activity", "bitflags", - "cocoa", + "cfg_aliases", "core-foundation", "core-graphics", "dispatch", @@ -4907,32 +4818,24 @@ dependencies = [ "log", "mio", "ndk", - "ndk-glue", - "objc", + "objc2", "once_cell", - "parking_lot", + "orbclient", "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.0", + "raw-window-handle", + "redox_syscall 0.3.4", "sctk-adwaita", "smithay-client-toolkit", "wasm-bindgen", "wayland-client", + "wayland-commons", "wayland-protocols", + "wayland-scanner", "web-sys", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] -[[package]] -name = "wio" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" -dependencies = [ - "winapi", -] - [[package]] name = "x11-dl" version = "2.21.0" @@ -5020,6 +4923,69 @@ dependencies = [ "time", ] +[[package]] +name = "zbus" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f1a9e02a5659c712de386c2af5156c51a530fac0668d3ff85fa26a2bc006ba" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-recursion", + "async-task", + "async-trait", + "byteorder", + "derivative", + "dirs", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.25.1", + "once_cell", + "ordered-stream", + "rand", + "serde", + "serde-xml-rs", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414cd9f07964695e00bfef8e589d1752ea0480b8a619f2064cbaccb8a6c2ed59" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "zbus_names" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f34f314916bd89bdb9934154627fab152f4f28acdda03e7c4c68181b214fe7e3" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + [[package]] name = "zeroize" version = "1.5.7" @@ -5040,3 +5006,29 @@ dependencies = [ "syn", "synstructure", ] + +[[package]] +name = "zvariant" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576cc41e65c7f283e5460f5818073e68fb1f1631502b969ef228c2e03c862efb" +dependencies = [ + "byteorder", + "enumflags2", + "libc 0.2.139", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fd4aafc0dee96ae7242a24249ce9babf21e1562822f03df650d4e68c20e41ed" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] diff --git a/client-native-gui/Cargo.toml b/client-native-gui/Cargo.toml index 767433c..6d76e15 100644 --- a/client-native-gui/Cargo.toml +++ b/client-native-gui/Cargo.toml @@ -14,8 +14,8 @@ log = "0.4" anyhow = "1.0.69" crossbeam-channel = "0.5.6" -egui = "0.20.1" -eframe = "0.20.1" +egui = "0.21.0" +eframe = "0.21.0" libmpv = { git = "https://github.com/sirno/libmpv-rs.git", branch = "upgrade-libmpv" } diff --git a/client-native-lib/Cargo.toml b/client-native-lib/Cargo.toml index c9b0ea4..c7c36d5 100644 --- a/client-native-lib/Cargo.toml +++ b/client-native-lib/Cargo.toml @@ -18,7 +18,7 @@ log = "0.4" fastpbkdf2 = "0.1.0" aes-gcm = "0.10.1" -sha256 = "1.1.1" +sha256 = "1.1.2" rand = "0.8.5" rand_chacha = "0.3.1" base64 = "0.21.0" diff --git a/server/src/assets.rs b/server/src/assets.rs index 068bc0c..bdd7ef9 100644 --- a/server/src/assets.rs +++ b/server/src/assets.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "standalone"))] #[macro_export] macro_rules! s_file { - ($path: literal) => { + ($path: literal, $content_type: literal) => { warp::fs::file($path) }; } @@ -17,8 +17,14 @@ macro_rules! s_asset_dir { #[cfg(feature = "standalone")] #[macro_export] macro_rules! s_file { - ($path: literal) => { - warp::get().map(|| include_str!(concat!("../../", $path))) + ($path: literal, $content_type: literal) => { + warp::any().map(|| { + warp::reply::with_header( + include_str!(concat!("../../", $path)), + "content-type", + $content_type, + ) + }) }; } @@ -29,8 +35,15 @@ macro_rules! s_asset_dir { use include_dir::{include_dir, Dir}; const DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/../client-web/public/assets"); warp::path::tail().and_then(|t: warp::path::Tail| async move { - DIR.get_file(t.as_str()) - .map(|f| f.contents_utf8().unwrap()) + let path = t.as_str(); + let content_type = match &path { + _ if path.ends_with(".wasm") => "application/wasm", + _ if path.ends_with(".js") => "application/javascript", + _ if path.ends_with(".css") => "text/css", + _ => "application/octet-stream", + }; + DIR.get_file(path) + .map(|f| warp::reply::with_header(f.contents(), "content-type", content_type)) .ok_or(warp::reject::not_found()) }) }}; diff --git a/server/src/main.rs b/server/src/main.rs index 518ea99..c818eb5 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -42,10 +42,10 @@ async fn run() { .and(warp::ws()) .map(signaling_connect); - let index: _ = warp::path!().and(s_file!("client-web/public/start.html")); - let room: _ = warp::path!("room").and(s_file!("client-web/public/app.html")); + let index: _ = warp::path!().and(s_file!("client-web/public/start.html", "text/html")); + let room: _ = warp::path!("room").and(s_file!("client-web/public/app.html", "text/html")); let assets: _ = warp::path("assets").and(s_asset_dir!()); - let sw_script: _ = warp::path("sw.js").and(s_file!("client-web/public/assets/sw.js")); + let sw_script: _ = warp::path("sw.js").and(s_file!("client-web/public/assets/sw.js", "application/javascript")); let favicon: _ = warp::path!("favicon.ico").map(|| ""); let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( -- cgit v1.2.3-70-g09d2 From 006c683f41fa9a6b7ce0032e3fb25b0b494222e3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 11 Feb 2023 12:05:30 +0100 Subject: set svg content type --- server/src/assets.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'server/src') diff --git a/server/src/assets.rs b/server/src/assets.rs index bdd7ef9..320a4e4 100644 --- a/server/src/assets.rs +++ b/server/src/assets.rs @@ -40,6 +40,7 @@ macro_rules! s_asset_dir { _ if path.ends_with(".wasm") => "application/wasm", _ if path.ends_with(".js") => "application/javascript", _ if path.ends_with(".css") => "text/css", + _ if path.ends_with(".svg") => "image/svg+xml", _ => "application/octet-stream", }; DIR.get_file(path) -- cgit v1.2.3-70-g09d2 From 70e1090e7c5e5aa6ed0a621ad71924b7931ef05d Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 16 Feb 2023 15:11:11 +0100 Subject: add description --- client-web/public/app.html | 1 + client-web/public/start.html | 3 ++- server/src/main.rs | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'server/src') diff --git a/client-web/public/app.html b/client-web/public/app.html index 665a7d2..d121be2 100644 --- a/client-web/public/app.html +++ b/client-web/public/app.html @@ -3,6 +3,7 @@ + keks-meet diff --git a/client-web/public/start.html b/client-web/public/start.html index 27b45f5..7a1885c 100644 --- a/client-web/public/start.html +++ b/client-web/public/start.html @@ -3,13 +3,14 @@ + keks-meet

keks-meet

-

A web conferencing application using webrtc

+

A simple secure conferencing application using webrtc


keks-meet is free software! It is licenced under the terms of diff --git a/server/src/main.rs b/server/src/main.rs index c818eb5..61c9ad1 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -42,10 +42,15 @@ async fn run() { .and(warp::ws()) .map(signaling_connect); + // TODO add cache policy headers + let index: _ = warp::path!().and(s_file!("client-web/public/start.html", "text/html")); let room: _ = warp::path!("room").and(s_file!("client-web/public/app.html", "text/html")); let assets: _ = warp::path("assets").and(s_asset_dir!()); - let sw_script: _ = warp::path("sw.js").and(s_file!("client-web/public/assets/sw.js", "application/javascript")); + let sw_script: _ = warp::path("sw.js").and(s_file!( + "client-web/public/assets/sw.js", + "application/javascript" + )); let favicon: _ = warp::path!("favicon.ico").map(|| ""); let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( -- cgit v1.2.3-70-g09d2 From 630cd2b82887da49cacb2deb032c6a51b3c2faf7 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 21 Feb 2023 15:12:38 +0100 Subject: server-side client configuration --- .gitignore | 2 ++ Cargo.lock | 48 +++++++++++++++++++++++++++++++++-- client-web/source/index.ts | 38 +++++++++++++++++---------- client-web/source/preferences/decl.ts | 6 +++++ client-web/source/preferences/mod.ts | 1 + client-web/source/room.ts | 2 +- client-web/source/user/remote.ts | 4 +-- server/Cargo.toml | 3 ++- server/src/assets.rs | 4 +-- server/src/config.rs | 20 +++++++++++++++ server/src/main.rs | 14 ++++++++++ 11 files changed, 120 insertions(+), 22 deletions(-) create mode 100644 server/src/config.rs (limited to 'server/src') diff --git a/.gitignore b/.gitignore index ea8c4bf..a37f649 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +/config/client.toml + diff --git a/Cargo.lock b/Cargo.lock index 036d078..5f13e86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2275,6 +2275,7 @@ dependencies = [ "serde", "serde_json", "tokio", + "toml", "warp", ] @@ -2964,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.18.1", ] [[package]] @@ -3421,6 +3422,15 @@ dependencies = [ "syn", ] +[[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" @@ -3887,12 +3897,33 @@ dependencies = [ "tracing", ] +[[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 0.6.1", + "toml_edit 0.19.3", +] + [[package]] name = "toml_datetime" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +[[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.18.1" @@ -3901,7 +3932,20 @@ checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ "indexmap", "nom8", - "toml_datetime", + "toml_datetime 0.5.1", +] + +[[package]] +name = "toml_edit" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6a7712b49e1775fb9a7b998de6635b299237f48b404dde71704f2e0e7f37e5" +dependencies = [ + "indexmap", + "nom8", + "serde", + "serde_spanned", + "toml_datetime 0.6.1", ] [[package]] diff --git a/client-web/source/index.ts b/client-web/source/index.ts index 4772f94..4590625 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -17,18 +17,14 @@ import { Room } from "./room.ts" export const VERSION = "0.1.12" export const ROOM_CONTAINER = esection({ class: "room", aria_label: "user list" }) -export const RTC_CONFIG: RTCConfiguration = { - iceServers: [ - { - urls: [ - "turn:meet.metamuffin.org:16900", - "stun:meet.metamuffin.org:16900" - ], - username: "keksmeet", - credential: "ujCmetg6bm0" - }, - ], - iceCandidatePoolSize: 10, +export interface ClientConfig { + appearance: { accent: string } + webrtc: { + stun: string, + turn?: string, + turn_user?: string, + turn_cred?: string + } } export interface User { @@ -51,7 +47,12 @@ window.onbeforeunload = ev => { let r: Room; export async function main() { document.body.append(LOGGER_CONTAINER) - log("*", "starting up") + log("*", "loading client config") + const config_res = await fetch("/config.json") + if (!config_res.ok) return log({ scope: "*", error: true }, "cannot load config") + const config: ClientConfig = await config_res.json() + log("*", "config loaded. starting") + document.body.querySelectorAll("p").forEach(e => e.remove()) const room_secret = load_params().rsecret @@ -64,7 +65,16 @@ export async function main() { if (PREFS.warn_redirect) log({ scope: "crypto", warn: true }, "You were redirected from the old URL format. The server knows the room secret now - e2ee is insecure!") const conn = await (new SignalingConnection().connect(room_secret)) - r = new Room(conn) + const rtc_config: RTCConfiguration = { + iceCandidatePoolSize: 10, + iceServers: [{ + urls: [config.webrtc.stun, ...(config.webrtc.turn ? [config.webrtc.turn] : [])], + credential: config.webrtc.turn_cred, + username: config.webrtc.turn_user, + }] + } + + r = new Room(conn, rtc_config) setup_keybinds(r) r.on_ready = () => { diff --git a/client-web/source/preferences/decl.ts b/client-web/source/preferences/decl.ts index f3f8e84..68cb9ee 100644 --- a/client-web/source/preferences/decl.ts +++ b/client-web/source/preferences/decl.ts @@ -18,7 +18,13 @@ export const PREF_DECLS = { username: { type: string, default: "guest-" + hex_id(), description: "Username", allow_url: true }, warn_redirect: { type: bool, hidden: true, default: false, description: "Internal option that is set by a server redirect.", allow_url: true }, image_view_popup: { type: bool, default: true, description: "Open image in popup instead of new tab" }, + + // TODO! + /* WEBRTC */ webrtc_debug: { type: bool, default: false, description: "Show additional information for WebRTC related stuff" }, + webrtc_stun: { type: string, default: "stun:meet.metamuffin.org:16900", description: "Custom STUN server (all participants must use the same server)" }, + webrtc_turn: { type: optional(string), default: "turn:meet.metamuffin.org:16900", description: "Custom TURN server (all participants must use the same server)" }, + webrtc_turn_cred: { type: optional(string), description: "TURN server credentials" }, /* MEDIA */ microphone_enabled: { type: bool, default: false, description: "Add one microphone track on startup" }, diff --git a/client-web/source/preferences/mod.ts b/client-web/source/preferences/mod.ts index 04fae2c..8aefb0f 100644 --- a/client-web/source/preferences/mod.ts +++ b/client-web/source/preferences/mod.ts @@ -15,6 +15,7 @@ export interface PrefDecl { optional?: boolean, hidden?: boolean allow_url?: boolean + require_reload?: boolean, } type Type = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"; diff --git a/client-web/source/room.ts b/client-web/source/room.ts index a685f1d..27d2327 100644 --- a/client-web/source/room.ts +++ b/client-web/source/room.ts @@ -20,7 +20,7 @@ export class Room { public on_ready = () => { }; - constructor(public signaling: SignalingConnection) { + constructor(public signaling: SignalingConnection, public rtc_config: RTCConfiguration) { this.signaling.control_handler = (a) => this.control_handler(a) this.signaling.relay_handler = (a, b) => this.relay_handler(a, b) } diff --git a/client-web/source/user/remote.ts b/client-web/source/user/remote.ts index bd89e0e..5e81cf7 100644 --- a/client-web/source/user/remote.ts +++ b/client-web/source/user/remote.ts @@ -7,7 +7,7 @@ import { RelayMessage } from "../../../common/packets.d.ts"; import { notify } from "../helper.ts"; -import { ROOM_CONTAINER, RTC_CONFIG } from "../index.ts" +import { ROOM_CONTAINER } from "../index.ts" import { log } from "../logger.ts" import { PREFS } from "../preferences/mod.ts"; import { new_remote_resource, RemoteResource } from "../resource/mod.ts"; @@ -28,7 +28,7 @@ export class RemoteUser extends User { room.remote_users.set(id, this) log("usermodel", `added remote user: ${this.display_name}`) - this.pc = new RTCPeerConnection(RTC_CONFIG) + this.pc = new RTCPeerConnection(room.rtc_config) this.pc.onicecandidate = ev => { if (!ev.candidate) return room.signaling.send_relay({ ice_candidate: ev.candidate.toJSON() }, this.id) diff --git a/server/Cargo.toml b/server/Cargo.toml index 4a61294..22413a2 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -warp = "0.3" +warp = "0.3.3" tokio = { version = "1.25", features = ["full"] } log = "0.4" env_logger = "0.10" @@ -14,6 +14,7 @@ hyper = "0.14.24" serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.93" include_dir = "0.7.3" +toml = "0.7.2" [features] default = [] diff --git a/server/src/assets.rs b/server/src/assets.rs index 320a4e4..51b0025 100644 --- a/server/src/assets.rs +++ b/server/src/assets.rs @@ -2,7 +2,7 @@ #[macro_export] macro_rules! s_file { ($path: literal, $content_type: literal) => { - warp::fs::file($path) + warp::fs::file(concat!("../", $path)) }; } @@ -10,7 +10,7 @@ macro_rules! s_file { #[macro_export] macro_rules! s_asset_dir { () => { - warp::fs::dir("client-web/public/assets") + warp::fs::dir("../client-web/public/assets") }; } diff --git a/server/src/config.rs b/server/src/config.rs new file mode 100644 index 0000000..9d6213c --- /dev/null +++ b/server/src/config.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientConfig { + webrtc: ClientWebrtcConfig, + appearance: ClientAppearanceConfig, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientWebrtcConfig { + stun: String, + turn: Option, + turn_user: Option, + turn_cred: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientAppearanceConfig { + accent: Option, +} diff --git a/server/src/main.rs b/server/src/main.rs index 61c9ad1..8a0e342 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -4,9 +4,11 @@ Copyright (C) 2022 metamuffin */ pub mod assets; +pub mod config; pub mod protocol; pub mod room; +use config::ClientConfig; use hyper::{header, StatusCode}; use listenfd::ListenFd; use log::{debug, error}; @@ -34,6 +36,10 @@ fn main() { async fn run() { env_logger::init_from_env("LOG"); + let client_config: ClientConfig = toml::from_str(include_str!("../../config/client.toml")) + .expect("client configuration invalid"); + let client_config_json = serde_json::to_string(&client_config).unwrap(); + let rooms: _ = Rooms::default(); let rooms: _ = warp::any().map(move || rooms.clone()); @@ -51,6 +57,13 @@ async fn run() { "client-web/public/assets/sw.js", "application/javascript" )); + let client_config: _ = warp::path!("config.json").map(move || { + warp::reply::with_header( + client_config_json.clone(), + "content-type", + "application/json", + ) + }); let favicon: _ = warp::path!("favicon.ico").map(|| ""); let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( @@ -65,6 +78,7 @@ async fn run() { .or(room) .or(index) .or(signaling) + .or(client_config) .or(favicon) .or(sw_script) .or(old_format_redirect) -- cgit v1.2.3-70-g09d2 From e31c48f5a9cfe6fd8988b83b17e00538fa69d6d3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 21 Feb 2023 15:52:06 +0100 Subject: server-side appearance config --- client-web/source/index.ts | 16 +++++++++++++++- client-web/source/preferences/decl.ts | 6 ------ client-web/source/protocol/mod.ts | 1 - config/client.example.toml | 16 ++++++++++++++++ server/src/config.rs | 8 ++++++-- 5 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 config/client.example.toml (limited to 'server/src') diff --git a/client-web/source/index.ts b/client-web/source/index.ts index 4590625..83f1dfc 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -18,7 +18,13 @@ export const VERSION = "0.1.12" export const ROOM_CONTAINER = esection({ class: "room", aria_label: "user list" }) export interface ClientConfig { - appearance: { accent: string } + appearance?: { + accent: string + accent_dark: string + accent_light: string + background: string + background_dark: string + } webrtc: { stun: string, turn?: string, @@ -73,6 +79,14 @@ export async function main() { username: config.webrtc.turn_user, }] } + if (config.appearance) { + document.body.style.setProperty("--ac", config.appearance.accent) + document.body.style.setProperty("--ac-dark", config.appearance.accent_dark) + document.body.style.setProperty("--ac-light", config.appearance.accent_light) + document.body.style.setProperty("--bg", config.appearance.background) + document.body.style.setProperty("--bg-dark", config.appearance.background_dark) + + } r = new Room(conn, rtc_config) diff --git a/client-web/source/preferences/decl.ts b/client-web/source/preferences/decl.ts index 68cb9ee..f3f8e84 100644 --- a/client-web/source/preferences/decl.ts +++ b/client-web/source/preferences/decl.ts @@ -18,13 +18,7 @@ export const PREF_DECLS = { username: { type: string, default: "guest-" + hex_id(), description: "Username", allow_url: true }, warn_redirect: { type: bool, hidden: true, default: false, description: "Internal option that is set by a server redirect.", allow_url: true }, image_view_popup: { type: bool, default: true, description: "Open image in popup instead of new tab" }, - - // TODO! - /* WEBRTC */ webrtc_debug: { type: bool, default: false, description: "Show additional information for WebRTC related stuff" }, - webrtc_stun: { type: string, default: "stun:meet.metamuffin.org:16900", description: "Custom STUN server (all participants must use the same server)" }, - webrtc_turn: { type: optional(string), default: "turn:meet.metamuffin.org:16900", description: "Custom TURN server (all participants must use the same server)" }, - webrtc_turn_cred: { type: optional(string), description: "TURN server credentials" }, /* MEDIA */ microphone_enabled: { type: bool, default: false, description: "Add one microphone track on startup" }, diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts index 3674c08..6d49a17 100644 --- a/client-web/source/protocol/mod.ts +++ b/client-web/source/protocol/mod.ts @@ -33,7 +33,6 @@ export class SignalingConnection { this.on_open() r() }) - log("ws", "connection opened") return this } diff --git a/config/client.example.toml b/config/client.example.toml new file mode 100644 index 0000000..39e942a --- /dev/null +++ b/config/client.example.toml @@ -0,0 +1,16 @@ + +[appearance] +accent = "#5e3f84" +accent_dark = "#2d0d52" +accent_light = "#7c43bd" +background = "#151315" +background_dark = "#070707" + +# If you decide to host your own TURN server, adjust this. +[webrtc] +stun = "stun:meet.metamuffin.org:16900" +# turn = "turn:meet.metamuffin.org:16900" +## Set the default turn credentials. +## If not provided, TURN is disabled by default and requires manual activation via password (TODO). +# turn_user = "keksmeet" +# turn_cred = "thatsmypassword" diff --git a/server/src/config.rs b/server/src/config.rs index 9d6213c..6dd380f 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientConfig { webrtc: ClientWebrtcConfig, - appearance: ClientAppearanceConfig, + appearance: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -16,5 +16,9 @@ pub struct ClientWebrtcConfig { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientAppearanceConfig { - accent: Option, + accent: String, + accent_light: String, + accent_dark: String, + background: String, + background_dark: String, } -- cgit v1.2.3-70-g09d2 From 0cc79a94471d4b12caad8e29dfbedba0149aae02 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 27 Feb 2023 18:19:50 +0100 Subject: properly apply configured theme everywheere --- client-web/source/index.ts | 8 -------- server/src/config.rs | 22 +++++++++++----------- server/src/main.rs | 29 ++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 20 deletions(-) (limited to 'server/src') diff --git a/client-web/source/index.ts b/client-web/source/index.ts index 83f1dfc..c92ca2b 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -79,14 +79,6 @@ export async function main() { username: config.webrtc.turn_user, }] } - if (config.appearance) { - document.body.style.setProperty("--ac", config.appearance.accent) - document.body.style.setProperty("--ac-dark", config.appearance.accent_dark) - document.body.style.setProperty("--ac-light", config.appearance.accent_light) - document.body.style.setProperty("--bg", config.appearance.background) - document.body.style.setProperty("--bg-dark", config.appearance.background_dark) - - } r = new Room(conn, rtc_config) diff --git a/server/src/config.rs b/server/src/config.rs index 6dd380f..870315e 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -2,23 +2,23 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientConfig { - webrtc: ClientWebrtcConfig, - appearance: Option, + pub webrtc: ClientWebrtcConfig, + pub appearance: ClientAppearanceConfig, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientWebrtcConfig { - stun: String, - turn: Option, - turn_user: Option, - turn_cred: Option, + pub stun: String, + pub turn: Option, + pub turn_user: Option, + pub turn_cred: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientAppearanceConfig { - accent: String, - accent_light: String, - accent_dark: String, - background: String, - background_dark: String, + pub accent: String, + pub accent_light: String, + pub accent_dark: String, + pub background: String, + pub background_dark: String, } diff --git a/server/src/main.rs b/server/src/main.rs index 8a0e342..78f236a 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -8,7 +8,7 @@ pub mod config; pub mod protocol; pub mod room; -use config::ClientConfig; +use config::{ClientAppearanceConfig, ClientConfig}; use hyper::{header, StatusCode}; use listenfd::ListenFd; use log::{debug, error}; @@ -39,6 +39,7 @@ async fn run() { let client_config: ClientConfig = toml::from_str(include_str!("../../config/client.toml")) .expect("client configuration invalid"); let client_config_json = serde_json::to_string(&client_config).unwrap(); + let client_config_css = css_overrides(&client_config.appearance); let rooms: _ = Rooms::default(); let rooms: _ = warp::any().map(move || rooms.clone()); @@ -64,6 +65,9 @@ async fn run() { "application/json", ) }); + let client_config_css: _ = warp::path!("overrides.css").map(move || { + warp::reply::with_header(client_config_css.clone(), "content-type", "text/css") + }); let favicon: _ = warp::path!("favicon.ico").map(|| ""); let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( @@ -82,6 +86,7 @@ async fn run() { .or(favicon) .or(sw_script) .or(old_format_redirect) + .or(client_config_css) .recover(handle_rejection) .with(warp::log("stuff")); @@ -140,3 +145,25 @@ fn signaling_connect(rsecret: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Re } ws.on_upgrade(move |sock| inner(sock, rsecret, rooms)) } + +fn css_overrides( + ClientAppearanceConfig { + accent, + accent_light, + accent_dark, + background, + background_dark, + }: &ClientAppearanceConfig, +) -> String { + format!( + r#":root {{ + --bg: {background}; + --bg-dark: {background_dark}; + --ac: {accent}; + --ac-dark: {accent_dark}; + --ac-dark-transparent: {accent_dark}c9; + --ac-light: {accent_light}; +}} +"# + ) +} -- cgit v1.2.3-70-g09d2