Merge remote-tracking branch 'origin/main'
fixed confilcting args -h (--host) and -h (--help)
This commit is contained in:
commit
a4a1e93ddd
36
Cargo.lock
generated
36
Cargo.lock
generated
|
@ -19,6 +19,29 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "actix-files"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bf0bdd6ff79de7c9a021f5d9ea79ce23e108d8bfc9b49b5b4a2cf6fad5a35212"
|
||||||
|
dependencies = [
|
||||||
|
"actix-http",
|
||||||
|
"actix-service",
|
||||||
|
"actix-utils",
|
||||||
|
"actix-web",
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"bytes",
|
||||||
|
"derive_more",
|
||||||
|
"futures-core",
|
||||||
|
"http-range",
|
||||||
|
"log",
|
||||||
|
"mime",
|
||||||
|
"mime_guess",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
"v_htmlescape",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.6.0"
|
version = "3.6.0"
|
||||||
|
@ -796,6 +819,12 @@ dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-range"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
|
@ -1067,6 +1096,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||||
name = "personal-website"
|
name = "personal-website"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"actix-files",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-lab",
|
"actix-web-lab",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@ -1562,6 +1592,12 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "v_htmlescape"
|
||||||
|
version = "0.15.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e8257fbc510f0a46eb602c10215901938b5c2a7d5e70fc11483b1d3c9b5b18c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
|
|
@ -8,6 +8,7 @@ authors = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
actix-files = "0.6.5"
|
||||||
actix-web = "4.5.1"
|
actix-web = "4.5.1"
|
||||||
actix-web-lab = "0.20.2"
|
actix-web-lab = "0.20.2"
|
||||||
anyhow = "1.0.81"
|
anyhow = "1.0.81"
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub struct CliArgs {
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
|
|
||||||
/// Host ip to bind to, usually not required to change
|
/// Host ip to bind to, usually not required to change
|
||||||
#[arg(short, long, default_value="0.0.0.0")]
|
#[arg(long, default_value="0.0.0.0")]
|
||||||
pub host: String,
|
pub host: String,
|
||||||
|
|
||||||
/// Extra debugging output
|
/// Extra debugging output
|
||||||
|
|
|
@ -3,6 +3,7 @@ mod routes;
|
||||||
mod templates;
|
mod templates;
|
||||||
|
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{web, App, HttpServer};
|
||||||
|
use actix_files as actix_fs;
|
||||||
|
|
||||||
use crate::cli::CliArgs;
|
use crate::cli::CliArgs;
|
||||||
|
|
||||||
|
@ -12,7 +13,8 @@ pub(crate) async fn start_actix(cli: &CliArgs) -> anyhow::Result<()> {
|
||||||
log::info!("Serving an http server at http://{bindip}");
|
log::info!("Serving an http server at http://{bindip}");
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
.route("/", web::get().to(routes::index))
|
.route("/", web::get().to(routes::index)) // index.html
|
||||||
|
.service(actix_fs::Files::new("/static", "./static").index_file("index.html")) // static directoryh
|
||||||
})
|
})
|
||||||
|
|
||||||
.bind(bindip)?
|
.bind(bindip)?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user