From 1abf1d194c0d11ae65a88c05c6f142cd3e61b443 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Sun, 29 Aug 2021 20:56:32 -0500 Subject: [PATCH] :construction: maybe HTTP Basic Auth? --- crates/ptth_server/src/bin/ptth_server.rs | 2 ++ crates/ptth_server/src/lib.rs | 11 +++++++---- crates/ptth_server_gui/src/main.rs | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/ptth_server/src/bin/ptth_server.rs b/crates/ptth_server/src/bin/ptth_server.rs index ce87317..835126a 100644 --- a/crates/ptth_server/src/bin/ptth_server.rs +++ b/crates/ptth_server/src/bin/ptth_server.rs @@ -107,6 +107,8 @@ async fn main () -> Result <(), anyhow::Error> { relay_url: opt.relay_url.or (config_file.relay_url).ok_or (anyhow::anyhow! ("`--relay-url` must be provided in command line or `relay_url` in config file"))?, file_server_root: opt.file_server_root.or (config_file.file_server_root).unwrap_or_else (|| PathBuf::from (".")), throttle_upload: opt.throttle_upload, + client_keys: Default::default (), + allow_any_client: true, }; if opt.print_tripcode { diff --git a/crates/ptth_server/src/lib.rs b/crates/ptth_server/src/lib.rs index 0845712..3509e36 100644 --- a/crates/ptth_server/src/lib.rs +++ b/crates/ptth_server/src/lib.rs @@ -221,8 +221,9 @@ pub struct ConfigFile { /// For debugging. pub throttle_upload: bool, - // Clients don't need to auth if this is None - // pub client_tripcodes: HashMap , + pub client_keys: HashSet , + + pub allow_any_client: bool, } impl ConfigFile { @@ -234,7 +235,8 @@ impl ConfigFile { relay_url, file_server_root: PathBuf::from ("."), throttle_upload: false, - // client_tripcodes: HashSet::new (), + client_keys: Default::default (), + allow_any_client: true, } } @@ -275,7 +277,8 @@ impl Builder { relay_url, file_server_root: PathBuf::from ("."), throttle_upload: false, - // client_tripcodes: HashMap::new (), + client_keys: Default::default (), + allow_any_client: true, }; Self { diff --git a/crates/ptth_server_gui/src/main.rs b/crates/ptth_server_gui/src/main.rs index c7f4ca1..12408bd 100644 --- a/crates/ptth_server_gui/src/main.rs +++ b/crates/ptth_server_gui/src/main.rs @@ -59,6 +59,8 @@ fn main () relay_url: gui.input_relay_url.value ().to_string (), file_server_root: std::path::PathBuf::from (gui.input_file_server_root.value ()), throttle_upload: false, + client_keys: Default::default (), + allow_any_client: true, }; let task = rt.spawn (async {