Server improvements

This commit is contained in:
NGnius (Graham) 2023-10-29 22:36:38 -04:00
parent bf08bf7000
commit 523e2b9df9
4 changed files with 7 additions and 4 deletions

View file

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Yarrr</title>
<link data-trunk rel="rust" data-bin="frontend" />
<link data-trunk rel="rust" data-bin="frontend" data-wasm-opt="0" />
<link data-trunk rel="sass" href="index.scss" />
</head>
</html>

2
run.sh
View file

@ -1,4 +1,4 @@
#!/bin/bash
#trunk build ./index.html && cargo run --bin backend -- localhost:7534
trunk build ./index.html && cargo run --bin backend -- localhost:7534 --dir /mnt/nas/media -u user -p password
trunk build ./index.html && cargo run --bin backend -- localhost:7534 --dir /mnt/nas/media -u user -p password --port 7534

View file

@ -23,6 +23,9 @@ pub struct CliArgs {
/// Display hidden files
#[clap(short, long)]
pub hidden: bool,
/// Local network port
#[clap(long)]
pub port: u16,
}
impl CliArgs {

View file

@ -26,7 +26,7 @@ async fn main() -> std::io::Result<()> {
.service(dir)
.service(file)
})
.bind(("127.0.0.1", 7534))?
.bind(("127.0.0.1", args.port))?
.run()
.await
} else {
@ -39,7 +39,7 @@ async fn main() -> std::io::Result<()> {
.service(dir)
.service(file)
})
.bind(("127.0.0.1", 7534))?
.bind(("127.0.0.1", args.port))?
.run()
.await
}