v1.2.54 - Sync relay_version to compiled CRELAY_VERSION on startup and show version in API header/title
This commit is contained in:
+14
-2
@@ -450,6 +450,12 @@ async function setupAutomaticRelayConnection(showSections = false) {
|
|||||||
|
|
||||||
if (relayInfo && relayInfo.pubkey) {
|
if (relayInfo && relayInfo.pubkey) {
|
||||||
relayPubkey = 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) + '...');
|
console.log('🔑 Auto-fetched relay pubkey:', relayPubkey.substring(0, 16) + '...');
|
||||||
} else {
|
} else {
|
||||||
// Use fallback pubkey
|
// Use fallback pubkey
|
||||||
@@ -4238,9 +4244,10 @@ function updateRelayInfoInHeader() {
|
|||||||
return;
|
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 relayInfo = getRelayInfo();
|
||||||
const relayName = relayInfo.name || 'C-Relay';
|
const relayName = relayInfo.name || 'C-Relay';
|
||||||
|
const relayVersion = relayInfo.version || '';
|
||||||
const relayDescription = relayInfo.description || 'Nostr Relay';
|
const relayDescription = relayInfo.description || 'Nostr Relay';
|
||||||
|
|
||||||
// Convert relay pubkey to npub
|
// Convert relay pubkey to npub
|
||||||
@@ -4263,7 +4270,9 @@ function updateRelayInfoInHeader() {
|
|||||||
formattedNpub = line1 + '\n' + line2 + '\n' + line3;
|
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;
|
relayPubkeyElement.textContent = formattedNpub;
|
||||||
relayDescriptionElement.textContent = relayDescription;
|
relayDescriptionElement.textContent = relayDescription;
|
||||||
}
|
}
|
||||||
@@ -4281,6 +4290,7 @@ function getRelayInfo() {
|
|||||||
// Default values
|
// Default values
|
||||||
return {
|
return {
|
||||||
name: 'C-Relay',
|
name: 'C-Relay',
|
||||||
|
version: '',
|
||||||
description: 'Nostr Relay',
|
description: 'Nostr Relay',
|
||||||
pubkey: relayPubkey
|
pubkey: relayPubkey
|
||||||
};
|
};
|
||||||
@@ -4291,10 +4301,12 @@ function updateStoredRelayInfo(configData) {
|
|||||||
if (configData && configData.data) {
|
if (configData && configData.data) {
|
||||||
// Extract relay info from config data
|
// Extract relay info from config data
|
||||||
const relayName = configData.data.find(item => item.key === 'relay_name')?.value || 'C-Relay';
|
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';
|
const relayDescription = configData.data.find(item => item.key === 'relay_description')?.value || 'Nostr Relay';
|
||||||
|
|
||||||
relayInfoData = {
|
relayInfoData = {
|
||||||
name: relayName,
|
name: relayName,
|
||||||
|
version: relayVersion,
|
||||||
description: relayDescription,
|
description: relayDescription,
|
||||||
pubkey: relayPubkey
|
pubkey: relayPubkey
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
Submodule nostr_core_lib updated: adc7aa9dcf...98cfd81b01
+15
@@ -2133,6 +2133,21 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
DEBUG_LOG("Existing database initialized");
|
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)
|
// Apply CLI overrides atomically (now that database is initialized)
|
||||||
if (apply_cli_overrides_atomic(&cli_options) != 0) {
|
if (apply_cli_overrides_atomic(&cli_options) != 0) {
|
||||||
DEBUG_ERROR("Failed to apply CLI overrides for existing relay");
|
DEBUG_ERROR("Failed to apply CLI overrides for existing relay");
|
||||||
|
|||||||
+2
-2
@@ -13,8 +13,8 @@
|
|||||||
// Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros
|
// Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros
|
||||||
#define CRELAY_VERSION_MAJOR 1
|
#define CRELAY_VERSION_MAJOR 1
|
||||||
#define CRELAY_VERSION_MINOR 2
|
#define CRELAY_VERSION_MINOR 2
|
||||||
#define CRELAY_VERSION_PATCH 53
|
#define CRELAY_VERSION_PATCH 54
|
||||||
#define CRELAY_VERSION "v1.2.53"
|
#define CRELAY_VERSION "v1.2.54"
|
||||||
|
|
||||||
// Relay metadata (authoritative source for NIP-11 information)
|
// Relay metadata (authoritative source for NIP-11 information)
|
||||||
#define RELAY_NAME "C-Relay"
|
#define RELAY_NAME "C-Relay"
|
||||||
|
|||||||
Reference in New Issue
Block a user