summary refs log tree commit diff
path: root/ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-02-23 02:03:20 +0100
committerRory& <root@rory.gay>2026-02-23 02:03:20 +0100
commit77a609758bb80bac9497d2e3988550f8be578407 (patch)
tree991a9d258ca4fece1132a1a344d0fe11e3b03d51 /ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js
downloadReferenceClientProxyImplementation-77a609758bb80bac9497d2e3988550f8be578407.tar.xz
Initial commit HEAD master
Diffstat (limited to 'ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js')
-rw-r--r--ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js b/ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js
new file mode 100644

index 0000000..c324891 --- /dev/null +++ b/ReferenceClientProxyImplementation/Resources/Assets/tools/rightsCalculator.js
@@ -0,0 +1,17 @@ +String.prototype.replaceAt = function (index, replacement) { + return this.substring(0, index) + replacement + this.substring(index + 1); +} + +var legacyRights = 0n; +var modernRights = '0'.repeat(document.getElementsByTagName("input").length); +var configRights = {}; + +function calculate(a) { + console.log(a) + legacyRights += a.checked ? (1n << BigInt(a.value)) : -(1n << BigInt(a.value)) + modernRights = modernRights.replaceAt(a.value, a.checked ? '1' : '0') + configRights[a.name] = a.checked + document.getElementById("legacyRights").innerText = "Legacy rights (fosscord-server-ts): " + legacyRights + document.getElementById("modernRights").innerText = "User rights: " + modernRights + document.getElementById("configRights").value = JSON.stringify(configRights, null, 4) +} \ No newline at end of file