From 04e008826f506ba93edac20a5f188023ec0442b4 Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Sun, 30 Oct 2022 12:15:28 +0530 Subject: [PATCH] misc changes Signed-off-by: Amneesh Singh --- flake.nix | 1 + src/main.rs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 2e19eea..82e1b38 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,7 @@ name = "simpler-filehost"; config = { Cmd = [ "${simpler-filehost}/bin/simpler-filehost" ]; + Env = [ "ROCKET_ADDRESS=0.0.0.0" ]; }; }; }; diff --git a/src/main.rs b/src/main.rs index 64197ae..b8cf5ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,7 +69,7 @@ async fn get_file(filename: String) -> Option { fn index() -> String { format!( "Use curl to upload:\n\ - curl -F file=@\"[file]\\n\" {url}\n\ + curl -F file=@\"[file]\" {url}\n\ If key is enabled then a field \"key\" might be required in which case it would be\n\ curl -F file=@\"[file]\" --F \"key=[key]\" {url}", url = env_user_url() @@ -94,11 +94,14 @@ fn env_key() -> String { fn env_user_url() -> String { let default_config = Config::default(); - env::var("USER_URL").unwrap_or(format!("http://localhost:{}", default_config.port)) + env::var("USER_URL").unwrap_or(format!("http://{}:{}", + default_config.address, + default_config.port)) } #[launch] fn rocket() -> _ { fs::create_dir_all(env_root_dir()).unwrap(); + println!("Starting"); rocket::build().mount("/", routes![post_file, get_file, index]) }