Minimal subsonic functionality
CI / check (push) Successful in 1m12s
CI / docker (push) Successful in 2m2s

This commit is contained in:
Connor Johnstone
2026-03-20 20:04:35 -04:00
parent 0496944923
commit 43f4dad038
5 changed files with 50 additions and 3 deletions
+9 -1
View File
@@ -131,13 +131,21 @@ async fn main() -> anyhow::Result<()> {
.service(
actix_files::Files::new("/", static_dir.clone())
.index_file("index.html")
.prefer_utf8(true),
.prefer_utf8(true)
.guard(actix_web::guard::fn_guard(|ctx| {
!ctx.head().uri.path().starts_with("/rest")
})),
)
.default_service(web::to({
let index_path = static_dir.join("index.html");
move |req: actix_web::HttpRequest| {
let index_path = index_path.clone();
async move {
if req.path().starts_with("/rest") {
return Ok(actix_web::HttpResponse::NotFound()
.content_type("application/json")
.body(r#"{"subsonic-response":{"status":"failed","version":"1.16.1","error":{"code":0,"message":"Unknown endpoint"}}}"#));
}
actix_files::NamedFile::open_async(index_path)
.await
.map(|f| f.into_response(&req))