debug du lecteur web

This commit is contained in:
2025-11-27 20:27:52 +01:00
parent 3d1673157b
commit 9e8491710c
6 changed files with 314 additions and 54 deletions

View File

@@ -13,7 +13,10 @@ use std::{fs, sync::Arc};
use axum::{
body::Body,
extract::{Path, State},
http::StatusCode,
http::{
header::{ACCEPT_RANGES, CACHE_CONTROL, CONNECTION, CONTENT_TYPE},
StatusCode,
},
response::{IntoResponse, Response},
routing::get,
Json, Router,
@@ -180,7 +183,10 @@ async fn stream_flac(
let stream = channel.subscribe_flac();
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "audio/flac")
.header(CONTENT_TYPE, "audio/flac")
.header(CACHE_CONTROL, "no-store, no-transform")
.header(CONNECTION, "keep-alive")
.header(ACCEPT_RANGES, "none")
.body(Body::from_stream(ReaderStream::new(stream)))
.unwrap())
}
@@ -193,7 +199,10 @@ async fn stream_ogg(
let stream = channel.subscribe_ogg();
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "audio/ogg")
.header(CONTENT_TYPE, "application/ogg")
.header(CACHE_CONTROL, "no-store, no-transform")
.header(CONNECTION, "keep-alive")
.header(ACCEPT_RANGES, "none")
.body(Body::from_stream(ReaderStream::new(stream)))
.unwrap())
}
@@ -206,7 +215,10 @@ async fn stream_icy(
let stream = channel.subscribe_icy();
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "audio/flac")
.header(CONTENT_TYPE, "audio/flac")
.header(CACHE_CONTROL, "no-store, no-transform")
.header(CONNECTION, "keep-alive")
.header(ACCEPT_RANGES, "none")
.header("icy-metaint", "16000")
.body(Body::from_stream(ReaderStream::new(stream)))
.unwrap())
@@ -236,7 +248,10 @@ async fn stream_history_flac(
})?;
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "audio/flac")
.header(CONTENT_TYPE, "audio/flac")
.header(CACHE_CONTROL, "no-store, no-transform")
.header(CONNECTION, "keep-alive")
.header(ACCEPT_RANGES, "none")
.body(Body::from_stream(ReaderStream::new(stream)))
.unwrap())
}
@@ -256,7 +271,10 @@ async fn stream_history_ogg(
})?;
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "audio/ogg")
.header(CONTENT_TYPE, "application/ogg")
.header(CACHE_CONTROL, "no-store, no-transform")
.header(CONNECTION, "keep-alive")
.header(ACCEPT_RANGES, "none")
.body(Body::from_stream(ReaderStream::new(stream)))
.unwrap())
}