Spaces:
Runtime error
Runtime error
Update dashboard.html
Browse files- dashboard.html +54 -1
dashboard.html
CHANGED
|
@@ -832,6 +832,17 @@ input:checked + .slider:before {
|
|
| 832 |
<p style="font-size:12px; color:var(--text-dim); margin-top:16px">When enabled, players on the lineup board will receive a DM reminder before a scheduled league match starts.</p>
|
| 833 |
</div>
|
| 834 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 835 |
<div style="border-top:1px solid var(--border); padding-top:32px; margin-bottom: 32px;">
|
| 836 |
<h4 style="margin-bottom:16px; font-size:15px; color:var(--accent)">💬 Command Messages</h4>
|
| 837 |
<div style="margin-bottom: 24px;">
|
|
@@ -1053,6 +1064,45 @@ function openServerSettings(id, name) {
|
|
| 1053 |
postSelect.appendChild(optP);
|
| 1054 |
});
|
| 1055 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1056 |
});
|
| 1057 |
}
|
| 1058 |
|
|
@@ -1071,6 +1121,8 @@ function saveConfig() {
|
|
| 1071 |
const remindersEnabled = document.getElementById('config-reminders-enabled').checked;
|
| 1072 |
const remindersLead = document.getElementById('config-reminders-lead').value;
|
| 1073 |
|
|
|
|
|
|
|
| 1074 |
fetch('/api/config/' + activeGuildId, {
|
| 1075 |
method: 'POST',
|
| 1076 |
headers: { 'Content-Type': 'application/json' },
|
|
@@ -1085,7 +1137,8 @@ function saveConfig() {
|
|
| 1085 |
cleanupHours,
|
| 1086 |
lineupCleanupHours,
|
| 1087 |
remindersEnabled,
|
| 1088 |
-
remindersLead
|
|
|
|
| 1089 |
})
|
| 1090 |
})
|
| 1091 |
.then(r => r.json())
|
|
|
|
| 832 |
<p style="font-size:12px; color:var(--text-dim); margin-top:16px">When enabled, players on the lineup board will receive a DM reminder before a scheduled league match starts.</p>
|
| 833 |
</div>
|
| 834 |
|
| 835 |
+
<div style="border-top:1px solid var(--border); padding-top:32px; margin-bottom: 32px;">
|
| 836 |
+
<h4 style="margin-bottom:16px; font-size:15px; color:var(--accent)">🔐 Staff Whitelist Roles</h4>
|
| 837 |
+
<div style="margin-bottom: 24px;">
|
| 838 |
+
<label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:8px">Permitted Whitelisted Roles</label>
|
| 839 |
+
<div id="whitelist-roles-container" style="display: flex; flex-wrap: wrap; gap: 12px; max-height: 200px; overflow-y: auto; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);">
|
| 840 |
+
<span style="font-size:13px; color:var(--text-dim);">Loading server roles...</span>
|
| 841 |
+
</div>
|
| 842 |
+
<p style="font-size:12px; color:var(--text-dim); margin-top:8px">Members with any of the checked roles will be permitted to run staff/manager commands (e.g. <code>!friendly</code>, <code>!lineup</code>, <code>!win</code>, <code>!loss</code>, <code>!draw</code>, <code>!motm</code>).</p>
|
| 843 |
+
</div>
|
| 844 |
+
</div>
|
| 845 |
+
|
| 846 |
<div style="border-top:1px solid var(--border); padding-top:32px; margin-bottom: 32px;">
|
| 847 |
<h4 style="margin-bottom:16px; font-size:15px; color:var(--accent)">💬 Command Messages</h4>
|
| 848 |
<div style="margin-bottom: 24px;">
|
|
|
|
| 1064 |
postSelect.appendChild(optP);
|
| 1065 |
});
|
| 1066 |
});
|
| 1067 |
+
|
| 1068 |
+
// Load roles and build whitelisted checklist
|
| 1069 |
+
fetch('/api/roles/' + id)
|
| 1070 |
+
.then(rr => rr.json())
|
| 1071 |
+
.then(roles => {
|
| 1072 |
+
const rolesContainer = document.getElementById('whitelist-roles-container');
|
| 1073 |
+
rolesContainer.innerHTML = '';
|
| 1074 |
+
|
| 1075 |
+
if (!roles || roles.length === 0) {
|
| 1076 |
+
rolesContainer.innerHTML = '<span style="font-size:13px; color:var(--text-dim);">No roles found or bot lacks permission to view roles.</span>';
|
| 1077 |
+
return;
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
roles.forEach(role => {
|
| 1081 |
+
const div = document.createElement('div');
|
| 1082 |
+
div.style.cssText = 'display: flex; align-items: center; gap: 8px; margin-right: 16px; margin-bottom: 8px; user-select: none;';
|
| 1083 |
+
|
| 1084 |
+
const chk = document.createElement('input');
|
| 1085 |
+
chk.type = 'checkbox';
|
| 1086 |
+
chk.className = 'role-whitelist-chk';
|
| 1087 |
+
chk.value = role.id;
|
| 1088 |
+
chk.id = 'role-chk-' + role.id;
|
| 1089 |
+
|
| 1090 |
+
if (data.whitelistedRoles && data.whitelistedRoles.includes(role.id)) {
|
| 1091 |
+
chk.checked = true;
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
const lbl = document.createElement('label');
|
| 1095 |
+
lbl.htmlFor = 'role-chk-' + role.id;
|
| 1096 |
+
lbl.style.cssText = `font-size: 14px; color: ${role.color || '#ffffff'}; cursor: pointer;`;
|
| 1097 |
+
lbl.textContent = role.name;
|
| 1098 |
+
|
| 1099 |
+
div.appendChild(chk);
|
| 1100 |
+
div.appendChild(lbl);
|
| 1101 |
+
rolesContainer.appendChild(div);
|
| 1102 |
+
});
|
| 1103 |
+
}).catch(() => {
|
| 1104 |
+
document.getElementById('whitelist-roles-container').innerHTML = '<span style="font-size:13px; color:var(--text-dim); color:#ff4444">Error loading server roles.</span>';
|
| 1105 |
+
});
|
| 1106 |
});
|
| 1107 |
}
|
| 1108 |
|
|
|
|
| 1121 |
const remindersEnabled = document.getElementById('config-reminders-enabled').checked;
|
| 1122 |
const remindersLead = document.getElementById('config-reminders-lead').value;
|
| 1123 |
|
| 1124 |
+
const whitelistedRoles = Array.from(document.querySelectorAll('.role-whitelist-chk:checked')).map(el => el.value);
|
| 1125 |
+
|
| 1126 |
fetch('/api/config/' + activeGuildId, {
|
| 1127 |
method: 'POST',
|
| 1128 |
headers: { 'Content-Type': 'application/json' },
|
|
|
|
| 1137 |
cleanupHours,
|
| 1138 |
lineupCleanupHours,
|
| 1139 |
remindersEnabled,
|
| 1140 |
+
remindersLead,
|
| 1141 |
+
whitelistedRoles
|
| 1142 |
})
|
| 1143 |
})
|
| 1144 |
.then(r => r.json())
|