diff --git a/api/index.js b/api/index.js
index 29fce61..82232ed 100644
--- a/api/index.js
+++ b/api/index.js
@@ -6220,7 +6220,20 @@ async function executeSqlQueryRaw(query, queryId) {
// Handle IP bans SQL response
function handleIpBansResponse(responseData) {
- if (!responseData.results || responseData.results.length === 0) {
+ // Convert rows+columns format to array of objects
+ let results = [];
+ if (responseData.rows && responseData.columns) {
+ const cols = responseData.columns;
+ results = responseData.rows.map(row => {
+ const obj = {};
+ cols.forEach((col, i) => { obj[col] = row[i]; });
+ return obj;
+ });
+ } else if (responseData.results) {
+ results = responseData.results;
+ }
+
+ if (results.length === 0) {
document.getElementById('ip-bans-tbody').innerHTML = '
| No IP bans found |
';
document.getElementById('ip-bans-total').textContent = '0';
document.getElementById('ip-bans-active').textContent = '0';
@@ -6229,20 +6242,20 @@ function handleIpBansResponse(responseData) {
}
const now = Math.floor(Date.now() / 1000);
- let totalIPs = responseData.results.length;
+ let totalIPs = results.length;
let currentlyBanned = 0;
let totalBans = 0;
// Filter results based on current filter
- let filteredResults = responseData.results;
+ let filteredResults = results;
if (ipBansFilter === 'banned') {
- filteredResults = responseData.results.filter(row => row.banned_until > now);
+ filteredResults = results.filter(row => row.banned_until > now);
} else if (ipBansFilter === 'expired') {
- filteredResults = responseData.results.filter(row => row.banned_until <= now && row.banned_until > 0);
+ filteredResults = results.filter(row => row.banned_until <= now && row.banned_until > 0);
}
// Calculate stats
- responseData.results.forEach(row => {
+ results.forEach(row => {
totalBans += parseInt(row.ban_count || 0);
if (row.banned_until > now) {
currentlyBanned++;
diff --git a/relay.pid b/relay.pid
index 11a1a99..0ed343b 100644
--- a/relay.pid
+++ b/relay.pid
@@ -1 +1 @@
-2373409
+2375515
diff --git a/src/main.h b/src/main.h
index c3cb3a4..2fc36cc 100644
--- a/src/main.h
+++ b/src/main.h
@@ -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 38
-#define CRELAY_VERSION "v1.2.38"
+#define CRELAY_VERSION_PATCH 39
+#define CRELAY_VERSION "v1.2.39"
// Relay metadata (authoritative source for NIP-11 information)
#define RELAY_NAME "C-Relay"