diff options
author | metamuffin <metamuffin@disroot.org> | 2023-02-21 15:12:38 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-02-21 15:12:38 +0100 |
commit | 630cd2b82887da49cacb2deb032c6a51b3c2faf7 (patch) | |
tree | 6a5eef8e1190d7e85a57d2bbe90663b71d56cabe /server/src/main.rs | |
parent | 70e1090e7c5e5aa6ed0a621ad71924b7931ef05d (diff) | |
download | keks-meet-630cd2b82887da49cacb2deb032c6a51b3c2faf7.tar keks-meet-630cd2b82887da49cacb2deb032c6a51b3c2faf7.tar.bz2 keks-meet-630cd2b82887da49cacb2deb032c6a51b3c2faf7.tar.zst |
server-side client configuration
Diffstat (limited to 'server/src/main.rs')
-rw-r--r-- | server/src/main.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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 <metamuffin@disroot.org> */ 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) |