mirror of
https://github.com/andrey271192/PCAtelegram_web.git
synced 2026-09-20 11:55:32 +00:00
fix: allow disabling main key
This commit is contained in:
@@ -2285,9 +2285,6 @@ class AdminHandler(BaseHTTPRequestHandler):
|
||||
), "restart": {"mode": "async", "requested": restart_requested}})
|
||||
elif path.startswith("/api/users/") and path.endswith("/enabled"):
|
||||
name = urllib.parse.unquote(path[len("/api/users/"):-len("/enabled")])
|
||||
if name == "main":
|
||||
self.send_error_json(400, "main user cannot be disabled")
|
||||
return
|
||||
enabled = bool(body.get("enabled"))
|
||||
try:
|
||||
with FileLock(USER_LOCK_FILE):
|
||||
|
||||
@@ -1302,8 +1302,8 @@ function renderUsers() {
|
||||
<strong>${escapeHtml(user.name)}</strong>${user.main ? ` <small>${escapeHtml(t("main"))}</small>` : ""}
|
||||
</button>
|
||||
<div class="status-control">
|
||||
<label class="switch" title="${escapeAttr(user.main ? t("main") : (user.enabled ? t("disableKey") : t("enableKey")))}">
|
||||
<input type="checkbox" data-toggle-user="${escapeAttr(user.name)}" ${user.enabled ? "checked" : ""} ${user.main || pending ? "disabled" : ""}>
|
||||
<label class="switch" title="${escapeAttr(user.enabled ? t("disableKey") : t("enableKey"))}">
|
||||
<input type="checkbox" data-toggle-user="${escapeAttr(user.name)}" ${user.enabled ? "checked" : ""} ${pending ? "disabled" : ""}>
|
||||
<span></span>
|
||||
</label>
|
||||
<strong class="${user.enabled ? "state-on" : "state-off"}">${escapeHtml(pending ? t("applying") : (user.enabled ? t("enabled") : t("disabled")))}</strong>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
document.documentElement.dataset.theme = theme;
|
||||
}());
|
||||
</script>
|
||||
<link rel="stylesheet" href="/styles.css?v=2.5.0-admin26">
|
||||
<link rel="stylesheet" href="/styles.css?v=2.5.0-admin27">
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-shell">
|
||||
@@ -482,6 +482,6 @@
|
||||
<button id="qrCopyBtn" type="button" class="soft" data-i18n="copyLink">Copy link</button>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/app.js?v=2.5.0-admin26" type="module"></script>
|
||||
<script src="/app.js?v=2.5.0-admin27" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user