v1.2.40 - IP Bans page: show whitelisted IPs with star icon, hide Unban button for whitelisted IPs

This commit is contained in:
Your Name
2026-02-25 06:54:35 -04:00
parent 6b20452fab
commit 0f124fe575
2 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -6267,11 +6267,16 @@ function handleIpBansResponse(responseData) {
document.getElementById('ip-bans-active').textContent = currentlyBanned;
document.getElementById('ip-bans-issued').textContent = totalBans;
// Get whitelist for display
const whitelistStr = (currentConfig && currentConfig.idle_ban_whitelist) || '';
const whitelistedIPs = new Set(whitelistStr.split(',').map(s => s.trim()).filter(s => s.length > 0));
// Render table
const tbody = document.getElementById('ip-bans-tbody');
tbody.innerHTML = filteredResults.map(row => {
const isBanned = row.banned_until > now;
const status = isBanned ? '🔴 Banned' : (row.ban_count > 0 ? '🟡 Expired' : '🟢 Clean');
const isWhitelisted = whitelistedIPs.has(row.ip);
const status = isWhitelisted ? '⭐ Whitelisted' : (isBanned ? '🔴 Banned' : (row.ban_count > 0 ? '🟡 Expired' : '🟢 Clean'));
const bannedUntil = row.banned_until > 0 ? new Date(row.banned_until * 1000).toLocaleString() : '-';
const failures = row.total_failures || 0;
const authedSuccessfully = row.has_authed_successfully ? '✅ Yes' : '❌ No';
@@ -6285,7 +6290,7 @@ function handleIpBansResponse(responseData) {
<td>${authedSuccessfully}</td>
<td>${connectionAttempts}</td>
<td>
${isBanned ? `<button type="button" onclick="unbanIp('${escapeHtml(row.ip)}')">Unban</button>` : ''}
${isBanned && !isWhitelisted ? `<button type="button" onclick="unbanIp('${escapeHtml(row.ip)}')">Unban</button>` : ''}
<button type="button" onclick="deleteIpBan('${escapeHtml(row.ip)}')">Delete</button>
</td>
</tr>`;
+2 -2
View File
@@ -13,8 +13,8 @@
// Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros
#define CRELAY_VERSION_MAJOR 1
#define CRELAY_VERSION_MINOR 2
#define CRELAY_VERSION_PATCH 39
#define CRELAY_VERSION "v1.2.39"
#define CRELAY_VERSION_PATCH 40
#define CRELAY_VERSION "v1.2.40"
// Relay metadata (authoritative source for NIP-11 information)
#define RELAY_NAME "C-Relay"