aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Main.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Main.hx')
-rw-r--r--src/client/Main.hx40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index d567d92..5c29d29 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -17,6 +17,8 @@ import Client.ClientData;
import Types.VideoDataRequest;
import Types.VideoData;
import Types.Config;
+import Types.Permission;
+import Client.ClientGroup;
import Types.WsEvent;
using StringTools;
using ClientTools;
@@ -123,17 +125,7 @@ class Main {
function initListeners():Void {
Buttons.init(this);
- ge("#leader_btn").onclick = e -> {
- // change button style before answer
- setLeaderButton(!personal.isLeader);
- final name = personal.isLeader ? "" : personal.name;
- send({
- type: SetLeader,
- setLeader: {
- clientName: name
- }
- });
- }
+ ge("#leader_btn").onclick = toggleLeader;
final voteSkip = ge("#voteskip");
voteSkip.onclick = e -> {
if (Utils.isTouch() && !window.confirm(Lang.get("skipItemConfirm"))) return;
@@ -829,6 +821,32 @@ class Main {
Settings.write(settings);
}
+ public function hasPermission(group:ClientGroup, permission:Permission):Bool {
+ final id = group.getName().toLowerCase();
+ final arr:Array<Permission> = Reflect.field(config.permissions, id);
+ return arr.contains(permission);
+ }
+
+ public function toggleLeader():Void {
+ // change button style before answer
+ setLeaderButton(!personal.isLeader);
+ final name = personal.isLeader ? "" : personal.name;
+ send({
+ type: SetLeader,
+ setLeader: {
+ clientName: name
+ }
+ });
+ }
+
+ public function hasLeader():Bool {
+ return clients.hasLeader();
+ }
+
+ public function hasLeaderOnPauseRequest():Bool {
+ return config.requestLeaderOnPause;
+ }
+
public function getTemplateUrl():String {
return config.templateUrl;
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage