adding &type=m3u_plus at the end of an m3u url wil trigger a download. Without it will only stream the result.

This commit is contained in:
euzu
2025-02-04 10:25:40 +01:00
parent d8002b27dd
commit f46a50a85c
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -40,6 +40,7 @@ web_ui_enabled: true
- added `hlsr` handling.
- refactored strm generation, does not delete root directory, avoids unchanged file creations.
- fixed mapper counter not incrementing.
- adding `&type=m3u_plus` at the end of an `m3u` url wil trigger a download. Without it will only stream the result.
# 2.1.3 (2025-01-26)
- Hotfix 2.1.2, forgot to update the stream api code.
+6 -3
View File
@@ -26,9 +26,12 @@ async fn m3u_api(
Ok(m3u_iter) => {
// Convert the iterator into a stream of `Bytes`
let content_stream = stream::iter(m3u_iter.map(|line| Ok::<Bytes, String>(Bytes::from([line.as_bytes(), b"\n"].concat()))));
HttpResponse::Ok()
.content_type(mime::TEXT_PLAIN_UTF_8)
.streaming(content_stream)
let mut builder = HttpResponse::Ok();
builder.content_type(mime::TEXT_PLAIN_UTF_8);
if api_req.content_type == "m3u_plus" {
builder.insert_header(("Content-Disposition", "attachment; filename=\"playlist.m3u\""));
}
builder.streaming(content_stream)
}
Err(err) => {
error!("{}", sanitize_sensitive_info(err.to_string().as_str()));
+2
View File
@@ -41,4 +41,6 @@ pub struct UserApiRequest {
pub stream: String,
#[serde(default)]
pub duration: String,
#[serde(default, alias = "type")]
pub content_type: String,
}