Fixing whitelist and blacklist functionality
This commit is contained in:
@@ -547,7 +547,7 @@
|
||||
|
||||
|
||||
<!-- Testing Section -->
|
||||
<div id="div_config" class="section flex-section">
|
||||
<div id="div_config" class="section flex-section" style="display: none;">
|
||||
<h2>RELAY CONFIGURATION</h2>
|
||||
<div id="config-display" class="hidden">
|
||||
<div id="config-view-mode">
|
||||
@@ -616,13 +616,12 @@
|
||||
<div id="authRuleInputSections" style="display: block;">
|
||||
|
||||
<!-- Combined Pubkey Auth Rule Section -->
|
||||
<div class="auth-rule-section">
|
||||
<h3>MANAGE PUBKEY ACCESS</h3>
|
||||
<p>Add pubkeys to whitelist (allow) or blacklist (deny) access</p>
|
||||
|
||||
|
||||
<div class="input-group">
|
||||
<label for="authRulePubkey">Pubkey (nsec or hex):</label>
|
||||
<input type="text" id="authRulePubkey" placeholder="nsec1... or 64-character hex pubkey">
|
||||
<small id="authRuleHelp">Enter nsec (will auto-convert) or 64-character hex pubkey</small>
|
||||
|
||||
</div>
|
||||
<div id="whitelistWarning" class="warning-box" style="display: none;">
|
||||
<strong>⚠️ WARNING:</strong> Adding whitelist rules changes relay behavior to whitelist-only
|
||||
@@ -636,7 +635,7 @@
|
||||
BLACKLIST</button>
|
||||
<button type="button" id="refreshAuthRulesBtn">REFRESH</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -975,6 +974,7 @@
|
||||
|
||||
// Step 4: Update UI
|
||||
updateRelayConnectionStatus('connected');
|
||||
updateAdminSectionsVisibility();
|
||||
|
||||
// Step 5: Relay URL updated
|
||||
|
||||
@@ -1034,6 +1034,7 @@
|
||||
// Update UI
|
||||
updateRelayConnectionStatus('disconnected');
|
||||
hideRelayInfo();
|
||||
updateAdminSectionsVisibility();
|
||||
|
||||
log('Disconnected from relay', 'INFO');
|
||||
|
||||
@@ -1280,7 +1281,7 @@
|
||||
loginSection.classList.remove('hidden');
|
||||
updateConfigStatus(false);
|
||||
updateLoginLogoutButton();
|
||||
hideAuthRulesSection();
|
||||
updateAdminSectionsVisibility();
|
||||
|
||||
console.log('Logout event handled successfully');
|
||||
}
|
||||
@@ -1298,11 +1299,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Update visibility of admin sections based on login and relay connection status
|
||||
function updateAdminSectionsVisibility() {
|
||||
const divConfig = document.getElementById('div_config');
|
||||
const authRulesSection = document.getElementById('authRulesSection');
|
||||
const shouldShow = isLoggedIn && isRelayConnected;
|
||||
|
||||
if (divConfig) divConfig.style.display = shouldShow ? 'block' : 'none';
|
||||
if (authRulesSection) authRulesSection.style.display = shouldShow ? 'block' : 'none';
|
||||
}
|
||||
|
||||
// Show main interface after login
|
||||
function showMainInterface() {
|
||||
loginSection.classList.add('hidden');
|
||||
// mainInterface.classList.remove('hidden');
|
||||
updateLoginLogoutButton();
|
||||
updateAdminSectionsVisibility();
|
||||
}
|
||||
|
||||
// Load user profile using nostr-tools pool
|
||||
|
||||
Reference in New Issue
Block a user