diff options
| -rw-r--r-- | build/server.js | 27 | ||||
| -rw-r--r-- | src/server/Main.hx | 18 |
2 files changed, 26 insertions, 19 deletions
diff --git a/build/server.js b/build/server.js index bc54fbb..02b5503 100644 --- a/build/server.js +++ b/build/server.js @@ -3637,7 +3637,7 @@ server_Main.prototype = { if(_gthis.videoList.length != currentLength) { return; } - _gthis.onMessage(client,{ type : "SkipVideo", skipVideo : { url : _gthis.videoList[_gthis.itemPos].url}}); + _gthis.skipVideo({ type : "SkipVideo", skipVideo : { url : _gthis.videoList[_gthis.itemPos].url}}); },1000); return; } @@ -3859,17 +3859,7 @@ server_Main.prototype = { if(!this.checkPermission(client,"removeVideo")) { return; } - if(this.videoList.length == 0) { - return; - } - if(this.videoList[this.itemPos].url != data.skipVideo.url) { - return; - } - this.itemPos = VideoList.skipItem(this.videoList,this.itemPos); - if(this.videoList.length > 0) { - this.restartWaitTimer(); - } - this.broadcast(data); + this.skipVideo(data); break; case "ToggleItemType": VideoList.toggleItemType(this.videoList,data.toggleItemType.pos); @@ -3928,6 +3918,19 @@ server_Main.prototype = { client.ws.send(json,null); } } + ,skipVideo: function(data) { + if(this.videoList.length == 0) { + return; + } + if(this.videoList[this.itemPos].url != data.skipVideo.url) { + return; + } + this.itemPos = VideoList.skipItem(this.videoList,this.itemPos); + if(this.videoList.length > 0) { + this.restartWaitTimer(); + } + this.broadcast(data); + } ,checkPermission: function(client,perm) { var state = this.hasPermission(client,perm); if(!state) { diff --git a/src/server/Main.hx b/src/server/Main.hx index e072774..d5e8be6 100644 --- a/src/server/Main.hx +++ b/src/server/Main.hx @@ -415,12 +415,7 @@ class Main { case SkipVideo: if (!checkPermission(client, RemoveVideoPerm)) return; - if (videoList.length == 0) return; - final item = videoList[itemPos]; - if (item.url != data.skipVideo.url) return; - itemPos = videoList.skipItem(itemPos); - if (videoList.length > 0) restartWaitTimer(); - broadcast(data); + skipVideo(data); case Pause: if (videoList.length == 0) return; @@ -445,7 +440,7 @@ class Main { final currentLength = videoList.length; Timer.delay(() -> { if (videoList.length != currentLength) return; - onMessage(client, { + skipVideo({ type: SkipVideo, skipVideo: { url: videoList[itemPos].url } @@ -611,6 +606,15 @@ class Main { } } + function skipVideo(data:WsEvent):Void { + if (videoList.length == 0) return; + final item = videoList[itemPos]; + if (item.url != data.skipVideo.url) return; + itemPos = videoList.skipItem(itemPos); + if (videoList.length > 0) restartWaitTimer(); + broadcast(data); + } + function checkPermission(client:Client, perm:Permission):Bool { final state = hasPermission(client, perm); if (!state) send(client, { |
