diff --git a/setup.php b/setup.php
index bb88005..973c570 100644
--- a/setup.php
+++ b/setup.php
@@ -216,7 +216,7 @@ $submitted_key = trim($_POST['admin_key_input'] ?? $_POST['admin_key_hidden']
GridTV is already configured.
Enter your admin key to edit the settings.
@@ -349,6 +349,41 @@ function syncPersonalM3uToggle() {
}
allowPersonalEpgToggle?.addEventListener('change', syncPersonalM3uToggle);
syncPersonalM3uToggle();
+
+const GRIDTV_ADMIN_KEY_STORAGE = 'gridtv-admin-key';
+const setupAdminKeyInput = document.getElementById('setupAdminKeyInput');
+const setupAdminHiddenInput = document.querySelector('input[name="admin_key_hidden"]');
+
+try {
+ const savedAdminKey = localStorage.getItem(GRIDTV_ADMIN_KEY_STORAGE) || '';
+ if (setupAdminKeyInput && savedAdminKey) setupAdminKeyInput.value = savedAdminKey;
+ if (setupAdminHiddenInput && savedAdminKey) setupAdminHiddenInput.value = savedAdminKey;
+} catch (_) {}
+
+if (setupAdminKeyInput?.form) {
+ setupAdminKeyInput.form.addEventListener('submit', () => {
+ try {
+ localStorage.setItem(GRIDTV_ADMIN_KEY_STORAGE, setupAdminKeyInput.value.trim());
+ } catch (_) {}
+ });
+}
+
+if (setupAdminHiddenInput?.form) {
+ const persistHiddenAdminKey = () => {
+ try {
+ const currentKey = setupAdminHiddenInput.value.trim();
+ if (currentKey) localStorage.setItem(GRIDTV_ADMIN_KEY_STORAGE, currentKey);
+ } catch (_) {}
+ };
+ persistHiddenAdminKey();
+ setupAdminHiddenInput.form.addEventListener('submit', persistHiddenAdminKey);
+}
+
+
+try {
+ localStorage.setItem(GRIDTV_ADMIN_KEY_STORAGE, = json_encode($new_key) ?>);
+} catch (_) {}
+