aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2023-04-18 06:00:10 +0300
committerRblSb <msrblsb@gmail.com>2023-04-23 12:29:24 +0300
commitb25ebe9ce888b516c6478be2592052a7916a736f (patch)
tree4c6944ff349330eb1f5ccf77810b07e5eb32196f
parentb57aca347d4076f995e8849c5cc47c41e9cfd6c2 (diff)
Update to Haxe 4.3
-rw-r--r--.github/workflows/main.yml2
-rw-r--r--Dockerfile2
-rw-r--r--README.md2
-rw-r--r--build/server.js218
-rw-r--r--package-lock.json16
-rw-r--r--package.json2
-rw-r--r--res/client.js127
7 files changed, 177 insertions, 192 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3a56fe2..2c93bc3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,7 +16,7 @@ jobs:
run: |
node -v
npm install --global lix
- lix install haxe 4.2.3 --global
+ lix install haxe 4.3.0 --global
lix download
npm ci
haxelib install tests.hxml --always
diff --git a/Dockerfile b/Dockerfile
index 11398c2..f2ad13b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM haxe:4.2.5-alpine3.15
+FROM haxe:4.3.0-alpine3.15
WORKDIR /usr/src/app
RUN apk add nodejs npm git
diff --git a/README.md b/README.md
index 633a749..578a5c9 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ It's just works, but you can also check [user/ folder](/user/README.md) for serv
- Add `APP_URL` config var with `your-app-link.herokuapp.com` value to prevent sleeping when clients online
### Development
-- Install [Haxe 4.2](https://haxe.org/download/), [VSCode](https://code.visualstudio.com) and [Haxe extension](https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe)
+- Install [Haxe 4.3](https://haxe.org/download/), [VSCode](https://code.visualstudio.com) and [Haxe extension](https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe)
- `haxelib install all` to install extern libs
- If you skipped `Setup` section before: `npm ci`
- Open project in VSCode and press `F5` for client+server build and run
diff --git a/build/server.js b/build/server.js
index d91d4ed..e29026e 100644
--- a/build/server.js
+++ b/build/server.js
@@ -1,3 +1,4 @@
+// Generated by Haxe 4.3.0
(function ($global) { "use strict";
var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_;
function $extend(from, fields) {
@@ -103,9 +104,6 @@ DateTools.__format_get = function(d,e) {
return DateTools.__format(d,"%m/%d/%y");
case "F":
return DateTools.__format(d,"%Y-%m-%d");
- case "I":case "l":
- var hour = d.getHours() % 12;
- return StringTools.lpad(Std.string(hour == 0 ? 12 : hour),e == "I" ? "0" : " ",2);
case "M":
return StringTools.lpad(Std.string(d.getMinutes()),"0",2);
case "R":
@@ -118,14 +116,17 @@ DateTools.__format_get = function(d,e) {
return Std.string(d.getFullYear());
case "a":
return DateTools.DAY_SHORT_NAMES[d.getDay()];
- case "b":case "h":
- return DateTools.MONTH_SHORT_NAMES[d.getMonth()];
case "d":
return StringTools.lpad(Std.string(d.getDate()),"0",2);
case "e":
return Std.string(d.getDate());
+ case "b":case "h":
+ return DateTools.MONTH_SHORT_NAMES[d.getMonth()];
case "H":case "k":
return StringTools.lpad(Std.string(d.getHours()),e == "H" ? "0" : " ",2);
+ case "I":case "l":
+ var hour = d.getHours() % 12;
+ return StringTools.lpad(Std.string(hour == 0 ? 12 : hour),e == "I" ? "0" : " ",2);
case "m":
return StringTools.lpad(Std.string(d.getMonth() + 1),"0",2);
case "n":
@@ -234,7 +235,7 @@ EReg.prototype = {
,map: function(s,f) {
var offset = 0;
var buf_b = "";
- while(true) {
+ do {
if(offset >= s.length) {
break;
} else if(!this.matchSub(s,offset)) {
@@ -250,10 +251,7 @@ EReg.prototype = {
} else {
offset = p.pos + p.len;
}
- if(!this.r.global) {
- break;
- }
- }
+ } while(this.r.global);
if(!this.r.global && offset > 0 && offset < s.length) {
buf_b += Std.string(HxOverrides.substr(s,offset,null));
}
@@ -2089,17 +2087,6 @@ Lambda.find = function(it,f) {
}
return null;
};
-var haxe_IMap = function() { };
-haxe_IMap.__name__ = true;
-haxe_IMap.__isInterface__ = true;
-var haxe_ds_StringMap = function() {
- this.h = Object.create(null);
-};
-haxe_ds_StringMap.__name__ = true;
-haxe_ds_StringMap.__interfaces__ = [haxe_IMap];
-haxe_ds_StringMap.prototype = {
- __class__: haxe_ds_StringMap
-};
var Lang = function() { };
Lang.__name__ = true;
Lang.request = function(path,callback) {
@@ -2173,24 +2160,11 @@ Std.string = function(s) {
return js_Boot.__string_rec(s,"");
};
Std.parseInt = function(x) {
- if(x != null) {
- var _g = 0;
- var _g1 = x.length;
- while(_g < _g1) {
- var i = _g++;
- var c = x.charCodeAt(i);
- if(c <= 8 || c >= 14 && c != 32 && c != 45) {
- var nc = x.charCodeAt(i + 1);
- var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10);
- if(isNaN(v)) {
- return null;
- } else {
- return v;
- }
- }
- }
+ var v = parseInt(x);
+ if(isNaN(v)) {
+ return null;
}
- return null;
+ return v;
};
Std.random = function(x) {
if(x <= 0) {
@@ -2279,13 +2253,10 @@ StringTools.replace = function(s,sub,by) {
};
StringTools.hex = function(n,digits) {
var s = "";
- while(true) {
+ do {
s = "0123456789ABCDEF".charAt(n & 15) + s;
n >>>= 4;
- if(!(n > 0)) {
- break;
- }
- }
+ } while(n > 0);
if(digits != null) {
while(s.length < digits) s = "0" + s;
}
@@ -2381,14 +2352,17 @@ VideoList.prototype = {
,shuffleArray: function(arr) {
var _g_current = 0;
while(_g_current < arr.length) {
- var _g1_value = arr[_g_current++];
+ var _g_value = arr[_g_current++];
var n = Std.random(arr.length);
arr[_g_current - 1] = arr[n];
- arr[n] = _g1_value;
+ arr[n] = _g_value;
}
}
,__class__: VideoList
};
+var haxe_IMap = function() { };
+haxe_IMap.__name__ = true;
+haxe_IMap.__isInterface__ = true;
var haxe_Exception = function(message,previous,native) {
Error.call(this,message);
this.message = message;
@@ -2626,6 +2600,14 @@ haxe_crypto_Sha256.prototype = {
}
,__class__: haxe_crypto_Sha256
};
+var haxe_ds_StringMap = function() {
+ this.h = Object.create(null);
+};
+haxe_ds_StringMap.__name__ = true;
+haxe_ds_StringMap.__interfaces__ = [haxe_IMap];
+haxe_ds_StringMap.prototype = {
+ __class__: haxe_ds_StringMap
+};
var haxe_exceptions_PosException = function(message,previous,pos) {
haxe_Exception.call(this,message,previous);
if(pos == null) {
@@ -2773,18 +2755,18 @@ haxe_io_Path.normalize = function(path) {
var acc_b = "";
var colon = false;
var slashes = false;
- var _g2_offset = 0;
- var _g2_s = target.join(slash);
- while(_g2_offset < _g2_s.length) {
- var s = _g2_s;
- var index = _g2_offset++;
+ var _g_offset = 0;
+ var _g_s = target.join(slash);
+ while(_g_offset < _g_s.length) {
+ var s = _g_s;
+ var index = _g_offset++;
var c = s.charCodeAt(index);
if(c >= 55296 && c <= 56319) {
c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023;
}
var c1 = c;
if(c1 >= 65536) {
- ++_g2_offset;
+ ++_g_offset;
}
var c2 = c1;
switch(c2) {
@@ -2931,60 +2913,55 @@ hxjsonast_Parser.prototype = {
var e = false;
var pm = false;
var end = false;
- while(true) {
- switch(this.source.charCodeAt(this.pos++)) {
- case 43:case 45:
- if(!e || pm) {
- this.invalidNumber(start);
- }
- digit = false;
- pm = true;
- break;
- case 46:
- if(minus || point || e) {
- this.invalidNumber(start);
- }
- digit = false;
- point = true;
- break;
- case 48:
- if(zero && !point) {
- this.invalidNumber(start);
- }
- if(minus) {
- minus = false;
- zero = true;
- }
- digit = true;
- break;
- case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
- if(zero && !point) {
- this.invalidNumber(start);
- }
- if(minus) {
- minus = false;
- }
- digit = true;
- zero = false;
- break;
- case 69:case 101:
- if(minus || zero || e) {
- this.invalidNumber(start);
- }
- digit = false;
- e = true;
- break;
- default:
- if(!digit) {
- this.invalidNumber(start);
- }
- this.pos--;
- end = true;
+ do switch(this.source.charCodeAt(this.pos++)) {
+ case 43:case 45:
+ if(!e || pm) {
+ this.invalidNumber(start);
}
- if(end) {
- break;
+ digit = false;
+ pm = true;
+ break;
+ case 46:
+ if(minus || point || e) {
+ this.invalidNumber(start);
}
- }
+ digit = false;
+ point = true;
+ break;
+ case 48:
+ if(zero && !point) {
+ this.invalidNumber(start);
+ }
+ if(minus) {
+ minus = false;
+ zero = true;
+ }
+ digit = true;
+ break;
+ case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
+ if(zero && !point) {
+ this.invalidNumber(start);
+ }
+ if(minus) {
+ minus = false;
+ }
+ digit = true;
+ zero = false;
+ break;
+ case 69:case 101:
+ if(minus || zero || e) {
+ this.invalidNumber(start);
+ }
+ digit = false;
+ e = true;
+ break;
+ default:
+ if(!digit) {
+ this.invalidNumber(start);
+ }
+ this.pos--;
+ end = true;
+ } while(!end);
return new hxjsonast_Json(hxjsonast_JsonValue.JNumber(HxOverrides.substr(this.source,start,this.pos - start)),new hxjsonast_Position(this.filename,start,this.pos));
case 91:
var values = [];
@@ -3582,10 +3559,10 @@ server_ConsoleInput.prototype = {
var item_current = 0;
while(item_current < item_length) _g.push("/" + item_keys[item_current++] + " ");
var _g1 = [];
- var _g11 = 0;
- while(_g11 < _g.length) {
- var v = _g[_g11];
- ++_g11;
+ var _g2 = 0;
+ while(_g2 < _g.length) {
+ var v = _g[_g2];
+ ++_g2;
if(StringTools.startsWith(v,line)) {
_g1.push(v);
}
@@ -3647,7 +3624,8 @@ server_ConsoleInput.prototype = {
haxe_Log.trace("File \"" + path + "\" not found",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 129, className : "server.ConsoleInput", methodName : "parseLine"});
return;
}
- var events = JSON.parse(js_node_Fs.readFileSync(path,{ encoding : "utf8"}));
+ var text = js_node_Fs.readFileSync(path,{ encoding : "utf8"});
+ var events = JSON.parse(text);
this.main.replayLog(events);
break;
}
@@ -3766,7 +3744,8 @@ server_HttpServer.getPath = function(dir,url) {
server_HttpServer.readFileError = function(err,res,filePath) {
if(err.code == "ENOENT") {
res.statusCode = 404;
- res.end("File " + js_node_Path.relative(server_HttpServer.dir,filePath) + " not found.");
+ var rel = js_node_Path.relative(server_HttpServer.dir,filePath);
+ res.end("File " + rel + " not found.");
} else {
res.statusCode = 500;
res.end("Error getting the file: " + Std.string(err) + ".");
@@ -3781,7 +3760,8 @@ server_HttpServer.serveMedia = function(req,res,filePath) {
if(range == null) {
res.statusCode = 200;
res.setHeader("Content-Length","" + videoSize);
- js_node_Fs.createReadStream(filePath).pipe(res);
+ var videoStream = js_node_Fs.createReadStream(filePath);
+ videoStream.pipe(res);
return true;
}
var ranges = new EReg("[-=]","g").split(range);
@@ -3799,7 +3779,8 @@ server_HttpServer.serveMedia = function(req,res,filePath) {
res.setHeader("Content-Range","bytes " + start + "-" + end + "/" + videoSize);
res.setHeader("Content-Length","" + (end - start + 1));
res.statusCode = 206;
- js_node_Fs.createReadStream(filePath,{ start : start, end : end}).pipe(res);
+ var videoStream = js_node_Fs.createReadStream(filePath,{ start : start, end : end});
+ videoStream.pipe(res);
return true;
};
server_HttpServer.isMediaExtension = function(ext) {
@@ -3822,7 +3803,8 @@ server_HttpServer.localizeHtml = function(data,lang) {
return data;
};
server_HttpServer.proxyUrl = function(req,res) {
- var proxy = server_HttpServer.proxyRequest(StringTools.replace(req.url,"/proxy?url=",""),req,res,function(proxyReq) {
+ var url = StringTools.replace(req.url,"/proxy?url=","");
+ var proxy = server_HttpServer.proxyRequest(url,req,res,function(proxyReq) {
var url = proxyReq.headers["location"];
if(url == null) {
return false;
@@ -3853,7 +3835,9 @@ server_HttpServer.proxyRequest = function(url,req,res,fn) {
if(url1.host == req.headers["host"]) {
return null;
}
- var proxy = (url1.protocol == "https:" ? js_node_Https.request : js_node_Http.request)({ host : url1.hostname, port : Std.parseInt(url1.port), path : url1.pathname + url1.search, method : req.method},function(proxyReq) {
+ var options = { host : url1.hostname, port : Std.parseInt(url1.port), path : url1.pathname + url1.search, method : req.method};
+ var request = url1.protocol == "https:" ? js_node_Https.request : js_node_Http.request;
+ var proxy = request(options,function(proxyReq) {
if(fn(proxyReq)) {
return;
}
@@ -4239,7 +4223,8 @@ server_Main.prototype = {
haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 287, className : "server.Main", methodName : "logError", customParams : [data]});
var crashesFolder = "" + this.rootDir + "/user/crashes";
server_Utils.ensureDir(crashesFolder);
- js_node_Fs.writeFileSync("" + crashesFolder + "/" + (DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S") + "-" + type) + ".json",JSON.stringify(data,null,"\t"));
+ var name = DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S") + "-" + type;
+ js_node_Fs.writeFileSync("" + crashesFolder + "/" + name + ".json",JSON.stringify(data,null,"\t"));
}
,initIntergationHandlers: function() {
var _gthis = this;
@@ -4324,8 +4309,9 @@ server_Main.prototype = {
var id = this.freeIds.length > 0 ? this.freeIds.shift() : this.clients.length;
var name = "Guest " + (id + 1);
haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 372, className : "server.Main", methodName : "onConnect", customParams : ["" + name + " connected (" + ip + ")"]});
+ var isAdmin = this.config.localAdmins && req.socket.localAddress == ip;
var client = new Client(ws,req,id,name,0);
- client.setGroupFlag(ClientGroup.Admin,this.config.localAdmins && req.socket.localAddress == ip);
+ client.setGroupFlag(ClientGroup.Admin,isAdmin);
this.clients.push(client);
ws.on("pong",function() {
return client.isAlive = true;
@@ -5228,7 +5214,7 @@ if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" :
HxOverrides.now = performance.now.bind(performance);
}
if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); }
-String.prototype.__class__ = String;
+Object.defineProperty(String.prototype,"__class__",{ value : String, enumerable : false, writable : true});
String.__name__ = true;
Array.__name__ = true;
Date.prototype.__class__ = Date;
diff --git a/package-lock.json b/package-lock.json
index 08020bf..3a16b32 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,19 +9,19 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
- "ws": "^8.3.0"
+ "ws": "^8.13.0"
}
},
"node_modules/ws": {
- "version": "8.3.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.3.0.tgz",
- "integrity": "sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==",
+ "version": "8.13.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
- "utf-8-validate": "^5.0.2"
+ "utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
@@ -35,9 +35,9 @@
},
"dependencies": {
"ws": {
- "version": "8.3.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.3.0.tgz",
- "integrity": "sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==",
+ "version": "8.13.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"requires": {}
}
}
diff --git a/package.json b/package.json
index 4fbbc46..ead8868 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,6 @@
},
"homepage": "https://github.com/RblSb/SyncTube#readme",
"dependencies": {
- "ws": "^8.3.0"
+ "ws": "^8.13.0"
}
}
diff --git a/res/client.js b/res/client.js
index 32780ac..29774b5 100644
--- a/res/client.js
+++ b/res/client.js
@@ -1,3 +1,4 @@
+// Generated by Haxe 4.3.0
(function ($hx_exports, $global) { "use strict";
$hx_exports["client"] = $hx_exports["client"] || {};
$hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {};
@@ -189,10 +190,6 @@ Lambda.find = function(it,f) {
}
return null;
};
-var haxe_ds_StringMap = function() {
- this.h = Object.create(null);
-};
-haxe_ds_StringMap.__name__ = true;
var Lang = function() { };
Lang.__name__ = true;
Lang.request = function(path,callback) {
@@ -278,26 +275,6 @@ Reflect.fields = function(o) {
}
return a;
};
-Reflect.isFunction = function(f) {
- if(typeof(f) == "function") {
- return !(f.__name__ || f.__ename__);
- } else {
- return false;
- }
-};
-Reflect.compareMethods = function(f1,f2) {
- if(f1 == f2) {
- return true;
- }
- if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) {
- return false;
- }
- if(f1.scope == f2.scope && f1.method == f2.method) {
- return f1.method != null;
- } else {
- return false;
- }
-};
Reflect.copy = function(o) {
if(o == null) {
return null;
@@ -318,24 +295,11 @@ Std.string = function(s) {
return js_Boot.__string_rec(s,"");
};
Std.parseInt = function(x) {
- if(x != null) {
- var _g = 0;
- var _g1 = x.length;
- while(_g < _g1) {
- var i = _g++;
- var c = x.charCodeAt(i);
- if(c <= 8 || c >= 14 && c != 32 && c != 45) {
- var nc = x.charCodeAt(i + 1);
- var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10);
- if(isNaN(v)) {
- return null;
- } else {
- return v;
- }
- }
- }
+ var v = parseInt(x);
+ if(isNaN(v)) {
+ return null;
}
- return null;
+ return v;
};
var StringTools = function() { };
StringTools.__name__ = true;
@@ -447,13 +411,10 @@ StringTools.replace = function(s,sub,by) {
};
StringTools.hex = function(n,digits) {
var s = "";
- while(true) {
+ do {
s = "0123456789ABCDEF".charAt(n & 15) + s;
n >>>= 4;
- if(!(n > 0)) {
- break;
- }
- }
+ } while(n > 0);
if(digits != null) {
while(s.length < digits) s = "0" + s;
}
@@ -552,7 +513,8 @@ client_Buttons.init = function(main) {
if(list.children.length == 0) {
return;
}
- if(smilesBtn.classList.toggle("active")) {
+ var isActive = smilesBtn.classList.toggle("active");
+ if(isActive) {
wrap.style.display = "block";
var tmp = client_Buttons.outerHeight(list);
wrap.style.height = tmp + "px";
@@ -606,7 +568,8 @@ client_Buttons.init = function(main) {
if(isHidden) {
icon.setAttribute("name","chevron-down");
style.display = "block";
- var tmp = client_Buttons.outerHeight(wrap.firstElementChild);
+ var list = wrap.firstElementChild;
+ var tmp = client_Buttons.outerHeight(list);
wrap.style.height = tmp + "px";
wrap.style.marginBottom = "1rem";
} else {
@@ -623,7 +586,8 @@ client_Buttons.init = function(main) {
userlistToggle.onclick();
} else {
var wrap = window.document.querySelector("#userlist-wrap");
- var tmp = client_Buttons.outerHeight(wrap.firstElementChild);
+ var list = wrap.firstElementChild;
+ var tmp = client_Buttons.outerHeight(list);
wrap.style.height = tmp + "px";
}
haxe_Timer.delay(function() {
@@ -772,13 +736,15 @@ client_Buttons.toggleGroup = function(el) {
el.classList.toggle("collapsed");
var id = el.dataset.target;
var target = window.document.querySelector(id);
- if(target.classList.toggle("collapse")) {
+ var isClosed = target.classList.toggle("collapse");
+ if(isClosed) {
target.style.height = "0";
} else {
+ var list = target.firstElementChild;
if(target.style.height == "") {
target.style.height = "0";
}
- var tmp = client_Buttons.outerHeight(target.firstElementChild);
+ var tmp = client_Buttons.outerHeight(list);
target.style.height = tmp + "px";
}
return el.classList.toggle("active");
@@ -864,7 +830,8 @@ client_Buttons.initHotkeys = function(main,player) {
if(!client_Buttons.settings.hotkeysEnabled) {
return;
}
- if(client_Buttons.isElementEditable(e.target)) {
+ var target = e.target;
+ if(client_Buttons.isElementEditable(target)) {
return;
}
var key = e.keyCode;
@@ -966,7 +933,8 @@ client_Buttons.initChatInput = function(main) {
}
};
if(client_Utils.isIOS() && window.visualViewport != null) {
- window.visualViewport.addEventListener("resize",function(e) {
+ var viewport = window.visualViewport;
+ viewport.addEventListener("resize",function(e) {
var tmp = "" + Std.string(window.innerHeight);
return window.document.querySelector("#chat").style.height = tmp + "px";
});
@@ -1020,7 +988,8 @@ client_InputWithHistory.pushIfNotLast = function(arr,item) {
};
client_InputWithHistory.prototype = {
onKeyDown: function(e) {
- switch(e.keyCode) {
+ var key = e.keyCode;
+ switch(key) {
case 13:
var value = this.element.value;
if(value.length == 0) {
@@ -1470,7 +1439,9 @@ client_Main.prototype = {
var _gthis = this;
var protocol = $global.location.protocol;
if(StringTools.startsWith(url,"/")) {
- url = "" + protocol + "//" + $global.location.hostname + ":" + $global.location.port + url;
+ var host = $global.location.hostname;
+ var port = $global.location.port;
+ url = "" + protocol + "//" + host + ":" + port + url;
}
if(!StringTools.startsWith(url,"http")) {
url = "" + protocol + "//" + url;
@@ -2318,7 +2289,8 @@ client_Player.prototype = {
}
,toggleItemType: function(pos) {
this.videoList.toggleItemType(pos);
- this.setItemElementType(this.videoItemsEl.children[pos],this.videoList.items[pos].isTemp);
+ var el = this.videoItemsEl.children[pos];
+ this.setItemElementType(el,this.videoList.items[pos].isTemp);
}
,setPlayer: function(newPlayer) {
if(this.player != newPlayer) {
@@ -2761,7 +2733,8 @@ client_Settings.read = function() {
if(!client_Settings.isSupported) {
return client_Settings.defaults;
}
- return client_Settings.checkData(JSON.parse(client_Settings.storage.getItem("data")));
+ var data = JSON.parse(client_Settings.storage.getItem("data"));
+ return client_Settings.checkData(data);
};
client_Settings.checkData = function(data) {
if(client_Settings.defaults == null) {
@@ -3292,12 +3265,11 @@ client_players_RawSubs.parseAss = function(video,url) {
}
var result = new Array(list1.length);
var _g3 = 0;
- var _g11 = list1.length;
- while(_g3 < _g11) {
+ var _g4 = list1.length;
+ while(_g3 < _g4) {
var i1 = _g3++;
result[i1] = StringTools.trim(list1[i1]);
}
- list1 = result;
var text = result[ids_h["Text"]];
if(drawingMode.match(text)) {
text = "";
@@ -3353,7 +3325,8 @@ client_players_RawSubs.onParsed = function(video,name,dataUrl) {
trackEl.srclang = "en";
trackEl.src = dataUrl;
video.appendChild(trackEl);
- trackEl.track.mode = "showing";
+ var track = trackEl.track;
+ track.mode = "showing";
};
var client_players_Youtube = function(main,player) {
this.matchSeconds = new EReg("([0-9]+)S","");
@@ -4000,6 +3973,10 @@ haxe_crypto_Sha256.prototype = {
return str.toLowerCase();
}
};
+var haxe_ds_StringMap = function() {
+ this.h = Object.create(null);
+};
+haxe_ds_StringMap.__name__ = true;
var haxe_http_HttpBase = function(url) {
this.url = url;
this.headers = [];
@@ -4017,7 +3994,7 @@ haxe_http_HttpBase.prototype = {
,onStatus: function(status) {
}
,hasOnData: function() {
- return !Reflect.compareMethods($bind(this,this.onData),this.emptyOnData);
+ return $bind(this,this.onData) != this.emptyOnData;
}
,success: function(data) {
this.responseBytes = data;
@@ -4046,6 +4023,7 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{
var _gthis = this;
this.responseAsString = null;
this.responseBytes = null;
+ this.responseHeaders = null;
var r = this.req = js_Browser.createXMLHttpRequest();
var onreadystatechange = function(_) {
if(r.readyState != 4) {
@@ -4071,6 +4049,27 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{
}
if(s != null && s >= 200 && s < 400) {
_gthis.req = null;
+ var headers = r.getAllResponseHeaders().split("\r\n");
+ var _g = [];
+ var _g1 = 0;
+ var _g2 = headers;
+ while(_g1 < _g2.length) {
+ var v = _g2[_g1];
+ ++_g1;
+ if(v != "") {
+ _g.push(v);
+ }
+ }
+ headers = _g;
+ _gthis.responseHeaders = new haxe_ds_StringMap();
+ var _g = 0;
+ while(_g < headers.length) {
+ var a = headers[_g++].split(": ");
+ var hname = a.shift();
+ var hval = a.length == 1 ? a[0] : a.join(": ");
+ hval = StringTools.ltrim(StringTools.rtrim(hval));
+ _gthis.responseHeaders.h[hname] = hval;
+ }
_gthis.success(haxe_io_Bytes.ofData(r.response));
} else if(s == null || s == 0 && r.response == null) {
_gthis.req = null;
@@ -4118,9 +4117,9 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{
uri = (uri == null ? "null" : Std.string(uri)) + "&";
}
var s = p.name;
- var value = (uri == null ? "null" : Std.string(uri)) + encodeURIComponent(s) + "=";
+ var uri1 = (uri == null ? "null" : Std.string(uri)) + encodeURIComponent(s) + "=";
var s1 = p.value;
- uri = value + encodeURIComponent(s1);
+ uri = uri1 + encodeURIComponent(s1);
}
}
try {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage