aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/HttpServer.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2025-05-19 03:06:41 +0300
committerRblSb <msrblsb@gmail.com>2025-05-24 13:59:03 +0300
commit623d85f88bb42834b335801ad5d703f6945d38d2 (patch)
tree857983c5c90f429e4764e4880f95d8f12a0f4595 /src/server/HttpServer.hx
parent4b48de4f824ce48f1466014a9e9aa24023212181 (diff)
Migrate to yt-dlp
- yt-dlp should be more stable and allows more cool stuff in future - easier to export cookies.txt with yt-dlp utility (cookies.json support removed) - better quality fallback if not enough space - keep progress reports after reconnections
Diffstat (limited to 'src/server/HttpServer.hx')
-rw-r--r--src/server/HttpServer.hx11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx
index b15018b..4f283a4 100644
--- a/src/server/HttpServer.hx
+++ b/src/server/HttpServer.hx
@@ -41,10 +41,12 @@ class HttpServer {
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"webp" => "image/webp",
+ "avif" => "image/avif",
"svg" => "image/svg+xml",
"ico" => "image/x-icon",
"wav" => "audio/wav",
"mp3" => "audio/mpeg",
+ "ogg" => "audio/ogg",
"mp4" => "video/mp4",
"webm" => "video/webm",
"woff" => "application/font-woff",
@@ -371,7 +373,7 @@ class HttpServer {
if (Utils.isOutOfRange(start, 0, videoSize - 1)) start = 0;
var end = Std.parseInt(ranges[2]);
if (end == null) end = start + CHUNK_SIZE;
- if (Utils.isOutOfRange(end, start, videoSize - 1)) end = videoSize - 1;
+ if (Utils.isOutOfRange(end, start, videoSize - 1)) end = (videoSize - 1).limitMin(0);
return {
start: start,
end: end
@@ -379,7 +381,10 @@ class HttpServer {
}
function isMediaExtension(ext:String):Bool {
- return ext == "mp4" || ext == "webm" || ext == "mp3" || ext == "wav";
+ return switch ext {
+ case "mp4", "webm", "mp3", "ogg", "wav": true;
+ case _: false;
+ }
}
final matchLang = ~/^[A-z]+/;
@@ -452,7 +457,7 @@ class HttpServer {
}
function getMimeType(ext:String):String {
- return mimeTypes[ext] ?? return "application/octet-stream";
+ return mimeTypes[ext] ?? "application/octet-stream";
}
final ctrlCharacters = ~/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/g;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage