From 55687cccf51eda9f9da34d66c36963d51627a630 Mon Sep 17 00:00:00 2001 From: riseremi <6680627+riseremi@users.noreply.github.com> Date: Sat, 5 Apr 2025 15:05:20 +0400 Subject: [PATCH 1/4] Ask to create admin user on fresh install --- build/server.js | 132 ++++++++++++++++++++--- default-config.json | 2 + res/client.js | 8 +- res/css/des.css | 3 +- res/css/setup.css | 39 +++++++ res/langs/en.json | 226 ++++++++++++++++++++------------------- res/langs/ru.json | 226 ++++++++++++++++++++------------------- res/setup.html | 34 ++++++ src/Types.hx | 2 + src/server/HttpServer.hx | 87 +++++++++++++++ src/server/Main.hx | 4 + 11 files changed, 523 insertions(+), 240 deletions(-) create mode 100644 res/css/setup.css create mode 100644 res/setup.html diff --git a/build/server.js b/build/server.js index a6b4b7e..fdd00eb 100644 --- a/build/server.js +++ b/build/server.js @@ -1694,7 +1694,7 @@ JsonParser_$65.__name__ = true; JsonParser_$65.__super__ = json2object_reader_BaseParser; JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, minPasswordLength : Int, maxPasswordLength : Int, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1702,7 +1702,7 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); + this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","maxPasswordLength","minPasswordLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -1739,6 +1739,12 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ case "maxMessageLength": this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); break; + case "maxPasswordLength": + this.value.maxPasswordLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxPasswordLength",assigned,this.value.maxPasswordLength,pos); + break; + case "minPasswordLength": + this.value.minPasswordLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"minPasswordLength",assigned,this.value.minPasswordLength,pos); + break; case "permissions": this.value.permissions = this.loadObjectField(($_=new JsonParser_$73(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); break; @@ -1779,7 +1785,7 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { allowProxyIps : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$70([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$71([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$73([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { allowProxyIps : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$70([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$71([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxPasswordLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), minPasswordLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$73([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$65 }); @@ -2227,6 +2233,9 @@ Lambda.count = function(it,pred) { } return n; }; +Lambda.empty = function(it) { + return !$getIterator(it).hasNext(); +}; Lambda.find = function(it,f) { var v = $getIterator(it); while(v.hasNext()) { @@ -2257,7 +2266,10 @@ var haxe_ds_StringMap = function() { haxe_ds_StringMap.__name__ = true; haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; haxe_ds_StringMap.prototype = { - __class__: haxe_ds_StringMap + iterator: function() { + return new haxe_ds__$StringMap_StringMapValueIterator(this.h); + } + ,__class__: haxe_ds_StringMap }; var Lang = function() { }; Lang.__name__ = true; @@ -2768,6 +2780,22 @@ haxe_crypto_Sha256.prototype = { } ,__class__: haxe_crypto_Sha256 }; +var haxe_ds__$StringMap_StringMapValueIterator = function(h) { + this.h = h; + this.keys = Object.keys(h); + this.length = this.keys.length; + this.current = 0; +}; +haxe_ds__$StringMap_StringMapValueIterator.__name__ = true; +haxe_ds__$StringMap_StringMapValueIterator.prototype = { + hasNext: function() { + return this.current < this.length; + } + ,next: function() { + return this.h[this.keys[this.current++]]; + } + ,__class__: haxe_ds__$StringMap_StringMapValueIterator +}; var haxe_exceptions_PosException = function(message,previous,pos) { haxe_Exception.call(this,message,previous); if(pos == null) { @@ -3891,6 +3919,9 @@ server_HttpServer.prototype = { res.setHeader("content-type",this.getMimeType(ext)); if(this.cache != null && req.method == "POST") { switch(url.pathname) { + case "/setup": + this.finishSetup(req,res); + break; case "/upload": this.uploadFile(req,res); break; @@ -3915,6 +3946,18 @@ server_HttpServer.prototype = { res.end("Error getting the file: No access to " + rel + "."); return; } + if(url.pathname == "/setup") { + if(this.main.hasAdmins()) { + this.redirect(res,"/"); + return; + } + js_node_Fs.readFile("res/setup.html",function(err,data) { + data = _gthis.localizeHtml(data.toString(),req.headers["accept-language"]); + res.setHeader("content-type",_gthis.getMimeType("html")); + res.end(data); + }); + return; + } if(url.pathname == "/proxy") { if(!this.proxyUrl(req,res)) { res.end("Proxy error: " + req.url); @@ -3940,6 +3983,10 @@ server_HttpServer.prototype = { return; } if(ext == "html") { + if(!_gthis.main.hasAdmins()) { + _gthis.redirect(res,"/setup"); + return; + } data = _gthis.localizeHtml(data.toString(),req.headers["accept-language"]); } res.end(data); @@ -4027,7 +4074,7 @@ server_HttpServer.prototype = { } }); stream.on("error",function(err) { - haxe_Log.trace(err,{ fileName : "src/server/HttpServer.hx", lineNumber : 202, className : "server.HttpServer", methodName : "uploadFile"}); + haxe_Log.trace(err,{ fileName : "src/server/HttpServer.hx", lineNumber : 221, className : "server.HttpServer", methodName : "uploadFile"}); res.statusCode = 500; res.end(JSON.stringify({ info : "File write stream error."})); var _this = _gthis.uploadingFilesSizes; @@ -4041,7 +4088,7 @@ server_HttpServer.prototype = { _gthis.cache.remove(name); }); req.on("error",function(err) { - haxe_Log.trace("Request Error:",{ fileName : "src/server/HttpServer.hx", lineNumber : 209, className : "server.HttpServer", methodName : "uploadFile", customParams : [err]}); + haxe_Log.trace("Request Error:",{ fileName : "src/server/HttpServer.hx", lineNumber : 228, className : "server.HttpServer", methodName : "uploadFile", customParams : [err]}); stream.destroy(); res.statusCode = 500; res.end(JSON.stringify({ info : "File request error."})); @@ -4056,6 +4103,64 @@ server_HttpServer.prototype = { _gthis.cache.remove(name); }); } + ,redirect: function(res,pathname) { + res.writeHead(302,{ "Location" : pathname}); + res.end(); + } + ,finishSetup: function(req,res) { + var _gthis = this; + if(this.main.hasAdmins()) { + this.redirect(res,"/"); + return; + } + var bodyChunks = []; + req.on("data",function(chunk) { + bodyChunks.push(chunk); + }); + req.on("end",function() { + try { + var body = js_node_buffer_Buffer.concat(bodyChunks).toString(); + var jsonData = JSON.parse(body); + var name = Std.string(jsonData.name); + var password = Std.string(jsonData.password); + var passwordConfirmation = Std.string(jsonData.passwordConfirmation); + var errors = new haxe_ds_StringMap(); + var lang = req.headers["accept-language"]; + if(_gthis.main.isBadClientName(name)) { + var error = StringTools.replace(Lang.get(lang,"usernameError"),"$MAX","" + _gthis.main.config.maxLoginLength); + errors.h["name"] = error; + } + var min = _gthis.main.config.minPasswordLength; + var max = _gthis.main.config.maxPasswordLength; + if(password.length < min || password.length > max) { + var error = StringTools.replace(StringTools.replace(Lang.get(lang,"passwordError"),"$MIN","" + min),"$MAX","" + max); + errors.h["password"] = error; + } + if(password != passwordConfirmation) { + errors.h["password"] = Lang.get(lang,"passwordsMismatchError"); + } + if(!Lambda.empty(errors)) { + var errorObj = { }; + var h = errors.h; + var _g_keys = Object.keys(h); + var _g_length = _g_keys.length; + var _g_current = 0; + while(_g_current < _g_length) { + var key = _g_keys[_g_current++]; + errorObj[key] = h[key]; + } + throw haxe_Exception.thrown(errorObj); + } + _gthis.main.addAdmin(name,password); + res.writeHead(200,{ "Content-Type" : "application/json"}); + res.end(JSON.stringify({ success : true})); + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + res.writeHead(400,{ "Content-Type" : "application/json"}); + res.end(JSON.stringify({ success : false, errors : _g1})); + } + }); + } ,getPath: function(dir,url) { var filePath = decodeURIComponent(dir.split("+").join(" ")) + decodeURIComponent(url.pathname); if(!sys_FileSystem.isDirectory(filePath)) { @@ -4650,6 +4755,9 @@ server_Main.prototype = { })); haxe_Log.trace("Admin " + name + " removed.",{ fileName : "src/server/Main.hx", lineNumber : 370, className : "server.Main", methodName : "removeAdmin"}); } + ,hasAdmins: function() { + return this.userList.admins.length > 0; + } ,replayLog: function(events) { var _gthis = this; var timer = new haxe_Timer(1000); @@ -4715,7 +4823,7 @@ server_Main.prototype = { var ip = this.clientIp(req); 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 : 429, className : "server.Main", methodName : "onConnect", customParams : ["" + name + " connected (" + ip + ")"]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 433, 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.uuid = uuid; @@ -4729,7 +4837,7 @@ server_Main.prototype = { var obj = _gthis.wsEventParser.fromJson(data.toString()); if(_gthis.wsEventParser.errors.length > 0 || _gthis.noTypeObj(obj)) { var errors = "" + ("Wrong request for type \"" + obj.type + "\":") + "\n" + json2object_ErrorUtils.convertErrorArray(_gthis.wsEventParser.errors); - haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 446, className : "server.Main", methodName : "onConnect"}); + haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 450, className : "server.Main", methodName : "onConnect"}); _gthis.serverMessage(client,errors); return; } @@ -4924,7 +5032,7 @@ server_Main.prototype = { if(!internal) { return; } - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 511, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " disconnected"]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 515, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " disconnected"]}); server_Utils.sortedPush(this.freeIds,client.id); HxOverrides.remove(this.clients,client); this.sendClientList(); @@ -5064,7 +5172,7 @@ server_Main.prototype = { this.send(client,{ type : "LoginError"}); return; } - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 602, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " logged as " + name]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 606, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " logged as " + name]}); client.name = name; client.setGroupFlag(ClientGroup.User,true); this.checkBan(client); @@ -5077,7 +5185,7 @@ server_Main.prototype = { var oldName = client.name; client.name = "Guest " + (this.clients.indexOf(client) + 1); client.setGroupFlag(ClientGroup.User,false); - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 623, className : "server.Main", methodName : "onMessage", customParams : ["Client " + oldName + " logout to " + client.name]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 627, className : "server.Main", methodName : "onMessage", customParams : ["Client " + oldName + " logout to " + client.name]}); this.send(client,{ type : data.type, logout : { oldClientName : oldName, clientName : client.name, clients : this.clientList()}}); this.sendClientListExcept(client); break; @@ -5407,7 +5515,7 @@ server_Main.prototype = { client.setGroupFlag(ClientGroup.Banned,!isOutdated); if(isOutdated) { HxOverrides.remove(this.userList.bans,ban); - haxe_Log.trace("" + client.name + " ban removed",{ fileName : "src/server/Main.hx", lineNumber : 1064, className : "server.Main", methodName : "checkBan"}); + haxe_Log.trace("" + client.name + " ban removed",{ fileName : "src/server/Main.hx", lineNumber : 1068, className : "server.Main", methodName : "checkBan"}); this.sendClientList(); } break; diff --git a/default-config.json b/default-config.json index 38fc271..b3b7165 100644 --- a/default-config.json +++ b/default-config.json @@ -2,6 +2,8 @@ "port": 4200, "channelName": "SyncTube", "maxLoginLength": 20, + "minPasswordLength": 4, + "maxPasswordLength": 50, "maxMessageLength": 500, "serverChatHistory": 50, "totalVideoLimit": 0, diff --git a/res/client.js b/res/client.js index cdfee99..d5531b9 100644 --- a/res/client.js +++ b/res/client.js @@ -253,6 +253,10 @@ Lambda.findIndex = function(it,f) { } return -1; }; +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) { @@ -5425,10 +5429,6 @@ 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 = []; diff --git a/res/css/des.css b/res/css/des.css index 5d90b2c..f0017c2 100644 --- a/res/css/des.css +++ b/res/css/des.css @@ -48,7 +48,6 @@ body.swap { grid-template-areas: "chat gutter video"; } - @media only screen and (orientation: portrait) { body { display: flex; @@ -995,4 +994,4 @@ html { .mobile-view #optionsPanel { top: 2.2rem; bottom: 0; -} +} \ No newline at end of file diff --git a/res/css/setup.css b/res/css/setup.css new file mode 100644 index 0000000..39643d5 --- /dev/null +++ b/res/css/setup.css @@ -0,0 +1,39 @@ +body { + display: flex; +} + +.setup { + margin: auto; + padding: 2rem; + width: 320px; + display: flex; + flex-direction: column; + align-items: center; + + /* debug */ + background-color: #1a1a1f; + border-radius: 0.375rem; + + & h1 { + font-size: 1.75rem; + } +} + +.setup-form { + display: flex; + flex-direction: column; + gap: var(--spacing-4); + width: 100%; + + & button { + margin: 0; + padding: .75rem .5rem; + justify-content: center; + background-color: var(--accent); + color: #fff; + + &:hover { + filter: brightness(1.15); + } + } +} \ No newline at end of file diff --git a/res/langs/en.json b/res/langs/en.json index b7f8246..d03df45 100644 --- a/res/langs/en.json +++ b/res/langs/en.json @@ -1,115 +1,119 @@ { - "connection": "Connection", - "msgConnected": "Connected", - "msgDisconnected": "Disconnected", - "joined": "joined", - "online": "online", - "nothingPlaying": "Nothing Playing", - "hintListStart": "Welcome to SyncTube! Here you can:", - "hintListAddVideo": "$addVideos to watch together", - "hintListRequestLeader": "$requestLeader to pause and rewind videos for everyone", - "hintListRequestLeaderMouse": "(also use right mouse button for quick pause)", - "hintListRequestLeaderTouch": "(also use long tap for quick pause)", - "hintListOpenInApp": "$openInApp this server for better Android experience", - "hintListHide": "$hideThisMessage and send /help in chat to see it again", - "addVideos": "Add Videos", - "requestLeader": "Request Leader", - "openInApp": "Open in App", - "hideThisMessage": "Hide this message", - "usernameError": "Username length must be from 1 to $MAX characters and don't repeat another's. Characters &^<>'\" are not allowed.", - "passwordMatchError": "Wrong password.", - "accessError": "Access error", - "noPermission": "No '$PERMISSION' permission.", - "totalVideoLimitError": "Playlist video limit has been reached.", - "userVideoLimitError": "Playlist video limit per user has been reached.", - "videoAlreadyExistsError": "The video already exists in playlist.", - "addVideoError": "Failed to add video.", - "adminsCannotBeBannedError": "Admins cannot be banned. Remove them first.", - "caching": "Caching", - "downloading": "Downloading", - "uploading": "Uploading", - "rawVideo": "Raw video", - "videos": "videos", - "addedBy": "Added by", - "play": "Play", - "setNext": "Next", - "makePermanent": "Make Permanent", - "makeTemporary": "Make Temporary", - "delete": "Delete", - "account": "Account", - "exportSettings": "Export Settings", - "importSettings": "Import Settings", - "login": "Login", - "exit": "Exit", - "settings": "Settings", - "synchThreshold": "Synch Threshold", - "general": "General", - "hotkeys": "Hotkeys", - "video": "Video", - "channel": "Channel", - "layout": "Layout", - "swapLayout": "Swap Layout", - "chatOnly": "Chat Only", - "setVideoUrl": "Set Video URL", - "setVideoUrlPrompt": "New video URL:\n(Does not affect other users)", - "selectLocalVideo": "Select Local Video", - "removePlayer": "Remove Player", - "restorePlayer": "Restore Player", - "toggleUserList": "Show/Hide Userlist", - "leaderDesc": "Request video control permissions", - "mobileViewBtn": "Mobile View", - "leader": "Leader", - "enterAsGuest": "Enter As Guest", - "yourName": "Your Name", - "enterUserPassword": "Enter User Password", - "yourPassword": "Your Password", - "emotes": "Emotes", - "chat": "Chat", - "kicked": "Kicked", - "clearChat": "Clear Chat", - "chatlinePlaceholder": "Send a message...", - "leaderDisconnectedServerOnPause": "Leader was disconnected, server on pause.", - "unpause": "Unpause", - "addVideoFromUrl": "Add video from URL", - "embedCustomFrame": "Embed a custom frame", - "clearPlaylist": "Clear playlist", - "shufflePlaylist": "Shuffle playlist", - "playlist": "Playlist", - "playlistOpen": "Playlist open", - "playlistLocked": "Playlist locked", - "expandPlayer": "Expand player", - "toggleVideoSync": "Toggle video synchronization", - "toggleSynchConfirm": "Are you sure you want to turn off video sync?", - "refreshPlayer": "Refresh player", - "fullscreenPlayer": "Fullscreen player", - "retrievePlaylistLinks": "Retrieve playlist links", - "voteForSkip": "Vote for skip", - "addAsTemporary": "Add as temporary", - "cacheOnServer": "Cache on server", - "mediaUrl": "Media URL", - "optionalTitle": "Title (optional)", - "subtitlesUrlOptional": "Subtitles URL (optional)", - "voiceOverAudioTrackUrlOptional": "Voice-over audio URL (optional)", - "addTemplateUrl": "Add template URL", - "queueNext": "Queue next", - "queueLast": "Queue last", - "and": "and", - "or": "or", - "to": "to", - "pasteEmbedCodeAndClick": "Paste the embed code here", - "acceptableEmbedCodesAre": "Acceptable embed codes are", - "customEmbedsCannotBeSynchronized": "CUSTOM EMBEDS CANNOT BE SYNCHRONIZED", - "save": "Save", - "skipItemConfirm": "Are you sure you want to skip current video?", - "clearPlaylistConfirm": "Are you sure you want to clear the playlist?", - "shufflePlaylistConfirm": "Are you sure you want to shuffle the playlist?", - "lockPlaylistConfirm": "Are you sure you want to lock the playlist?", + "connection": "Connection", + "msgConnected": "Connected", + "msgDisconnected": "Disconnected", + "joined": "joined", + "online": "online", + "nothingPlaying": "Nothing Playing", + "hintListStart": "Welcome to SyncTube! Here you can:", + "hintListAddVideo": "$addVideos to watch together", + "hintListRequestLeader": "$requestLeader to pause and rewind videos for everyone", + "hintListRequestLeaderMouse": "(also use right mouse button for quick pause)", + "hintListRequestLeaderTouch": "(also use long tap for quick pause)", + "hintListOpenInApp": "$openInApp this server for better Android experience", + "hintListHide": "$hideThisMessage and send /help in chat to see it again", + "addVideos": "Add Videos", + "requestLeader": "Request Leader", + "openInApp": "Open in App", + "hideThisMessage": "Hide this message", + "usernameError": "Username length must be from 1 to $MAX characters and don't repeat another's. Characters &^<>'\" are not allowed.", + "passwordError": "Password length must be from $MIN to $MAX characters.", + "passwordsMismatchError": "Passwords do not match.", + "passwordMatchError": "Wrong password.", + "accessError": "Access error", + "noPermission": "No '$PERMISSION' permission.", + "totalVideoLimitError": "Playlist video limit has been reached.", + "userVideoLimitError": "Playlist video limit per user has been reached.", + "videoAlreadyExistsError": "The video already exists in playlist.", + "addVideoError": "Failed to add video.", + "adminsCannotBeBannedError": "Admins cannot be banned. Remove them first.", + "caching": "Caching", + "downloading": "Downloading", + "uploading": "Uploading", + "rawVideo": "Raw video", + "videos": "videos", + "addedBy": "Added by", + "play": "Play", + "setNext": "Next", + "makePermanent": "Make Permanent", + "makeTemporary": "Make Temporary", + "delete": "Delete", + "account": "Account", + "exportSettings": "Export Settings", + "importSettings": "Import Settings", + "login": "Login", + "exit": "Exit", + "settings": "Settings", + "synchThreshold": "Synch Threshold", + "general": "General", + "hotkeys": "Hotkeys", + "video": "Video", + "channel": "Channel", + "layout": "Layout", + "swapLayout": "Swap Layout", + "chatOnly": "Chat Only", + "setVideoUrl": "Set Video URL", + "setVideoUrlPrompt": "New video URL:\n(Does not affect other users)", + "selectLocalVideo": "Select Local Video", + "removePlayer": "Remove Player", + "restorePlayer": "Restore Player", + "toggleUserList": "Show/Hide Userlist", + "leaderDesc": "Request video control permissions", + "mobileViewBtn": "Mobile View", + "leader": "Leader", + "enterAsGuest": "Enter As Guest", + "yourName": "Your Name", + "enterUserPassword": "Enter User Password", + "yourPassword": "Your Password", + "emotes": "Emotes", + "chat": "Chat", + "kicked": "Kicked", + "clearChat": "Clear Chat", + "chatlinePlaceholder": "Send a message...", + "leaderDisconnectedServerOnPause": "Leader was disconnected, server on pause.", + "unpause": "Unpause", + "addVideoFromUrl": "Add video from URL", + "embedCustomFrame": "Embed a custom frame", + "clearPlaylist": "Clear playlist", + "shufflePlaylist": "Shuffle playlist", + "playlist": "Playlist", + "playlistOpen": "Playlist open", + "playlistLocked": "Playlist locked", + "expandPlayer": "Expand player", + "toggleVideoSync": "Toggle video synchronization", + "toggleSynchConfirm": "Are you sure you want to turn off video sync?", + "refreshPlayer": "Refresh player", + "fullscreenPlayer": "Fullscreen player", + "retrievePlaylistLinks": "Retrieve playlist links", + "voteForSkip": "Vote for skip", + "addAsTemporary": "Add as temporary", + "cacheOnServer": "Cache on server", + "mediaUrl": "Media URL", + "optionalTitle": "Title (optional)", + "subtitlesUrlOptional": "Subtitles URL (optional)", + "voiceOverAudioTrackUrlOptional": "Voice-over audio URL (optional)", + "addTemplateUrl": "Add template URL", + "queueNext": "Queue next", + "queueLast": "Queue last", + "and": "and", + "or": "or", + "to": "to", + "pasteEmbedCodeAndClick": "Paste the embed code here", + "acceptableEmbedCodesAre": "Acceptable embed codes are", + "customEmbedsCannotBeSynchronized": "CUSTOM EMBEDS CANNOT BE SYNCHRONIZED", + "save": "Save", + "skipItemConfirm": "Are you sure you want to skip current video?", + "clearPlaylistConfirm": "Are you sure you want to clear the playlist?", + "shufflePlaylistConfirm": "Are you sure you want to shuffle the playlist?", + "lockPlaylistConfirm": "Are you sure you want to lock the playlist?", - "yes": "Yes", - "no": "No", - "on": "On", - "off": "Off", + "yes": "Yes", + "no": "No", + "on": "On", + "off": "Off", - "areYouSure": "Are you sure?", - "dataWillBeLost": "The data will be lost." + "areYouSure": "Are you sure?", + "dataWillBeLost": "The data will be lost.", + + "setupTitle": "Welcome to SyncTube!" } diff --git a/res/langs/ru.json b/res/langs/ru.json index b98237d..689ad9c 100644 --- a/res/langs/ru.json +++ b/res/langs/ru.json @@ -1,115 +1,119 @@ { - "connection": "Подключение", - "msgConnected": "Соединение установлено", - "msgDisconnected": "Соединение потеряно", - "joined": "вошел", - "online": "онлайн", - "nothingPlaying": "Ничего не играет", - "hintListStart": "Добро пожаловать на SyncTube! Здесь вы можете:", - "hintListAddVideo": "$addVideos для совместного просмотра", - "hintListRequestLeader": "$requestLeader для всеобщей паузы и перемотки видео", - "hintListRequestLeaderMouse": "(кстати, правая кнопка мыши сразу сделает паузу)", - "hintListRequestLeaderTouch": "(кстати, удерживайте кнопку для быстрой паузы)", - "hintListOpenInApp": "$openInApp этот сервер для лучшего опыта на Android", - "hintListHide": "$hideThisMessage и отправлять `/help` в чат чтобы прочесть его снова", - "addVideos": "Добавлять видео", - "requestLeader": "Запрашивать лидера", - "openInApp": "Открыть в приложении", - "hideThisMessage": "Скрыть это сообщение", - "usernameError": "Ник должен быть от 1 до $MAX символов и не повторять чужие. Символы &^<>'\" запрещены.", - "passwordMatchError": "Неправильный пароль.", - "accessError": "Ошибка доступа", - "noPermission": "Нет '$PERMISSION' разрешения.", - "totalVideoLimitError": "Был достингут лимит видео в плейлисте.", - "userVideoLimitError": "Был достингут лимит видео на пользователя.", - "videoAlreadyExistsError": "Видео уже имеется в плейлисте.", - "addVideoError": "Не удалось добавить видео.", - "adminsCannotBeBannedError": "Админы не могут быть заблокированы. Сначала удалите их.", - "caching": "Кэширование", - "uploading": "Выгрузка", - "downloading": "Загрузка", - "rawVideo": "Исходное видео", - "videos": "видео", - "addedBy": "Добавлено", - "play": "Воспроизвести", - "setNext": "Следующее", - "makePermanent": "Закрепить", - "makeTemporary": "Открепить", - "delete": "Удалить", - "account": "Аккаунт", - "exportSettings": "Экспорт настроек", - "importSettings": "Импорт настроек", - "login": "Войти", - "exit": "Выход", - "settings": "Настройки", - "synchThreshold": "Частота синхронизации", - "general": "Основное", - "hotkeys": "Горячие клавиши", - "video": "Видео", - "channel": "Канал", - "layout": "Разметка", - "swapLayout": "Сменить разметку", - "chatOnly": "Только чат", - "setVideoUrl": "Задать ссылку на видео", - "setVideoUrlPrompt": "Новая ссылка на видео:\n(Не влияет на других пользователей)", - "selectLocalVideo": "Выбрать локальный видеофайл", - "removePlayer": "Удалить плеер", - "restorePlayer": "Вернуть плеер", - "toggleUserList": "Показать/Скрыть список юзеров", - "leaderDesc": "Запросить права на контроль роликом", - "mobileViewBtn": "Моб. вид", - "leader": "Лидер", - "enterAsGuest": "Войти как гость:", - "yourName": "Ваш ник", - "enterUserPassword": "Введите пароль пользователя", - "yourPassword": "Ваш пароль", - "emotes": "Смайлы", - "chat": "Чат", - "kicked": "Выпнут", - "clearChat": "Очистить чат", - "chatlinePlaceholder": "Введите сообщение...", - "leaderDisconnectedServerOnPause": "Лидер вышел, сервер на паузе.", - "unpause": "Возобновить", - "addVideoFromUrl": "Добавить видео по ссылке", - "embedCustomFrame": "Добавить iframe", - "clearPlaylist": "Очистить плейлист", - "shufflePlaylist": "Перемешать плейлист", - "playlist": "Плейлист", - "playlistOpen": "Плейлист открыт", - "playlistLocked": "Плейлист заблокирован", - "expandPlayer": "Расширить плеер", - "toggleVideoSync": "Переключить синхронизацию видео", - "toggleSynchConfirm": "Вы уверены что хотите отключить синхронизацию видео?", - "refreshPlayer": "Обновить плеер", - "fullscreenPlayer": "Полноэкранный режим видео", - "retrievePlaylistLinks": "Получить ссылки на видео из плейлиста", - "voteForSkip": "Голосовать за пропуск", - "addAsTemporary": "Добавить как временный", - "cacheOnServer": "Закэшировать на сервере", - "mediaUrl": "Ссылка на видео", - "optionalTitle": "Заголовок (опционально)", - "subtitlesUrlOptional": "Ссылка на субтитры (опционально)", - "voiceOverAudioTrackUrlOptional": "Ссылка на аудиодорожку (опционально)", - "addTemplateUrl": "Добавить пример ссылки", - "queueNext": "След.", - "queueLast": "В конец", - "and": "и", - "or": "или", - "to": "в", - "pasteEmbedCodeAndClick": "Вставьте код видео в это поле", - "acceptableEmbedCodesAre": "Можно добавить видео с тегами", - "customEmbedsCannotBeSynchronized": "СИНХРОНИЗАЦИЯ БУДЕТ НЕДОСТУПНА", - "save": "Сохранить", - "skipItemConfirm": "Вы уверены что хотите пропустить текущее видео?", - "clearPlaylistConfirm": "Вы уверены что хотите очистить плейлист?", - "shufflePlaylistConfirm": "Вы уверены что хотите перемешать плейлист?", - "lockPlaylistConfirm": "Вы уверены что хотите заблокировать плейлист?", + "connection": "Подключение", + "msgConnected": "Соединение установлено", + "msgDisconnected": "Соединение потеряно", + "joined": "вошел", + "online": "онлайн", + "nothingPlaying": "Ничего не играет", + "hintListStart": "Добро пожаловать на SyncTube! Здесь вы можете:", + "hintListAddVideo": "$addVideos для совместного просмотра", + "hintListRequestLeader": "$requestLeader для всеобщей паузы и перемотки видео", + "hintListRequestLeaderMouse": "(кстати, правая кнопка мыши сразу сделает паузу)", + "hintListRequestLeaderTouch": "(кстати, удерживайте кнопку для быстрой паузы)", + "hintListOpenInApp": "$openInApp этот сервер для лучшего опыта на Android", + "hintListHide": "$hideThisMessage и отправлять `/help` в чат чтобы прочесть его снова", + "addVideos": "Добавлять видео", + "requestLeader": "Запрашивать лидера", + "openInApp": "Открыть в приложении", + "hideThisMessage": "Скрыть это сообщение", + "usernameError": "Ник должен быть от 1 до $MAX символов и не повторять чужие. Символы &^<>'\" запрещены.", + "passwordError": "Длина пароля должна быть от $MIN до $MAX символов.", + "passwordsMismatchError": "Пароли не совпадают.", + "passwordMatchError": "Неправильный пароль.", + "accessError": "Ошибка доступа", + "noPermission": "Нет '$PERMISSION' разрешения.", + "totalVideoLimitError": "Был достингут лимит видео в плейлисте.", + "userVideoLimitError": "Был достингут лимит видео на пользователя.", + "videoAlreadyExistsError": "Видео уже имеется в плейлисте.", + "addVideoError": "Не удалось добавить видео.", + "adminsCannotBeBannedError": "Админы не могут быть заблокированы. Сначала удалите их.", + "caching": "Кэширование", + "uploading": "Выгрузка", + "downloading": "Загрузка", + "rawVideo": "Исходное видео", + "videos": "видео", + "addedBy": "Добавлено", + "play": "Воспроизвести", + "setNext": "Следующее", + "makePermanent": "Закрепить", + "makeTemporary": "Открепить", + "delete": "Удалить", + "account": "Аккаунт", + "exportSettings": "Экспорт настроек", + "importSettings": "Импорт настроек", + "login": "Войти", + "exit": "Выход", + "settings": "Настройки", + "synchThreshold": "Частота синхронизации", + "general": "Основное", + "hotkeys": "Горячие клавиши", + "video": "Видео", + "channel": "Канал", + "layout": "Разметка", + "swapLayout": "Сменить разметку", + "chatOnly": "Только чат", + "setVideoUrl": "Задать ссылку на видео", + "setVideoUrlPrompt": "Новая ссылка на видео:\n(Не влияет на других пользователей)", + "selectLocalVideo": "Выбрать локальный видеофайл", + "removePlayer": "Удалить плеер", + "restorePlayer": "Вернуть плеер", + "toggleUserList": "Показать/Скрыть список юзеров", + "leaderDesc": "Запросить права на контроль роликом", + "mobileViewBtn": "Моб. вид", + "leader": "Лидер", + "enterAsGuest": "Войти как гость:", + "yourName": "Ваш ник", + "enterUserPassword": "Введите пароль пользователя", + "yourPassword": "Ваш пароль", + "emotes": "Смайлы", + "chat": "Чат", + "kicked": "Выпнут", + "clearChat": "Очистить чат", + "chatlinePlaceholder": "Введите сообщение...", + "leaderDisconnectedServerOnPause": "Лидер вышел, сервер на паузе.", + "unpause": "Возобновить", + "addVideoFromUrl": "Добавить видео по ссылке", + "embedCustomFrame": "Добавить iframe", + "clearPlaylist": "Очистить плейлист", + "shufflePlaylist": "Перемешать плейлист", + "playlist": "Плейлист", + "playlistOpen": "Плейлист открыт", + "playlistLocked": "Плейлист заблокирован", + "expandPlayer": "Расширить плеер", + "toggleVideoSync": "Переключить синхронизацию видео", + "toggleSynchConfirm": "Вы уверены что хотите отключить синхронизацию видео?", + "refreshPlayer": "Обновить плеер", + "fullscreenPlayer": "Полноэкранный режим видео", + "retrievePlaylistLinks": "Получить ссылки на видео из плейлиста", + "voteForSkip": "Голосовать за пропуск", + "addAsTemporary": "Добавить как временный", + "cacheOnServer": "Закэшировать на сервере", + "mediaUrl": "Ссылка на видео", + "optionalTitle": "Заголовок (опционально)", + "subtitlesUrlOptional": "Ссылка на субтитры (опционально)", + "voiceOverAudioTrackUrlOptional": "Ссылка на аудиодорожку (опционально)", + "addTemplateUrl": "Добавить пример ссылки", + "queueNext": "След.", + "queueLast": "В конец", + "and": "и", + "or": "или", + "to": "в", + "pasteEmbedCodeAndClick": "Вставьте код видео в это поле", + "acceptableEmbedCodesAre": "Можно добавить видео с тегами", + "customEmbedsCannotBeSynchronized": "СИНХРОНИЗАЦИЯ БУДЕТ НЕДОСТУПНА", + "save": "Сохранить", + "skipItemConfirm": "Вы уверены что хотите пропустить текущее видео?", + "clearPlaylistConfirm": "Вы уверены что хотите очистить плейлист?", + "shufflePlaylistConfirm": "Вы уверены что хотите перемешать плейлист?", + "lockPlaylistConfirm": "Вы уверены что хотите заблокировать плейлист?", - "yes": "Да", - "no": "Нет", - "on": "Вкл.", - "off": "Откл.", + "yes": "Да", + "no": "Нет", + "on": "Вкл.", + "off": "Откл.", - "areYouSure": "Вы уверены?", - "dataWillBeLost": "Данные будут потеряны." + "areYouSure": "Вы уверены?", + "dataWillBeLost": "Данные будут потеряны.", + + "setupTitle": "Добро пожаловать в SyncTube!" } diff --git a/res/setup.html b/res/setup.html new file mode 100644 index 0000000..dd68a99 --- /dev/null +++ b/res/setup.html @@ -0,0 +1,34 @@ + + + + + + + + + + + SyncTube + + + + + + + +
+

SyncTube

+

Create your admin account

+ +
+ + + + + +
+ +
+ + + \ No newline at end of file diff --git a/src/Types.hx b/src/Types.hx index 2dfe899..9b4a3ff 100644 --- a/src/Types.hx +++ b/src/Types.hx @@ -33,6 +33,8 @@ typedef Config = { port:Int, channelName:String, maxLoginLength:Int, + minPasswordLength:Int, + maxPasswordLength:Int, maxMessageLength:Int, serverChatHistory:Int, totalVideoLimit:Int, diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx index dd8c178..fc33bfb 100644 --- a/src/server/HttpServer.hx +++ b/src/server/HttpServer.hx @@ -87,6 +87,8 @@ class HttpServer { uploadFileLastChunk(req, res); case "/upload": uploadFile(req, res); + case "/setup": + finishSetup(req, res); } return; } @@ -106,6 +108,19 @@ class HttpServer { return; } + if (url.pathname == "/setup") { + if (main.hasAdmins()) { + return redirect(res, "/"); + } + + Fs.readFile("res/setup.html", (err:Dynamic, data:Buffer) -> { + data = cast localizeHtml(data.toString(), req.headers["accept-language"]); + res.setHeader("content-type", getMimeType("html")); + res.end(data); + }); + return; + } + if (url.pathname == "/proxy") { if (!proxyUrl(req, res)) res.end('Proxy error: ${req.url}'); return; @@ -127,7 +142,11 @@ class HttpServer { readFileError(err, res, filePath); return; } + if (ext == "html") { + if (!main.hasAdmins()) { + return redirect(res, "/setup"); + } // replace ${textId} to localized strings data = cast localizeHtml(data.toString(), req.headers["accept-language"]); } @@ -215,6 +234,74 @@ class HttpServer { }); } + function redirect(res:ServerResponse, pathname:String) { + res.writeHead(302, { "Location": pathname }); + return res.end(); + } + + function finishSetup(req:IncomingMessage, res:ServerResponse) { + if (main.hasAdmins()) { + return redirect(res, "/"); + } + + final lang = req.headers["accept-language"]; + var bodyChunks:Array = []; + + req.on("data", function(chunk) { + bodyChunks.push(chunk); + }); + + req.on("end", function() { + try { + final body = Buffer.concat(bodyChunks).toString(); + final jsonData:Dynamic = haxe.Json.parse(body); + + final name = Std.string(jsonData.name); + final password = Std.string(jsonData.password); + final passwordConfirmation = Std.string(jsonData.passwordConfirmation); + + var errors:Map = []; + + final lang = req.headers["accept-language"]; + if (main.isBadClientName(name)) { + final error = Lang.get(lang, "usernameError") + .replace("$MAX", '${main.config.maxLoginLength}'); + errors["name"] = error; + } + + final min = main.config.minPasswordLength; + final max = main.config.maxPasswordLength; + if (password.length < min || password.length > max) { + final error = Lang.get(lang, "passwordError") + .replace("$MIN", '${min}') + .replace("$MAX", '${max}'); + errors["password"] = error; + } + + if (password != passwordConfirmation) { + final error = Lang.get(lang, "passwordsMismatchError"); + errors["password"] = error; + } + + if (!errors.empty()) { + var errorObj = {}; + for (key => value in errors) { + Reflect.setField(errorObj, key, value); + } + throw errorObj; + } + + main.addAdmin(name, password); + + res.writeHead(200, { "Content-Type": "application/json" }); + res.end(haxe.Json.stringify({ success: true })); + } catch (e:Dynamic) { + res.writeHead(400, { "Content-Type": "application/json" }); + res.end(haxe.Json.stringify({ success: false, errors: e })); + } + }); + } + function getPath(dir:String, url:URL):String { final filePath = dir.urlDecode() + decodeURIComponent(url.pathname); if (!FileSystem.isDirectory(filePath)) return filePath; diff --git a/src/server/Main.hx b/src/server/Main.hx index d935157..dd938b1 100644 --- a/src/server/Main.hx +++ b/src/server/Main.hx @@ -370,6 +370,10 @@ class Main { trace('Admin $name removed.'); } + public function hasAdmins():Bool { + return userList.admins.length > 0; + } + public function replayLog(events:Array):Void { final timer = new Timer(1000); timer.run = () -> { From fd8df41859cb0dd592488d6f7443de9e355bb0b5 Mon Sep 17 00:00:00 2001 From: riseremi <6680627+riseremi@users.noreply.github.com> Date: Sat, 5 Apr 2025 15:48:24 +0400 Subject: [PATCH 2/4] Implement client form submitting --- res/css/setup.css | 9 +++++++- res/setup.html | 54 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/res/css/setup.css b/res/css/setup.css index 39643d5..539b33b 100644 --- a/res/css/setup.css +++ b/res/css/setup.css @@ -22,7 +22,7 @@ body { .setup-form { display: flex; flex-direction: column; - gap: var(--spacing-4); + gap: 1rem; width: 100%; & button { @@ -36,4 +36,11 @@ body { filter: brightness(1.15); } } +} + +.form-errors { + display: flex; + flex-direction: column; + gap: 0.5rem; + color: var(--error); } \ No newline at end of file diff --git a/res/setup.html b/res/setup.html index dd68a99..d5dcea6 100644 --- a/res/setup.html +++ b/res/setup.html @@ -13,6 +13,7 @@ + @@ -20,15 +21,60 @@

SyncTube

Create your admin account

-
+
- + - -
+
+ + + + \ No newline at end of file From 7ec9d2685b28f9eb6e933f2f1e7a17e7641faa1d Mon Sep 17 00:00:00 2001 From: RblSb Date: Sat, 5 Apr 2025 20:25:19 +0300 Subject: [PATCH 3/4] minimize diff, simplify impl --- build/server.js | 125 +++++++++------------ res/css/setup.css | 62 +++++------ res/langs/en.json | 228 +++++++++++++++++++-------------------- res/langs/ru.json | 228 +++++++++++++++++++-------------------- res/setup.html | 4 +- src/Types.hx | 2 - src/server/HttpServer.hx | 105 +++++++++--------- src/server/Main.hx | 4 +- 8 files changed, 374 insertions(+), 384 deletions(-) diff --git a/build/server.js b/build/server.js index fdd00eb..50b50b8 100644 --- a/build/server.js +++ b/build/server.js @@ -1694,7 +1694,7 @@ JsonParser_$65.__name__ = true; JsonParser_$65.__super__ = json2object_reader_BaseParser; JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, minPasswordLength : Int, maxPasswordLength : Int, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1702,7 +1702,7 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","maxPasswordLength","minPasswordLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); + this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -1739,12 +1739,6 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ case "maxMessageLength": this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); break; - case "maxPasswordLength": - this.value.maxPasswordLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxPasswordLength",assigned,this.value.maxPasswordLength,pos); - break; - case "minPasswordLength": - this.value.minPasswordLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"minPasswordLength",assigned,this.value.minPasswordLength,pos); - break; case "permissions": this.value.permissions = this.loadObjectField(($_=new JsonParser_$73(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); break; @@ -1785,7 +1779,7 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { allowProxyIps : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$70([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$71([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxPasswordLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), minPasswordLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$73([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { allowProxyIps : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$70([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$71([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$73([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$65 }); @@ -2233,9 +2227,6 @@ Lambda.count = function(it,pred) { } return n; }; -Lambda.empty = function(it) { - return !$getIterator(it).hasNext(); -}; Lambda.find = function(it,f) { var v = $getIterator(it); while(v.hasNext()) { @@ -3951,8 +3942,8 @@ server_HttpServer.prototype = { this.redirect(res,"/"); return; } - js_node_Fs.readFile("res/setup.html",function(err,data) { - data = _gthis.localizeHtml(data.toString(),req.headers["accept-language"]); + js_node_Fs.readFile("" + this.dir + "/setup.html",function(err,data) { + data = js_node_buffer_Buffer.from(_gthis.localizeHtml(data.toString(),req.headers["accept-language"])); res.setHeader("content-type",_gthis.getMimeType("html")); res.end(data); }); @@ -3983,7 +3974,7 @@ server_HttpServer.prototype = { return; } if(ext == "html") { - if(!_gthis.main.hasAdmins()) { + if(!_gthis.main.isNoState && !_gthis.main.hasAdmins()) { _gthis.redirect(res,"/setup"); return; } @@ -4115,50 +4106,40 @@ server_HttpServer.prototype = { } var bodyChunks = []; req.on("data",function(chunk) { - bodyChunks.push(chunk); + return bodyChunks.push(chunk); }); req.on("end",function() { + var body = js_node_buffer_Buffer.concat(bodyChunks).toString(); + var jsonData; try { - var body = js_node_buffer_Buffer.concat(bodyChunks).toString(); - var jsonData = JSON.parse(body); - var name = Std.string(jsonData.name); - var password = Std.string(jsonData.password); - var passwordConfirmation = Std.string(jsonData.passwordConfirmation); - var errors = new haxe_ds_StringMap(); - var lang = req.headers["accept-language"]; - if(_gthis.main.isBadClientName(name)) { - var error = StringTools.replace(Lang.get(lang,"usernameError"),"$MAX","" + _gthis.main.config.maxLoginLength); - errors.h["name"] = error; - } - var min = _gthis.main.config.minPasswordLength; - var max = _gthis.main.config.maxPasswordLength; - if(password.length < min || password.length > max) { - var error = StringTools.replace(StringTools.replace(Lang.get(lang,"passwordError"),"$MIN","" + min),"$MAX","" + max); - errors.h["password"] = error; - } - if(password != passwordConfirmation) { - errors.h["password"] = Lang.get(lang,"passwordsMismatchError"); - } - if(!Lambda.empty(errors)) { - var errorObj = { }; - var h = errors.h; - var _g_keys = Object.keys(h); - var _g_length = _g_keys.length; - var _g_current = 0; - while(_g_current < _g_length) { - var key = _g_keys[_g_current++]; - errorObj[key] = h[key]; - } - throw haxe_Exception.thrown(errorObj); - } - _gthis.main.addAdmin(name,password); - res.writeHead(200,{ "Content-Type" : "application/json"}); - res.end(JSON.stringify({ success : true})); + jsonData = JSON.parse(body); } catch( _g ) { - var _g1 = haxe_Exception.caught(_g).unwrap(); res.writeHead(400,{ "Content-Type" : "application/json"}); - res.end(JSON.stringify({ success : false, errors : _g1})); + res.end(JSON.stringify({ success : false, errors : []})); + return; + } + var name = jsonData.name == null ? "null" : "" + jsonData.name; + var password = jsonData.password == null ? "null" : "" + jsonData.password; + var passwordConfirmation = jsonData.passwordConfirmation == null ? "null" : "" + jsonData.passwordConfirmation; + var errors = []; + var lang = req.headers["accept-language"]; + if(_gthis.main.isBadClientName(name)) { + errors.push({ type : "name", error : StringTools.replace(Lang.get(lang,"usernameError"),"$MAX","" + _gthis.main.config.maxLoginLength)}); + } + if(password.length < 4 || password.length > 50) { + errors.push({ type : "password", error : StringTools.replace(StringTools.replace(Lang.get(lang,"passwordError"),"$MIN","" + 4),"$MAX","" + 50)}); + } + if(password != passwordConfirmation) { + errors.push({ type : "password", error : Lang.get(lang,"passwordsMismatchError")}); + } + if(errors.length > 0) { + res.writeHead(400,{ "Content-Type" : "application/json"}); + res.end(JSON.stringify({ success : false, errors : errors})); + return; } + _gthis.main.addAdmin(name,password); + res.writeHead(200,{ "Content-Type" : "application/json"}); + res.end(JSON.stringify({ success : true})); }); } ,getPath: function(dir,url) { @@ -4493,7 +4474,7 @@ var server_Main = function(opts) { preparePort = function() { server_Utils.isPortFree(_gthis.port,function(isFree) { if(!isFree && attempts > 0) { - haxe_Log.trace("Warning: port " + _gthis.port + " is already in use. Changed to " + (_gthis.port + 1),{ fileName : "src/server/Main.hx", lineNumber : 138, className : "server.Main", methodName : "new"}); + haxe_Log.trace("Warning: port " + _gthis.port + " is already in use. Changed to " + (_gthis.port + 1),{ fileName : "src/server/Main.hx", lineNumber : 140, className : "server.Main", methodName : "new"}); attempts -= 1; _gthis.port++; preparePort(); @@ -4520,16 +4501,16 @@ server_Main.jsonFilterNulls = function(key,value) { server_Main.prototype = { runServer: function() { var _gthis = this; - haxe_Log.trace("Local: http://" + this.localIp + ":" + this.port,{ fileName : "src/server/Main.hx", lineNumber : 151, className : "server.Main", methodName : "runServer"}); + haxe_Log.trace("Local: http://" + this.localIp + ":" + this.port,{ fileName : "src/server/Main.hx", lineNumber : 153, className : "server.Main", methodName : "runServer"}); if(this.config.localNetworkOnly) { - haxe_Log.trace("Global network is disabled in config",{ fileName : "src/server/Main.hx", lineNumber : 153, className : "server.Main", methodName : "runServer"}); + haxe_Log.trace("Global network is disabled in config",{ fileName : "src/server/Main.hx", lineNumber : 155, className : "server.Main", methodName : "runServer"}); } else if(!this.isNoState) { server_Utils.getGlobalIp(function(ip) { if(ip.indexOf(":") != -1) { ip = "[" + ip + "]"; } _gthis.globalIp = ip; - haxe_Log.trace("Global: http://" + _gthis.globalIp + ":" + _gthis.port,{ fileName : "src/server/Main.hx", lineNumber : 159, className : "server.Main", methodName : "runServer"}); + haxe_Log.trace("Global: http://" + _gthis.globalIp + ":" + _gthis.port,{ fileName : "src/server/Main.hx", lineNumber : 161, className : "server.Main", methodName : "runServer"}); }); } var dir = "" + this.rootDir + "/res"; @@ -4614,7 +4595,7 @@ server_Main.prototype = { var field = _g1[_g]; ++_g; if(Reflect.field(config,field) == null) { - haxe_Log.trace("Warning: config field \"" + field + "\" is unknown",{ fileName : "src/server/Main.hx", lineNumber : 233, className : "server.Main", methodName : "getUserConfig"}); + haxe_Log.trace("Warning: config field \"" + field + "\" is unknown",{ fileName : "src/server/Main.hx", lineNumber : 235, className : "server.Main", methodName : "getUserConfig"}); } config[field] = Reflect.field(customConfig,field); } @@ -4625,14 +4606,14 @@ server_Main.prototype = { var emote = _g1[_g]; ++_g; if(emoteCopies_h[emote.name]) { - haxe_Log.trace("Warning: emote name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 239, className : "server.Main", methodName : "getUserConfig"}); + haxe_Log.trace("Warning: emote name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 241, className : "server.Main", methodName : "getUserConfig"}); } emoteCopies_h[emote.name] = true; if(!this.verbose) { continue; } if(emoteCopies_h[emote.image]) { - haxe_Log.trace("Warning: emote url of name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 243, className : "server.Main", methodName : "getUserConfig"}); + haxe_Log.trace("Warning: emote url of name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 245, className : "server.Main", methodName : "getUserConfig"}); } emoteCopies_h[emote.image] = true; } @@ -4669,7 +4650,7 @@ server_Main.prototype = { js_node_Fs.writeFileSync("" + this.userDir + "/users.json",JSON.stringify({ admins : users1, bans : _g, salt : users.salt},null,"\t")); } ,saveState: function() { - haxe_Log.trace("Saving state...",{ fileName : "src/server/Main.hx", lineNumber : 281, className : "server.Main", methodName : "saveState"}); + haxe_Log.trace("Saving state...",{ fileName : "src/server/Main.hx", lineNumber : 283, className : "server.Main", methodName : "saveState"}); var json = JSON.stringify(this.getCurrentState(),null,"\t"); js_node_Fs.writeFileSync(this.statePath,json); this.writeUsers(this.userList); @@ -4684,7 +4665,7 @@ server_Main.prototype = { if(!sys_FileSystem.exists(this.statePath)) { return; } - haxe_Log.trace("Loading state...",{ fileName : "src/server/Main.hx", lineNumber : 305, className : "server.Main", methodName : "loadState"}); + haxe_Log.trace("Loading state...",{ fileName : "src/server/Main.hx", lineNumber : 307, className : "server.Main", methodName : "loadState"}); var state = JSON.parse(js_node_Fs.readFileSync(this.statePath,{ encoding : "utf8"})); state.flashbacks = state.flashbacks != null ? state.flashbacks : []; state.cachedFiles = state.cachedFiles != null ? state.cachedFiles : []; @@ -4706,7 +4687,7 @@ server_Main.prototype = { } ,logError: function(type,data) { this.cache.removeOlderCache(1048576); - haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 329, className : "server.Main", methodName : "logError", customParams : [data]}); + haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 331, className : "server.Main", methodName : "logError", customParams : [data]}); var crashesFolder = "" + this.userDir + "/crashes"; server_Utils.ensureDir(crashesFolder); var name = DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S") + "-" + type; @@ -4728,7 +4709,7 @@ server_Main.prototype = { if(_gthis.clients.length == 0) { return; } - haxe_Log.trace("Ping " + url,{ fileName : "src/server/Main.hx", lineNumber : 342, className : "server.Main", methodName : "initIntergationHandlers"}); + haxe_Log.trace("Ping " + url,{ fileName : "src/server/Main.hx", lineNumber : 344, className : "server.Main", methodName : "initIntergationHandlers"}); js_node_Http.get(url,null,function(r) { }); }; @@ -4747,13 +4728,13 @@ server_Main.prototype = { password += this.config.salt; var hash = haxe_crypto_Sha256.encode(password); this.userList.admins.push({ name : name, hash : hash}); - haxe_Log.trace("Admin " + name + " added.",{ fileName : "src/server/Main.hx", lineNumber : 363, className : "server.Main", methodName : "addAdmin"}); + haxe_Log.trace("Admin " + name + " added.",{ fileName : "src/server/Main.hx", lineNumber : 365, className : "server.Main", methodName : "addAdmin"}); } ,removeAdmin: function(name) { HxOverrides.remove(this.userList.admins,Lambda.find(this.userList.admins,function(item) { return item.name == name; })); - haxe_Log.trace("Admin " + name + " removed.",{ fileName : "src/server/Main.hx", lineNumber : 370, className : "server.Main", methodName : "removeAdmin"}); + haxe_Log.trace("Admin " + name + " removed.",{ fileName : "src/server/Main.hx", lineNumber : 372, className : "server.Main", methodName : "removeAdmin"}); } ,hasAdmins: function() { return this.userList.admins.length > 0; @@ -4823,7 +4804,7 @@ server_Main.prototype = { var ip = this.clientIp(req); 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 : 433, className : "server.Main", methodName : "onConnect", customParams : ["" + name + " connected (" + ip + ")"]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 435, 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.uuid = uuid; @@ -4837,7 +4818,7 @@ server_Main.prototype = { var obj = _gthis.wsEventParser.fromJson(data.toString()); if(_gthis.wsEventParser.errors.length > 0 || _gthis.noTypeObj(obj)) { var errors = "" + ("Wrong request for type \"" + obj.type + "\":") + "\n" + json2object_ErrorUtils.convertErrorArray(_gthis.wsEventParser.errors); - haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 450, className : "server.Main", methodName : "onConnect"}); + haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 452, className : "server.Main", methodName : "onConnect"}); _gthis.serverMessage(client,errors); return; } @@ -5032,7 +5013,7 @@ server_Main.prototype = { if(!internal) { return; } - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 515, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " disconnected"]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 517, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " disconnected"]}); server_Utils.sortedPush(this.freeIds,client.id); HxOverrides.remove(this.clients,client); this.sendClientList(); @@ -5172,7 +5153,7 @@ server_Main.prototype = { this.send(client,{ type : "LoginError"}); return; } - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 606, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " logged as " + name]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 608, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " logged as " + name]}); client.name = name; client.setGroupFlag(ClientGroup.User,true); this.checkBan(client); @@ -5185,7 +5166,7 @@ server_Main.prototype = { var oldName = client.name; client.name = "Guest " + (this.clients.indexOf(client) + 1); client.setGroupFlag(ClientGroup.User,false); - haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 627, className : "server.Main", methodName : "onMessage", customParams : ["Client " + oldName + " logout to " + client.name]}); + haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 629, className : "server.Main", methodName : "onMessage", customParams : ["Client " + oldName + " logout to " + client.name]}); this.send(client,{ type : data.type, logout : { oldClientName : oldName, clientName : client.name, clients : this.clientList()}}); this.sendClientListExcept(client); break; @@ -5515,7 +5496,7 @@ server_Main.prototype = { client.setGroupFlag(ClientGroup.Banned,!isOutdated); if(isOutdated) { HxOverrides.remove(this.userList.bans,ban); - haxe_Log.trace("" + client.name + " ban removed",{ fileName : "src/server/Main.hx", lineNumber : 1068, className : "server.Main", methodName : "checkBan"}); + haxe_Log.trace("" + client.name + " ban removed",{ fileName : "src/server/Main.hx", lineNumber : 1070, className : "server.Main", methodName : "checkBan"}); this.sendClientList(); } break; diff --git a/res/css/setup.css b/res/css/setup.css index 539b33b..0ea3290 100644 --- a/res/css/setup.css +++ b/res/css/setup.css @@ -1,46 +1,46 @@ body { - display: flex; + display: flex; } .setup { - margin: auto; - padding: 2rem; - width: 320px; - display: flex; - flex-direction: column; - align-items: center; + margin: auto; + padding: 2rem; + width: 320px; + display: flex; + flex-direction: column; + align-items: center; - /* debug */ - background-color: #1a1a1f; - border-radius: 0.375rem; + /* debug */ + background-color: #1a1a1f; + border-radius: 0.375rem; - & h1 { - font-size: 1.75rem; - } + & h1 { + font-size: 1.75rem; + } } .setup-form { - display: flex; - flex-direction: column; - gap: 1rem; - width: 100%; + display: flex; + flex-direction: column; + gap: 1rem; + width: 100%; - & button { - margin: 0; - padding: .75rem .5rem; - justify-content: center; - background-color: var(--accent); - color: #fff; + & button { + margin: 0; + padding: .75rem .5rem; + justify-content: center; + background-color: var(--accent); + color: #fff; - &:hover { - filter: brightness(1.15); - } + &:hover { + filter: brightness(1.15); } + } } .form-errors { - display: flex; - flex-direction: column; - gap: 0.5rem; - color: var(--error); -} \ No newline at end of file + display: flex; + flex-direction: column; + gap: 0.5rem; + color: var(--error); +} diff --git a/res/langs/en.json b/res/langs/en.json index d03df45..1cda8aa 100644 --- a/res/langs/en.json +++ b/res/langs/en.json @@ -1,119 +1,119 @@ { - "connection": "Connection", - "msgConnected": "Connected", - "msgDisconnected": "Disconnected", - "joined": "joined", - "online": "online", - "nothingPlaying": "Nothing Playing", - "hintListStart": "Welcome to SyncTube! Here you can:", - "hintListAddVideo": "$addVideos to watch together", - "hintListRequestLeader": "$requestLeader to pause and rewind videos for everyone", - "hintListRequestLeaderMouse": "(also use right mouse button for quick pause)", - "hintListRequestLeaderTouch": "(also use long tap for quick pause)", - "hintListOpenInApp": "$openInApp this server for better Android experience", - "hintListHide": "$hideThisMessage and send /help in chat to see it again", - "addVideos": "Add Videos", - "requestLeader": "Request Leader", - "openInApp": "Open in App", - "hideThisMessage": "Hide this message", - "usernameError": "Username length must be from 1 to $MAX characters and don't repeat another's. Characters &^<>'\" are not allowed.", - "passwordError": "Password length must be from $MIN to $MAX characters.", - "passwordsMismatchError": "Passwords do not match.", - "passwordMatchError": "Wrong password.", - "accessError": "Access error", - "noPermission": "No '$PERMISSION' permission.", - "totalVideoLimitError": "Playlist video limit has been reached.", - "userVideoLimitError": "Playlist video limit per user has been reached.", - "videoAlreadyExistsError": "The video already exists in playlist.", - "addVideoError": "Failed to add video.", - "adminsCannotBeBannedError": "Admins cannot be banned. Remove them first.", - "caching": "Caching", - "downloading": "Downloading", - "uploading": "Uploading", - "rawVideo": "Raw video", - "videos": "videos", - "addedBy": "Added by", - "play": "Play", - "setNext": "Next", - "makePermanent": "Make Permanent", - "makeTemporary": "Make Temporary", - "delete": "Delete", - "account": "Account", - "exportSettings": "Export Settings", - "importSettings": "Import Settings", - "login": "Login", - "exit": "Exit", - "settings": "Settings", - "synchThreshold": "Synch Threshold", - "general": "General", - "hotkeys": "Hotkeys", - "video": "Video", - "channel": "Channel", - "layout": "Layout", - "swapLayout": "Swap Layout", - "chatOnly": "Chat Only", - "setVideoUrl": "Set Video URL", - "setVideoUrlPrompt": "New video URL:\n(Does not affect other users)", - "selectLocalVideo": "Select Local Video", - "removePlayer": "Remove Player", - "restorePlayer": "Restore Player", - "toggleUserList": "Show/Hide Userlist", - "leaderDesc": "Request video control permissions", - "mobileViewBtn": "Mobile View", - "leader": "Leader", - "enterAsGuest": "Enter As Guest", - "yourName": "Your Name", - "enterUserPassword": "Enter User Password", - "yourPassword": "Your Password", - "emotes": "Emotes", - "chat": "Chat", - "kicked": "Kicked", - "clearChat": "Clear Chat", - "chatlinePlaceholder": "Send a message...", - "leaderDisconnectedServerOnPause": "Leader was disconnected, server on pause.", - "unpause": "Unpause", - "addVideoFromUrl": "Add video from URL", - "embedCustomFrame": "Embed a custom frame", - "clearPlaylist": "Clear playlist", - "shufflePlaylist": "Shuffle playlist", - "playlist": "Playlist", - "playlistOpen": "Playlist open", - "playlistLocked": "Playlist locked", - "expandPlayer": "Expand player", - "toggleVideoSync": "Toggle video synchronization", - "toggleSynchConfirm": "Are you sure you want to turn off video sync?", - "refreshPlayer": "Refresh player", - "fullscreenPlayer": "Fullscreen player", - "retrievePlaylistLinks": "Retrieve playlist links", - "voteForSkip": "Vote for skip", - "addAsTemporary": "Add as temporary", - "cacheOnServer": "Cache on server", - "mediaUrl": "Media URL", - "optionalTitle": "Title (optional)", - "subtitlesUrlOptional": "Subtitles URL (optional)", - "voiceOverAudioTrackUrlOptional": "Voice-over audio URL (optional)", - "addTemplateUrl": "Add template URL", - "queueNext": "Queue next", - "queueLast": "Queue last", - "and": "and", - "or": "or", - "to": "to", - "pasteEmbedCodeAndClick": "Paste the embed code here", - "acceptableEmbedCodesAre": "Acceptable embed codes are", - "customEmbedsCannotBeSynchronized": "CUSTOM EMBEDS CANNOT BE SYNCHRONIZED", - "save": "Save", - "skipItemConfirm": "Are you sure you want to skip current video?", - "clearPlaylistConfirm": "Are you sure you want to clear the playlist?", - "shufflePlaylistConfirm": "Are you sure you want to shuffle the playlist?", - "lockPlaylistConfirm": "Are you sure you want to lock the playlist?", + "connection": "Connection", + "msgConnected": "Connected", + "msgDisconnected": "Disconnected", + "joined": "joined", + "online": "online", + "nothingPlaying": "Nothing Playing", + "hintListStart": "Welcome to SyncTube! Here you can:", + "hintListAddVideo": "$addVideos to watch together", + "hintListRequestLeader": "$requestLeader to pause and rewind videos for everyone", + "hintListRequestLeaderMouse": "(also use right mouse button for quick pause)", + "hintListRequestLeaderTouch": "(also use long tap for quick pause)", + "hintListOpenInApp": "$openInApp this server for better Android experience", + "hintListHide": "$hideThisMessage and send /help in chat to see it again", + "addVideos": "Add Videos", + "requestLeader": "Request Leader", + "openInApp": "Open in App", + "hideThisMessage": "Hide this message", + "usernameError": "Username length must be from 1 to $MAX characters and don't repeat another's. Characters &^<>'\" are not allowed.", + "passwordError": "Password length must be from $MIN to $MAX characters.", + "passwordsMismatchError": "Passwords do not match.", + "passwordMatchError": "Wrong password.", + "accessError": "Access error", + "noPermission": "No '$PERMISSION' permission.", + "totalVideoLimitError": "Playlist video limit has been reached.", + "userVideoLimitError": "Playlist video limit per user has been reached.", + "videoAlreadyExistsError": "The video already exists in playlist.", + "addVideoError": "Failed to add video.", + "adminsCannotBeBannedError": "Admins cannot be banned. Remove them first.", + "caching": "Caching", + "downloading": "Downloading", + "uploading": "Uploading", + "rawVideo": "Raw video", + "videos": "videos", + "addedBy": "Added by", + "play": "Play", + "setNext": "Next", + "makePermanent": "Make Permanent", + "makeTemporary": "Make Temporary", + "delete": "Delete", + "account": "Account", + "exportSettings": "Export Settings", + "importSettings": "Import Settings", + "login": "Login", + "exit": "Exit", + "settings": "Settings", + "synchThreshold": "Synch Threshold", + "general": "General", + "hotkeys": "Hotkeys", + "video": "Video", + "channel": "Channel", + "layout": "Layout", + "swapLayout": "Swap Layout", + "chatOnly": "Chat Only", + "setVideoUrl": "Set Video URL", + "setVideoUrlPrompt": "New video URL:\n(Does not affect other users)", + "selectLocalVideo": "Select Local Video", + "removePlayer": "Remove Player", + "restorePlayer": "Restore Player", + "toggleUserList": "Show/Hide Userlist", + "leaderDesc": "Request video control permissions", + "mobileViewBtn": "Mobile View", + "leader": "Leader", + "enterAsGuest": "Enter As Guest", + "yourName": "Your Name", + "enterUserPassword": "Enter User Password", + "yourPassword": "Your Password", + "emotes": "Emotes", + "chat": "Chat", + "kicked": "Kicked", + "clearChat": "Clear Chat", + "chatlinePlaceholder": "Send a message...", + "leaderDisconnectedServerOnPause": "Leader was disconnected, server on pause.", + "unpause": "Unpause", + "addVideoFromUrl": "Add video from URL", + "embedCustomFrame": "Embed a custom frame", + "clearPlaylist": "Clear playlist", + "shufflePlaylist": "Shuffle playlist", + "playlist": "Playlist", + "playlistOpen": "Playlist open", + "playlistLocked": "Playlist locked", + "expandPlayer": "Expand player", + "toggleVideoSync": "Toggle video synchronization", + "toggleSynchConfirm": "Are you sure you want to turn off video sync?", + "refreshPlayer": "Refresh player", + "fullscreenPlayer": "Fullscreen player", + "retrievePlaylistLinks": "Retrieve playlist links", + "voteForSkip": "Vote for skip", + "addAsTemporary": "Add as temporary", + "cacheOnServer": "Cache on server", + "mediaUrl": "Media URL", + "optionalTitle": "Title (optional)", + "subtitlesUrlOptional": "Subtitles URL (optional)", + "voiceOverAudioTrackUrlOptional": "Voice-over audio URL (optional)", + "addTemplateUrl": "Add template URL", + "queueNext": "Queue next", + "queueLast": "Queue last", + "and": "and", + "or": "or", + "to": "to", + "pasteEmbedCodeAndClick": "Paste the embed code here", + "acceptableEmbedCodesAre": "Acceptable embed codes are", + "customEmbedsCannotBeSynchronized": "CUSTOM EMBEDS CANNOT BE SYNCHRONIZED", + "save": "Save", + "skipItemConfirm": "Are you sure you want to skip current video?", + "clearPlaylistConfirm": "Are you sure you want to clear the playlist?", + "shufflePlaylistConfirm": "Are you sure you want to shuffle the playlist?", + "lockPlaylistConfirm": "Are you sure you want to lock the playlist?", - "yes": "Yes", - "no": "No", - "on": "On", - "off": "Off", + "yes": "Yes", + "no": "No", + "on": "On", + "off": "Off", - "areYouSure": "Are you sure?", - "dataWillBeLost": "The data will be lost.", + "areYouSure": "Are you sure?", + "dataWillBeLost": "The data will be lost.", - "setupTitle": "Welcome to SyncTube!" + "setupTitle": "Welcome to SyncTube!" } diff --git a/res/langs/ru.json b/res/langs/ru.json index 689ad9c..f9c5303 100644 --- a/res/langs/ru.json +++ b/res/langs/ru.json @@ -1,119 +1,119 @@ { - "connection": "Подключение", - "msgConnected": "Соединение установлено", - "msgDisconnected": "Соединение потеряно", - "joined": "вошел", - "online": "онлайн", - "nothingPlaying": "Ничего не играет", - "hintListStart": "Добро пожаловать на SyncTube! Здесь вы можете:", - "hintListAddVideo": "$addVideos для совместного просмотра", - "hintListRequestLeader": "$requestLeader для всеобщей паузы и перемотки видео", - "hintListRequestLeaderMouse": "(кстати, правая кнопка мыши сразу сделает паузу)", - "hintListRequestLeaderTouch": "(кстати, удерживайте кнопку для быстрой паузы)", - "hintListOpenInApp": "$openInApp этот сервер для лучшего опыта на Android", - "hintListHide": "$hideThisMessage и отправлять `/help` в чат чтобы прочесть его снова", - "addVideos": "Добавлять видео", - "requestLeader": "Запрашивать лидера", - "openInApp": "Открыть в приложении", - "hideThisMessage": "Скрыть это сообщение", - "usernameError": "Ник должен быть от 1 до $MAX символов и не повторять чужие. Символы &^<>'\" запрещены.", - "passwordError": "Длина пароля должна быть от $MIN до $MAX символов.", - "passwordsMismatchError": "Пароли не совпадают.", - "passwordMatchError": "Неправильный пароль.", - "accessError": "Ошибка доступа", - "noPermission": "Нет '$PERMISSION' разрешения.", - "totalVideoLimitError": "Был достингут лимит видео в плейлисте.", - "userVideoLimitError": "Был достингут лимит видео на пользователя.", - "videoAlreadyExistsError": "Видео уже имеется в плейлисте.", - "addVideoError": "Не удалось добавить видео.", - "adminsCannotBeBannedError": "Админы не могут быть заблокированы. Сначала удалите их.", - "caching": "Кэширование", - "uploading": "Выгрузка", - "downloading": "Загрузка", - "rawVideo": "Исходное видео", - "videos": "видео", - "addedBy": "Добавлено", - "play": "Воспроизвести", - "setNext": "Следующее", - "makePermanent": "Закрепить", - "makeTemporary": "Открепить", - "delete": "Удалить", - "account": "Аккаунт", - "exportSettings": "Экспорт настроек", - "importSettings": "Импорт настроек", - "login": "Войти", - "exit": "Выход", - "settings": "Настройки", - "synchThreshold": "Частота синхронизации", - "general": "Основное", - "hotkeys": "Горячие клавиши", - "video": "Видео", - "channel": "Канал", - "layout": "Разметка", - "swapLayout": "Сменить разметку", - "chatOnly": "Только чат", - "setVideoUrl": "Задать ссылку на видео", - "setVideoUrlPrompt": "Новая ссылка на видео:\n(Не влияет на других пользователей)", - "selectLocalVideo": "Выбрать локальный видеофайл", - "removePlayer": "Удалить плеер", - "restorePlayer": "Вернуть плеер", - "toggleUserList": "Показать/Скрыть список юзеров", - "leaderDesc": "Запросить права на контроль роликом", - "mobileViewBtn": "Моб. вид", - "leader": "Лидер", - "enterAsGuest": "Войти как гость:", - "yourName": "Ваш ник", - "enterUserPassword": "Введите пароль пользователя", - "yourPassword": "Ваш пароль", - "emotes": "Смайлы", - "chat": "Чат", - "kicked": "Выпнут", - "clearChat": "Очистить чат", - "chatlinePlaceholder": "Введите сообщение...", - "leaderDisconnectedServerOnPause": "Лидер вышел, сервер на паузе.", - "unpause": "Возобновить", - "addVideoFromUrl": "Добавить видео по ссылке", - "embedCustomFrame": "Добавить iframe", - "clearPlaylist": "Очистить плейлист", - "shufflePlaylist": "Перемешать плейлист", - "playlist": "Плейлист", - "playlistOpen": "Плейлист открыт", - "playlistLocked": "Плейлист заблокирован", - "expandPlayer": "Расширить плеер", - "toggleVideoSync": "Переключить синхронизацию видео", - "toggleSynchConfirm": "Вы уверены что хотите отключить синхронизацию видео?", - "refreshPlayer": "Обновить плеер", - "fullscreenPlayer": "Полноэкранный режим видео", - "retrievePlaylistLinks": "Получить ссылки на видео из плейлиста", - "voteForSkip": "Голосовать за пропуск", - "addAsTemporary": "Добавить как временный", - "cacheOnServer": "Закэшировать на сервере", - "mediaUrl": "Ссылка на видео", - "optionalTitle": "Заголовок (опционально)", - "subtitlesUrlOptional": "Ссылка на субтитры (опционально)", - "voiceOverAudioTrackUrlOptional": "Ссылка на аудиодорожку (опционально)", - "addTemplateUrl": "Добавить пример ссылки", - "queueNext": "След.", - "queueLast": "В конец", - "and": "и", - "or": "или", - "to": "в", - "pasteEmbedCodeAndClick": "Вставьте код видео в это поле", - "acceptableEmbedCodesAre": "Можно добавить видео с тегами", - "customEmbedsCannotBeSynchronized": "СИНХРОНИЗАЦИЯ БУДЕТ НЕДОСТУПНА", - "save": "Сохранить", - "skipItemConfirm": "Вы уверены что хотите пропустить текущее видео?", - "clearPlaylistConfirm": "Вы уверены что хотите очистить плейлист?", - "shufflePlaylistConfirm": "Вы уверены что хотите перемешать плейлист?", - "lockPlaylistConfirm": "Вы уверены что хотите заблокировать плейлист?", + "connection": "Подключение", + "msgConnected": "Соединение установлено", + "msgDisconnected": "Соединение потеряно", + "joined": "вошел", + "online": "онлайн", + "nothingPlaying": "Ничего не играет", + "hintListStart": "Добро пожаловать на SyncTube! Здесь вы можете:", + "hintListAddVideo": "$addVideos для совместного просмотра", + "hintListRequestLeader": "$requestLeader для всеобщей паузы и перемотки видео", + "hintListRequestLeaderMouse": "(кстати, правая кнопка мыши сразу сделает паузу)", + "hintListRequestLeaderTouch": "(кстати, удерживайте кнопку для быстрой паузы)", + "hintListOpenInApp": "$openInApp этот сервер для лучшего опыта на Android", + "hintListHide": "$hideThisMessage и отправлять `/help` в чат чтобы прочесть его снова", + "addVideos": "Добавлять видео", + "requestLeader": "Запрашивать лидера", + "openInApp": "Открыть в приложении", + "hideThisMessage": "Скрыть это сообщение", + "usernameError": "Ник должен быть от 1 до $MAX символов и не повторять чужие. Символы &^<>'\" запрещены.", + "passwordError": "Длина пароля должна быть от $MIN до $MAX символов.", + "passwordsMismatchError": "Пароли не совпадают.", + "passwordMatchError": "Неправильный пароль.", + "accessError": "Ошибка доступа", + "noPermission": "Нет '$PERMISSION' разрешения.", + "totalVideoLimitError": "Был достингут лимит видео в плейлисте.", + "userVideoLimitError": "Был достингут лимит видео на пользователя.", + "videoAlreadyExistsError": "Видео уже имеется в плейлисте.", + "addVideoError": "Не удалось добавить видео.", + "adminsCannotBeBannedError": "Админы не могут быть заблокированы. Сначала удалите их.", + "caching": "Кэширование", + "uploading": "Выгрузка", + "downloading": "Загрузка", + "rawVideo": "Исходное видео", + "videos": "видео", + "addedBy": "Добавлено", + "play": "Воспроизвести", + "setNext": "Следующее", + "makePermanent": "Закрепить", + "makeTemporary": "Открепить", + "delete": "Удалить", + "account": "Аккаунт", + "exportSettings": "Экспорт настроек", + "importSettings": "Импорт настроек", + "login": "Войти", + "exit": "Выход", + "settings": "Настройки", + "synchThreshold": "Частота синхронизации", + "general": "Основное", + "hotkeys": "Горячие клавиши", + "video": "Видео", + "channel": "Канал", + "layout": "Разметка", + "swapLayout": "Сменить разметку", + "chatOnly": "Только чат", + "setVideoUrl": "Задать ссылку на видео", + "setVideoUrlPrompt": "Новая ссылка на видео:\n(Не влияет на других пользователей)", + "selectLocalVideo": "Выбрать локальный видеофайл", + "removePlayer": "Удалить плеер", + "restorePlayer": "Вернуть плеер", + "toggleUserList": "Показать/Скрыть список юзеров", + "leaderDesc": "Запросить права на контроль роликом", + "mobileViewBtn": "Моб. вид", + "leader": "Лидер", + "enterAsGuest": "Войти как гость:", + "yourName": "Ваш ник", + "enterUserPassword": "Введите пароль пользователя", + "yourPassword": "Ваш пароль", + "emotes": "Смайлы", + "chat": "Чат", + "kicked": "Выпнут", + "clearChat": "Очистить чат", + "chatlinePlaceholder": "Введите сообщение...", + "leaderDisconnectedServerOnPause": "Лидер вышел, сервер на паузе.", + "unpause": "Возобновить", + "addVideoFromUrl": "Добавить видео по ссылке", + "embedCustomFrame": "Добавить iframe", + "clearPlaylist": "Очистить плейлист", + "shufflePlaylist": "Перемешать плейлист", + "playlist": "Плейлист", + "playlistOpen": "Плейлист открыт", + "playlistLocked": "Плейлист заблокирован", + "expandPlayer": "Расширить плеер", + "toggleVideoSync": "Переключить синхронизацию видео", + "toggleSynchConfirm": "Вы уверены что хотите отключить синхронизацию видео?", + "refreshPlayer": "Обновить плеер", + "fullscreenPlayer": "Полноэкранный режим видео", + "retrievePlaylistLinks": "Получить ссылки на видео из плейлиста", + "voteForSkip": "Голосовать за пропуск", + "addAsTemporary": "Добавить как временный", + "cacheOnServer": "Закэшировать на сервере", + "mediaUrl": "Ссылка на видео", + "optionalTitle": "Заголовок (опционально)", + "subtitlesUrlOptional": "Ссылка на субтитры (опционально)", + "voiceOverAudioTrackUrlOptional": "Ссылка на аудиодорожку (опционально)", + "addTemplateUrl": "Добавить пример ссылки", + "queueNext": "След.", + "queueLast": "В конец", + "and": "и", + "or": "или", + "to": "в", + "pasteEmbedCodeAndClick": "Вставьте код видео в это поле", + "acceptableEmbedCodesAre": "Можно добавить видео с тегами", + "customEmbedsCannotBeSynchronized": "СИНХРОНИЗАЦИЯ БУДЕТ НЕДОСТУПНА", + "save": "Сохранить", + "skipItemConfirm": "Вы уверены что хотите пропустить текущее видео?", + "clearPlaylistConfirm": "Вы уверены что хотите очистить плейлист?", + "shufflePlaylistConfirm": "Вы уверены что хотите перемешать плейлист?", + "lockPlaylistConfirm": "Вы уверены что хотите заблокировать плейлист?", - "yes": "Да", - "no": "Нет", - "on": "Вкл.", - "off": "Откл.", + "yes": "Да", + "no": "Нет", + "on": "Вкл.", + "off": "Откл.", - "areYouSure": "Вы уверены?", - "dataWillBeLost": "Данные будут потеряны.", + "areYouSure": "Вы уверены?", + "dataWillBeLost": "Данные будут потеряны.", - "setupTitle": "Добро пожаловать в SyncTube!" + "setupTitle": "Добро пожаловать в SyncTube!" } diff --git a/res/setup.html b/res/setup.html index d5dcea6..d92938e 100644 --- a/res/setup.html +++ b/res/setup.html @@ -60,7 +60,7 @@

SyncTube

const errors = !response ? ["Unknown error"] - : Object.values(response.errors || {}); + : (response.errors ?? []).map(item => item.error); showErrors(errorsElement, errors); } @@ -77,4 +77,4 @@

SyncTube

- \ No newline at end of file + diff --git a/src/Types.hx b/src/Types.hx index 9b4a3ff..2dfe899 100644 --- a/src/Types.hx +++ b/src/Types.hx @@ -33,8 +33,6 @@ typedef Config = { port:Int, channelName:String, maxLoginLength:Int, - minPasswordLength:Int, - maxPasswordLength:Int, maxMessageLength:Int, serverChatHistory:Int, totalVideoLimit:Int, diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx index fc33bfb..b68376c 100644 --- a/src/server/HttpServer.hx +++ b/src/server/HttpServer.hx @@ -113,8 +113,8 @@ class HttpServer { return redirect(res, "/"); } - Fs.readFile("res/setup.html", (err:Dynamic, data:Buffer) -> { - data = cast localizeHtml(data.toString(), req.headers["accept-language"]); + Fs.readFile('$dir/setup.html', (err:Dynamic, data:Buffer) -> { + data = Buffer.from(localizeHtml(data.toString(), req.headers["accept-language"])); res.setHeader("content-type", getMimeType("html")); res.end(data); }); @@ -144,7 +144,7 @@ class HttpServer { } if (ext == "html") { - if (!main.hasAdmins()) { + if (!main.isNoState && !main.hasAdmins()) { return redirect(res, "/setup"); } // replace ${textId} to localized strings @@ -235,7 +235,7 @@ class HttpServer { } function redirect(res:ServerResponse, pathname:String) { - res.writeHead(302, { "Location": pathname }); + res.writeHead(302, {"Location": pathname}); return res.end(); } @@ -245,60 +245,69 @@ class HttpServer { } final lang = req.headers["accept-language"]; - var bodyChunks:Array = []; + var bodyChunks:Array = []; - req.on("data", function(chunk) { + req.on("data", chunk -> { bodyChunks.push(chunk); }); - req.on("end", function() { - try { - final body = Buffer.concat(bodyChunks).toString(); - final jsonData:Dynamic = haxe.Json.parse(body); - - final name = Std.string(jsonData.name); - final password = Std.string(jsonData.password); - final passwordConfirmation = Std.string(jsonData.passwordConfirmation); - - var errors:Map = []; - - final lang = req.headers["accept-language"]; - if (main.isBadClientName(name)) { - final error = Lang.get(lang, "usernameError") - .replace("$MAX", '${main.config.maxLoginLength}'); - errors["name"] = error; - } + req.on("end", () -> { + final body = Buffer.concat(bodyChunks).toString(); + final jsonData:{ + name:String, + password:String, + passwordConfirmation:String + } = try { + Json.parse(body); + } catch (e) { + res.writeHead(400, {"Content-Type": "application/json"}); + res.end(Json.stringify({success: false, errors: []})); + return; + } - final min = main.config.minPasswordLength; - final max = main.config.maxPasswordLength; - if (password.length < min || password.length > max) { - final error = Lang.get(lang, "passwordError") - .replace("$MIN", '${min}') - .replace("$MAX", '${max}'); - errors["password"] = error; - } + final name = Std.string(jsonData.name); + final password = Std.string(jsonData.password); + final passwordConfirmation = Std.string(jsonData.passwordConfirmation); - if (password != passwordConfirmation) { - final error = Lang.get(lang, "passwordsMismatchError"); - errors["password"] = error; - } + final errors:Array<{type:String, error:String}> = []; - if (!errors.empty()) { - var errorObj = {}; - for (key => value in errors) { - Reflect.setField(errorObj, key, value); - } - throw errorObj; - } + final lang = req.headers["accept-language"]; + if (main.isBadClientName(name)) { + final error = Lang.get(lang, "usernameError") + .replace("$MAX", '${main.config.maxLoginLength}'); + errors.push({ + type: "name", + error: error + }); + } - main.addAdmin(name, password); + final min = Main.MIN_PASSWORD_LENGTH; + final max = Main.MAX_PASSWORD_LENGTH; + if (password.length < min || password.length > max) { + final error = Lang.get(lang, "passwordError") + .replace("$MIN", '$min').replace("$MAX", '$max'); + errors.push({ + type: "password", + error: error + }); + } - res.writeHead(200, { "Content-Type": "application/json" }); - res.end(haxe.Json.stringify({ success: true })); - } catch (e:Dynamic) { - res.writeHead(400, { "Content-Type": "application/json" }); - res.end(haxe.Json.stringify({ success: false, errors: e })); + if (password != passwordConfirmation) { + errors.push({ + type: "password", + error: Lang.get(lang, "passwordsMismatchError") + }); } + + if (errors.length > 0) { + res.writeHead(400, {"Content-Type": "application/json"}); + res.end(Json.stringify({success: false, errors: errors})); + return; + } + + main.addAdmin(name, password); + res.writeHead(200, {"Content-Type": "application/json"}); + res.end(Json.stringify({success: true})); }); } diff --git a/src/server/Main.hx b/src/server/Main.hx index dd938b1..61cb46b 100644 --- a/src/server/Main.hx +++ b/src/server/Main.hx @@ -31,6 +31,8 @@ private typedef MainOptions = { } class Main { + public static inline var MIN_PASSWORD_LENGTH = 4; + public static inline var MAX_PASSWORD_LENGTH = 50; static inline var VIDEO_START_MAX_DELAY = 3000; static inline var VIDEO_SKIP_DELAY = 1000; static inline var FLASHBACKS_COUNT = 50; @@ -42,8 +44,8 @@ class Main { public final userDir:String; public final logsDir:String; public final config:Config; + public final isNoState:Bool; - final isNoState:Bool; final verbose:Bool; final statePath:String; var wss:WSServer; From 7b0ecfff36bd0a8b8a5b2170a1f0d562fcd6ff50 Mon Sep 17 00:00:00 2001 From: RblSb Date: Mon, 7 Apr 2025 17:49:29 +0300 Subject: [PATCH 4/4] Check json typing and clean stuff --- build-server.hxml | 6 +- build/server.js | 1745 +++++++++++++++++----------------- default-config.json | 2 - res/client.js | 8 +- res/css/des.css | 2 +- res/css/setup.css | 3 + res/setup.html | 138 +-- src/server/HttpServer.hx | 65 +- src/server/import.hx | 3 + src/tools/HttpServerTools.hx | 22 + tests.hxml | 3 +- 11 files changed, 1023 insertions(+), 974 deletions(-) create mode 100644 src/server/import.hx create mode 100644 src/tools/HttpServerTools.hx diff --git a/build-server.hxml b/build-server.hxml index fdf77c0..7bc5e6b 100644 --- a/build-server.hxml +++ b/build-server.hxml @@ -1,7 +1,6 @@ --library hxnodejs --library hxnodejs-ws ---library json2object:git:https://github.com/RblSb/json2object.git --D junsafe_compiler_cache +--library json2object:git:https://github.com/RblSb/json2object.git#nightly_safe_macros # Client libs for completion --library youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git --library hls.js-extern:git:https://github.com/zoldesi-andor/hls.js-haxe-extern.git @@ -9,6 +8,7 @@ --class-path src --main server.Main -D analyzer-optimize --w -WDeprecatedEnumAbstract +# -w -WDeprecatedEnumAbstract +-w -WDeprecated --dce full --js build/server.js diff --git a/build/server.js b/build/server.js index 50b50b8..f4e8b91 100644 --- a/build/server.js +++ b/build/server.js @@ -513,17 +513,17 @@ json2object_reader_BaseParser.prototype = { } ,__class__: json2object_reader_BaseParser }; -var JsonParser_$1 = function(errors,putils,errorType) { +var JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$1.__name__ = true; -JsonParser_$1.__super__ = json2object_reader_BaseParser; -JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.__name__ = true; +JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.__super__ = json2object_reader_BaseParser; +JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ ?updatePlaylist : Null<{ videoList : Array }>, ?updateClients : Null<{ clients : Array }>, type : WsEventType, ?togglePlaylistLock : Null<{ isOpen : Bool }>, ?toggleItemType : Null<{ pos : Int }>, ?skipVideo : Null<{ url : String }>, ?setTime : Null<{ time : Float }>, ?setRate : Null<{ rate : Float }>, ?setNextItem : Null<{ pos : Int }>, ?setLeader : Null<{ clientName : String }>, ?serverMessage : Null<{ textId : String }>, ?rewind : Null<{ time : Float }>, ?removeVideo : Null<{ url : String }>, ?progress : Null<{ type : ProgressType, ratio : Float, ?data : Null }>, ?playItem : Null<{ pos : Int }>, ?play : Null<{ time : Float }>, ?pause : Null<{ time : Float }>, ?message : Null<{ text : String, clientName : String }>, ?logout : Null<{ oldClientName : String, clients : Array, clientName : String }>, ?login : Null<{ ?passHash : Null, ?isUnknownClient : Null, ?clients : Null>, clientName : String }>, ?kickClient : Null<{ name : String }>, ?getTime : Null, ?dump : Null<{ data : String }>, ?connected : Null<{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }>, ?banClient : Null<{ time : Float, name : String }>, ?addVideo : Null<{ item : VideoItem, atEnd : Bool }> }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, group : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -531,90 +531,18 @@ JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["addVideo","banClient","connected","dump","getTime","kickClient","login","logout","message","pause","play","playItem","progress","removeVideo","rewind","serverMessage","setLeader","setNextItem","setRate","setTime","skipVideo","toggleItemType","togglePlaylistLock","type","updateClients","updatePlaylist"],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true]); + this.objectSetupAssign(assigned,["group","name"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "addVideo": - this.value.addVideo = this.loadObjectField(($_=new JsonParser_$3(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"addVideo",assigned,this.value.addVideo,pos); - break; - case "banClient": - this.value.banClient = this.loadObjectField(($_=new JsonParser_$5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banClient",assigned,this.value.banClient,pos); - break; - case "connected": - this.value.connected = this.loadObjectField(($_=new JsonParser_$7(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"connected",assigned,this.value.connected,pos); - break; - case "dump": - this.value.dump = this.loadObjectField(($_=new JsonParser_$9(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"dump",assigned,this.value.dump,pos); - break; - case "getTime": - this.value.getTime = this.loadObjectField(($_=new JsonParser_$12(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"getTime",assigned,this.value.getTime,pos); - break; - case "kickClient": - this.value.kickClient = this.loadObjectField(($_=new JsonParser_$14(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"kickClient",assigned,this.value.kickClient,pos); - break; - case "login": - this.value.login = this.loadObjectField(($_=new JsonParser_$16(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"login",assigned,this.value.login,pos); - break; - case "logout": - this.value.logout = this.loadObjectField(($_=new JsonParser_$18(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"logout",assigned,this.value.logout,pos); - break; - case "message": - this.value.message = this.loadObjectField(($_=new JsonParser_$20(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"message",assigned,this.value.message,pos); - break; - case "pause": - this.value.pause = this.loadObjectField(($_=new JsonParser_$22(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pause",assigned,this.value.pause,pos); - break; - case "play": - this.value.play = this.loadObjectField(($_=new JsonParser_$22(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"play",assigned,this.value.play,pos); - break; - case "playItem": - this.value.playItem = this.loadObjectField(($_=new JsonParser_$24(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playItem",assigned,this.value.playItem,pos); - break; - case "progress": - this.value.progress = this.loadObjectField(($_=new JsonParser_$26(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"progress",assigned,this.value.progress,pos); - break; - case "removeVideo": - this.value.removeVideo = this.loadObjectField(($_=new JsonParser_$28(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"removeVideo",assigned,this.value.removeVideo,pos); - break; - case "rewind": - this.value.rewind = this.loadObjectField(($_=new JsonParser_$22(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rewind",assigned,this.value.rewind,pos); - break; - case "serverMessage": - this.value.serverMessage = this.loadObjectField(($_=new JsonParser_$30(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverMessage",assigned,this.value.serverMessage,pos); - break; - case "setLeader": - this.value.setLeader = this.loadObjectField(($_=new JsonParser_$32(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setLeader",assigned,this.value.setLeader,pos); - break; - case "setNextItem": - this.value.setNextItem = this.loadObjectField(($_=new JsonParser_$24(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setNextItem",assigned,this.value.setNextItem,pos); - break; - case "setRate": - this.value.setRate = this.loadObjectField(($_=new JsonParser_$34(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setRate",assigned,this.value.setRate,pos); - break; - case "setTime": - this.value.setTime = this.loadObjectField(($_=new JsonParser_$22(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setTime",assigned,this.value.setTime,pos); - break; - case "skipVideo": - this.value.skipVideo = this.loadObjectField(($_=new JsonParser_$28(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"skipVideo",assigned,this.value.skipVideo,pos); - break; - case "toggleItemType": - this.value.toggleItemType = this.loadObjectField(($_=new JsonParser_$24(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"toggleItemType",assigned,this.value.toggleItemType,pos); - break; - case "togglePlaylistLock": - this.value.togglePlaylistLock = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"togglePlaylistLock",assigned,this.value.togglePlaylistLock,pos); - break; - case "type": - this.value.type = this.loadObjectField(($_=new JsonParser_$37(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); - break; - case "updateClients": - this.value.updateClients = this.loadObjectField(($_=new JsonParser_$39(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updateClients",assigned,this.value.updateClients,pos); + case "group": + this.value.group = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos); break; - case "updatePlaylist": - this.value.updatePlaylist = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updatePlaylist",assigned,this.value.updatePlaylist,pos); + case "name": + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -623,69 +551,42 @@ JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { addVideo : new JsonParser_$3([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banClient : new JsonParser_$5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), connected : new JsonParser_$7([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), dump : new JsonParser_$9([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), getTime : new JsonParser_$12([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), kickClient : new JsonParser_$14([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), login : new JsonParser_$16([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), logout : new JsonParser_$18([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), message : new JsonParser_$20([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pause : new JsonParser_$22([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), play : new JsonParser_$22([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playItem : new JsonParser_$24([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), progress : new JsonParser_$26([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), removeVideo : new JsonParser_$28([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rewind : new JsonParser_$22([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverMessage : new JsonParser_$30([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setLeader : new JsonParser_$32([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setNextItem : new JsonParser_$24([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setRate : new JsonParser_$34([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setTime : new JsonParser_$22([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), skipVideo : new JsonParser_$28([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), toggleItemType : new JsonParser_$24([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), togglePlaylistLock : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updateClients : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updatePlaylist : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { group : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$1 + ,__class__: JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11 }); -var JsonParser_$12 = function(errors,putils,errorType) { +var JsonParser_$08065556836b0755d9c8e1550cf9f19c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$12.__name__ = true; -JsonParser_$12.__super__ = json2object_reader_BaseParser; -JsonParser_$12.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$08065556836b0755d9c8e1550cf9f19c.__name__ = true; +JsonParser_$08065556836b0755d9c8e1550cf9f19c.__super__ = json2object_reader_BaseParser; +JsonParser_$08065556836b0755d9c8e1550cf9f19c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, ?rate : Null, ?pausedByServer : Null, ?paused : Null }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonObject: function(o,pos,variable) { - var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["paused","pausedByServer","rate","time"],[true,true,true,false]); - this.value = this.getAuto(); - var _g = 0; - while(_g < o.length) { - var field = o[_g]; - ++_g; - switch(field.name) { - case "paused": - this.value.paused = this.loadObjectField(($_=new JsonParser_$61(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos); - break; - case "pausedByServer": - this.value.pausedByServer = this.loadObjectField(($_=new JsonParser_$61(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pausedByServer",assigned,this.value.pausedByServer,pos); - break; - case "rate": - this.value.rate = this.loadObjectField(($_=new JsonParser_$63(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); - break; - case "time": - this.value.time = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); - break; - default: - this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); - } - } - this.objectErrors(assigned,pos); - } - ,getAuto: function() { - return { paused : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pausedByServer : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$63([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + ,loadJsonNumber: function(f,pos,variable) { + this.value = this.loadJsonFloat(f,pos,variable,this.value); } - ,__class__: JsonParser_$12 + ,__class__: JsonParser_$08065556836b0755d9c8e1550cf9f19c }); -var JsonParser_$14 = function(errors,putils,errorType) { +var JsonParser_$126814d365d277a375ef70de1963f53d = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$14.__name__ = true; -JsonParser_$14.__super__ = json2object_reader_BaseParser; -JsonParser_$14.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$126814d365d277a375ef70de1963f53d.__name__ = true; +JsonParser_$126814d365d277a375ef70de1963f53d.__super__ = json2object_reader_BaseParser; +JsonParser_$126814d365d277a375ef70de1963f53d.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ clients : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -693,14 +594,14 @@ JsonParser_$14.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["name"],[false]); + this.objectSetupAssign(assigned,["clients"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "name") { - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + if(field.name == "clients") { + this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -708,19 +609,19 @@ JsonParser_$14.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$14 + ,__class__: JsonParser_$126814d365d277a375ef70de1963f53d }); -var JsonParser_$16 = function(errors,putils,errorType) { +var JsonParser_$128275a4734b926daca1924fc6a200c7 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$16.__name__ = true; -JsonParser_$16.__super__ = json2object_reader_BaseParser; -JsonParser_$16.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$128275a4734b926daca1924fc6a200c7.__name__ = true; +JsonParser_$128275a4734b926daca1924fc6a200c7.__super__ = json2object_reader_BaseParser; +JsonParser_$128275a4734b926daca1924fc6a200c7.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ ?passHash : Null, ?isUnknownClient : Null, ?clients : Null>, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -738,16 +639,16 @@ JsonParser_$16.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$59(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + this.value.clients = this.loadObjectField(($_=new JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; case "isUnknownClient": - this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$61(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); + this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); break; case "passHash": - this.value.passHash = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos); + this.value.passHash = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -756,21 +657,40 @@ JsonParser_$16.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$59([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$16 + ,__class__: JsonParser_$128275a4734b926daca1924fc6a200c7 }); -var JsonParser_$18 = function(errors,putils,errorType) { +var JsonParser_$1686a6c336b71b36d77354cea19a8b52 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); + this.value = 0; }; -JsonParser_$18.__name__ = true; -JsonParser_$18.__super__ = json2object_reader_BaseParser; -JsonParser_$18.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$1686a6c336b71b36d77354cea19a8b52.__name__ = true; +JsonParser_$1686a6c336b71b36d77354cea19a8b52.__super__ = json2object_reader_BaseParser; +JsonParser_$1686a6c336b71b36d77354cea19a8b52.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ oldClientName : String, clients : Array, clientName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos)); + json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); + } + ,loadJsonNumber: function(f,pos,variable) { + this.value = this.loadJsonInt(f,pos,variable,this.value); + } + ,__class__: JsonParser_$1686a6c336b71b36d77354cea19a8b52 +}); +var JsonParser_$17f62a9968afd16686d4888a98c34102 = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$17f62a9968afd16686d4888a98c34102.__name__ = true; +JsonParser_$17f62a9968afd16686d4888a98c34102.__super__ = json2object_reader_BaseParser; +JsonParser_$17f62a9968afd16686d4888a98c34102.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { + this.errors.push(json2object_Error.IncorrectType(variable,"{ item : VideoItem, atEnd : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -778,21 +698,18 @@ JsonParser_$18.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName","clients","oldClientName"],[false,false,false]); + this.objectSetupAssign(assigned,["atEnd","item"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); - break; - case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$53(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + case "atEnd": + this.value.atEnd = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"atEnd",assigned,this.value.atEnd,pos); break; - case "oldClientName": - this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"oldClientName",assigned,this.value.oldClientName,pos); + case "item": + this.value.item = this.loadObjectField(($_=new JsonParser_$d89734267d6f665b411f49f013149267(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"item",assigned,this.value.item,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -801,137 +718,104 @@ JsonParser_$18.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { atEnd : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), item : new JsonParser_$d89734267d6f665b411f49f013149267([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$18 + ,__class__: JsonParser_$17f62a9968afd16686d4888a98c34102 }); -var JsonParser_$20 = function(errors,putils,errorType) { +var JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); + this.value = 0; }; -JsonParser_$20.__name__ = true; -JsonParser_$20.__super__ = json2object_reader_BaseParser; -JsonParser_$20.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.__name__ = true; +JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.__super__ = json2object_reader_BaseParser; +JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ text : String, clientName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } + ,loadJsonNumber: function(f,pos,variable) { + this.value = this.loadJsonFloat(f,pos,variable,this.value); + } + ,__class__: JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b +}); +var JsonParser_$237c3c85cf00342dfb7f01e6a6157d10 = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.__name__ = true; +JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.__super__ = json2object_reader_BaseParser; +JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { + this.value = "RawType"; + this.errors.push(json2object_Error.IncorrectType(variable,"PlayerType",pos)); + this.objectThrow(pos,variable); + } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonObject: function(o,pos,variable) { - var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName","text"],[false,false]); - this.value = this.getAuto(); - var _g = 0; - while(_g < o.length) { - var field = o[_g]; - ++_g; - switch(field.name) { - case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); - break; - case "text": - this.value.text = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); - break; - default: - this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); - } - } - this.objectErrors(assigned,pos); - } - ,getAuto: function() { - return { clientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + ,loadJsonString: function(s,pos,variable) { + this.value = this.loadString(s,pos,variable,["RawType","YoutubeType","VkType","IframeType"],"RawType"); } - ,__class__: JsonParser_$20 + ,__class__: JsonParser_$237c3c85cf00342dfb7f01e6a6157d10 }); -var JsonParser_$22 = function(errors,putils,errorType) { +var JsonParser_$269e3fee3d557ee1c48cb89bee0049dc = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$22.__name__ = true; -JsonParser_$22.__super__ = json2object_reader_BaseParser; -JsonParser_$22.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.__name__ = true; +JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.__super__ = json2object_reader_BaseParser; +JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonObject: function(o,pos,variable) { - var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["time"],[false]); - this.value = this.getAuto(); - var _g = 0; - while(_g < o.length) { - var field = o[_g]; - ++_g; - if(field.name == "time") { - this.value.time = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); - } else { - this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); - } - } - this.objectErrors(assigned,pos); - } - ,getAuto: function() { - return { time : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$22 + ,__class__: JsonParser_$269e3fee3d557ee1c48cb89bee0049dc }); -var JsonParser_$24 = function(errors,putils,errorType) { +var JsonParser_$27118326006d3829667a400ad23d5d98 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$24.__name__ = true; -JsonParser_$24.__super__ = json2object_reader_BaseParser; -JsonParser_$24.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$27118326006d3829667a400ad23d5d98.__name__ = true; +JsonParser_$27118326006d3829667a400ad23d5d98.__super__ = json2object_reader_BaseParser; +JsonParser_$27118326006d3829667a400ad23d5d98.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ pos : Int }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonObject: function(o,pos,variable) { - var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["pos"],[false]); - this.value = this.getAuto(); - var _g = 0; - while(_g < o.length) { - var field = o[_g]; - ++_g; - if(field.name == "pos") { - this.value.pos = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos); - } else { - this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); - } - } - this.objectErrors(assigned,pos); - } - ,getAuto: function() { - return { pos : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + ,loadJsonString: function(s,pos,variable) { + this.value = s; } - ,__class__: JsonParser_$24 + ,__class__: JsonParser_$27118326006d3829667a400ad23d5d98 }); -var JsonParser_$26 = function(errors,putils,errorType) { +var JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$26.__name__ = true; -JsonParser_$26.__super__ = json2object_reader_BaseParser; -JsonParser_$26.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.__name__ = true; +JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.__super__ = json2object_reader_BaseParser; +JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ type : ProgressType, ratio : Float, ?data : Null }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ text : String, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -939,21 +823,18 @@ JsonParser_$26.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["data","ratio","type"],[true,false,false]); + this.objectSetupAssign(assigned,["clientName","text"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "data": - this.value.data = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); - break; - case "ratio": - this.value.ratio = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"ratio",assigned,this.value.ratio,pos); + case "clientName": + this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; - case "type": - this.value.type = this.loadObjectField(($_=new JsonParser_$57(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); + case "text": + this.value.text = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -962,21 +843,21 @@ JsonParser_$26.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { data : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), ratio : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$26 + ,__class__: JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb }); -var JsonParser_$28 = function(errors,putils,errorType) { +var JsonParser_$359929cb56fda98b8740cbc66ef083c4 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$28.__name__ = true; -JsonParser_$28.__super__ = json2object_reader_BaseParser; -JsonParser_$28.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$359929cb56fda98b8740cbc66ef083c4.__name__ = true; +JsonParser_$359929cb56fda98b8740cbc66ef083c4.__super__ = json2object_reader_BaseParser; +JsonParser_$359929cb56fda98b8740cbc66ef083c4.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ rate : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -984,14 +865,14 @@ JsonParser_$28.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["url"],[false]); + this.objectSetupAssign(assigned,["rate"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "url") { - this.value.url = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); + if(field.name == "rate") { + this.value.rate = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -999,21 +880,42 @@ JsonParser_$28.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { url : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { rate : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$28 + ,__class__: JsonParser_$359929cb56fda98b8740cbc66ef083c4 }); -var JsonParser_$3 = function(errors,putils,errorType) { +var JsonParser_$4152afa9599cfde83ddff5d84d1707c8 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$3.__name__ = true; -JsonParser_$3.__super__ = json2object_reader_BaseParser; -JsonParser_$3.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$4152afa9599cfde83ddff5d84d1707c8.__name__ = true; +JsonParser_$4152afa9599cfde83ddff5d84d1707c8.__super__ = json2object_reader_BaseParser; +JsonParser_$4152afa9599cfde83ddff5d84d1707c8.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ item : VideoItem, atEnd : Bool }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); + } + ,loadJsonNull: function(pos,variable) { + this.value = null; + } + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$d7778d0c64b6ba21494c97f77a66885a(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + } + ,__class__: JsonParser_$4152afa9599cfde83ddff5d84d1707c8 +}); +var JsonParser_$4b72cd217167f3afa7ba448cbebefe3a = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.__name__ = true; +JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.__super__ = json2object_reader_BaseParser; +JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { + this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, image : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1021,18 +923,18 @@ JsonParser_$3.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["atEnd","item"],[false,false]); + this.objectSetupAssign(assigned,["image","name"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "atEnd": - this.value.atEnd = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"atEnd",assigned,this.value.atEnd,pos); + case "image": + this.value.image = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"image",assigned,this.value.image,pos); break; - case "item": - this.value.item = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"item",assigned,this.value.item,pos); + case "name": + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -1041,21 +943,21 @@ JsonParser_$3.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { atEnd : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), item : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { image : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$3 + ,__class__: JsonParser_$4b72cd217167f3afa7ba448cbebefe3a }); -var JsonParser_$30 = function(errors,putils,errorType) { +var JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$30.__name__ = true; -JsonParser_$30.__super__ = json2object_reader_BaseParser; -JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.__name__ = true; +JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.__super__ = json2object_reader_BaseParser; +JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ textId : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ time : String, text : String, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1063,36 +965,44 @@ JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["textId"],[false]); + this.objectSetupAssign(assigned,["name","text","time"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "textId") { - this.value.textId = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"textId",assigned,this.value.textId,pos); - } else { + switch(field.name) { + case "name": + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + break; + case "text": + this.value.text = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); + break; + case "time": + this.value.time = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); + break; + default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { textId : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$30 + ,__class__: JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4 }); -var JsonParser_$32 = function(errors,putils,errorType) { +var JsonParser_$5696efcdbd81f0be9220dc4cfb255706 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$32.__name__ = true; -JsonParser_$32.__super__ = json2object_reader_BaseParser; -JsonParser_$32.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$5696efcdbd81f0be9220dc4cfb255706.__name__ = true; +JsonParser_$5696efcdbd81f0be9220dc4cfb255706.__super__ = json2object_reader_BaseParser; +JsonParser_$5696efcdbd81f0be9220dc4cfb255706.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ clientName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ pos : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1100,14 +1010,14 @@ JsonParser_$32.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName"],[false]); + this.objectSetupAssign(assigned,["pos"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "clientName") { - this.value.clientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + if(field.name == "pos") { + this.value.pos = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -1115,58 +1025,42 @@ JsonParser_$32.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { pos : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$32 + ,__class__: JsonParser_$5696efcdbd81f0be9220dc4cfb255706 }); -var JsonParser_$34 = function(errors,putils,errorType) { +var JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$34.__name__ = true; -JsonParser_$34.__super__ = json2object_reader_BaseParser; -JsonParser_$34.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.__name__ = true; +JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.__super__ = json2object_reader_BaseParser; +JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ rate : Float }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonObject: function(o,pos,variable) { - var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["rate"],[false]); - this.value = this.getAuto(); - var _g = 0; - while(_g < o.length) { - var field = o[_g]; - ++_g; - if(field.name == "rate") { - this.value.rate = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); - } else { - this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); - } - } - this.objectErrors(assigned,pos); - } - ,getAuto: function() { - return { rate : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$34 + ,__class__: JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d }); -var JsonParser_$36 = function(errors,putils,errorType) { +var JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$36.__name__ = true; -JsonParser_$36.__super__ = json2object_reader_BaseParser; -JsonParser_$36.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.__name__ = true; +JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.__super__ = json2object_reader_BaseParser; +JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ isOpen : Bool }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ ?updatePlaylist : Null<{ videoList : Array }>, ?updateClients : Null<{ clients : Array }>, type : WsEventType, ?togglePlaylistLock : Null<{ isOpen : Bool }>, ?toggleItemType : Null<{ pos : Int }>, ?skipVideo : Null<{ url : String }>, ?setTime : Null<{ time : Float }>, ?setRate : Null<{ rate : Float }>, ?setNextItem : Null<{ pos : Int }>, ?setLeader : Null<{ clientName : String }>, ?serverMessage : Null<{ textId : String }>, ?rewind : Null<{ time : Float }>, ?removeVideo : Null<{ url : String }>, ?progress : Null<{ type : ProgressType, ratio : Float, ?data : Null }>, ?playItem : Null<{ pos : Int }>, ?play : Null<{ time : Float }>, ?pause : Null<{ time : Float }>, ?message : Null<{ text : String, clientName : String }>, ?logout : Null<{ oldClientName : String, clients : Array, clientName : String }>, ?login : Null<{ ?passHash : Null, ?isUnknownClient : Null, ?clients : Null>, clientName : String }>, ?kickClient : Null<{ name : String }>, ?getTime : Null, ?dump : Null<{ data : String }>, ?connected : Null<{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }>, ?banClient : Null<{ time : Float, name : String }>, ?addVideo : Null<{ item : VideoItem, atEnd : Bool }> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1174,58 +1068,113 @@ JsonParser_$36.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["isOpen"],[false]); + this.objectSetupAssign(assigned,["addVideo","banClient","connected","dump","getTime","kickClient","login","logout","message","pause","play","playItem","progress","removeVideo","rewind","serverMessage","setLeader","setNextItem","setRate","setTime","skipVideo","toggleItemType","togglePlaylistLock","type","updateClients","updatePlaylist"],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "isOpen") { - this.value.isOpen = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isOpen",assigned,this.value.isOpen,pos); - } else { + switch(field.name) { + case "addVideo": + this.value.addVideo = this.loadObjectField(($_=new JsonParser_$17f62a9968afd16686d4888a98c34102(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"addVideo",assigned,this.value.addVideo,pos); + break; + case "banClient": + this.value.banClient = this.loadObjectField(($_=new JsonParser_$cceff829ad5e63207b6f78bebb03c69a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banClient",assigned,this.value.banClient,pos); + break; + case "connected": + this.value.connected = this.loadObjectField(($_=new JsonParser_$d011018d886fa55f8828ebb1e93413c3(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"connected",assigned,this.value.connected,pos); + break; + case "dump": + this.value.dump = this.loadObjectField(($_=new JsonParser_$dda5f87e2972892b16c7b833df96706a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"dump",assigned,this.value.dump,pos); + break; + case "getTime": + this.value.getTime = this.loadObjectField(($_=new JsonParser_$feded5bdb427eb48f39e60029d5dca4a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"getTime",assigned,this.value.getTime,pos); + break; + case "kickClient": + this.value.kickClient = this.loadObjectField(($_=new JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"kickClient",assigned,this.value.kickClient,pos); + break; + case "login": + this.value.login = this.loadObjectField(($_=new JsonParser_$128275a4734b926daca1924fc6a200c7(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"login",assigned,this.value.login,pos); + break; + case "logout": + this.value.logout = this.loadObjectField(($_=new JsonParser_$8d3a3702ec359ae3022bce905b75550b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"logout",assigned,this.value.logout,pos); + break; + case "message": + this.value.message = this.loadObjectField(($_=new JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"message",assigned,this.value.message,pos); + break; + case "pause": + this.value.pause = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pause",assigned,this.value.pause,pos); + break; + case "play": + this.value.play = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"play",assigned,this.value.play,pos); + break; + case "playItem": + this.value.playItem = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playItem",assigned,this.value.playItem,pos); + break; + case "progress": + this.value.progress = this.loadObjectField(($_=new JsonParser_$e15c2211613da80aa2992b6249949a65(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"progress",assigned,this.value.progress,pos); + break; + case "removeVideo": + this.value.removeVideo = this.loadObjectField(($_=new JsonParser_$bf1400338ef221d86126b3ec267cf395(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"removeVideo",assigned,this.value.removeVideo,pos); + break; + case "rewind": + this.value.rewind = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rewind",assigned,this.value.rewind,pos); + break; + case "serverMessage": + this.value.serverMessage = this.loadObjectField(($_=new JsonParser_$d1c1e71f4452df068de6cecc104f6dd6(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverMessage",assigned,this.value.serverMessage,pos); + break; + case "setLeader": + this.value.setLeader = this.loadObjectField(($_=new JsonParser_$65985176838b1da92d970132a0cb6d58(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setLeader",assigned,this.value.setLeader,pos); + break; + case "setNextItem": + this.value.setNextItem = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setNextItem",assigned,this.value.setNextItem,pos); + break; + case "setRate": + this.value.setRate = this.loadObjectField(($_=new JsonParser_$359929cb56fda98b8740cbc66ef083c4(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setRate",assigned,this.value.setRate,pos); + break; + case "setTime": + this.value.setTime = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setTime",assigned,this.value.setTime,pos); + break; + case "skipVideo": + this.value.skipVideo = this.loadObjectField(($_=new JsonParser_$bf1400338ef221d86126b3ec267cf395(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"skipVideo",assigned,this.value.skipVideo,pos); + break; + case "toggleItemType": + this.value.toggleItemType = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"toggleItemType",assigned,this.value.toggleItemType,pos); + break; + case "togglePlaylistLock": + this.value.togglePlaylistLock = this.loadObjectField(($_=new JsonParser_$e5a960b500232cc84a0caf718de13706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"togglePlaylistLock",assigned,this.value.togglePlaylistLock,pos); + break; + case "type": + this.value.type = this.loadObjectField(($_=new JsonParser_$d8e5213783812cec0906ca233f0379dc(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); + break; + case "updateClients": + this.value.updateClients = this.loadObjectField(($_=new JsonParser_$126814d365d277a375ef70de1963f53d(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updateClients",assigned,this.value.updateClients,pos); + break; + case "updatePlaylist": + this.value.updatePlaylist = this.loadObjectField(($_=new JsonParser_$a82c17fc41c21179c58e1d406d2b20cd(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updatePlaylist",assigned,this.value.updatePlaylist,pos); + break; + default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { isOpen : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; - } - ,__class__: JsonParser_$36 -}); -var JsonParser_$37 = function(errors,putils,errorType) { - if(errorType == null) { - errorType = 0; - } - json2object_reader_BaseParser.call(this,errors,putils,errorType); -}; -JsonParser_$37.__name__ = true; -JsonParser_$37.__super__ = json2object_reader_BaseParser; -JsonParser_$37.prototype = $extend(json2object_reader_BaseParser.prototype,{ - onIncorrectType: function(pos,variable) { - this.value = "Connected"; - this.errors.push(json2object_Error.IncorrectType(variable,"WsEventType",pos)); - this.objectThrow(pos,variable); + return { addVideo : new JsonParser_$17f62a9968afd16686d4888a98c34102([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banClient : new JsonParser_$cceff829ad5e63207b6f78bebb03c69a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), connected : new JsonParser_$d011018d886fa55f8828ebb1e93413c3([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), dump : new JsonParser_$dda5f87e2972892b16c7b833df96706a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), getTime : new JsonParser_$feded5bdb427eb48f39e60029d5dca4a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), kickClient : new JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), login : new JsonParser_$128275a4734b926daca1924fc6a200c7([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), logout : new JsonParser_$8d3a3702ec359ae3022bce905b75550b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), message : new JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pause : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), play : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playItem : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), progress : new JsonParser_$e15c2211613da80aa2992b6249949a65([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), removeVideo : new JsonParser_$bf1400338ef221d86126b3ec267cf395([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rewind : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverMessage : new JsonParser_$d1c1e71f4452df068de6cecc104f6dd6([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setLeader : new JsonParser_$65985176838b1da92d970132a0cb6d58([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setNextItem : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setRate : new JsonParser_$359929cb56fda98b8740cbc66ef083c4([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setTime : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), skipVideo : new JsonParser_$bf1400338ef221d86126b3ec267cf395([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), toggleItemType : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), togglePlaylistLock : new JsonParser_$e5a960b500232cc84a0caf718de13706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$d8e5213783812cec0906ca233f0379dc([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updateClients : new JsonParser_$126814d365d277a375ef70de1963f53d([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updatePlaylist : new JsonParser_$a82c17fc41c21179c58e1d406d2b20cd([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,loadJsonNull: function(pos,variable) { - this.value = null; - } - ,loadJsonString: function(s,pos,variable) { - this.value = this.loadString(s,pos,variable,["Connected","Disconnected","Login","PasswordRequest","LoginError","Logout","Message","ServerMessage","Progress","UpdateClients","BanClient","KickClient","AddVideo","RemoveVideo","SkipVideo","VideoLoaded","Pause","Play","GetTime","SetTime","SetRate","Rewind","Flashback","SetLeader","PlayItem","SetNextItem","ToggleItemType","ClearChat","ClearPlaylist","ShufflePlaylist","UpdatePlaylist","TogglePlaylistLock","Dump"],"Connected"); - } - ,__class__: JsonParser_$37 + ,__class__: JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9 }); -var JsonParser_$39 = function(errors,putils,errorType) { +var JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$39.__name__ = true; -JsonParser_$39.__super__ = json2object_reader_BaseParser; -JsonParser_$39.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.__name__ = true; +JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.__super__ = json2object_reader_BaseParser; +JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ clients : Array }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1233,14 +1182,14 @@ JsonParser_$39.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clients"],[false]); + this.objectSetupAssign(assigned,["time"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "clients") { - this.value.clients = this.loadObjectField(($_=new JsonParser_$53(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + if(field.name == "time") { + this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -1248,21 +1197,21 @@ JsonParser_$39.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clients : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$39 + ,__class__: JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162 }); -var JsonParser_$41 = function(errors,putils,errorType) { +var JsonParser_$65985176838b1da92d970132a0cb6d58 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$41.__name__ = true; -JsonParser_$41.__super__ = json2object_reader_BaseParser; -JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$65985176838b1da92d970132a0cb6d58.__name__ = true; +JsonParser_$65985176838b1da92d970132a0cb6d58.__super__ = json2object_reader_BaseParser; +JsonParser_$65985176838b1da92d970132a0cb6d58.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1270,14 +1219,14 @@ JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["videoList"],[false]); + this.objectSetupAssign(assigned,["clientName"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "videoList") { - this.value.videoList = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); + if(field.name == "clientName") { + this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -1285,42 +1234,42 @@ JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { videoList : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$41 + ,__class__: JsonParser_$65985176838b1da92d970132a0cb6d58 }); -var JsonParser_$44 = function(errors,putils,errorType) { +var JsonParser_$65cb6553a71d34740bf81458b7243f94 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$44.__name__ = true; -JsonParser_$44.__super__ = json2object_reader_BaseParser; -JsonParser_$44.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$65cb6553a71d34740bf81458b7243f94.__name__ = true; +JsonParser_$65cb6553a71d34740bf81458b7243f94.__super__ = json2object_reader_BaseParser; +JsonParser_$65cb6553a71d34740bf81458b7243f94.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$46(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$ed5dea09095f671b801bee34ea28a319(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$44 + ,__class__: JsonParser_$65cb6553a71d34740bf81458b7243f94 }); -var JsonParser_$46 = function(errors,putils,errorType) { +var JsonParser_$8d3a3702ec359ae3022bce905b75550b = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$46.__name__ = true; -JsonParser_$46.__super__ = json2object_reader_BaseParser; -JsonParser_$46.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$8d3a3702ec359ae3022bce905b75550b.__name__ = true; +JsonParser_$8d3a3702ec359ae3022bce905b75550b.__super__ = json2object_reader_BaseParser; +JsonParser_$8d3a3702ec359ae3022bce905b75550b.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ ?voiceOverTrack : Null, url : String, title : String, ?subs : Null, playerType : PlayerType, isTemp : Bool, duration : Float, doCache : Bool, author : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ oldClientName : String, clients : Array, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1328,39 +1277,21 @@ JsonParser_$46.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["author","doCache","duration","isTemp","playerType","subs","title","url","voiceOverTrack"],[false,false,false,false,false,true,false,false,true]); + this.objectSetupAssign(assigned,["clientName","clients","oldClientName"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "author": - this.value.author = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"author",assigned,this.value.author,pos); - break; - case "doCache": - this.value.doCache = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"doCache",assigned,this.value.doCache,pos); - break; - case "duration": - this.value.duration = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"duration",assigned,this.value.duration,pos); - break; - case "isTemp": - this.value.isTemp = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos); - break; - case "playerType": - this.value.playerType = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playerType",assigned,this.value.playerType,pos); - break; - case "subs": - this.value.subs = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos); - break; - case "title": - this.value.title = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos); + case "clientName": + this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; - case "url": - this.loadObjectFieldReflect(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,pos); + case "clients": + this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; - case "voiceOverTrack": - this.value.voiceOverTrack = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"voiceOverTrack",assigned,this.value.voiceOverTrack,pos); + case "oldClientName": + this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"oldClientName",assigned,this.value.oldClientName,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -1369,80 +1300,100 @@ JsonParser_$46.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { author : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), doCache : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playerType : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), voiceOverTrack : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$46 + ,__class__: JsonParser_$8d3a3702ec359ae3022bce905b75550b }); -var JsonParser_$47 = function(errors,putils,errorType) { +var JsonParser_$a82c17fc41c21179c58e1d406d2b20cd = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$47.__name__ = true; -JsonParser_$47.__super__ = json2object_reader_BaseParser; -JsonParser_$47.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.__name__ = true; +JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.__super__ = json2object_reader_BaseParser; +JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonString: function(s,pos,variable) { - this.value = s; + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["videoList"],[false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + if(field.name == "videoList") { + this.value.videoList = this.loadObjectField(($_=new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); + } else { + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); } - ,__class__: JsonParser_$47 + ,getAuto: function() { + return { videoList : new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + } + ,__class__: JsonParser_$a82c17fc41c21179c58e1d406d2b20cd }); -var JsonParser_$48 = function(errors,putils,errorType) { +var JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); - this.value = false; }; -JsonParser_$48.__name__ = true; -JsonParser_$48.__super__ = json2object_reader_BaseParser; -JsonParser_$48.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.__name__ = true; +JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.__super__ = json2object_reader_BaseParser; +JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } - ,loadJsonBool: function(b,pos,variable) { - this.value = b; + ,loadJsonNull: function(pos,variable) { + this.value = null; } - ,__class__: JsonParser_$48 + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$d89734267d6f665b411f49f013149267(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + } + ,__class__: JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c }); -var JsonParser_$49 = function(errors,putils,errorType) { +var JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); - this.value = 0; }; -JsonParser_$49.__name__ = true; -JsonParser_$49.__super__ = json2object_reader_BaseParser; -JsonParser_$49.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.__name__ = true; +JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.__super__ = json2object_reader_BaseParser; +JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } - ,loadJsonNumber: function(f,pos,variable) { - this.value = this.loadJsonFloat(f,pos,variable,this.value); + ,loadJsonNull: function(pos,variable) { + this.value = null; } - ,__class__: JsonParser_$49 + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$4b72cd217167f3afa7ba448cbebefe3a(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + } + ,__class__: JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2 }); -var JsonParser_$5 = function(errors,putils,errorType) { +var JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$5.__name__ = true; -JsonParser_$5.__super__ = json2object_reader_BaseParser; -JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.__name__ = true; +JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.__super__ = json2object_reader_BaseParser; +JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, name : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1450,105 +1401,113 @@ JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["name","time"],[false,false]); + this.objectSetupAssign(assigned,["name"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - switch(field.name) { - case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); - break; - case "time": - this.value.time = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); - break; - default: + if(field.name == "name") { + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$5 + ,__class__: JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca }); -var JsonParser_$50 = function(errors,putils,errorType) { +var JsonParser_$b3a4781c98609b64e4a870171c45561f = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$50.__name__ = true; -JsonParser_$50.__super__ = json2object_reader_BaseParser; -JsonParser_$50.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$b3a4781c98609b64e4a870171c45561f.__name__ = true; +JsonParser_$b3a4781c98609b64e4a870171c45561f.__super__ = json2object_reader_BaseParser; +JsonParser_$b3a4781c98609b64e4a870171c45561f.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.value = "RawType"; - this.errors.push(json2object_Error.IncorrectType(variable,"PlayerType",pos)); - this.objectThrow(pos,variable); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonString: function(s,pos,variable) { - this.value = this.loadString(s,pos,variable,["RawType","YoutubeType","VkType","IframeType"],"RawType"); + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$50 + ,__class__: JsonParser_$b3a4781c98609b64e4a870171c45561f }); -var JsonParser_$52 = function(errors,putils,errorType) { +var JsonParser_$bf1400338ef221d86126b3ec267cf395 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$52.__name__ = true; -JsonParser_$52.__super__ = json2object_reader_BaseParser; -JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$bf1400338ef221d86126b3ec267cf395.__name__ = true; +JsonParser_$bf1400338ef221d86126b3ec267cf395.__super__ = json2object_reader_BaseParser; +JsonParser_$bf1400338ef221d86126b3ec267cf395.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonString: function(s,pos,variable) { - this.value = s; + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["url"],[false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + if(field.name == "url") { + this.value.url = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); + } else { + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); + } + ,getAuto: function() { + return { url : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$52 + ,__class__: JsonParser_$bf1400338ef221d86126b3ec267cf395 }); -var JsonParser_$53 = function(errors,putils,errorType) { +var JsonParser_$c26f15e86e3de4c398a8273272aba034 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); + this.value = false; }; -JsonParser_$53.__name__ = true; -JsonParser_$53.__super__ = json2object_reader_BaseParser; -JsonParser_$53.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$c26f15e86e3de4c398a8273272aba034.__name__ = true; +JsonParser_$c26f15e86e3de4c398a8273272aba034.__super__ = json2object_reader_BaseParser; +JsonParser_$c26f15e86e3de4c398a8273272aba034.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } - ,loadJsonNull: function(pos,variable) { - this.value = null; - } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$55(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonBool: function(b,pos,variable) { + this.value = b; } - ,__class__: JsonParser_$53 + ,__class__: JsonParser_$c26f15e86e3de4c398a8273272aba034 }); -var JsonParser_$55 = function(errors,putils,errorType) { +var JsonParser_$cceff829ad5e63207b6f78bebb03c69a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$55.__name__ = true; -JsonParser_$55.__super__ = json2object_reader_BaseParser; -JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$cceff829ad5e63207b6f78bebb03c69a.__name__ = true; +JsonParser_$cceff829ad5e63207b6f78bebb03c69a.__super__ = json2object_reader_BaseParser; +JsonParser_$cceff829ad5e63207b6f78bebb03c69a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, group : Int }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1556,18 +1515,18 @@ JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["group","name"],[false,false]); + this.objectSetupAssign(assigned,["name","time"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "group": - this.value.group = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos); - break; case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + break; + case "time": + this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -1576,125 +1535,141 @@ JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { group : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$55 + ,__class__: JsonParser_$cceff829ad5e63207b6f78bebb03c69a }); -var JsonParser_$56 = function(errors,putils,errorType) { +var JsonParser_$d011018d886fa55f8828ebb1e93413c3 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); - this.value = 0; }; -JsonParser_$56.__name__ = true; -JsonParser_$56.__super__ = json2object_reader_BaseParser; -JsonParser_$56.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d011018d886fa55f8828ebb1e93413c3.__name__ = true; +JsonParser_$d011018d886fa55f8828ebb1e93413c3.__super__ = json2object_reader_BaseParser; +JsonParser_$d011018d886fa55f8828ebb1e93413c3.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } - ,loadJsonNumber: function(f,pos,variable) { - this.value = this.loadJsonInt(f,pos,variable,this.value); - } - ,__class__: JsonParser_$56 -}); -var JsonParser_$57 = function(errors,putils,errorType) { - if(errorType == null) { - errorType = 0; - } - json2object_reader_BaseParser.call(this,errors,putils,errorType); -}; -JsonParser_$57.__name__ = true; -JsonParser_$57.__super__ = json2object_reader_BaseParser; -JsonParser_$57.prototype = $extend(json2object_reader_BaseParser.prototype,{ - onIncorrectType: function(pos,variable) { - this.value = "Caching"; - this.errors.push(json2object_Error.IncorrectType(variable,"ProgressType",pos)); - this.objectThrow(pos,variable); - } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonString: function(s,pos,variable) { - this.value = this.loadString(s,pos,variable,["Caching","Downloading","Uploading","Canceled"],"Caching"); - } - ,__class__: JsonParser_$57 -}); -var JsonParser_$59 = function(errors,putils,errorType) { - if(errorType == null) { - errorType = 0; - } - json2object_reader_BaseParser.call(this,errors,putils,errorType); -}; -JsonParser_$59.__name__ = true; -JsonParser_$59.__super__ = json2object_reader_BaseParser; -JsonParser_$59.prototype = $extend(json2object_reader_BaseParser.prototype,{ - onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); - json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); - } - ,loadJsonNull: function(pos,variable) { - this.value = null; + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["clientName","clients","config","globalIp","history","isPlaylistOpen","isUnknownClient","itemPos","playersCacheSupport","uuid","videoList"],[false,false,false,false,false,false,false,false,false,false,false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + switch(field.name) { + case "clientName": + this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + break; + case "clients": + this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + break; + case "config": + this.value.config = this.loadObjectField(($_=new JsonParser_$fa535ffb25e1fd20341652f9be21e06e(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos); + break; + case "globalIp": + this.value.globalIp = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"globalIp",assigned,this.value.globalIp,pos); + break; + case "history": + this.value.history = this.loadObjectField(($_=new JsonParser_$d853ed77ba06d4925d9511d45b7002f6(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"history",assigned,this.value.history,pos); + break; + case "isPlaylistOpen": + this.value.isPlaylistOpen = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isPlaylistOpen",assigned,this.value.isPlaylistOpen,pos); + break; + case "isUnknownClient": + this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); + break; + case "itemPos": + this.value.itemPos = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos); + break; + case "playersCacheSupport": + this.value.playersCacheSupport = this.loadObjectField(($_=new JsonParser_$269e3fee3d557ee1c48cb89bee0049dc(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playersCacheSupport",assigned,this.value.playersCacheSupport,pos); + break; + case "uuid": + this.value.uuid = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"uuid",assigned,this.value.uuid,pos); + break; + case "videoList": + this.value.videoList = this.loadObjectField(($_=new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); + break; + default: + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$55(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,getAuto: function() { + return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$fa535ffb25e1fd20341652f9be21e06e([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$d853ed77ba06d4925d9511d45b7002f6([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playersCacheSupport : new JsonParser_$269e3fee3d557ee1c48cb89bee0049dc([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), uuid : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$59 + ,__class__: JsonParser_$d011018d886fa55f8828ebb1e93413c3 }); -var JsonParser_$61 = function(errors,putils,errorType) { +var JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$61.__name__ = true; -JsonParser_$61.__super__ = json2object_reader_BaseParser; -JsonParser_$61.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.__name__ = true; +JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.__super__ = json2object_reader_BaseParser; +JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ user : Array, leader : Array, guest : Array, banned : Array, admin : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonBool: function(b,pos,variable) { - this.value = b; - } - ,__class__: JsonParser_$61 -}); -var JsonParser_$63 = function(errors,putils,errorType) { - if(errorType == null) { - errorType = 0; - } - json2object_reader_BaseParser.call(this,errors,putils,errorType); -}; -JsonParser_$63.__name__ = true; -JsonParser_$63.__super__ = json2object_reader_BaseParser; -JsonParser_$63.prototype = $extend(json2object_reader_BaseParser.prototype,{ - onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); - json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); - } - ,loadJsonNull: function(pos,variable) { - this.value = null; + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["admin","banned","guest","leader","user"],[false,false,false,false,false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + switch(field.name) { + case "admin": + this.value.admin = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"admin",assigned,this.value.admin,pos); + break; + case "banned": + this.value.banned = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banned",assigned,this.value.banned,pos); + break; + case "guest": + this.value.guest = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"guest",assigned,this.value.guest,pos); + break; + case "leader": + this.value.leader = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"leader",assigned,this.value.leader,pos); + break; + case "user": + this.value.user = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"user",assigned,this.value.user,pos); + break; + default: + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); } - ,loadJsonNumber: function(f,pos,variable) { - this.value = this.loadJsonFloat(f,pos,variable,this.value); + ,getAuto: function() { + return { admin : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banned : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), guest : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), leader : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), user : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$63 + ,__class__: JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29 }); -var JsonParser_$65 = function(errors,putils,errorType) { +var JsonParser_$d1c1e71f4452df068de6cecc104f6dd6 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$65.__name__ = true; -JsonParser_$65.__super__ = json2object_reader_BaseParser; -JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.__name__ = true; +JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.__super__ = json2object_reader_BaseParser; +JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ textId : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1702,140 +1677,105 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); + this.objectSetupAssign(assigned,["textId"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - switch(field.name) { - case "allowProxyIps": - this.value.allowProxyIps = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"allowProxyIps",assigned,this.value.allowProxyIps,pos); - break; - case "cacheStorageLimitGiB": - this.value.cacheStorageLimitGiB = this.loadObjectField(($_=new JsonParser_$49(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"cacheStorageLimitGiB",assigned,this.value.cacheStorageLimitGiB,pos); - break; - case "channelName": - this.value.channelName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"channelName",assigned,this.value.channelName,pos); - break; - case "emotes": - this.value.emotes = this.loadObjectField(($_=new JsonParser_$70(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"emotes",assigned,this.value.emotes,pos); - break; - case "filters": - this.value.filters = this.loadObjectField(($_=new JsonParser_$71(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos); - break; - case "isVerbose": - this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$61(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos); - break; - case "localAdmins": - this.value.localAdmins = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localAdmins",assigned,this.value.localAdmins,pos); - break; - case "localNetworkOnly": - this.value.localNetworkOnly = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localNetworkOnly",assigned,this.value.localNetworkOnly,pos); - break; - case "maxLoginLength": - this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos); - break; - case "maxMessageLength": - this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); - break; - case "permissions": - this.value.permissions = this.loadObjectField(($_=new JsonParser_$73(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); - break; - case "port": - this.value.port = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos); - break; - case "requestLeaderOnPause": - this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos); - break; - case "salt": - this.value.salt = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos); - break; - case "serverChatHistory": - this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos); - break; - case "templateUrl": - this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos); - break; - case "totalVideoLimit": - this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos); - break; - case "unpauseWithoutLeader": - this.value.unpauseWithoutLeader = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"unpauseWithoutLeader",assigned,this.value.unpauseWithoutLeader,pos); - break; - case "userVideoLimit": - this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos); - break; - case "youtubeApiKey": - this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); - break; - case "youtubePlaylistLimit": - this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos); - break; - default: + if(field.name == "textId") { + this.value.textId = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"textId",assigned,this.value.textId,pos); + } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { allowProxyIps : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$49([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$70([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$71([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$73([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { textId : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$65 + ,__class__: JsonParser_$d1c1e71f4452df068de6cecc104f6dd6 }); -var JsonParser_$66 = function(errors,putils,errorType) { +var JsonParser_$d7778d0c64b6ba21494c97f77a66885a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$66.__name__ = true; -JsonParser_$66.__super__ = json2object_reader_BaseParser; -JsonParser_$66.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d7778d0c64b6ba21494c97f77a66885a.__name__ = true; +JsonParser_$d7778d0c64b6ba21494c97f77a66885a.__super__ = json2object_reader_BaseParser; +JsonParser_$d7778d0c64b6ba21494c97f77a66885a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ replace : String, regex : String, name : String, flags : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$69(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["flags","name","regex","replace"],[false,false,false,false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + switch(field.name) { + case "flags": + this.value.flags = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"flags",assigned,this.value.flags,pos); + break; + case "name": + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + break; + case "regex": + this.value.regex = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"regex",assigned,this.value.regex,pos); + break; + case "replace": + this.value.replace = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"replace",assigned,this.value.replace,pos); + break; + default: + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); + } + ,getAuto: function() { + return { flags : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), regex : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), replace : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$66 + ,__class__: JsonParser_$d7778d0c64b6ba21494c97f77a66885a }); -var JsonParser_$67 = function(errors,putils,errorType) { +var JsonParser_$d853ed77ba06d4925d9511d45b7002f6 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$67.__name__ = true; -JsonParser_$67.__super__ = json2object_reader_BaseParser; -JsonParser_$67.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d853ed77ba06d4925d9511d45b7002f6.__name__ = true; +JsonParser_$d853ed77ba06d4925d9511d45b7002f6.__super__ = json2object_reader_BaseParser; +JsonParser_$d853ed77ba06d4925d9511d45b7002f6.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$50(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$67 + ,__class__: JsonParser_$d853ed77ba06d4925d9511d45b7002f6 }); -var JsonParser_$69 = function(errors,putils,errorType) { +var JsonParser_$d89734267d6f665b411f49f013149267 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$69.__name__ = true; -JsonParser_$69.__super__ = json2object_reader_BaseParser; -JsonParser_$69.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d89734267d6f665b411f49f013149267.__name__ = true; +JsonParser_$d89734267d6f665b411f49f013149267.__super__ = json2object_reader_BaseParser; +JsonParser_$d89734267d6f665b411f49f013149267.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ time : String, text : String, name : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ ?voiceOverTrack : Null, url : String, title : String, ?subs : Null, playerType : PlayerType, isTemp : Bool, duration : Float, doCache : Bool, author : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1843,21 +1783,39 @@ JsonParser_$69.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["name","text","time"],[false,false,false]); + this.objectSetupAssign(assigned,["author","doCache","duration","isTemp","playerType","subs","title","url","voiceOverTrack"],[false,false,false,false,false,true,false,false,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + case "author": + this.value.author = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"author",assigned,this.value.author,pos); break; - case "text": - this.value.text = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); + case "doCache": + this.value.doCache = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"doCache",assigned,this.value.doCache,pos); break; - case "time": - this.value.time = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); + case "duration": + this.value.duration = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"duration",assigned,this.value.duration,pos); + break; + case "isTemp": + this.value.isTemp = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos); + break; + case "playerType": + this.value.playerType = this.loadObjectField(($_=new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playerType",assigned,this.value.playerType,pos); + break; + case "subs": + this.value.subs = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos); + break; + case "title": + this.value.title = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos); + break; + case "url": + this.loadObjectFieldReflect(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,pos); + break; + case "voiceOverTrack": + this.value.voiceOverTrack = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"voiceOverTrack",assigned,this.value.voiceOverTrack,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -1866,21 +1824,43 @@ JsonParser_$69.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { author : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), doCache : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playerType : new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), voiceOverTrack : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$69 + ,__class__: JsonParser_$d89734267d6f665b411f49f013149267 }); -var JsonParser_$7 = function(errors,putils,errorType) { +var JsonParser_$d8e5213783812cec0906ca233f0379dc = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$7.__name__ = true; -JsonParser_$7.__super__ = json2object_reader_BaseParser; -JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$d8e5213783812cec0906ca233f0379dc.__name__ = true; +JsonParser_$d8e5213783812cec0906ca233f0379dc.__super__ = json2object_reader_BaseParser; +JsonParser_$d8e5213783812cec0906ca233f0379dc.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }",pos)); + this.value = "Connected"; + this.errors.push(json2object_Error.IncorrectType(variable,"WsEventType",pos)); + this.objectThrow(pos,variable); + } + ,loadJsonNull: function(pos,variable) { + this.value = null; + } + ,loadJsonString: function(s,pos,variable) { + this.value = this.loadString(s,pos,variable,["Connected","Disconnected","Login","PasswordRequest","LoginError","Logout","Message","ServerMessage","Progress","UpdateClients","BanClient","KickClient","AddVideo","RemoveVideo","SkipVideo","VideoLoaded","Pause","Play","GetTime","SetTime","SetRate","Rewind","Flashback","SetLeader","PlayItem","SetNextItem","ToggleItemType","ClearChat","ClearPlaylist","ShufflePlaylist","UpdatePlaylist","TogglePlaylistLock","Dump"],"Connected"); + } + ,__class__: JsonParser_$d8e5213783812cec0906ca233f0379dc +}); +var JsonParser_$dda5f87e2972892b16c7b833df96706a = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$dda5f87e2972892b16c7b833df96706a.__name__ = true; +JsonParser_$dda5f87e2972892b16c7b833df96706a.__super__ = json2object_reader_BaseParser; +JsonParser_$dda5f87e2972892b16c7b833df96706a.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { + this.errors.push(json2object_Error.IncorrectType(variable,"{ data : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1888,110 +1868,102 @@ JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName","clients","config","globalIp","history","isPlaylistOpen","isUnknownClient","itemPos","playersCacheSupport","uuid","videoList"],[false,false,false,false,false,false,false,false,false,false,false]); + this.objectSetupAssign(assigned,["data"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - switch(field.name) { - case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); - break; - case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$53(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); - break; - case "config": - this.value.config = this.loadObjectField(($_=new JsonParser_$65(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos); - break; - case "globalIp": - this.value.globalIp = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"globalIp",assigned,this.value.globalIp,pos); - break; - case "history": - this.value.history = this.loadObjectField(($_=new JsonParser_$66(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"history",assigned,this.value.history,pos); - break; - case "isPlaylistOpen": - this.value.isPlaylistOpen = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isPlaylistOpen",assigned,this.value.isPlaylistOpen,pos); - break; - case "isUnknownClient": - this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); - break; - case "itemPos": - this.value.itemPos = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos); - break; - case "playersCacheSupport": - this.value.playersCacheSupport = this.loadObjectField(($_=new JsonParser_$67(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playersCacheSupport",assigned,this.value.playersCacheSupport,pos); - break; - case "uuid": - this.value.uuid = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"uuid",assigned,this.value.uuid,pos); - break; - case "videoList": - this.value.videoList = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); - break; - default: + if(field.name == "data") { + this.value.data = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); + } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$65([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$66([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playersCacheSupport : new JsonParser_$67([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), uuid : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { data : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$7 + ,__class__: JsonParser_$dda5f87e2972892b16c7b833df96706a }); -var JsonParser_$70 = function(errors,putils,errorType) { +var JsonParser_$ddce6d3de223cb2759be5c48797abca5 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$70.__name__ = true; -JsonParser_$70.__super__ = json2object_reader_BaseParser; -JsonParser_$70.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$ddce6d3de223cb2759be5c48797abca5.__name__ = true; +JsonParser_$ddce6d3de223cb2759be5c48797abca5.__super__ = json2object_reader_BaseParser; +JsonParser_$ddce6d3de223cb2759be5c48797abca5.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$79(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonString: function(s,pos,variable) { + this.value = s; } - ,__class__: JsonParser_$70 + ,__class__: JsonParser_$ddce6d3de223cb2759be5c48797abca5 }); -var JsonParser_$71 = function(errors,putils,errorType) { +var JsonParser_$e15c2211613da80aa2992b6249949a65 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$71.__name__ = true; -JsonParser_$71.__super__ = json2object_reader_BaseParser; -JsonParser_$71.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$e15c2211613da80aa2992b6249949a65.__name__ = true; +JsonParser_$e15c2211613da80aa2992b6249949a65.__super__ = json2object_reader_BaseParser; +JsonParser_$e15c2211613da80aa2992b6249949a65.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ type : ProgressType, ratio : Float, ?data : Null }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$77(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["data","ratio","type"],[true,false,false]); + this.value = this.getAuto(); + var _g = 0; + while(_g < o.length) { + var field = o[_g]; + ++_g; + switch(field.name) { + case "data": + this.value.data = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); + break; + case "ratio": + this.value.ratio = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"ratio",assigned,this.value.ratio,pos); + break; + case "type": + this.value.type = this.loadObjectField(($_=new JsonParser_$ec6c0149f584f56bd68388d292edf21c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); + break; + default: + this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); + } + } + this.objectErrors(assigned,pos); + } + ,getAuto: function() { + return { data : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), ratio : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$ec6c0149f584f56bd68388d292edf21c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$71 + ,__class__: JsonParser_$e15c2211613da80aa2992b6249949a65 }); -var JsonParser_$73 = function(errors,putils,errorType) { +var JsonParser_$e5a960b500232cc84a0caf718de13706 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$73.__name__ = true; -JsonParser_$73.__super__ = json2object_reader_BaseParser; -JsonParser_$73.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$e5a960b500232cc84a0caf718de13706.__name__ = true; +JsonParser_$e5a960b500232cc84a0caf718de13706.__super__ = json2object_reader_BaseParser; +JsonParser_$e5a960b500232cc84a0caf718de13706.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ user : Array, leader : Array, guest : Array, banned : Array, admin : Array }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ isOpen : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1999,69 +1971,56 @@ JsonParser_$73.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["admin","banned","guest","leader","user"],[false,false,false,false,false]); + this.objectSetupAssign(assigned,["isOpen"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - switch(field.name) { - case "admin": - this.value.admin = this.loadObjectField(($_=new JsonParser_$74(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"admin",assigned,this.value.admin,pos); - break; - case "banned": - this.value.banned = this.loadObjectField(($_=new JsonParser_$74(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banned",assigned,this.value.banned,pos); - break; - case "guest": - this.value.guest = this.loadObjectField(($_=new JsonParser_$74(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"guest",assigned,this.value.guest,pos); - break; - case "leader": - this.value.leader = this.loadObjectField(($_=new JsonParser_$74(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"leader",assigned,this.value.leader,pos); - break; - case "user": - this.value.user = this.loadObjectField(($_=new JsonParser_$74(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"user",assigned,this.value.user,pos); - break; - default: + if(field.name == "isOpen") { + this.value.isOpen = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isOpen",assigned,this.value.isOpen,pos); + } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { admin : new JsonParser_$74([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banned : new JsonParser_$74([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), guest : new JsonParser_$74([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), leader : new JsonParser_$74([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), user : new JsonParser_$74([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { isOpen : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$73 + ,__class__: JsonParser_$e5a960b500232cc84a0caf718de13706 }); -var JsonParser_$74 = function(errors,putils,errorType) { +var JsonParser_$ec6c0149f584f56bd68388d292edf21c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$74.__name__ = true; -JsonParser_$74.__super__ = json2object_reader_BaseParser; -JsonParser_$74.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$ec6c0149f584f56bd68388d292edf21c.__name__ = true; +JsonParser_$ec6c0149f584f56bd68388d292edf21c.__super__ = json2object_reader_BaseParser; +JsonParser_$ec6c0149f584f56bd68388d292edf21c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); - json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); + this.value = "Caching"; + this.errors.push(json2object_Error.IncorrectType(variable,"ProgressType",pos)); + this.objectThrow(pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$75(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonString: function(s,pos,variable) { + this.value = this.loadString(s,pos,variable,["Caching","Downloading","Uploading","Canceled"],"Caching"); } - ,__class__: JsonParser_$74 + ,__class__: JsonParser_$ec6c0149f584f56bd68388d292edf21c }); -var JsonParser_$75 = function(errors,putils,errorType) { +var JsonParser_$ed5dea09095f671b801bee34ea28a319 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$75.__name__ = true; -JsonParser_$75.__super__ = json2object_reader_BaseParser; -JsonParser_$75.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$ed5dea09095f671b801bee34ea28a319.__name__ = true; +JsonParser_$ed5dea09095f671b801bee34ea28a319.__super__ = json2object_reader_BaseParser; +JsonParser_$ed5dea09095f671b801bee34ea28a319.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "guest"; this.errors.push(json2object_Error.IncorrectType(variable,"Permission",pos)); @@ -2073,19 +2032,19 @@ JsonParser_$75.prototype = $extend(json2object_reader_BaseParser.prototype,{ ,loadJsonString: function(s,pos,variable) { this.value = this.loadString(s,pos,variable,["guest","user","leader","admin","writeChat","addVideo","removeVideo","requestLeader","rewind","clearChat","setLeader","changeOrder","toggleItemType","lockPlaylist","banClient"],"guest"); } - ,__class__: JsonParser_$75 + ,__class__: JsonParser_$ed5dea09095f671b801bee34ea28a319 }); -var JsonParser_$77 = function(errors,putils,errorType) { +var JsonParser_$f3c29c0813c93ee49a61ccf072b8a177 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$77.__name__ = true; -JsonParser_$77.__super__ = json2object_reader_BaseParser; -JsonParser_$77.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.__name__ = true; +JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.__super__ = json2object_reader_BaseParser; +JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ replace : String, regex : String, name : String, flags : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ passwordConfirmation : String, password : String, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -2093,24 +2052,21 @@ JsonParser_$77.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["flags","name","regex","replace"],[false,false,false,false]); + this.objectSetupAssign(assigned,["name","password","passwordConfirmation"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "flags": - this.value.flags = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"flags",assigned,this.value.flags,pos); - break; case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; - case "regex": - this.value.regex = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"regex",assigned,this.value.regex,pos); + case "password": + this.value.password = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"password",assigned,this.value.password,pos); break; - case "replace": - this.value.replace = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"replace",assigned,this.value.replace,pos); + case "passwordConfirmation": + this.value.passwordConfirmation = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passwordConfirmation",assigned,this.value.passwordConfirmation,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -2119,21 +2075,42 @@ JsonParser_$77.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { flags : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), regex : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), replace : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), password : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passwordConfirmation : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$77 + ,__class__: JsonParser_$f3c29c0813c93ee49a61ccf072b8a177 }); -var JsonParser_$79 = function(errors,putils,errorType) { +var JsonParser_$f55acea3678203c700715b781ad1ef0c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$79.__name__ = true; -JsonParser_$79.__super__ = json2object_reader_BaseParser; -JsonParser_$79.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$f55acea3678203c700715b781ad1ef0c.__name__ = true; +JsonParser_$f55acea3678203c700715b781ad1ef0c.__super__ = json2object_reader_BaseParser; +JsonParser_$f55acea3678203c700715b781ad1ef0c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, image : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); + json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); + } + ,loadJsonNull: function(pos,variable) { + this.value = null; + } + ,loadJsonBool: function(b,pos,variable) { + this.value = b; + } + ,__class__: JsonParser_$f55acea3678203c700715b781ad1ef0c +}); +var JsonParser_$fa535ffb25e1fd20341652f9be21e06e = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$fa535ffb25e1fd20341652f9be21e06e.__name__ = true; +JsonParser_$fa535ffb25e1fd20341652f9be21e06e.__super__ = json2object_reader_BaseParser; +JsonParser_$fa535ffb25e1fd20341652f9be21e06e.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { + this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, localNetworkOnly : Bool, localAdmins : Bool, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String, cacheStorageLimitGiB : Float, allowProxyIps : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -2141,18 +2118,75 @@ JsonParser_$79.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["image","name"],[false,false]); + this.objectSetupAssign(assigned,["allowProxyIps","cacheStorageLimitGiB","channelName","emotes","filters","isVerbose","localAdmins","localNetworkOnly","maxLoginLength","maxMessageLength","permissions","port","requestLeaderOnPause","salt","serverChatHistory","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,false,false,true,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { - case "image": - this.value.image = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"image",assigned,this.value.image,pos); + case "allowProxyIps": + this.value.allowProxyIps = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"allowProxyIps",assigned,this.value.allowProxyIps,pos); break; - case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + case "cacheStorageLimitGiB": + this.value.cacheStorageLimitGiB = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"cacheStorageLimitGiB",assigned,this.value.cacheStorageLimitGiB,pos); + break; + case "channelName": + this.value.channelName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"channelName",assigned,this.value.channelName,pos); + break; + case "emotes": + this.value.emotes = this.loadObjectField(($_=new JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"emotes",assigned,this.value.emotes,pos); + break; + case "filters": + this.value.filters = this.loadObjectField(($_=new JsonParser_$4152afa9599cfde83ddff5d84d1707c8(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos); + break; + case "isVerbose": + this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos); + break; + case "localAdmins": + this.value.localAdmins = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localAdmins",assigned,this.value.localAdmins,pos); + break; + case "localNetworkOnly": + this.value.localNetworkOnly = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localNetworkOnly",assigned,this.value.localNetworkOnly,pos); + break; + case "maxLoginLength": + this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos); + break; + case "maxMessageLength": + this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); + break; + case "permissions": + this.value.permissions = this.loadObjectField(($_=new JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); + break; + case "port": + this.value.port = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos); + break; + case "requestLeaderOnPause": + this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos); + break; + case "salt": + this.value.salt = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos); + break; + case "serverChatHistory": + this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos); + break; + case "templateUrl": + this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos); + break; + case "totalVideoLimit": + this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos); + break; + case "unpauseWithoutLeader": + this.value.unpauseWithoutLeader = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"unpauseWithoutLeader",assigned,this.value.unpauseWithoutLeader,pos); + break; + case "userVideoLimit": + this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos); + break; + case "youtubeApiKey": + this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); + break; + case "youtubePlaylistLimit": + this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -2161,21 +2195,21 @@ JsonParser_$79.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { image : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { allowProxyIps : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), cacheStorageLimitGiB : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), channelName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$4152afa9599cfde83ddff5d84d1707c8([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localNetworkOnly : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$79 + ,__class__: JsonParser_$fa535ffb25e1fd20341652f9be21e06e }); -var JsonParser_$9 = function(errors,putils,errorType) { +var JsonParser_$feded5bdb427eb48f39e60029d5dca4a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$9.__name__ = true; -JsonParser_$9.__super__ = json2object_reader_BaseParser; -JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$feded5bdb427eb48f39e60029d5dca4a.__name__ = true; +JsonParser_$feded5bdb427eb48f39e60029d5dca4a.__super__ = json2object_reader_BaseParser; +JsonParser_$feded5bdb427eb48f39e60029d5dca4a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ data : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, ?rate : Null, ?pausedByServer : Null, ?paused : Null }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -2183,24 +2217,35 @@ JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["data"],[false]); + this.objectSetupAssign(assigned,["paused","pausedByServer","rate","time"],[true,true,true,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; - if(field.name == "data") { - this.value.data = this.loadObjectField(($_=new JsonParser_$47(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); - } else { + switch(field.name) { + case "paused": + this.value.paused = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos); + break; + case "pausedByServer": + this.value.pausedByServer = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pausedByServer",assigned,this.value.pausedByServer,pos); + break; + case "rate": + this.value.rate = this.loadObjectField(($_=new JsonParser_$08065556836b0755d9c8e1550cf9f19c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); + break; + case "time": + this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); + break; + default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { - return { data : new JsonParser_$47([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { paused : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pausedByServer : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$08065556836b0755d9c8e1550cf9f19c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$9 + ,__class__: JsonParser_$feded5bdb427eb48f39e60029d5dca4a }); var Lambda = function() { }; Lambda.__name__ = true; @@ -2257,10 +2302,7 @@ var haxe_ds_StringMap = function() { haxe_ds_StringMap.__name__ = true; haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; haxe_ds_StringMap.prototype = { - iterator: function() { - return new haxe_ds__$StringMap_StringMapValueIterator(this.h); - } - ,__class__: haxe_ds_StringMap + __class__: haxe_ds_StringMap }; var Lang = function() { }; Lang.__name__ = true; @@ -2771,22 +2813,6 @@ haxe_crypto_Sha256.prototype = { } ,__class__: haxe_crypto_Sha256 }; -var haxe_ds__$StringMap_StringMapValueIterator = function(h) { - this.h = h; - this.keys = Object.keys(h); - this.length = this.keys.length; - this.current = 0; -}; -haxe_ds__$StringMap_StringMapValueIterator.__name__ = true; -haxe_ds__$StringMap_StringMapValueIterator.prototype = { - hasNext: function() { - return this.current < this.length; - } - ,next: function() { - return this.h[this.keys[this.current++]]; - } - ,__class__: haxe_ds__$StringMap_StringMapValueIterator -}; var haxe_exceptions_PosException = function(message,previous,pos) { haxe_Exception.call(this,message,previous); if(pos == null) { @@ -3939,7 +3965,7 @@ server_HttpServer.prototype = { } if(url.pathname == "/setup") { if(this.main.hasAdmins()) { - this.redirect(res,"/"); + tools_HttpServerTools.redirect(res,"/"); return; } js_node_Fs.readFile("" + this.dir + "/setup.html",function(err,data) { @@ -3975,7 +4001,7 @@ server_HttpServer.prototype = { } if(ext == "html") { if(!_gthis.main.isNoState && !_gthis.main.hasAdmins()) { - _gthis.redirect(res,"/setup"); + tools_HttpServerTools.redirect(res,"/setup"); return; } data = _gthis.localizeHtml(data.toString(),req.headers["accept-language"]); @@ -4003,9 +4029,8 @@ server_HttpServer.prototype = { req.on("end",function() { var buffer = js_node_buffer_Buffer.concat(body); _gthis.uploadingFilesLastChunks.h[filePath] = buffer; - res.writeHead(200,{ "content-type" : _gthis.getMimeType("json")}); var json = { info : "File last chunk uploaded", url : _gthis.cache.getFileUrl(name)}; - res.end(JSON.stringify(json)); + return tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),json); }); } ,uploadFile: function(req,res) { @@ -4029,8 +4054,8 @@ server_HttpServer.prototype = { this.cache.removeOlderCache(tmp); } if(this.cache.getFreeSpace() < tmp) { - res.statusCode = 413; - res.end(JSON.stringify({ info : this.cache.notEnoughSpaceErrorText, errorId : "freeSpace"})); + var json = { info : this.cache.notEnoughSpaceErrorText, errorId : "freeSpace"}; + tools_HttpServerTools.json(tools_HttpServerTools.status(res,413),json); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); @@ -4053,8 +4078,7 @@ server_HttpServer.prototype = { this.cache.add(name); this.uploadingFilesSizes.h[filePath] = tmp; stream.on("close",function() { - res.statusCode = 200; - res.end(JSON.stringify({ info : "File write stream closed."})); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),{ info : "File write stream closed."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); @@ -4065,9 +4089,8 @@ server_HttpServer.prototype = { } }); stream.on("error",function(err) { - haxe_Log.trace(err,{ fileName : "src/server/HttpServer.hx", lineNumber : 221, className : "server.HttpServer", methodName : "uploadFile"}); - res.statusCode = 500; - res.end(JSON.stringify({ info : "File write stream error."})); + haxe_Log.trace(err,{ fileName : "src/server/HttpServer.hx", lineNumber : 225, className : "server.HttpServer", methodName : "uploadFile"}); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,500),{ info : "File write stream error."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); @@ -4079,10 +4102,9 @@ server_HttpServer.prototype = { _gthis.cache.remove(name); }); req.on("error",function(err) { - haxe_Log.trace("Request Error:",{ fileName : "src/server/HttpServer.hx", lineNumber : 228, className : "server.HttpServer", methodName : "uploadFile", customParams : [err]}); + haxe_Log.trace("Request Error:",{ fileName : "src/server/HttpServer.hx", lineNumber : 232, className : "server.HttpServer", methodName : "uploadFile", customParams : [err]}); stream.destroy(); - res.statusCode = 500; - res.end(JSON.stringify({ info : "File request error."})); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,500),{ info : "File request error."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); @@ -4094,14 +4116,10 @@ server_HttpServer.prototype = { _gthis.cache.remove(name); }); } - ,redirect: function(res,pathname) { - res.writeHead(302,{ "Location" : pathname}); - res.end(); - } ,finishSetup: function(req,res) { var _gthis = this; if(this.main.hasAdmins()) { - this.redirect(res,"/"); + tools_HttpServerTools.redirect(res,"/"); return; } var bodyChunks = []; @@ -4110,19 +4128,19 @@ server_HttpServer.prototype = { }); req.on("end",function() { var body = js_node_buffer_Buffer.concat(bodyChunks).toString(); - var jsonData; - try { - jsonData = JSON.parse(body); - } catch( _g ) { - res.writeHead(400,{ "Content-Type" : "application/json"}); - res.end(JSON.stringify({ success : false, errors : []})); + var jsonParser = new JsonParser_$f3c29c0813c93ee49a61ccf072b8a177(); + var jsonData = jsonParser.fromJson(body); + if(jsonParser.errors.length > 0) { + haxe_Log.trace(json2object_ErrorUtils.convertErrorArray(jsonParser.errors),{ fileName : "src/server/HttpServer.hx", lineNumber : 258, className : "server.HttpServer", methodName : "finishSetup"}); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,400),{ success : false, errors : []}); return; } - var name = jsonData.name == null ? "null" : "" + jsonData.name; - var password = jsonData.password == null ? "null" : "" + jsonData.password; - var passwordConfirmation = jsonData.passwordConfirmation == null ? "null" : "" + jsonData.passwordConfirmation; + var name = jsonData.name; + var password = jsonData.password; + var passwordConfirmation = jsonData.passwordConfirmation; + var tmp = req.headers["accept-language"]; + var lang = tmp != null ? tmp : "en"; var errors = []; - var lang = req.headers["accept-language"]; if(_gthis.main.isBadClientName(name)) { errors.push({ type : "name", error : StringTools.replace(Lang.get(lang,"usernameError"),"$MAX","" + _gthis.main.config.maxLoginLength)}); } @@ -4133,13 +4151,11 @@ server_HttpServer.prototype = { errors.push({ type : "password", error : Lang.get(lang,"passwordsMismatchError")}); } if(errors.length > 0) { - res.writeHead(400,{ "Content-Type" : "application/json"}); - res.end(JSON.stringify({ success : false, errors : errors})); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,400),{ success : false, errors : errors}); return; } _gthis.main.addAdmin(name,password); - res.writeHead(200,{ "Content-Type" : "application/json"}); - res.end(JSON.stringify({ success : true})); + tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),{ success : true}); }); } ,getPath: function(dir,url) { @@ -4412,7 +4428,7 @@ var server_Main = function(opts) { this.messages = []; this.videoTimer = new server_VideoTimer(); this.videoList = new VideoList(); - this.wsEventParser = new JsonParser_$1(); + this.wsEventParser = new JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9(); this.freeIds = []; this.clients = []; this.playersCacheSupport = ["RawType"]; @@ -6547,6 +6563,21 @@ sys_FileSystem.createDirectory = function(path) { } } }; +var tools_HttpServerTools = function() { }; +tools_HttpServerTools.__name__ = true; +tools_HttpServerTools.status = function(res,status) { + res.statusCode = status; + return res; +}; +tools_HttpServerTools.json = function(res,obj) { + res.setHeader("content-type","application/json"); + res.end(JSON.stringify(obj)); + return res; +}; +tools_HttpServerTools.redirect = function(res,url) { + res.writeHead(302,{ "location" : url}); + res.end(); +}; var tools_MathTools = function() { }; tools_MathTools.__name__ = true; tools_MathTools.toFixed = function(v,digits) { diff --git a/default-config.json b/default-config.json index b3b7165..38fc271 100644 --- a/default-config.json +++ b/default-config.json @@ -2,8 +2,6 @@ "port": 4200, "channelName": "SyncTube", "maxLoginLength": 20, - "minPasswordLength": 4, - "maxPasswordLength": 50, "maxMessageLength": 500, "serverChatHistory": 50, "totalVideoLimit": 0, diff --git a/res/client.js b/res/client.js index d5531b9..cdfee99 100644 --- a/res/client.js +++ b/res/client.js @@ -253,10 +253,6 @@ Lambda.findIndex = function(it,f) { } return -1; }; -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) { @@ -5429,6 +5425,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 = []; diff --git a/res/css/des.css b/res/css/des.css index f0017c2..fa9a50b 100644 --- a/res/css/des.css +++ b/res/css/des.css @@ -994,4 +994,4 @@ html { .mobile-view #optionsPanel { top: 2.2rem; bottom: 0; -} \ No newline at end of file +} diff --git a/res/css/setup.css b/res/css/setup.css index 0ea3290..9755ad3 100644 --- a/res/css/setup.css +++ b/res/css/setup.css @@ -1,5 +1,8 @@ body { display: flex; + height: 100vh; + align-items: center; + justify-content: center; } .setup { diff --git a/res/setup.html b/res/setup.html index d92938e..5d39518 100644 --- a/res/setup.html +++ b/res/setup.html @@ -2,79 +2,79 @@ - - - - - - - SyncTube - - - - + + + + + + + SyncTube + + + + -
-

SyncTube

-

Create your admin account

- -
- - - - -
- - -
-
- - +
+

SyncTube

+

Create your admin account

+ +
+ + + + +
+ + +
+
+ + diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx index b68376c..b15018b 100644 --- a/src/server/HttpServer.hx +++ b/src/server/HttpServer.hx @@ -1,7 +1,6 @@ package server; import Types.UploadResponse; -import haxe.Json; import haxe.io.Path; import js.node.Buffer; import js.node.Fs.Fs; @@ -12,6 +11,8 @@ import js.node.http.ClientRequest; import js.node.http.IncomingMessage; import js.node.http.ServerResponse; import js.node.url.URL; +import json2object.ErrorUtils; +import json2object.JsonParser; import server.cache.Cache; import sys.FileSystem; @@ -23,6 +24,12 @@ private class HttpServerConfig { public final cache:Cache = null; } +typedef SetupAdminRequest = { + name:String, + password:String, + passwordConfirmation:String, +} + class HttpServer { static final mimeTypes = [ "html" => "text/html", @@ -110,7 +117,8 @@ class HttpServer { if (url.pathname == "/setup") { if (main.hasAdmins()) { - return redirect(res, "/"); + res.redirect("/"); + return; } Fs.readFile('$dir/setup.html', (err:Dynamic, data:Buffer) -> { @@ -145,7 +153,8 @@ class HttpServer { if (ext == "html") { if (!main.isNoState && !main.hasAdmins()) { - return redirect(res, "/setup"); + res.redirect("/setup"); + return; } // replace ${textId} to localized strings data = cast localizeHtml(data.toString(), req.headers["accept-language"]); @@ -164,14 +173,11 @@ class HttpServer { req.on("end", () -> { final buffer = Buffer.concat(body); uploadingFilesLastChunks[filePath] = buffer; - res.writeHead(200, { - "content-type": getMimeType("json"), - }); final json:UploadResponse = { info: "File last chunk uploaded", url: cache.getFileUrl(name) } - res.end(Json.stringify(json)); + res.status(200).json(json); }); } @@ -183,9 +189,7 @@ class HttpServer { final size = Std.parseInt(req.headers["content-length"]) ?? return; inline function end(code:Int, json:UploadResponse):Void { - res.statusCode = code; - res.end(Json.stringify(json)); - + res.status(code).json(json); uploadingFilesSizes.remove(filePath); uploadingFilesLastChunks.remove(filePath); } @@ -234,18 +238,12 @@ class HttpServer { }); } - function redirect(res:ServerResponse, pathname:String) { - res.writeHead(302, {"Location": pathname}); - return res.end(); - } - function finishSetup(req:IncomingMessage, res:ServerResponse) { if (main.hasAdmins()) { - return redirect(res, "/"); + return res.redirect("/"); } - final lang = req.headers["accept-language"]; - var bodyChunks:Array = []; + final bodyChunks:Array = []; req.on("data", chunk -> { bodyChunks.push(chunk); @@ -253,25 +251,20 @@ class HttpServer { req.on("end", () -> { final body = Buffer.concat(bodyChunks).toString(); - final jsonData:{ - name:String, - password:String, - passwordConfirmation:String - } = try { - Json.parse(body); - } catch (e) { - res.writeHead(400, {"Content-Type": "application/json"}); - res.end(Json.stringify({success: false, errors: []})); + final jsonParser = new JsonParser(); + final jsonData = jsonParser.fromJson(body); + if (jsonParser.errors.length > 0) { + final errors = ErrorUtils.convertErrorArray(jsonParser.errors); + trace(errors); + res.status(400).json({success: false, errors: []}); return; } - - final name = Std.string(jsonData.name); - final password = Std.string(jsonData.password); - final passwordConfirmation = Std.string(jsonData.passwordConfirmation); - + final name = jsonData.name; + final password = jsonData.password; + final passwordConfirmation = jsonData.passwordConfirmation; + final lang = req.headers["accept-language"] ?? "en"; final errors:Array<{type:String, error:String}> = []; - final lang = req.headers["accept-language"]; if (main.isBadClientName(name)) { final error = Lang.get(lang, "usernameError") .replace("$MAX", '${main.config.maxLoginLength}'); @@ -300,14 +293,12 @@ class HttpServer { } if (errors.length > 0) { - res.writeHead(400, {"Content-Type": "application/json"}); - res.end(Json.stringify({success: false, errors: errors})); + res.status(400).json({success: false, errors: errors}); return; } main.addAdmin(name, password); - res.writeHead(200, {"Content-Type": "application/json"}); - res.end(Json.stringify({success: true})); + res.status(200).json({success: true}); }); } diff --git a/src/server/import.hx b/src/server/import.hx new file mode 100644 index 0000000..9983810 --- /dev/null +++ b/src/server/import.hx @@ -0,0 +1,3 @@ +package server; + +using tools.HttpServerTools; diff --git a/src/tools/HttpServerTools.hx b/src/tools/HttpServerTools.hx new file mode 100644 index 0000000..980a458 --- /dev/null +++ b/src/tools/HttpServerTools.hx @@ -0,0 +1,22 @@ +package tools; + +import haxe.Json; +import js.node.http.ServerResponse; + +class HttpServerTools { + public static function status(res:ServerResponse, status:Int):ServerResponse { + res.statusCode = status; + return res; + } + + public static function json(res:ServerResponse, obj:Any):ServerResponse { + res.setHeader("content-type", "application/json"); + res.end(Json.stringify(obj)); + return res; + } + + public static function redirect(res:ServerResponse, url:String):Void { + res.writeHead(302, {"location": url}); + res.end(); + } +} diff --git a/tests.hxml b/tests.hxml index 7541cc2..f28775d 100644 --- a/tests.hxml +++ b/tests.hxml @@ -1,6 +1,6 @@ --library hxnodejs --library hxnodejs-ws ---library json2object +--library json2object:git:https://github.com/RblSb/json2object.git#nightly_safe_macros # Client libs for completion --library youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git --library hls.js-extern:git:https://github.com/zoldesi-andor/hls.js-haxe-extern.git @@ -8,6 +8,7 @@ --class-path src --class-path test --main Main +-w -WDeprecated # -D UTEST_PATTERN=testMain --js build/tests.js --cmd node build/tests.js