filite icon indicating copy to clipboard operation
filite copied to clipboard

Allow custom host to bind to

Open catthehacker opened this issue 3 years ago • 2 comments

This allows for filite to work in edge(?) cases where binding to localhost is not enough. Binding to localhost or 127.0.0.1 allows the app to be accessible only by the host itself and with sandboxed network configuration this makes it impossible to have it accessible in certain setups. I've made quick change to current source to allow it but I'm not good at Rust. https://github.com/CatTheHacker/filite/commit/df89d52ae8fd513f4442d849e87bb7bfc1502fd6

Also in case of using reverse proxy in front of filite, it would be nice to have an option to use UNIX sockets to bypass network completely

diff --git a/src/main.rs b/src/main.rs
index 62cfd45..245d5e9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -95,7 +95,7 @@ async fn main() {
                     .route(web::delete().to(routes::texts::delete)),
             )
     })
-    .bind(&format!("{}:{}", host, port))
+    .bind_uds("/path/cat/.local/tmp/filite.sock")
     .unwrap_or_else(|e| {
         eprintln!("Can't bind webserver to specified port: {}", e);
         process::exit(1);

Nginx:

proxy_pass http://unix:/path/cat/.local/tmp/filite.sock:/

catthehacker avatar Nov 09 '20 08:11 catthehacker

Pretty sure that's configurable on the next branch but I'll double check. I'll also add unix socket support there, thanks for the suggestion. I don't plan on making any improvements to master myself since next is a complete rewrite and will replace it soon-ish (hopefully, but I haven't got a whole lot of free time to put in it at the moment), but if you open a PR I'll merge it.

raftario avatar Nov 09 '20 13:11 raftario

Any news here?

ghost avatar May 24 '22 01:05 ghost