v1.2.54 - Sync relay_version to compiled CRELAY_VERSION on startup and show version in API header/title

This commit is contained in:
Your Name
2026-03-23 09:04:49 -04:00
parent ff2a3aa335
commit a89460be5d
5 changed files with 32 additions and 5 deletions

View File

@@ -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
};

View File

@@ -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");

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 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"