diff --git a/Cargo.lock b/Cargo.lock index af4ab01..9c04f18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -803,6 +803,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-range-header" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" + [[package]] name = "httparse" version = "1.10.1" @@ -1909,6 +1915,7 @@ dependencies = [ "chrono", "clawdforge", "regex", + "reqwest", "serde", "serde_json", "sqlx", @@ -2393,11 +2400,19 @@ checksum = "68d6fdd9f81c2819c9a8b0e0cd91660e7746a8e6ea2ba7c6b2b057985f6bcb51" dependencies = [ "bitflags", "bytes", + "futures-core", "futures-util", "http", "http-body", "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", "pin-project-lite", + "tokio", + "tokio-util", "tower", "tower-layer", "tower-service", diff --git a/Cargo.toml b/Cargo.toml index 1201067..e2c99c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ repository = "http://192.168.0.5:3001/cobb/skald" tokio = { version = "1", features = ["full"] } axum = "0.8" tower = "0.5" -tower-http = { version = "0.6", features = ["trace", "limit"] } +tower-http = { version = "0.6", features = ["trace", "limit", "fs"] } sqlx = { version = "0.8", default-features = false, features = [ "postgres", "runtime-tokio", "tls-rustls", "chrono", "uuid", "macros", "migrate", diff --git a/skald/src/web.rs b/skald/src/web.rs index 3a10be3..6f254f1 100644 --- a/skald/src/web.rs +++ b/skald/src/web.rs @@ -14,12 +14,13 @@ use axum::Router; use axum::extract::{Path, State}; use axum::http::StatusCode; use axum::response::{Html, Redirect}; -use axum::routing::get; +use axum::routing::{get, post}; use axum::Form; use chrono::{DateTime, Utc}; use maud::{DOCTYPE, Markup, html}; use serde::Deserialize; use sqlx::PgPool; +use tower_http::services::ServeDir; use uuid::Uuid; #[derive(Clone)] @@ -28,13 +29,24 @@ pub struct WebState { } pub fn router(state: WebState) -> Router { + // Audio dir is the f5-tts bind mount, exposed read-only inside + // skald via compose. ServeDir handles Range requests + correct + // MIME for .wav — important for HTML5