diff --git a/After 24 hours, if they fail auth again, we ban for another 24 hours b/After 24 hours, if they fail auth again, we ban for another 24 hours deleted file mode 100644 index e69de29..0000000 diff --git a/api/index.js b/api/index.js index 25aa7ab..80cd60f 100644 --- a/api/index.js +++ b/api/index.js @@ -450,6 +450,12 @@ async function setupAutomaticRelayConnection(showSections = false) { if (relayInfo && relayInfo.pubkey) { relayPubkey = relayInfo.pubkey; + relayInfoData = { + name: relayInfo.name || 'C-Relay', + version: relayInfo.version || '', + description: relayInfo.description || 'Nostr Relay', + pubkey: relayPubkey + }; console.log('🔑 Auto-fetched relay pubkey:', relayPubkey.substring(0, 16) + '...'); } else { // Use fallback pubkey @@ -4238,9 +4244,10 @@ function updateRelayInfoInHeader() { return; } - // Get relay info from NIP-11 data or use defaults + // Get relay info from NIP-11/config data or use defaults const relayInfo = getRelayInfo(); const relayName = relayInfo.name || 'C-Relay'; + const relayVersion = relayInfo.version || ''; const relayDescription = relayInfo.description || 'Nostr Relay'; // Convert relay pubkey to npub @@ -4263,7 +4270,9 @@ function updateRelayInfoInHeader() { formattedNpub = line1 + '\n' + line2 + '\n' + line3; } - relayNameElement.textContent = relayName; + const displayName = relayVersion ? `${relayName} ${relayVersion}` : relayName; + relayNameElement.textContent = displayName; + document.title = `${displayName} Admin`; relayPubkeyElement.textContent = formattedNpub; relayDescriptionElement.textContent = relayDescription; } @@ -4281,6 +4290,7 @@ function getRelayInfo() { // Default values return { name: 'C-Relay', + version: '', description: 'Nostr Relay', pubkey: relayPubkey }; @@ -4291,10 +4301,12 @@ function updateStoredRelayInfo(configData) { if (configData && configData.data) { // Extract relay info from config data const relayName = configData.data.find(item => item.key === 'relay_name')?.value || 'C-Relay'; + const relayVersion = configData.data.find(item => item.key === 'relay_version')?.value || ''; const relayDescription = configData.data.find(item => item.key === 'relay_description')?.value || 'Nostr Relay'; relayInfoData = { name: relayName, + version: relayVersion, description: relayDescription, pubkey: relayPubkey }; diff --git a/nostr_core_lib b/nostr_core_lib index adc7aa9..98cfd81 160000 --- a/nostr_core_lib +++ b/nostr_core_lib @@ -1 +1 @@ -Subproject commit adc7aa9dcfd16e41eb38c9883d64cfc11dd374bc +Subproject commit 98cfd81b01c181f98e00b7ffea7602ff2bfb390d diff --git a/src/main.c b/src/main.c index e4b4010..f74059a 100644 --- a/src/main.c +++ b/src/main.c @@ -2133,6 +2133,21 @@ int main(int argc, char* argv[]) { } DEBUG_LOG("Existing database initialized"); + // Keep relay_version in sync with the compiled binary version on every startup + if (update_config_in_table("relay_version", CRELAY_VERSION) != 0) { + DEBUG_ERROR("Failed to synchronize relay_version with compiled CRELAY_VERSION"); + cleanup_configuration_system(); + free(relay_pubkey); + for (int i = 0; existing_files[i]; i++) { + free(existing_files[i]); + } + free(existing_files); + nostr_cleanup(); + close_database(); + return 1; + } + DEBUG_INFO("Synchronized relay_version to %s", CRELAY_VERSION); + // Apply CLI overrides atomically (now that database is initialized) if (apply_cli_overrides_atomic(&cli_options) != 0) { DEBUG_ERROR("Failed to apply CLI overrides for existing relay"); diff --git a/src/main.h b/src/main.h index 9996146..c5dce3b 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 53 -#define CRELAY_VERSION "v1.2.53" +#define CRELAY_VERSION_PATCH 54 +#define CRELAY_VERSION "v1.2.54" // Relay metadata (authoritative source for NIP-11 information) #define RELAY_NAME "C-Relay"