aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/players/RawSubs.hx5
-rw-r--r--src/server/HttpServer.hx8
2 files changed, 10 insertions, 3 deletions
diff --git a/src/client/players/RawSubs.hx b/src/client/players/RawSubs.hx
index a8cbc98..aa77bf8 100644
--- a/src/client/players/RawSubs.hx
+++ b/src/client/players/RawSubs.hx
@@ -22,7 +22,10 @@ class RawSubs {
final ext = PathTools.urlExtension(item.subs);
// do not load subs if there is custom plugin
if (JsApi.hasSubtitleSupport(ext)) return;
- final url = '/proxy?url=${encodeURI(item.subs)}';
+ var url = encodeURI(item.subs);
+ if (!url.startsWith("/")) {
+ url = '/proxy?url=$url';
+ }
switch ext {
case "ass":
diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx
index 2076336..1198ca1 100644
--- a/src/server/HttpServer.hx
+++ b/src/server/HttpServer.hx
@@ -50,7 +50,7 @@ class HttpServer {
}
public static function serveFiles(req:IncomingMessage, res:ServerResponse):Void {
- var url = req.url;
+ var url = decodeURI(req.url);
if (url == "/") url = "/index.html";
var filePath = dir + url;
final ext = Path.extension(filePath).toLowerCase();
@@ -183,7 +183,7 @@ class HttpServer {
fn:(req:IncomingMessage) -> Bool
):Null<ClientRequest> {
final url = try {
- new URL(js.Node.global.decodeURI(url));
+ new URL(decodeURI(url));
} catch (e) return null;
if (url.host == req.headers["host"]) return null;
final options = {
@@ -215,4 +215,8 @@ class HttpServer {
if (contentType == null) return "application/octet-stream";
return contentType;
}
+
+ static inline function decodeURI(data:String):String {
+ return js.Syntax.code("decodeURI({0})", data);
+ }
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage