Minimal subsonic functionality
This commit is contained in:
+9
-1
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user