diff options
| -rw-r--r-- | build/server.js | 895 | ||||
| -rw-r--r-- | default-config.json | 3 | ||||
| -rw-r--r-- | res/client.js | 171 | ||||
| -rw-r--r-- | res/css/des.css | 6 | ||||
| -rw-r--r-- | res/langs/en.json | 1 | ||||
| -rw-r--r-- | res/langs/ru.json | 1 | ||||
| -rw-r--r-- | src/Client.hx | 12 | ||||
| -rw-r--r-- | src/ClientTools.hx | 1 | ||||
| -rw-r--r-- | src/Types.hx | 13 | ||||
| -rw-r--r-- | src/client/Buttons.hx | 1 | ||||
| -rw-r--r-- | src/client/Main.hx | 85 | ||||
| -rw-r--r-- | src/client/Utils.hx | 8 | ||||
| -rw-r--r-- | src/server/ConsoleInput.hx | 23 | ||||
| -rw-r--r-- | src/server/HttpServer.hx | 3 | ||||
| -rw-r--r-- | src/server/Main.hx | 120 |
15 files changed, 896 insertions, 447 deletions
diff --git a/build/server.js b/build/server.js index 5601172..013e3c4 100644 --- a/build/server.js +++ b/build/server.js @@ -8,11 +8,12 @@ function $extend(from, fields) { return proto; } var ClientGroup = $hxEnums["ClientGroup"] = { __ename__:true,__constructs__:null - ,User: {_hx_name:"User",_hx_index:0,__enum__:"ClientGroup",toString:$estr} - ,Leader: {_hx_name:"Leader",_hx_index:1,__enum__:"ClientGroup",toString:$estr} - ,Admin: {_hx_name:"Admin",_hx_index:2,__enum__:"ClientGroup",toString:$estr} + ,Banned: {_hx_name:"Banned",_hx_index:0,__enum__:"ClientGroup",toString:$estr} + ,User: {_hx_name:"User",_hx_index:1,__enum__:"ClientGroup",toString:$estr} + ,Leader: {_hx_name:"Leader",_hx_index:2,__enum__:"ClientGroup",toString:$estr} + ,Admin: {_hx_name:"Admin",_hx_index:3,__enum__:"ClientGroup",toString:$estr} }; -ClientGroup.__constructs__ = [ClientGroup.User,ClientGroup.Leader,ClientGroup.Admin]; +ClientGroup.__constructs__ = [ClientGroup.Banned,ClientGroup.User,ClientGroup.Leader,ClientGroup.Admin]; var Client = function(ws,req,id,name,group) { this.isAlive = true; this.ws = ws; @@ -49,14 +50,14 @@ ClientTools.setLeader = function(clients,name) { ++_g; if(client.name == name) { client.setGroupFlag(ClientGroup.Leader,true); - } else if((client.group & 2) != 0) { + } else if((client.group & 4) != 0) { client.setGroupFlag(ClientGroup.Leader,false); } } }; ClientTools.hasLeader = function(clients) { var _g = 0; - while(_g < clients.length) if((clients[_g++].group & 2) != 0) { + while(_g < clients.length) if((clients[_g++].group & 4) != 0) { return true; } return false; @@ -73,13 +74,16 @@ ClientTools.getByName = function(clients,name,def) { return def; }; ClientTools.hasPermission = function(client,permission,permissions) { - if((client.group & 4) != 0) { + if((client.group & 1) != 0) { + return permissions.banned.indexOf(permission) != -1; + } + if((client.group & 8) != 0) { return permissions.admin.indexOf(permission) != -1; } - if((client.group & 2) != 0) { + if((client.group & 4) != 0) { return permissions.leader.indexOf(permission) != -1; } - if((client.group & 1) != 0) { + if((client.group & 2) != 0) { return permissions.user.indexOf(permission) != -1; } return permissions.guest.indexOf(permission) != -1; @@ -506,7 +510,7 @@ JsonParser_$1.__name__ = true; JsonParser_$1.__super__ = json2object_reader_BaseParser; JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ ?updatePlaylist : Null<{ videoList : Array<VideoItem> }>, ?updateClients : Null<{ clients : Array<ClientData> }>, 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 }>, ?playItem : Null<{ pos : Int }>, ?play : Null<{ time : Float }>, ?pause : Null<{ time : Float }>, ?message : Null<{ text : String, clientName : String }>, ?logout : Null<{ oldClientName : String, clients : Array<ClientData>, clientName : String }>, ?login : Null<{ ?passHash : Null<String>, ?isUnknownClient : Null<Bool>, ?clients : Null<Array<ClientData>>, clientName : String }>, ?getTime : Null<{ time : Float, ?rate : Null<Float>, ?paused : Null<Bool> }>, ?connected : Null<{ videoList : Array<VideoItem>, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array<Message>, globalIp : String, config : Config, clients : Array<ClientData>, clientName : String }>, ?addVideo : Null<{ item : VideoItem, atEnd : Bool }> }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ ?updatePlaylist : Null<{ videoList : Array<VideoItem> }>, ?updateClients : Null<{ clients : Array<ClientData> }>, 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 }>, ?playItem : Null<{ pos : Int }>, ?play : Null<{ time : Float }>, ?pause : Null<{ time : Float }>, ?message : Null<{ text : String, clientName : String }>, ?logout : Null<{ oldClientName : String, clients : Array<ClientData>, clientName : String }>, ?login : Null<{ ?passHash : Null<String>, ?isUnknownClient : Null<Bool>, ?clients : Null<Array<ClientData>>, clientName : String }>, ?getTime : Null<{ time : Float, ?rate : Null<Float>, ?paused : Null<Bool> }>, ?connected : Null<{ videoList : Array<VideoItem>, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array<Message>, globalIp : String, config : Config, clients : Array<ClientData>, 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) { @@ -514,7 +518,7 @@ JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["addVideo","connected","getTime","login","logout","message","pause","play","playItem","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,false,true,true]); + this.objectSetupAssign(assigned,["addVideo","banClient","connected","getTime","login","logout","message","pause","play","playItem","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,false,true,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -524,68 +528,71 @@ JsonParser_$1.prototype = $extend(json2object_reader_BaseParser.prototype,{ 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_$5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"connected",assigned,this.value.connected,pos); + this.value.connected = this.loadObjectField(($_=new JsonParser_$7(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"connected",assigned,this.value.connected,pos); break; case "getTime": - this.value.getTime = this.loadObjectField(($_=new JsonParser_$7(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"getTime",assigned,this.value.getTime,pos); + this.value.getTime = this.loadObjectField(($_=new JsonParser_$9(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"getTime",assigned,this.value.getTime,pos); break; case "login": - this.value.login = this.loadObjectField(($_=new JsonParser_$9(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"login",assigned,this.value.login,pos); + this.value.login = this.loadObjectField(($_=new JsonParser_$11(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"login",assigned,this.value.login,pos); break; case "logout": - this.value.logout = this.loadObjectField(($_=new JsonParser_$11(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"logout",assigned,this.value.logout,pos); + this.value.logout = this.loadObjectField(($_=new JsonParser_$13(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"logout",assigned,this.value.logout,pos); break; case "message": - this.value.message = this.loadObjectField(($_=new JsonParser_$13(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"message",assigned,this.value.message,pos); + this.value.message = this.loadObjectField(($_=new JsonParser_$15(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"message",assigned,this.value.message,pos); break; case "pause": - this.value.pause = this.loadObjectField(($_=new JsonParser_$15(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pause",assigned,this.value.pause,pos); + this.value.pause = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pause",assigned,this.value.pause,pos); break; case "play": - this.value.play = this.loadObjectField(($_=new JsonParser_$15(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"play",assigned,this.value.play,pos); + this.value.play = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"play",assigned,this.value.play,pos); break; case "playItem": - this.value.playItem = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playItem",assigned,this.value.playItem,pos); + this.value.playItem = this.loadObjectField(($_=new JsonParser_$19(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playItem",assigned,this.value.playItem,pos); break; case "removeVideo": - this.value.removeVideo = this.loadObjectField(($_=new JsonParser_$19(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"removeVideo",assigned,this.value.removeVideo,pos); + this.value.removeVideo = this.loadObjectField(($_=new JsonParser_$21(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"removeVideo",assigned,this.value.removeVideo,pos); break; case "rewind": - this.value.rewind = this.loadObjectField(($_=new JsonParser_$15(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rewind",assigned,this.value.rewind,pos); + this.value.rewind = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rewind",assigned,this.value.rewind,pos); break; case "serverMessage": - this.value.serverMessage = this.loadObjectField(($_=new JsonParser_$21(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverMessage",assigned,this.value.serverMessage,pos); + this.value.serverMessage = this.loadObjectField(($_=new JsonParser_$23(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverMessage",assigned,this.value.serverMessage,pos); break; case "setLeader": - this.value.setLeader = this.loadObjectField(($_=new JsonParser_$23(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setLeader",assigned,this.value.setLeader,pos); + this.value.setLeader = this.loadObjectField(($_=new JsonParser_$25(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setLeader",assigned,this.value.setLeader,pos); break; case "setNextItem": - this.value.setNextItem = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setNextItem",assigned,this.value.setNextItem,pos); + this.value.setNextItem = this.loadObjectField(($_=new JsonParser_$19(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setNextItem",assigned,this.value.setNextItem,pos); break; case "setRate": - this.value.setRate = this.loadObjectField(($_=new JsonParser_$25(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setRate",assigned,this.value.setRate,pos); + this.value.setRate = this.loadObjectField(($_=new JsonParser_$27(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setRate",assigned,this.value.setRate,pos); break; case "setTime": - this.value.setTime = this.loadObjectField(($_=new JsonParser_$15(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setTime",assigned,this.value.setTime,pos); + this.value.setTime = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setTime",assigned,this.value.setTime,pos); break; case "skipVideo": - this.value.skipVideo = this.loadObjectField(($_=new JsonParser_$19(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"skipVideo",assigned,this.value.skipVideo,pos); + this.value.skipVideo = this.loadObjectField(($_=new JsonParser_$21(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"skipVideo",assigned,this.value.skipVideo,pos); break; case "toggleItemType": - this.value.toggleItemType = this.loadObjectField(($_=new JsonParser_$17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"toggleItemType",assigned,this.value.toggleItemType,pos); + this.value.toggleItemType = this.loadObjectField(($_=new JsonParser_$19(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"toggleItemType",assigned,this.value.toggleItemType,pos); break; case "togglePlaylistLock": - this.value.togglePlaylistLock = this.loadObjectField(($_=new JsonParser_$27(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"togglePlaylistLock",assigned,this.value.togglePlaylistLock,pos); + this.value.togglePlaylistLock = this.loadObjectField(($_=new JsonParser_$29(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"togglePlaylistLock",assigned,this.value.togglePlaylistLock,pos); break; case "type": - this.value.type = this.loadObjectField(($_=new JsonParser_$28(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); + this.value.type = this.loadObjectField(($_=new JsonParser_$30(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); break; case "updateClients": - this.value.updateClients = this.loadObjectField(($_=new JsonParser_$30(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updateClients",assigned,this.value.updateClients,pos); + this.value.updateClients = this.loadObjectField(($_=new JsonParser_$32(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updateClients",assigned,this.value.updateClients,pos); break; case "updatePlaylist": - this.value.updatePlaylist = this.loadObjectField(($_=new JsonParser_$32(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updatePlaylist",assigned,this.value.updatePlaylist,pos); + this.value.updatePlaylist = this.loadObjectField(($_=new JsonParser_$34(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))); @@ -594,7 +601,7 @@ 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))), connected : new JsonParser_$5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), getTime : new JsonParser_$7([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), login : new JsonParser_$9([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), logout : new JsonParser_$11([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), message : new JsonParser_$13([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pause : new JsonParser_$15([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), play : new JsonParser_$15([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playItem : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), removeVideo : new JsonParser_$19([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rewind : new JsonParser_$15([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverMessage : new JsonParser_$21([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setLeader : new JsonParser_$23([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setNextItem : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setRate : new JsonParser_$25([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setTime : new JsonParser_$15([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), skipVideo : new JsonParser_$19([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), toggleItemType : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), togglePlaylistLock : new JsonParser_$27([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$28([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updateClients : new JsonParser_$30([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updatePlaylist : new JsonParser_$32([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + 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))), getTime : new JsonParser_$9([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), login : new JsonParser_$11([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), logout : new JsonParser_$13([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), message : new JsonParser_$15([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pause : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), play : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playItem : new JsonParser_$19([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), removeVideo : new JsonParser_$21([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rewind : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverMessage : new JsonParser_$23([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setLeader : new JsonParser_$25([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setNextItem : new JsonParser_$19([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setRate : new JsonParser_$27([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setTime : new JsonParser_$17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), skipVideo : new JsonParser_$21([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), toggleItemType : new JsonParser_$19([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), togglePlaylistLock : new JsonParser_$29([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$30([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updateClients : new JsonParser_$32([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updatePlaylist : new JsonParser_$34([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$1 }); @@ -608,7 +615,7 @@ JsonParser_$11.__name__ = true; JsonParser_$11.__super__ = json2object_reader_BaseParser; JsonParser_$11.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ oldClientName : String, clients : Array<ClientData>, clientName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ ?passHash : Null<String>, ?isUnknownClient : Null<Bool>, ?clients : Null<Array<ClientData>>, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -616,7 +623,7 @@ JsonParser_$11.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,["clientName","clients","isUnknownClient","passHash"],[false,true,true,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -624,13 +631,16 @@ JsonParser_$11.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + this.value.clientName = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + this.value.clients = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; - case "oldClientName": - this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"oldClientName",assigned,this.value.oldClientName,pos); + case "isUnknownClient": + this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); + break; + case "passHash": + this.value.passHash = this.loadObjectField(($_=new JsonParser_$42(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))); @@ -639,7 +649,7 @@ JsonParser_$11.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$11 }); @@ -653,7 +663,7 @@ JsonParser_$13.__name__ = true; JsonParser_$13.__super__ = json2object_reader_BaseParser; JsonParser_$13.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,"{ oldClientName : String, clients : Array<ClientData>, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -661,7 +671,7 @@ JsonParser_$13.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName","text"],[false,false]); + this.objectSetupAssign(assigned,["clientName","clients","oldClientName"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -669,10 +679,13 @@ JsonParser_$13.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + this.value.clientName = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; - case "text": - this.value.text = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); + case "clients": + this.value.clients = this.loadObjectField(($_=new JsonParser_$43(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + break; + case "oldClientName": + this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$38(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))); @@ -681,7 +694,7 @@ JsonParser_$13.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$43([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$13 }); @@ -695,7 +708,7 @@ JsonParser_$15.__name__ = true; JsonParser_$15.__super__ = json2object_reader_BaseParser; JsonParser_$15.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,"{ text : String, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -703,22 +716,27 @@ JsonParser_$15.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["time"],[false]); + this.objectSetupAssign(assigned,["clientName","text"],[false,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_$37(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); - } else { + switch(field.name) { + case "clientName": + this.value.clientName = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + break; + case "text": + this.value.text = this.loadObjectField(($_=new JsonParser_$38(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 { time : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$15 }); @@ -732,7 +750,7 @@ JsonParser_$17.__name__ = true; JsonParser_$17.__super__ = json2object_reader_BaseParser; JsonParser_$17.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,"{ time : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -740,14 +758,14 @@ JsonParser_$17.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["pos"],[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 == "pos") { - this.value.pos = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos); + if(field.name == "time") { + this.value.time = this.loadObjectField(($_=new JsonParser_$39(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))); } @@ -755,7 +773,7 @@ JsonParser_$17.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { pos : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { time : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$17 }); @@ -769,7 +787,7 @@ JsonParser_$19.__name__ = true; JsonParser_$19.__super__ = json2object_reader_BaseParser; JsonParser_$19.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,"{ pos : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -777,14 +795,14 @@ JsonParser_$19.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,["pos"],[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_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); + if(field.name == "pos") { + this.value.pos = this.loadObjectField(($_=new JsonParser_$46(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))); } @@ -792,7 +810,7 @@ JsonParser_$19.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { url : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { pos : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$19 }); @@ -806,7 +824,7 @@ JsonParser_$21.__name__ = true; JsonParser_$21.__super__ = json2object_reader_BaseParser; JsonParser_$21.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,"{ url : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -814,14 +832,14 @@ JsonParser_$21.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,["url"],[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_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"textId",assigned,this.value.textId,pos); + if(field.name == "url") { + this.value.url = this.loadObjectField(($_=new JsonParser_$38(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))); } @@ -829,7 +847,7 @@ JsonParser_$21.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { textId : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { url : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$21 }); @@ -843,7 +861,7 @@ JsonParser_$23.__name__ = true; JsonParser_$23.__super__ = json2object_reader_BaseParser; JsonParser_$23.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,"{ textId : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -851,14 +869,14 @@ JsonParser_$23.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,["textId"],[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_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); + if(field.name == "textId") { + this.value.textId = this.loadObjectField(($_=new JsonParser_$38(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))); } @@ -866,7 +884,7 @@ JsonParser_$23.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { textId : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$23 }); @@ -880,7 +898,7 @@ JsonParser_$25.__name__ = true; JsonParser_$25.__super__ = json2object_reader_BaseParser; JsonParser_$25.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,"{ clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -888,14 +906,14 @@ JsonParser_$25.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["rate"],[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 == "rate") { - this.value.rate = this.loadObjectField(($_=new JsonParser_$37(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); + if(field.name == "clientName") { + this.value.clientName = this.loadObjectField(($_=new JsonParser_$38(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))); } @@ -903,7 +921,7 @@ JsonParser_$25.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { rate : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$25 }); @@ -917,7 +935,7 @@ JsonParser_$27.__name__ = true; JsonParser_$27.__super__ = json2object_reader_BaseParser; JsonParser_$27.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,"{ rate : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -925,14 +943,14 @@ JsonParser_$27.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,["rate"],[false]); 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_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isOpen",assigned,this.value.isOpen,pos); + if(field.name == "rate") { + this.value.rate = this.loadObjectField(($_=new JsonParser_$39(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))); } @@ -940,31 +958,46 @@ JsonParser_$27.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { isOpen : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { rate : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$27 }); -var JsonParser_$28 = function(errors,putils,errorType) { +var JsonParser_$29 = 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_$29.__name__ = true; +JsonParser_$29.__super__ = json2object_reader_BaseParser; +JsonParser_$29.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); + this.errors.push(json2object_Error.IncorrectType(variable,"{ isOpen : Bool }",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,["Connected","Disconnected","Login","PasswordRequest","LoginError","Logout","Message","ServerMessage","UpdateClients","AddVideo","RemoveVideo","SkipVideo","VideoLoaded","Pause","Play","GetTime","SetTime","SetRate","Rewind","SetLeader","PlayItem","SetNextItem","ToggleItemType","ClearChat","ClearPlaylist","ShufflePlaylist","UpdatePlaylist","TogglePlaylistLock"],"Connected"); + ,loadJsonObject: function(o,pos,variable) { + var assigned = new haxe_ds_StringMap(); + this.objectSetupAssign(assigned,["isOpen"],[false]); + 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_$40(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 { isOpen : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$28 + ,__class__: JsonParser_$29 }); var JsonParser_$3 = function(errors,putils,errorType) { if(errorType == null) { @@ -992,10 +1025,10 @@ JsonParser_$3.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "atEnd": - this.value.atEnd = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"atEnd",assigned,this.value.atEnd,pos); + this.value.atEnd = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"atEnd",assigned,this.value.atEnd,pos); break; case "item": - this.value.item = this.loadObjectField(($_=new JsonParser_$35(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"item",assigned,this.value.item,pos); + this.value.item = this.loadObjectField(($_=new JsonParser_$37(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))); @@ -1004,7 +1037,7 @@ JsonParser_$3.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { atEnd : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), item : new JsonParser_$35([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { atEnd : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), item : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$3 }); @@ -1018,6 +1051,28 @@ JsonParser_$30.__name__ = true; JsonParser_$30.__super__ = json2object_reader_BaseParser; JsonParser_$30.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); + } + ,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","UpdateClients","BanClient","AddVideo","RemoveVideo","SkipVideo","VideoLoaded","Pause","Play","GetTime","SetTime","SetRate","Rewind","SetLeader","PlayItem","SetNextItem","ToggleItemType","ClearChat","ClearPlaylist","ShufflePlaylist","UpdatePlaylist","TogglePlaylistLock"],"Connected"); + } + ,__class__: JsonParser_$30 +}); +var JsonParser_$32 = 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,{ + onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ clients : Array<ClientData> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } @@ -1033,7 +1088,7 @@ JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{ var field = o[_g]; ++_g; if(field.name == "clients") { - this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + this.value.clients = this.loadObjectField(($_=new JsonParser_$43(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))); } @@ -1041,19 +1096,19 @@ JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clients : new JsonParser_$43([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$30 + ,__class__: JsonParser_$32 }); -var JsonParser_$32 = function(errors,putils,errorType) { +var JsonParser_$34 = 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_$34.__name__ = true; +JsonParser_$34.__super__ = json2object_reader_BaseParser; +JsonParser_$34.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array<VideoItem> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1070,7 +1125,7 @@ JsonParser_$32.prototype = $extend(json2object_reader_BaseParser.prototype,{ var field = o[_g]; ++_g; if(field.name == "videoList") { - this.value.videoList = this.loadObjectField(($_=new JsonParser_$33(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); + this.value.videoList = this.loadObjectField(($_=new JsonParser_$35(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))); } @@ -1078,19 +1133,19 @@ JsonParser_$32.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { videoList : new JsonParser_$33([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { videoList : new JsonParser_$35([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$32 + ,__class__: JsonParser_$34 }); -var JsonParser_$33 = function(errors,putils,errorType) { +var JsonParser_$35 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$33.__name__ = true; -JsonParser_$33.__super__ = json2object_reader_BaseParser; -JsonParser_$33.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$35.__name__ = true; +JsonParser_$35.__super__ = json2object_reader_BaseParser; +JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array<VideoItem>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1099,19 +1154,19 @@ JsonParser_$33.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$35(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$37(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$33 + ,__class__: JsonParser_$35 }); -var JsonParser_$35 = function(errors,putils,errorType) { +var JsonParser_$37 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$35.__name__ = true; -JsonParser_$35.__super__ = json2object_reader_BaseParser; -JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$37.__name__ = true; +JsonParser_$37.__super__ = json2object_reader_BaseParser; +JsonParser_$37.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String, title : String, ?subs : Null<String>, isTemp : Bool, isIframe : Bool, duration : Float, author : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1129,25 +1184,25 @@ JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "author": - this.value.author = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"author",assigned,this.value.author,pos); + this.value.author = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"author",assigned,this.value.author,pos); break; case "duration": - this.value.duration = this.loadObjectField(($_=new JsonParser_$37(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"duration",assigned,this.value.duration,pos); + this.value.duration = this.loadObjectField(($_=new JsonParser_$39(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"duration",assigned,this.value.duration,pos); break; case "isIframe": - this.value.isIframe = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isIframe",assigned,this.value.isIframe,pos); + this.value.isIframe = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isIframe",assigned,this.value.isIframe,pos); break; case "isTemp": - this.value.isTemp = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos); + this.value.isTemp = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos); break; case "subs": - this.value.subs = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos); + this.value.subs = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos); break; case "title": - this.value.title = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos); + this.value.title = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos); break; case "url": - this.value.url = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); + this.value.url = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); @@ -1156,19 +1211,19 @@ JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { author : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isIframe : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { author : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isIframe : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$35 + ,__class__: JsonParser_$37 }); -var JsonParser_$36 = function(errors,putils,errorType) { +var JsonParser_$38 = 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_$38.__name__ = true; +JsonParser_$38.__super__ = json2object_reader_BaseParser; +JsonParser_$38.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1179,18 +1234,18 @@ JsonParser_$36.prototype = $extend(json2object_reader_BaseParser.prototype,{ ,loadJsonString: function(s,pos,variable) { this.value = s; } - ,__class__: JsonParser_$36 + ,__class__: JsonParser_$38 }); -var JsonParser_$37 = function(errors,putils,errorType) { +var JsonParser_$39 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); this.value = 0; }; -JsonParser_$37.__name__ = true; -JsonParser_$37.__super__ = json2object_reader_BaseParser; -JsonParser_$37.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$39.__name__ = true; +JsonParser_$39.__super__ = json2object_reader_BaseParser; +JsonParser_$39.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); @@ -1198,18 +1253,18 @@ JsonParser_$37.prototype = $extend(json2object_reader_BaseParser.prototype,{ ,loadJsonNumber: function(f,pos,variable) { this.value = this.loadJsonFloat(f,pos,variable,this.value); } - ,__class__: JsonParser_$37 + ,__class__: JsonParser_$39 }); -var JsonParser_$38 = function(errors,putils,errorType) { +var JsonParser_$40 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); this.value = false; }; -JsonParser_$38.__name__ = true; -JsonParser_$38.__super__ = json2object_reader_BaseParser; -JsonParser_$38.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$40.__name__ = true; +JsonParser_$40.__super__ = json2object_reader_BaseParser; +JsonParser_$40.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1217,17 +1272,17 @@ JsonParser_$38.prototype = $extend(json2object_reader_BaseParser.prototype,{ ,loadJsonBool: function(b,pos,variable) { this.value = b; } - ,__class__: JsonParser_$38 + ,__class__: JsonParser_$40 }); -var JsonParser_$40 = function(errors,putils,errorType) { +var JsonParser_$42 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$40.__name__ = true; -JsonParser_$40.__super__ = json2object_reader_BaseParser; -JsonParser_$40.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$42.__name__ = true; +JsonParser_$42.__super__ = json2object_reader_BaseParser; +JsonParser_$42.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1238,17 +1293,17 @@ JsonParser_$40.prototype = $extend(json2object_reader_BaseParser.prototype,{ ,loadJsonString: function(s,pos,variable) { this.value = s; } - ,__class__: JsonParser_$40 + ,__class__: JsonParser_$42 }); -var JsonParser_$41 = function(errors,putils,errorType) { +var JsonParser_$43 = 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_$43.__name__ = true; +JsonParser_$43.__super__ = json2object_reader_BaseParser; +JsonParser_$43.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1257,19 +1312,19 @@ JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$43(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$45(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$41 + ,__class__: JsonParser_$43 }); -var JsonParser_$43 = function(errors,putils,errorType) { +var JsonParser_$45 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$43.__name__ = true; -JsonParser_$43.__super__ = json2object_reader_BaseParser; -JsonParser_$43.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$45.__name__ = true; +JsonParser_$45.__super__ = json2object_reader_BaseParser; +JsonParser_$45.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, group : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1287,10 +1342,10 @@ JsonParser_$43.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "group": - this.value.group = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos); + this.value.group = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos); break; case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$38(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))); @@ -1299,47 +1354,26 @@ JsonParser_$43.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { group : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { group : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$43 -}); -var JsonParser_$44 = function(errors,putils,errorType) { - if(errorType == null) { - errorType = 0; - } - json2object_reader_BaseParser.call(this,errors,putils,errorType); - this.value = 0; -}; -JsonParser_$44.__name__ = true; -JsonParser_$44.__super__ = json2object_reader_BaseParser; -JsonParser_$44.prototype = $extend(json2object_reader_BaseParser.prototype,{ - onIncorrectType: function(pos,variable) { - 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_$44 + ,__class__: JsonParser_$45 }); var JsonParser_$46 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); + this.value = 0; }; JsonParser_$46.__name__ = true; JsonParser_$46.__super__ = json2object_reader_BaseParser; JsonParser_$46.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"Int",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_$43(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + ,loadJsonNumber: function(f,pos,variable) { + this.value = this.loadJsonInt(f,pos,variable,this.value); } ,__class__: JsonParser_$46 }); @@ -1353,14 +1387,14 @@ JsonParser_$48.__name__ = true; JsonParser_$48.__super__ = json2object_reader_BaseParser; JsonParser_$48.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<ClientData>",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; + ,loadJsonArray: function(a,pos,variable) { + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$45(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$48 }); @@ -1374,7 +1408,7 @@ JsonParser_$5.__name__ = true; JsonParser_$5.__super__ = json2object_reader_BaseParser; JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array<VideoItem>, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array<Message>, globalIp : String, config : Config, clients : Array<ClientData>, clientName : String }",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) { @@ -1382,39 +1416,18 @@ JsonParser_$5.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","videoList"],[false,false,false,false,false,false,false,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 "clientName": - this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); - break; - case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); - break; - case "config": - this.value.config = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos); - break; - case "globalIp": - this.value.globalIp = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"globalIp",assigned,this.value.globalIp,pos); - break; - case "history": - this.value.history = this.loadObjectField(($_=new JsonParser_$53(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"history",assigned,this.value.history,pos); - break; - case "isPlaylistOpen": - this.value.isPlaylistOpen = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isPlaylistOpen",assigned,this.value.isPlaylistOpen,pos); - break; - case "isUnknownClient": - this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); - break; - case "itemPos": - this.value.itemPos = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos); + case "name": + this.value.name = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; - case "videoList": - this.value.videoList = this.loadObjectField(($_=new JsonParser_$33(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); + case "time": + this.value.time = this.loadObjectField(($_=new JsonParser_$39(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))); @@ -1423,7 +1436,7 @@ JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$33([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$5 }); @@ -1437,14 +1450,14 @@ JsonParser_$50.__name__ = true; JsonParser_$50.__super__ = json2object_reader_BaseParser; JsonParser_$50.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,"Bool",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } - ,loadJsonNumber: function(f,pos,variable) { - this.value = this.loadJsonFloat(f,pos,variable,this.value); + ,loadJsonBool: function(b,pos,variable) { + this.value = b; } ,__class__: JsonParser_$50 }); @@ -1458,6 +1471,27 @@ JsonParser_$52.__name__ = true; JsonParser_$52.__super__ = json2object_reader_BaseParser; JsonParser_$52.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; + } + ,loadJsonNumber: function(f,pos,variable) { + this.value = this.loadJsonFloat(f,pos,variable,this.value); + } + ,__class__: JsonParser_$52 +}); +var JsonParser_$54 = function(errors,putils,errorType) { + if(errorType == null) { + errorType = 0; + } + json2object_reader_BaseParser.call(this,errors,putils,errorType); +}; +JsonParser_$54.__name__ = true; +JsonParser_$54.__super__ = json2object_reader_BaseParser; +JsonParser_$54.prototype = $extend(json2object_reader_BaseParser.prototype,{ + onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null<String>, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, localAdmins : Bool, ?isVerbose : Null<Bool>, filters : Array<Filter>, emotes : Array<Emote>, channelName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } @@ -1474,55 +1508,55 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "channelName": - this.value.channelName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"channelName",assigned,this.value.channelName,pos); + this.value.channelName = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"channelName",assigned,this.value.channelName,pos); break; case "emotes": - this.value.emotes = this.loadObjectField(($_=new JsonParser_$56(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"emotes",assigned,this.value.emotes,pos); + this.value.emotes = this.loadObjectField(($_=new JsonParser_$58(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"emotes",assigned,this.value.emotes,pos); break; case "filters": - this.value.filters = this.loadObjectField(($_=new JsonParser_$57(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos); + this.value.filters = this.loadObjectField(($_=new JsonParser_$59(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos); break; case "isVerbose": - this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos); + this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos); break; case "localAdmins": - this.value.localAdmins = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localAdmins",assigned,this.value.localAdmins,pos); + this.value.localAdmins = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localAdmins",assigned,this.value.localAdmins,pos); break; case "maxLoginLength": - this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos); + this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos); break; case "maxMessageLength": - this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); + this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); break; case "permissions": - this.value.permissions = this.loadObjectField(($_=new JsonParser_$59(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); + this.value.permissions = this.loadObjectField(($_=new JsonParser_$61(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); break; case "port": - this.value.port = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos); + this.value.port = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos); break; case "requestLeaderOnPause": - this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos); + this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos); break; case "salt": - this.value.salt = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos); + this.value.salt = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos); break; case "serverChatHistory": - this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos); + this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos); break; case "templateUrl": - this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos); + this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos); break; case "totalVideoLimit": - this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos); + this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos); break; case "userVideoLimit": - this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos); + this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos); break; case "youtubeApiKey": - this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); + this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); break; case "youtubePlaylistLimit": - this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos); + this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$46(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))); @@ -1531,19 +1565,19 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { channelName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$59([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { channelName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$58([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$59([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$61([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$52 + ,__class__: JsonParser_$54 }); -var JsonParser_$53 = function(errors,putils,errorType) { +var JsonParser_$55 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$53.__name__ = true; -JsonParser_$53.__super__ = json2object_reader_BaseParser; -JsonParser_$53.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$55.__name__ = true; +JsonParser_$55.__super__ = json2object_reader_BaseParser; +JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array<Message>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1552,19 +1586,19 @@ JsonParser_$53.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$55(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$57(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$53 + ,__class__: JsonParser_$55 }); -var JsonParser_$55 = function(errors,putils,errorType) { +var JsonParser_$57 = 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_$57.__name__ = true; +JsonParser_$57.__super__ = json2object_reader_BaseParser; +JsonParser_$57.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ time : String, text : String, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1582,13 +1616,13 @@ JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "text": - this.value.text = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); + this.value.text = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); break; case "time": - this.value.time = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); + this.value.time = this.loadObjectField(($_=new JsonParser_$38(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))); @@ -1597,19 +1631,19 @@ JsonParser_$55.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { name : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$55 + ,__class__: JsonParser_$57 }); -var JsonParser_$56 = function(errors,putils,errorType) { +var JsonParser_$58 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$56.__name__ = true; -JsonParser_$56.__super__ = json2object_reader_BaseParser; -JsonParser_$56.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$58.__name__ = true; +JsonParser_$58.__super__ = json2object_reader_BaseParser; +JsonParser_$58.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array<Emote>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1618,19 +1652,19 @@ JsonParser_$56.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$65(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$67(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$56 + ,__class__: JsonParser_$58 }); -var JsonParser_$57 = function(errors,putils,errorType) { +var JsonParser_$59 = 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,{ +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<Filter>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1639,21 +1673,21 @@ JsonParser_$57.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$63(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$65(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$57 + ,__class__: JsonParser_$59 }); -var JsonParser_$59 = function(errors,putils,errorType) { +var JsonParser_$61 = 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,{ +JsonParser_$61.__name__ = true; +JsonParser_$61.__super__ = json2object_reader_BaseParser; +JsonParser_$61.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ user : Array<Permission>, leader : Array<Permission>, guest : Array<Permission>, admin : Array<Permission> }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ user : Array<Permission>, leader : Array<Permission>, guest : Array<Permission>, banned : Array<Permission>, admin : Array<Permission> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1661,7 +1695,7 @@ JsonParser_$59.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["admin","guest","leader","user"],[false,false,false,false]); + this.objectSetupAssign(assigned,["admin","banned","guest","leader","user"],[false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -1669,16 +1703,19 @@ JsonParser_$59.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "admin": - this.value.admin = this.loadObjectField(($_=new JsonParser_$60(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"admin",assigned,this.value.admin,pos); + this.value.admin = this.loadObjectField(($_=new JsonParser_$62(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"admin",assigned,this.value.admin,pos); + break; + case "banned": + this.value.banned = this.loadObjectField(($_=new JsonParser_$62(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banned",assigned,this.value.banned,pos); break; case "guest": - this.value.guest = this.loadObjectField(($_=new JsonParser_$60(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"guest",assigned,this.value.guest,pos); + this.value.guest = this.loadObjectField(($_=new JsonParser_$62(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"guest",assigned,this.value.guest,pos); break; case "leader": - this.value.leader = this.loadObjectField(($_=new JsonParser_$60(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"leader",assigned,this.value.leader,pos); + this.value.leader = this.loadObjectField(($_=new JsonParser_$62(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"leader",assigned,this.value.leader,pos); break; case "user": - this.value.user = this.loadObjectField(($_=new JsonParser_$60(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"user",assigned,this.value.user,pos); + this.value.user = this.loadObjectField(($_=new JsonParser_$62(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))); @@ -1687,19 +1724,19 @@ JsonParser_$59.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { admin : new JsonParser_$60([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), guest : new JsonParser_$60([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), leader : new JsonParser_$60([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), user : new JsonParser_$60([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { admin : new JsonParser_$62([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banned : new JsonParser_$62([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), guest : new JsonParser_$62([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), leader : new JsonParser_$62([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), user : new JsonParser_$62([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$59 + ,__class__: JsonParser_$61 }); -var JsonParser_$60 = function(errors,putils,errorType) { +var JsonParser_$62 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; -JsonParser_$60.__name__ = true; -JsonParser_$60.__super__ = json2object_reader_BaseParser; -JsonParser_$60.prototype = $extend(json2object_reader_BaseParser.prototype,{ +JsonParser_$62.__name__ = true; +JsonParser_$62.__super__ = json2object_reader_BaseParser; +JsonParser_$62.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array<Permission>",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1708,19 +1745,19 @@ JsonParser_$60.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonArray: function(a,pos,variable) { - this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$61(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); + this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$63(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } - ,__class__: JsonParser_$60 + ,__class__: JsonParser_$62 }); -var JsonParser_$61 = function(errors,putils,errorType) { +var JsonParser_$63 = 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_$63.__name__ = true; +JsonParser_$63.__super__ = json2object_reader_BaseParser; +JsonParser_$63.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "guest"; this.errors.push(json2object_Error.IncorrectType(variable,"Permission",pos)); @@ -1730,19 +1767,19 @@ JsonParser_$61.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.value = null; } ,loadJsonString: function(s,pos,variable) { - this.value = this.loadString(s,pos,variable,["guest","user","leader","admin","writeChat","addVideo","removeVideo","requestLeader","rewind","clearChat","setLeader","changeOrder","lockPlaylist"],"guest"); + this.value = this.loadString(s,pos,variable,["guest","user","leader","admin","writeChat","addVideo","removeVideo","requestLeader","rewind","clearChat","setLeader","changeOrder","lockPlaylist","banClient"],"guest"); } - ,__class__: JsonParser_$61 + ,__class__: JsonParser_$63 }); -var JsonParser_$63 = function(errors,putils,errorType) { +var JsonParser_$65 = 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,{ +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,"{ replace : String, regex : String, name : String, flags : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); @@ -1760,16 +1797,16 @@ JsonParser_$63.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "flags": - this.value.flags = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"flags",assigned,this.value.flags,pos); + this.value.flags = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"flags",assigned,this.value.flags,pos); break; case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "regex": - this.value.regex = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"regex",assigned,this.value.regex,pos); + this.value.regex = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"regex",assigned,this.value.regex,pos); break; case "replace": - this.value.replace = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"replace",assigned,this.value.replace,pos); + this.value.replace = this.loadObjectField(($_=new JsonParser_$38(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))); @@ -1778,19 +1815,19 @@ JsonParser_$63.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { flags : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), regex : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), replace : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { flags : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), regex : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), replace : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$63 + ,__class__: JsonParser_$65 }); -var JsonParser_$65 = function(errors,putils,errorType) { +var JsonParser_$67 = 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_$67.__name__ = true; +JsonParser_$67.__super__ = json2object_reader_BaseParser; +JsonParser_$67.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); @@ -1808,10 +1845,10 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ ++_g; switch(field.name) { case "image": - this.value.image = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"image",assigned,this.value.image,pos); + this.value.image = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"image",assigned,this.value.image,pos); break; case "name": - this.value.name = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); + this.value.name = this.loadObjectField(($_=new JsonParser_$38(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))); @@ -1820,9 +1857,9 @@ JsonParser_$65.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { image : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { image : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } - ,__class__: JsonParser_$65 + ,__class__: JsonParser_$67 }); var JsonParser_$7 = function(errors,putils,errorType) { if(errorType == null) { @@ -1834,7 +1871,7 @@ JsonParser_$7.__name__ = true; JsonParser_$7.__super__ = json2object_reader_BaseParser; JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, ?rate : Null<Float>, ?paused : Null<Bool> }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array<VideoItem>, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array<Message>, globalIp : String, config : Config, clients : Array<ClientData>, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1842,21 +1879,39 @@ JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["paused","rate","time"],[true,true,false]); + this.objectSetupAssign(assigned,["clientName","clients","config","globalIp","history","isPlaylistOpen","isUnknownClient","itemPos","videoList"],[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 "paused": - this.value.paused = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos); + case "clientName": + this.value.clientName = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; - case "rate": - this.value.rate = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); + case "clients": + this.value.clients = this.loadObjectField(($_=new JsonParser_$43(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; - case "time": - this.value.time = this.loadObjectField(($_=new JsonParser_$37(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); + case "config": + this.value.config = this.loadObjectField(($_=new JsonParser_$54(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos); + break; + case "globalIp": + this.value.globalIp = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"globalIp",assigned,this.value.globalIp,pos); + break; + case "history": + this.value.history = this.loadObjectField(($_=new JsonParser_$55(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"history",assigned,this.value.history,pos); + break; + case "isPlaylistOpen": + this.value.isPlaylistOpen = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isPlaylistOpen",assigned,this.value.isPlaylistOpen,pos); + break; + case "isUnknownClient": + this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); + break; + case "itemPos": + this.value.itemPos = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos); + break; + case "videoList": + this.value.videoList = this.loadObjectField(($_=new JsonParser_$35(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))); @@ -1865,7 +1920,7 @@ JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { paused : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { clientName : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$43([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$54([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$55([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$35([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$7 }); @@ -1879,7 +1934,7 @@ JsonParser_$9.__name__ = true; JsonParser_$9.__super__ = json2object_reader_BaseParser; JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ ?passHash : Null<String>, ?isUnknownClient : Null<Bool>, ?clients : Null<Array<ClientData>>, clientName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, ?rate : Null<Float>, ?paused : Null<Bool> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1887,24 +1942,21 @@ JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["clientName","clients","isUnknownClient","passHash"],[false,true,true,true]); + this.objectSetupAssign(assigned,["paused","rate","time"],[true,true,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_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); - break; - case "clients": - this.value.clients = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); + case "paused": + this.value.paused = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,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); + case "rate": + this.value.rate = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); break; - case "passHash": - this.value.passHash = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos); + case "time": + this.value.time = this.loadObjectField(($_=new JsonParser_$39(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))); @@ -1913,7 +1965,7 @@ JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$46([],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))), passHash : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { paused : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$9 }); @@ -1949,6 +2001,16 @@ Lambda.count = function(it,pred) { } return n; }; +Lambda.find = function(it,f) { + var v = $getIterator(it); + while(v.hasNext()) { + var v1 = v.next(); + if(f(v1)) { + return v1; + } + } + return null; +}; var haxe_IMap = function() { }; haxe_IMap.__name__ = true; haxe_IMap.__isInterface__ = true; @@ -3348,6 +3410,7 @@ json2object_PositionUtils.prototype = { var server_ConsoleInput = function(main) { var _g = new haxe_ds_StringMap(); _g.h["addAdmin"] = { args : ["name","password"], desc : "Adds channel admin"}; + _g.h["removeAdmin"] = { args : ["name"], desc : "Removes channel admin"}; _g.h["replay"] = { args : ["name"], desc : "Replay log file on server from user/logs/"}; _g.h["logList"] = { args : [], desc : "Show log list from user/logs/"}; _g.h["exit"] = { args : [], desc : "Exit process"}; @@ -3359,10 +3422,10 @@ server_ConsoleInput.prototype = { initConsoleInput: function() { var _gthis = this; var rl = js_node_Readline.createInterface({ input : process.stdin, output : process.stdout, completer : $bind(this,this.onCompletion)}); - haxe_Log.trace = function(msg,pos) { + haxe_Log.trace = function(msg,infos) { js_node_Readline.clearLine(process.stdout,0); js_node_Readline.cursorTo(process.stdout,0,null); - console.log(msg); + console.log(_gthis.formatOutput(msg,infos)); rl.prompt(true); }; rl.prompt(); @@ -3371,6 +3434,18 @@ server_ConsoleInput.prototype = { rl.prompt(); }); } + ,formatOutput: function(v,infos) { + var str = Std.string(v); + if(infos == null) { + return str; + } + if(infos.customParams != null) { + var _g = 0; + var _g1 = infos.customParams; + while(_g < _g1.length) str += ", " + Std.string(_g1[_g++]); + } + return str; + } ,onCompletion: function(line) { var _g = []; var item_keys = Object.keys(this.commands.h); @@ -3410,7 +3485,7 @@ server_ConsoleInput.prototype = { var name = args[0]; var password = args[1]; if(this.main.badNickName(name)) { - haxe_Log.trace(StringTools.replace(Lang.get("usernameError"),"$MAX","" + this.main.config.maxLoginLength),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 100, className : "server.ConsoleInput", methodName : "parseLine"}); + haxe_Log.trace(StringTools.replace(Lang.get("usernameError"),"$MAX","" + this.main.config.maxLoginLength),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 115, className : "server.ConsoleInput", methodName : "parseLine"}); return; } this.main.addAdmin(name,password); @@ -3431,13 +3506,16 @@ server_ConsoleInput.prototype = { } } var _g1 = 0; - while(_g1 < _g.length) haxe_Log.trace(haxe_io_Path.withoutExtension(_g[_g1++]),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 122, className : "server.ConsoleInput", methodName : "parseLine"}); + while(_g1 < _g.length) haxe_Log.trace(haxe_io_Path.withoutExtension(_g[_g1++]),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 141, className : "server.ConsoleInput", methodName : "parseLine"}); + break; + case "removeAdmin": + this.main.removeAdmin(args[0]); break; case "replay": server_Utils.ensureDir(this.main.logsDir); var path = haxe_io_Path.normalize("" + this.main.logsDir + "/" + args[0] + ".json"); if(!sys_FileSystem.exists(path)) { - haxe_Log.trace("File \"" + path + "\" not found",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 110, className : "server.ConsoleInput", methodName : "parseLine"}); + haxe_Log.trace("File \"" + path + "\" not found",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 129, className : "server.ConsoleInput", methodName : "parseLine"}); return; } var events = JSON.parse(js_node_Fs.readFileSync(path,{ encoding : "utf8"})); @@ -3449,7 +3527,7 @@ server_ConsoleInput.prototype = { var len = args.length; var actual = this.commands.h[command].args.length; if(len != actual) { - haxe_Log.trace("Wrong count of arguments for command \"" + command + "\" (" + len + " instead of " + actual + ")",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 134, className : "server.ConsoleInput", methodName : "isValidArgs"}); + haxe_Log.trace("Wrong count of arguments for command \"" + command + "\" (" + len + " instead of " + actual + ")",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 153, className : "server.ConsoleInput", methodName : "isValidArgs"}); return false; } return true; @@ -3479,7 +3557,7 @@ server_ConsoleInput.prototype = { var data = _g.value; list.push("" + StringTools.rpad("/" + _g.key + " " + data.args.join(" ")," ",maxLength) + " | " + data.desc); } - haxe_Log.trace("Unknown command \"" + line + "\". List:\n" + list.join("\n"),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 153, className : "server.ConsoleInput", methodName : "printHelp"}); + haxe_Log.trace("Unknown command \"" + line + "\". List:\n" + list.join("\n"),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 172, className : "server.ConsoleInput", methodName : "printHelp"}); } ,__class__: server_ConsoleInput }; @@ -3503,7 +3581,7 @@ server_HttpServer.serveFiles = function(req,res) { var ext = haxe_io_Path.extension(filePath).toLowerCase(); res.setHeader("Accept-Ranges","bytes"); res.setHeader("Content-Type",server_HttpServer.getMimeType(ext)); - if(server_HttpServer.allowLocalRequests && req.connection.remoteAddress == req.connection.localAddress || server_HttpServer.allowedLocalFiles.h[url]) { + if(server_HttpServer.allowLocalRequests && req.socket.remoteAddress == req.socket.localAddress || server_HttpServer.allowedLocalFiles.h[url]) { if(server_HttpServer.isMediaExtension(ext)) { server_HttpServer.allowedLocalFiles.h[url] = true; if(server_HttpServer.serveMedia(req,res,url)) { @@ -3732,6 +3810,7 @@ var server_Main = function() { this.loadedClientsCount = 0; this.matchGuestName = new EReg("guest [0-9]+",""); this.matchHtmlChars = new EReg("[&^<>'\"]",""); + this.isHeroku = false; this.itemPos = 0; this.isPlaylistOpen = true; this.messages = []; @@ -3903,25 +3982,49 @@ server_Main.prototype = { ,loadUsers: function() { var customPath = "" + this.rootDir + "/user/users.json"; if(!sys_FileSystem.exists(customPath)) { - return { admins : []}; + return { admins : [], bans : []}; + } + var users = JSON.parse(js_node_Fs.readFileSync(customPath,{ encoding : "utf8"})); + if(users.admins == null) { + users.admins = []; + } + if(users.bans == null) { + users.bans = []; } - return JSON.parse(js_node_Fs.readFileSync(customPath,{ encoding : "utf8"})); + var _g = 0; + var _g1 = users.bans; + while(_g < _g1.length) { + var field = _g1[_g]; + ++_g; + field.toDate = HxOverrides.strDate(field.toDate); + } + return users; } ,writeUsers: function(users) { var folder = "" + this.rootDir + "/user"; server_Utils.ensureDir(folder); - js_node_Fs.writeFileSync("" + folder + "/users.json",JSON.stringify(users,null,"\t")); + var users1 = users.admins; + var _g = []; + var _g1 = 0; + var _g2 = users.bans; + while(_g1 < _g2.length) { + var field = _g2[_g1]; + ++_g1; + _g.push({ ip : field.ip, toDate : HxOverrides.dateStr(field.toDate)}); + } + js_node_Fs.writeFileSync("" + folder + "/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 : 212, className : "server.Main", methodName : "saveState"}); + haxe_Log.trace("Saving state...",{ fileName : "src/server/Main.hx", lineNumber : 228, className : "server.Main", methodName : "saveState"}); var json = JSON.stringify({ videoList : this.videoList, isPlaylistOpen : this.isPlaylistOpen, itemPos : this.itemPos, messages : this.messages, timer : { time : this.videoTimer.getTime(), paused : this.videoTimer.isPaused()}},null,"\t"); js_node_Fs.writeFileSync(this.statePath,json); + this.writeUsers(this.userList); } ,loadState: function() { if(!sys_FileSystem.exists(this.statePath)) { return; } - haxe_Log.trace("Loading state...",{ fileName : "src/server/Main.hx", lineNumber : 229, className : "server.Main", methodName : "loadState"}); + haxe_Log.trace("Loading state...",{ fileName : "src/server/Main.hx", lineNumber : 246, className : "server.Main", methodName : "loadState"}); var data = JSON.parse(js_node_Fs.readFileSync(this.statePath,{ encoding : "utf8"})); this.videoList.length = 0; this.messages.length = 0; @@ -3938,14 +4041,15 @@ server_Main.prototype = { this.videoTimer.pause(); } ,logError: function(type,data) { - haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 247, className : "server.Main", methodName : "logError", customParams : [data]}); + haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 264, className : "server.Main", methodName : "logError", customParams : [data]}); var crashesFolder = "" + this.rootDir + "/user/crashes"; server_Utils.ensureDir(crashesFolder); js_node_Fs.writeFileSync("" + crashesFolder + "/" + (DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S") + "-" + type) + ".json",JSON.stringify(data,null,"\t")); } ,initIntergationHandlers: function() { var _gthis = this; - if(process.env["_"] != null && process.env["_"].indexOf("heroku") != -1 && process.env["APP_URL"] != null) { + this.isHeroku = process.env["_"] != null && process.env["_"].indexOf("heroku") != -1; + if(this.isHeroku && process.env["APP_URL"] != null) { var url = process.env["APP_URL"]; if(!StringTools.startsWith(url,"http")) { url = "http://" + url; @@ -3954,21 +4058,34 @@ server_Main.prototype = { if(_gthis.clients.length == 0) { return; } - haxe_Log.trace("Ping " + url,{ fileName : "src/server/Main.hx", lineNumber : 262, className : "server.Main", methodName : "initIntergationHandlers"}); + haxe_Log.trace("Ping " + url,{ fileName : "src/server/Main.hx", lineNumber : 281, className : "server.Main", methodName : "initIntergationHandlers"}); js_node_Http.get(url,null,function(r) { }); }; } } + ,clientIp: function(req) { + if(this.isHeroku) { + var forwarded = req.headers["x-forwarded-for"]; + forwarded = StringTools.trim(forwarded.split(",")[0]); + if(forwarded == null || forwarded.length == 0) { + return req.socket.remoteAddress; + } + return forwarded; + } + return req.socket.remoteAddress; + } ,addAdmin: function(name,password) { password += this.config.salt; var hash = haxe_crypto_Sha256.encode(password); - if(this.userList.admins == null) { - this.userList.admins = []; - } this.userList.admins.push({ name : name, hash : hash}); - this.writeUsers(this.userList); - haxe_Log.trace("Admin " + name + " added.",{ fileName : "src/server/Main.hx", lineNumber : 277, className : "server.Main", methodName : "addAdmin"}); + haxe_Log.trace("Admin " + name + " added.",{ fileName : "src/server/Main.hx", lineNumber : 305, 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 : 312, className : "server.Main", methodName : "removeAdmin"}); } ,replayLog: function(events) { var _gthis = this; @@ -4009,12 +4126,12 @@ server_Main.prototype = { } ,onConnect: function(ws,req) { var _gthis = this; - var ip = req.connection.remoteAddress; + 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("" + name + " connected (" + ip + ")",{ fileName : "src/server/Main.hx", lineNumber : 315, className : "server.Main", methodName : "onConnect"}); + haxe_Log.trace("" + name + " connected (" + ip + ")",{ fileName : "src/server/Main.hx", lineNumber : 350, className : "server.Main", methodName : "onConnect"}); var client = new Client(ws,req,id,name,0); - client.setGroupFlag(ClientGroup.Admin,this.config.localAdmins && req.connection.localAddress == ip); + client.setGroupFlag(ClientGroup.Admin,this.config.localAdmins && req.socket.localAddress == ip); this.clients.push(client); ws.on("pong",function() { return client.isAlive = true; @@ -4024,7 +4141,7 @@ server_Main.prototype = { var obj = _gthis.wsEventParser.fromJson(data); 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 : 331, className : "server.Main", methodName : "onConnect"}); + haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 366, className : "server.Main", methodName : "onConnect"}); _gthis.serverMessage(client,errors); return; } @@ -4092,6 +4209,38 @@ server_Main.prototype = { this.restartWaitTimer(); } break; + case "BanClient": + if(!this.checkPermission(client,"banClient")) { + return; + } + var name = data.banClient.name; + var bannedClient = ClientTools.getByName(this.clients,name); + if(bannedClient == null) { + return; + } + if(client.name == name || (bannedClient.group & 8) != 0) { + this.serverMessage(client,"adminsCannotBeBannedError"); + return; + } + var ip = this.clientIp(bannedClient.req); + HxOverrides.remove(this.userList.bans,Lambda.find(this.userList.bans,function(item) { + return item.ip == ip; + })); + if(data.banClient.time == 0) { + bannedClient.setGroupFlag(ClientGroup.Banned,false); + this.sendClientList(); + return; + } + var currentTime = new Date().getTime(); + var time = currentTime + data.banClient.time * 1000; + if(time < currentTime) { + return; + } + this.userList.bans.push({ ip : ip, toDate : new Date(time)}); + this.checkBan(bannedClient); + this.serverMessage(client,"" + bannedClient.name + " (" + ip + ") has been banned."); + this.sendClientList(); + break; case "ClearChat": if(!this.checkPermission(client,"clearChat")) { return; @@ -4117,6 +4266,7 @@ server_Main.prototype = { this.videoTimer.play(); } } + this.checkBan(client); this.send(client,{ type : "Connected", connected : { config : this.config, history : this.messages, isUnknownClient : true, clientName : client.name, clients : this.clientList(), videoList : this.videoList, isPlaylistOpen : this.isPlaylistOpen, itemPos : this.itemPos, globalIp : this.globalIp}}); this.sendClientListExcept(client); break; @@ -4124,11 +4274,11 @@ server_Main.prototype = { if(!internal) { return; } - haxe_Log.trace("Client " + client.name + " disconnected",{ fileName : "src/server/Main.hx", lineNumber : 387, className : "server.Main", methodName : "onMessage"}); + haxe_Log.trace("Client " + client.name + " disconnected",{ fileName : "src/server/Main.hx", lineNumber : 423, className : "server.Main", methodName : "onMessage"}); server_Utils.sortedPush(this.freeIds,client.id); HxOverrides.remove(this.clients,client); this.sendClientList(); - if((client.group & 2) != 0) { + if((client.group & 4) != 0) { if(this.videoTimer.isPaused()) { this.videoTimer.play(); } @@ -4213,6 +4363,7 @@ server_Main.prototype = { } client.name = name; client.setGroupFlag(ClientGroup.User,true); + this.checkBan(client); this.send(client,{ type : data.type, login : { isUnknownClient : true, clientName : client.name, clients : this.clientList()}}); this.sendClientListExcept(client); break; @@ -4251,7 +4402,7 @@ server_Main.prototype = { if(this.videoList.length == 0) { return; } - if((client.group & 2) == 0) { + if((client.group & 4) == 0) { return; } this.videoTimer.setTime(data.pause.time); @@ -4262,7 +4413,7 @@ server_Main.prototype = { if(this.videoList.length == 0) { return; } - if((client.group & 2) == 0) { + if((client.group & 4) == 0) { return; } this.videoTimer.setTime(data.play.time); @@ -4322,7 +4473,7 @@ server_Main.prototype = { if(!this.checkPermission(client,"requestLeader")) { return; } - } else if((client.group & 2) == 0 && clientName != "") { + } else if((client.group & 4) == 0 && clientName != "") { if(!this.checkPermission(client,"setLeader")) { return; } @@ -4355,7 +4506,7 @@ server_Main.prototype = { if(this.videoList.length == 0) { return; } - if((client.group & 2) == 0) { + if((client.group & 4) == 0) { return; } this.videoTimer.setRate(data.setRate.rate); @@ -4365,7 +4516,7 @@ server_Main.prototype = { if(this.videoList.length == 0) { return; } - if((client.group & 2) == 0) { + if((client.group & 4) == 0) { return; } this.videoTimer.setTime(data.setTime.time); @@ -4464,12 +4615,40 @@ server_Main.prototype = { this.broadcast(data); } ,checkPermission: function(client,perm) { + if((client.group & 1) != 0) { + this.checkBan(client); + } var state = ClientTools.hasPermission(client,perm,this.config.permissions); if(!state) { this.send(client,{ type : "ServerMessage", serverMessage : { textId : "accessError"}}); } return state; } + ,checkBan: function(client) { + if((client.group & 8) != 0) { + client.setGroupFlag(ClientGroup.Banned,false); + return; + } + var ip = this.clientIp(client.req); + var currentTime = new Date().getTime(); + var _g = 0; + var _g1 = this.userList.bans; + while(_g < _g1.length) { + var ban = _g1[_g]; + ++_g; + if(ban.ip != ip) { + continue; + } + var isOutdated = ban.toDate.getTime() < currentTime; + 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 : 844, className : "server.Main", methodName : "checkBan"}); + this.sendClientList(); + } + break; + } + } ,badNickName: function(name) { if(name.length > this.config.maxLoginLength) { return true; diff --git a/default-config.json b/default-config.json index bc4c9c0..0448a1a 100644 --- a/default-config.json +++ b/default-config.json @@ -12,10 +12,11 @@ "youtubeApiKey": "AIzaSyDTk1OPRI9cDkAK_BKsBcv10DQCHse-QaA", "youtubePlaylistLimit": 50, "permissions": { + "banned": [], "guest": ["writeChat", "addVideo", "removeVideo", "changeOrder", "requestLeader", "rewind"], "user": ["guest"], "leader": ["user"], - "admin": ["user", "clearChat", "setLeader", "lockPlaylist"] + "admin": ["user", "clearChat", "setLeader", "lockPlaylist", "banClient"] }, "emotes": [ {"name": ":adorable:", "image": "https://i.imgur.com/5GxNwDY.png"}, diff --git a/res/client.js b/res/client.js index 80418d4..75e3448 100644 --- a/res/client.js +++ b/res/client.js @@ -10,11 +10,12 @@ function $extend(from, fields) { return proto; } var ClientGroup = $hxEnums["ClientGroup"] = { __ename__:true,__constructs__:null - ,User: {_hx_name:"User",_hx_index:0,__enum__:"ClientGroup",toString:$estr} - ,Leader: {_hx_name:"Leader",_hx_index:1,__enum__:"ClientGroup",toString:$estr} - ,Admin: {_hx_name:"Admin",_hx_index:2,__enum__:"ClientGroup",toString:$estr} + ,Banned: {_hx_name:"Banned",_hx_index:0,__enum__:"ClientGroup",toString:$estr} + ,User: {_hx_name:"User",_hx_index:1,__enum__:"ClientGroup",toString:$estr} + ,Leader: {_hx_name:"Leader",_hx_index:2,__enum__:"ClientGroup",toString:$estr} + ,Admin: {_hx_name:"Admin",_hx_index:3,__enum__:"ClientGroup",toString:$estr} }; -ClientGroup.__constructs__ = [ClientGroup.User,ClientGroup.Leader,ClientGroup.Admin]; +ClientGroup.__constructs__ = [ClientGroup.Banned,ClientGroup.User,ClientGroup.Leader,ClientGroup.Admin]; var Client = function(name,group) { this.name = name; var i = group; @@ -46,14 +47,14 @@ ClientTools.setLeader = function(clients,name) { ++_g; if(client.name == name) { client.setGroupFlag(ClientGroup.Leader,true); - } else if((client.group & 2) != 0) { + } else if((client.group & 4) != 0) { client.setGroupFlag(ClientGroup.Leader,false); } } }; ClientTools.hasLeader = function(clients) { var _g = 0; - while(_g < clients.length) if((clients[_g++].group & 2) != 0) { + while(_g < clients.length) if((clients[_g++].group & 4) != 0) { return true; } return false; @@ -70,13 +71,16 @@ ClientTools.getByName = function(clients,name,def) { return def; }; ClientTools.hasPermission = function(client,permission,permissions) { - if((client.group & 4) != 0) { + if((client.group & 1) != 0) { + return permissions.banned.indexOf(permission) != -1; + } + if((client.group & 8) != 0) { return permissions.admin.indexOf(permission) != -1; } - if((client.group & 2) != 0) { + if((client.group & 4) != 0) { return permissions.leader.indexOf(permission) != -1; } - if((client.group & 1) != 0) { + if((client.group & 2) != 0) { return permissions.user.indexOf(permission) != -1; } return permissions.guest.indexOf(permission) != -1; @@ -537,13 +541,13 @@ client_Buttons.init = function(main) { } }; window.document.querySelector("#clearchatbtn").onclick = function(e) { - if((main.personal.group & 4) != 0) { + if((main.personal.group & 8) != 0) { main.send({ type : "ClearChat"}); } }; var userList = window.document.querySelector("#userlist"); userList.onclick = function(e) { - if((main.personal.group & 4) == 0) { + if((main.personal.group & 8) == 0) { return; } var el = e.target; @@ -628,7 +632,7 @@ client_Buttons.init = function(main) { main.send({ type : "ShufflePlaylist"}); }; window.document.querySelector("#lockplaylist").onclick = function(e) { - if((main.personal.group & 4) != 0) { + if((main.personal.group & 8) != 0) { main.send({ type : "TogglePlaylistLock"}); } }; @@ -657,7 +661,7 @@ client_Buttons.init = function(main) { return client_Buttons.toggleGroup(showOptions); }; window.document.querySelector("#exitBtn").onclick = function(e) { - if((main.personal.group & 1) != 0) { + if((main.personal.group & 2) != 0) { main.send({ type : "Logout"}); } else { window.document.querySelector("#guestname").focus(); @@ -794,7 +798,7 @@ client_Buttons.initHotkeys = function(main,player) { main.toggleLeader(); break; case 80: - if((main.personal.group & 2) == 0) { + if((main.personal.group & 4) == 0) { client_JsApi.once("SetLeader",function(event) { if(event.setLeader.clientName == main.personal.name) { player.pause(); @@ -845,6 +849,9 @@ client_Buttons.initChatInput = function(main) { } }; new client_InputWithHistory(chatline,null,50,function(value) { + if(main.handleCommands(value)) { + return true; + } main.send({ type : "Message", message : { clientName : "", text : value}}); return true; }); @@ -994,7 +1001,7 @@ client_JsApi.setTime = $hx_exports["client"]["JsApi"]["setTime"] = function(time client_JsApi.player.setTime(time); }; client_JsApi.isLeader = $hx_exports["client"]["JsApi"]["isLeader"] = function() { - return (client_JsApi.main.personal.group & 2) != 0; + return (client_JsApi.main.personal.group & 4) != 0; }; client_JsApi.forceSyncNextTick = $hx_exports["client"]["JsApi"]["forceSyncNextTick"] = function(flag) { client_JsApi.main.forceSyncNextTick = flag; @@ -1059,7 +1066,7 @@ client_JsApi.fireVideoRemoveEvents = function(item) { while(_g < _g1.length) _g1[_g++](item); }; var client_Main = function() { - this.matchNumbers = new EReg("^-?[0-9]+$",""); + this.matchSimpleDate = new EReg("^-?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s?)?$",""); this.mask = new EReg("\\${([0-9]+)-([0-9]+)}","g"); this.isConnected = false; this.personal = new Client("Unknown",0); @@ -1374,6 +1381,8 @@ client_Main.prototype = { this.player.setVideo(0); } break; + case "BanClient": + break; case "ClearChat": this.clearChat(); break; @@ -1402,7 +1411,7 @@ client_Main.prototype = { var synchThreshold = this.settings.synchThreshold; var newTime = data.getTime.time; var time = this.player.getTime(); - if((this.personal.group & 2) != 0 && !this.forceSyncNextTick) { + if((this.personal.group & 4) != 0 && !this.forceSyncNextTick) { if(Math.abs(time - newTime) < synchThreshold) { return; } @@ -1452,7 +1461,7 @@ client_Main.prototype = { break; case "Pause": this.player.setPauseIndicator(false); - if((this.personal.group & 2) != 0) { + if((this.personal.group & 4) != 0) { return; } this.player.pause(); @@ -1460,7 +1469,7 @@ client_Main.prototype = { break; case "Play": this.player.setPauseIndicator(true); - if((this.personal.group & 2) != 0) { + if((this.personal.group & 4) != 0) { return; } var synchThreshold = this.settings.synchThreshold; @@ -1489,8 +1498,8 @@ client_Main.prototype = { case "SetLeader": ClientTools.setLeader(this.clients,data.setLeader.clientName); this.updateUserList(); - this.setLeaderButton((this.personal.group & 2) != 0); - if((this.personal.group & 2) != 0) { + this.setLeaderButton((this.personal.group & 4) != 0); + if((this.personal.group & 4) != 0) { this.player.onSetTime(); } break; @@ -1498,7 +1507,7 @@ client_Main.prototype = { this.player.setNextItem(data.setNextItem.pos); break; case "SetRate": - if((this.personal.group & 2) != 0) { + if((this.personal.group & 4) != 0) { return; } this.player.setPlaybackRate(data.setRate.rate); @@ -1539,7 +1548,7 @@ client_Main.prototype = { case "VideoLoaded": this.player.setTime(0); this.player.play(); - if((this.personal.group & 2) != 0 && !this.player.isVideoLoaded()) { + if((this.personal.group & 4) != 0 && !this.player.isVideoLoaded()) { this.forceSyncNextTick = true; } break; @@ -1567,7 +1576,7 @@ client_Main.prototype = { } else { this.guestLogin(name); } - this.setLeaderButton((this.personal.group & 2) != 0); + this.setLeaderButton((this.personal.group & 4) != 0); this.setPlaylistLock(connected.isPlaylistOpen); this.clearChat(); this.serverMessage(1); @@ -1589,7 +1598,7 @@ client_Main.prototype = { button.disabled = true; } var adminMenu = window.document.querySelector("#adminMenu"); - if((this.personal.group & 4) != 0) { + if((this.personal.group & 8) != 0) { adminMenu.style.display = "block"; } else { adminMenu.style.display = "none"; @@ -1754,10 +1763,14 @@ client_Main.prototype = { var client = _g1[_g]; ++_g; list_b += "<div class=\"userlist_item\">"; - if((client.group & 2) != 0) { + if((client.group & 4) != 0) { list_b += "<ion-icon name=\"play\"></ion-icon>"; } - list_b += Std.string("<span class=\"" + ((client.group & 4) != 0 ? "userlist_owner" : "") + "\">" + client.name + "</span></div>"); + var klass = (client.group & 1) != 0 ? "userlist_banned" : ""; + if((client.group & 8) != 0) { + klass += " userlist_owner"; + } + list_b += Std.string("<span class=\"" + klass + "\">" + client.name + "</span></div>"); } window.document.querySelector("#userlist").innerHTML = list_b; } @@ -1785,18 +1798,12 @@ client_Main.prototype = { var textDiv = window.document.createElement("div"); textDiv.className = "text"; text = StringTools.htmlEscape(text); - if(StringTools.startsWith(text,"/")) { - if(name == this.personal.name) { - this.handleCommands(HxOverrides.substr(text,1,null)); - } - } else { - var _g = 0; - var _g1 = this.filters; - while(_g < _g1.length) { - var filter = _g1[_g]; - ++_g; - text = text.replace(filter.regex.r,filter.replace); - } + var _g = 0; + var _g1 = this.filters; + while(_g < _g1.length) { + var filter = _g1[_g]; + ++_g; + text = text.replace(filter.regex.r,filter.replace); } textDiv.innerHTML = text; var isInChatEnd = msgBuf.scrollTop + msgBuf.clientHeight >= msgBuf.scrollHeight - 1; @@ -1844,15 +1851,70 @@ client_Main.prototype = { var msgBuf = window.document.querySelector("#messagebuffer"); msgBuf.scrollTop = msgBuf.scrollHeight; } - ,handleCommands: function(text) { - if(text == "clear") { - if((this.personal.group & 4) != 0) { - this.send({ type : "ClearChat"}); + ,handleCommands: function(command) { + if(!StringTools.startsWith(command,"/")) { + return false; + } + var args = StringTools.trim(command).split(" "); + command = HxOverrides.substr(args.shift(),1,null); + switch(command) { + case "ban": + var name = args[0]; + var time = this.parseSimpleDate(args[1]); + if(time < 0) { + return true; } + this.send({ type : "BanClient", banClient : { name : name, time : time}}); + return true; + case "clear": + this.send({ type : "ClearChat"}); + return true; + case "removeBan":case "unban": + this.send({ type : "BanClient", banClient : { name : args[0], time : 0}}); + return true; } - if(this.matchNumbers.match(text)) { - this.send({ type : "Rewind", rewind : { time : Std.parseInt(text)}}); + if(this.matchSimpleDate.match(command)) { + this.send({ type : "Rewind", rewind : { time : this.parseSimpleDate(command)}}); + return false; } + return false; + } + ,parseSimpleDate: function(text) { + if(text == null) { + return 0; + } + if(!this.matchSimpleDate.match(text)) { + return 0; + } + var matches = []; + var length = client_Utils.matchedNum(this.matchSimpleDate); + var _g = 1; + while(_g < length) { + var group = this.matchSimpleDate.matched(_g++); + if(group == null) { + continue; + } + matches.push(group); + } + var seconds = 0; + var _g = 0; + while(_g < matches.length) seconds += this.parseSimpleDateBlock(matches[_g++]); + if(StringTools.startsWith(text,"-")) { + seconds = -seconds; + } + return seconds; + } + ,parseSimpleDateBlock: function(block) { + if(StringTools.endsWith(block,"s")) { + return Std.parseInt(HxOverrides.substr(block,0,block.length - 1)); + } else if(StringTools.endsWith(block,"m")) { + return Std.parseInt(HxOverrides.substr(block,0,block.length - 1)) * 60; + } else if(StringTools.endsWith(block,"h")) { + return Std.parseInt(HxOverrides.substr(block,0,block.length - 1)) * 60 * 60; + } else if(StringTools.endsWith(block,"d")) { + return Std.parseInt(HxOverrides.substr(block,0,block.length - 1)) * 60 * 60 * 24; + } + return Std.parseInt(block); } ,blinkTabWithTitle: function(title) { var _gthis = this; @@ -1908,8 +1970,8 @@ client_Main.prototype = { return Reflect.field(this.config.permissions,$hxEnums[group.__enum__].__constructs__[group._hx_index]._hx_name.toLowerCase()).indexOf(permission) != -1; } ,toggleLeader: function() { - this.setLeaderButton((this.personal.group & 2) == 0); - this.send({ type : "SetLeader", setLeader : { clientName : (this.personal.group & 2) != 0 ? "" : this.personal.name}}); + this.setLeaderButton((this.personal.group & 4) == 0); + this.send({ type : "SetLeader", setLeader : { clientName : (this.personal.group & 4) != 0 ? "" : this.personal.name}}); } ,hasLeader: function() { return ClientTools.hasLeader(this.clients); @@ -2067,12 +2129,12 @@ client_Player.prototype = { this.isLoaded = true; } ,onPlay: function() { - if((this.main.personal.group & 2) == 0) { + if((this.main.personal.group & 4) == 0) { return; } this.main.send({ type : "Play", play : { time : this.getTime()}}); if(this.main.hasLeaderOnPauseRequest()) { - if(this.main.hasPermission((this.main.personal.group & 4) != 0 ? ClientGroup.Admin : ClientGroup.User,"requestLeader")) { + if(this.main.hasPermission((this.main.personal.group & 8) != 0 ? ClientGroup.Admin : ClientGroup.User,"requestLeader")) { this.main.toggleLeader(); } } @@ -2090,7 +2152,7 @@ client_Player.prototype = { this.main.toggleLeader(); return; } - if((this.main.personal.group & 2) == 0) { + if((this.main.personal.group & 4) == 0) { return; } this.main.send({ type : "Pause", pause : { time : this.getTime()}}); @@ -2100,7 +2162,7 @@ client_Player.prototype = { this.skipSetTime = false; return; } - if((this.main.personal.group & 2) == 0) { + if((this.main.personal.group & 4) == 0) { return; } this.main.send({ type : "SetTime", setTime : { time : this.getTime()}}); @@ -2110,7 +2172,7 @@ client_Player.prototype = { this.skipSetRate = false; return; } - if((this.main.personal.group & 2) == 0) { + if((this.main.personal.group & 4) == 0) { return; } this.main.send({ type : "SetRate", setRate : { rate : this.getPlaybackRate()}}); @@ -2220,7 +2282,7 @@ client_Player.prototype = { var time = this.getTime(); this.removeVideo(); this.setVideo(this.itemPos); - if((this.main.personal.group & 2) != 0) { + if((this.main.personal.group & 4) != 0) { this.setTime(time); this.main.forceSyncNextTick = true; } @@ -2467,6 +2529,9 @@ client_Utils.copyToClipboard = function(text) { window.document.body.removeChild(textarea); } }; +client_Utils.matchedNum = function(ereg) { + return ereg.r.m.length; +}; client_Utils.browseFileUrl = function(onFileLoad,isBinary,revoke) { if(revoke == null) { revoke = false; diff --git a/res/css/des.css b/res/css/des.css index e6e9145..5b2ddcc 100644 --- a/res/css/des.css +++ b/res/css/des.css @@ -506,6 +506,12 @@ footer#footer { color: var(--midground); } +.userlist_banned { + opacity: 0.5; + text-decoration: line-through; + text-decoration-thickness: 2px; +} + #userlisttoggle { overflow: hidden; white-space: nowrap; diff --git a/res/langs/en.json b/res/langs/en.json index a38355a..692f816 100644 --- a/res/langs/en.json +++ b/res/langs/en.json @@ -12,6 +12,7 @@ "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.", "rawVideo": "Raw video", "videos": "videos", "addedBy": "Added by", diff --git a/res/langs/ru.json b/res/langs/ru.json index 8228eeb..77b1cb1 100644 --- a/res/langs/ru.json +++ b/res/langs/ru.json @@ -12,6 +12,7 @@ "userVideoLimitError": "Был достингут лимит видео на пользователя.", "videoAlreadyExistsError": "Видео уже имеется в плейлисте.", "addVideoError": "Не удалось добавить видео.", + "adminsCannotBeBannedError": "Админы не могут быть заблокированы. Сначала удалите их.", "rawVideo": "Исходное видео", "videos": "видео", "addedBy": "Добавлено", diff --git a/src/Client.hx b/src/Client.hx index 254e294..ae35ef4 100644 --- a/src/Client.hx +++ b/src/Client.hx @@ -7,6 +7,7 @@ import js.npm.ws.WebSocket; import haxe.EnumFlags; enum ClientGroup { + Banned; User; Leader; Admin; @@ -20,12 +21,13 @@ typedef ClientData = { class Client { #if nodejs public final ws:WebSocket; - public final id:Int; public final req:IncomingMessage; + public final id:Int; public var isAlive = true; #end public var name:String; public var group:EnumFlags<ClientGroup>; + public var isBanned(get, set):Bool; public var isUser(get, set):Bool; public var isLeader(get, set):Bool; public var isAdmin(get, set):Bool; @@ -45,6 +47,14 @@ class Client { } #end + inline function get_isBanned():Bool { + return group.has(Banned); + } + + inline function set_isBanned(flag:Bool):Bool { + return setGroupFlag(Banned, flag); + } + inline function get_isUser():Bool { return group.has(User); } diff --git a/src/ClientTools.hx b/src/ClientTools.hx index b4ac9cb..c5053f1 100644 --- a/src/ClientTools.hx +++ b/src/ClientTools.hx @@ -29,6 +29,7 @@ class ClientTools { public static function hasPermission(client:Client, permission:Permission, permissions:Permissions):Bool { final p = permissions; + if (client.isBanned) return p.banned.contains(permission); if (client.isAdmin) return p.admin.contains(permission); if (client.isLeader) return p.leader.contains(permission); if (client.isUser) return p.user.contains(permission); diff --git a/src/Types.hx b/src/Types.hx index 519ac76..c2136b4 100644 --- a/src/Types.hx +++ b/src/Types.hx @@ -36,6 +36,7 @@ typedef Config = { } typedef Permissions = { + banned:Array<Permission>, guest:Array<Permission>, user:Array<Permission>, leader:Array<Permission>, @@ -56,10 +57,12 @@ enum abstract Permission(String) { var SetLeaderPerm = "setLeader"; var ChangeOrderPerm = "changeOrder"; var LockPlaylistPerm = "lockPlaylist"; + var BanClientPerm = "banClient"; } typedef UserList = { admins:Array<UserField>, + bans:Array<BanField>, ?salt:String } @@ -68,6 +71,11 @@ typedef UserField = { hash:String } +typedef BanField = { + ip:String, + toDate:Date +} + typedef Emote = { name:String, image:String @@ -130,6 +138,10 @@ typedef WsEvent = { ?updateClients:{ clients:Array<ClientData>, }, + ?banClient:{ + name:String, + time:Float + }, ?addVideo:{ item:VideoItem, atEnd:Bool @@ -192,6 +204,7 @@ enum abstract WsEventType(String) { var UpdateClients; // var AddClient; // var RemoveClient; + var BanClient; var AddVideo; var RemoveVideo; var SkipVideo; diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx index 86a7d82..aba629e 100644 --- a/src/client/Buttons.hx +++ b/src/client/Buttons.hx @@ -351,6 +351,7 @@ class Buttons { if (Utils.isTouch()) main.scrollChatToEnd(); } new InputWithHistory(chatline, 50, value -> { + if (main.handleCommands(value)) return true; main.send({ type: Message, message: { diff --git a/src/client/Main.hx b/src/client/Main.hx index c5dca67..57a2d0f 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -382,8 +382,8 @@ class Main { case Connected: onConnected(data); onTimeGet.run(); - case Disconnected: // server-only + case Disconnected: // server-only case Login: onLogin(data.login.clients, data.login.clientName); @@ -411,6 +411,7 @@ class Main { personal = clients.getByName(personal.name, personal); if (personal.group.toInt() != oldGroup) onUserGroupChanged(); + case BanClient: // server-only case Message: addMessage(data.message.clientName, data.message.text); @@ -728,7 +729,8 @@ class Main { for (client in clients) { list.add('<div class="userlist_item">'); if (client.isLeader) list.add('<ion-icon name="play"></ion-icon>'); - final klass = client.isAdmin ? "userlist_owner" : ""; + var klass = client.isBanned ? "userlist_banned" : ""; + if (client.isAdmin) klass += " userlist_owner"; list.add('<span class="$klass">${client.name}</span></div>'); } final userlist = ge("#userlist"); @@ -764,12 +766,8 @@ class Main { textDiv.className = "text"; text = text.htmlEscape(); - if (text.startsWith("/")) { - if (name == personal.name) handleCommands(text.substr(1)); - } else { - for (filter in filters) { - text = filter.regex.replace(text, filter.replace); - } + for (filter in filters) { + text = filter.regex.replace(text, filter.replace); } textDiv.innerHTML = text; final isInChatEnd = msgBuf.scrollTop + msgBuf.clientHeight >= msgBuf.scrollHeight - 1; @@ -828,21 +826,80 @@ class Main { msgBuf.scrollTop = msgBuf.scrollHeight; } - final matchNumbers = ~/^-?[0-9]+$/; + /* Returns `true` if text should not be sent to chat */ + public function handleCommands(command:String):Bool { + if (!command.startsWith("/")) return false; + final args = command.trim().split(" "); + command = args.shift().substr(1); - function handleCommands(text:String):Void { - switch (text) { + switch (command) { + case "ban": + final name = args[0]; + final time = parseSimpleDate(args[1]); + if (time < 0) return true; + send({ + type: BanClient, + banClient: { + name: name, + time: time + } + }); + return true; + case "unban", "removeBan": + final name = args[0]; + send({ + type: BanClient, + banClient: { + name: name, + time: 0 + } + }); + return true; case "clear": - if (isAdmin()) send({type: ClearChat}); + send({type: ClearChat}); + return true; } - if (matchNumbers.match(text)) { + if (matchSimpleDate.match(command)) { send({ type: Rewind, rewind: { - time: Std.parseInt(text) + time: parseSimpleDate(command) } }); + return false; + } + return false; + } + + final matchSimpleDate = ~/^-?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s?)?$/; + + function parseSimpleDate(text:Null<String>):Int { + if (text == null) return 0; + if (!matchSimpleDate.match(text)) return 0; + final matches:Array<String> = []; + final length = Utils.matchedNum(matchSimpleDate); + for (i in 1...length) { + final group = matchSimpleDate.matched(i); + if (group == null) continue; + matches.push(group); + } + var seconds = 0; + for (block in matches) { + seconds += parseSimpleDateBlock(block); + } + if (text.startsWith("-")) seconds = -seconds; + return seconds; + } + + function parseSimpleDateBlock(block:String):Int { + inline function time():Int { + return Std.parseInt(block.substr(0, block.length - 1)); } + if (block.endsWith("s")) return time(); + else if (block.endsWith("m")) return time() * 60; + else if (block.endsWith("h")) return time() * 60 * 60; + else if (block.endsWith("d")) return time() * 60 * 60 * 24; + return Std.parseInt(block); } public function blinkTabWithTitle(title:String):Void { diff --git a/src/client/Utils.hx b/src/client/Utils.hx index 232ca02..f23365e 100644 --- a/src/client/Utils.hx +++ b/src/client/Utils.hx @@ -89,6 +89,14 @@ class Utils { } } + public static function matchedNum(ereg:EReg):Int { + #if js + return (ereg : Dynamic).r.m.length; + #else + #error "not implemented" + #end + } + public static function browseFileUrl( onFileLoad:(url:String, name:String) -> Void, isBinary = true, diff --git a/src/server/ConsoleInput.hx b/src/server/ConsoleInput.hx index 9b8faf3..119d87e 100644 --- a/src/server/ConsoleInput.hx +++ b/src/server/ConsoleInput.hx @@ -18,6 +18,7 @@ private typedef CommandData = { private enum abstract Command(String) from String { var AddAdmin = "addAdmin"; + var RemoveAdmin = "removeAdmin"; var Replay = "replay"; var LogList = "logList"; var Exit = "exit"; @@ -30,6 +31,10 @@ class ConsoleInput { args: ["name", "password"], desc: "Adds channel admin" }, + RemoveAdmin => { + args: ["name"], + desc: "Removes channel admin" + }, Replay => { args: ["name"], desc: "Replay log file on server from user/logs/" @@ -54,10 +59,10 @@ class ConsoleInput { output: process.stdout, completer: onCompletion }); - haxe.Log.trace = (msg, ?pos) -> { + haxe.Log.trace = (msg:Dynamic, ?infos:haxe.PosInfos) -> { Readline.clearLine(process.stdout, 0); Readline.cursorTo(process.stdout, 0, null); - Console.log(msg); + Console.log(formatOutput(msg, infos)); rl.prompt(true); }; rl.prompt(); @@ -68,6 +73,16 @@ class ConsoleInput { // rl.on("close", exit); } + function formatOutput(v:Dynamic, infos:haxe.PosInfos):String { + var str = Std.string(v); + if (infos == null) return str; + if (infos.customParams != null) { + for (v in infos.customParams) + str += ", " + Std.string(v); + } + return str; + } + function onCompletion(line:String):Array<Or<Array<String>, String>> { final commands:Array<String> = [ for (item in commands.keys()) '/$item ' @@ -102,6 +117,10 @@ class ConsoleInput { } main.addAdmin(name, password); + case RemoveAdmin: + final name = args[0]; + main.removeAdmin(name); + case Replay: Utils.ensureDir(main.logsDir); final name = args[0]; diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx index 44e4f36..2076336 100644 --- a/src/server/HttpServer.hx +++ b/src/server/HttpServer.hx @@ -58,8 +58,7 @@ class HttpServer { res.setHeader("Accept-Ranges", "bytes"); res.setHeader("Content-Type", getMimeType(ext)); - if (allowLocalRequests - && req.connection.remoteAddress == req.connection.localAddress + if (allowLocalRequests && req.socket.remoteAddress == req.socket.localAddress || allowedLocalFiles[url]) { if (isMediaExtension(ext)) { allowedLocalFiles[url] = true; diff --git a/src/server/Main.hx b/src/server/Main.hx index ea1e40b..2f3a8a4 100644 --- a/src/server/Main.hx +++ b/src/server/Main.hx @@ -196,16 +196,32 @@ class Main { function loadUsers():UserList { final customPath = '$rootDir/user/users.json'; if (!FileSystem.exists(customPath)) return { - admins: [] + admins: [], + bans: [] }; - return Json.parse(File.getContent(customPath)); + final users:UserList = Json.parse(File.getContent(customPath)); + if (users.admins == null) users.admins = []; + if (users.bans == null) users.bans = []; + for (field in users.bans) { + field.toDate = Date.fromString(cast field.toDate); + } + return users; } function writeUsers(users:UserList):Void { final folder = '$rootDir/user'; Utils.ensureDir(folder); - final data = Json.stringify(users, "\t"); - File.saveContent('$folder/users.json', data); + final data:UserList = { + admins: users.admins, + bans: [ + for (field in users.bans) { + ip: field.ip, + toDate: cast field.toDate.toString() + } + ], + salt: users.salt + } + File.saveContent('$folder/users.json', Json.stringify(data, "\t")); } function saveState():Void { @@ -222,6 +238,7 @@ class Main { } final json = Json.stringify(data, "\t"); File.saveContent(statePath, json); + writeUsers(userList); } function loadState():Void { @@ -251,10 +268,12 @@ class Main { File.saveContent('$crashesFolder/$name.json', Json.stringify(data, "\t")); } + var isHeroku = false; + function initIntergationHandlers():Void { + isHeroku = process.env["_"] != null && process.env["_"].contains("heroku"); // Prevent heroku idle when clients online (needs APP_URL env var) - if (process.env["_"] != null && process.env["_"].contains("heroku") - && process.env["APP_URL"] != null) { + if (isHeroku && process.env["APP_URL"] != null) { var url = process.env["APP_URL"]; if (!url.startsWith("http")) url = 'http://$url'; new Timer(10 * 60 * 1000).run = function() { @@ -265,18 +284,34 @@ class Main { } } + function clientIp(req:IncomingMessage):String { + // Heroku uses internal proxy, so header cannot be spoofed + if (isHeroku) { + var forwarded:String = req.headers["x-forwarded-for"]; + forwarded = forwarded.split(",")[0].trim(); + if (forwarded == null || forwarded.length == 0) return req.socket.remoteAddress; + return forwarded; + } + return req.socket.remoteAddress; + } + public function addAdmin(name:String, password:String):Void { password += config.salt; final hash = Sha256.encode(password); - if (userList.admins == null) userList.admins = []; userList.admins.push({ name: name, hash: hash }); - writeUsers(userList); trace('Admin $name added.'); } + public function removeAdmin(name:String):Void { + userList.admins.remove( + userList.admins.find(item -> item.name == name) + ); + trace('Admin $name removed.'); + } + public function replayLog(events:Array<ServerEvent>):Void { final timer = new Timer(1000); timer.run = () -> { @@ -309,11 +344,11 @@ class Main { } function onConnect(ws:WebSocket, req:IncomingMessage):Void { - final ip = req.connection.remoteAddress; + final ip = clientIp(req); final id = freeIds.length > 0 ? freeIds.shift() : clients.length; final name = 'Guest ${id + 1}'; trace('$name connected ($ip)'); - final isAdmin = config.localAdmins && req.connection.localAddress == ip; + final isAdmin = config.localAdmins && req.socket.localAddress == ip; final client = new Client(ws, req, id, name, 0); client.isAdmin = isAdmin; clients.push(client); @@ -366,6 +401,7 @@ class Main { if (videoTimer.isPaused()) videoTimer.play(); } + checkBan(client); send(client, { type: Connected, connected: { @@ -407,6 +443,34 @@ class Main { case UpdateClients: sendClientList(); + + case BanClient: + if (!checkPermission(client, BanClientPerm)) return; + final name = data.banClient.name; + final bannedClient = clients.getByName(name); + if (bannedClient == null) return; + if (client.name == name || bannedClient.isAdmin) { + serverMessage(client, "adminsCannotBeBannedError"); + return; + } + final ip = clientIp(bannedClient.req); + userList.bans.remove(userList.bans.find(item -> item.ip == ip)); + if (data.banClient.time == 0) { + bannedClient.isBanned = false; + sendClientList(); + return; + } + final currentTime = Date.now().getTime(); + final time = currentTime + data.banClient.time * 1000; + if (time < currentTime) return; + userList.bans.push({ + ip: ip, + toDate: Date.fromTime(time) + }); + checkBan(bannedClient); + serverMessage(client, '${bannedClient.name} ($ip) has been banned.'); + sendClientList(); + case Login: final name = data.login.clientName.trim(); final lcName = name.toLowerCase(); @@ -434,6 +498,7 @@ class Main { } client.name = name; client.isUser = true; + checkBan(client); send(client, { type: data.type, login: { @@ -750,16 +815,39 @@ class Main { } function checkPermission(client:Client, perm:Permission):Bool { + if (client.isBanned) checkBan(client); final state = client.hasPermission(perm, config.permissions); - if (!state) send(client, { - type: ServerMessage, - serverMessage: { - textId: "accessError" - } - }); + if (!state) { + send(client, { + type: ServerMessage, + serverMessage: { + textId: "accessError" + } + }); + } return state; } + function checkBan(client:Client):Void { + if (client.isAdmin) { + client.isBanned = false; + return; + } + final ip = clientIp(client.req); + final currentTime = Date.now().getTime(); + for (ban in userList.bans) { + if (ban.ip != ip) continue; + final isOutdated = ban.toDate.getTime() < currentTime; + client.isBanned = !isOutdated; + if (isOutdated) { + userList.bans.remove(ban); + trace('${client.name} ban removed'); + sendClientList(); + } + break; + } + } + final matchHtmlChars = ~/[&^<>'"]/; final matchGuestName = ~/guest [0-9]+/; |
