diff options
| author | RblSb <msrblsb@gmail.com> | 2020-05-20 14:47:12 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-05-20 14:47:12 +0300 |
| commit | 97bad11001aeb299e0e8c339af77368e065d215d (patch) | |
| tree | bf4996916d6099dd0443c3239f2b1c3d05a4ecd5 /src/server/Main.hx | |
| parent | 5abb726dc80decc2e3a73164905f1b8cccf9c47d (diff) | |
Fix server video skip for guests
Diffstat (limited to 'src/server/Main.hx')
| -rw-r--r-- | src/server/Main.hx | 18 |
1 files changed, 11 insertions, 7 deletions
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, { |
