diff --git a/add-on/_locales/en/messages.json b/add-on/_locales/en/messages.json index 8129f65ef..5d6169c02 100644 --- a/add-on/_locales/en/messages.json +++ b/add-on/_locales/en/messages.json @@ -35,13 +35,9 @@ "message": "The URL of your local Kubo RPC", "description": "A label in Node status section of Browser Action pop-up (panel_statusApiAddressTitle)" }, - "panel_statusGatewayVersion": { - "message": "version", - "description": "A label in Node status section of Browser Action pop-up (panel_statusGatewayVersion)" - }, - "panel_statusGatewayVersionTitle": { - "message": "The version of IPFS your local node is using", - "description": "A label in Node status section of Browser Action pop-up (panel_statusGatewayVersionTitle)" + "panel_kuboRpcBackendVersionTitle": { + "message": "The version of IPFS backend this extension talks to over Kubo RPC API", + "description": "A label in Node status section of Browser Action pop-up (panel_kuboRpcBackendVersionTitle)" }, "panel_statusSwarmPeers": { "message": "Peers", @@ -260,7 +256,7 @@ "description": "An option title on the Preferences screen (option_ipfsNodeConfig_title)" }, "option_ipfsNodeType_external": { - "message": "External", + "message": "External (Kubo RPC)", "description": "An option on the Preferences screen (option_ipfsNodeType_external)" }, "option_ipfsNodeType_brave": { diff --git a/add-on/src/lib/ipfs-companion.js b/add-on/src/lib/ipfs-companion.js index 480975b02..aca4e7d16 100644 --- a/add-on/src/lib/ipfs-companion.js +++ b/add-on/src/lib/ipfs-companion.js @@ -230,6 +230,21 @@ export default async function init (inQuickImport = false) { handler(message) } + async function fetchKuboRpcBackendVersion () { + // prefer AgentVersion string from 'ipfs id' , but if that fails, use 'ipfs version' + try { + const { agentVersion } = await ipfs.id() + if (agentVersion) { + return agentVersion + } + const { version, commit } = await ipfs.version() + if (version || commit) { + return [version, commit].filter(Boolean).join('/') + } + } catch (_) {} + return null + } + async function sendStatusUpdateToBrowserAction () { if (!browserActionPort) return const currentTab = await browser.tabs.query({ active: true, currentWindow: true }).then(tabs => tabs[0]) @@ -250,14 +265,9 @@ export default async function init (inQuickImport = false) { newVersion: state.dismissedUpdate !== version ? version : null, currentTab } - try { - const v = await ipfs.version() - if (v) { - info.gatewayVersion = v.commit ? v.version + '/' + v.commit : v.version - } - } catch (error) { - info.gatewayVersion = null - } + + info.kuboRpcBackendVersion = await fetchKuboRpcBackendVersion() + if (state.active && info.currentTab) { const url = info.currentTab.url info.isIpfsContext = ipfsPathValidator.isIpfsPageActionsContext(url) diff --git a/add-on/src/popup/browser-action/gateway-status.js b/add-on/src/popup/browser-action/gateway-status.js index b877d27d7..c1ead02aa 100644 --- a/add-on/src/popup/browser-action/gateway-status.js +++ b/add-on/src/popup/browser-action/gateway-status.js @@ -19,7 +19,7 @@ function statusEntry ({ label, labelLegend, value, check, itemClass = '', valueC export default function gatewayStatus ({ gatewayAddress, - gatewayVersion, + kuboRpcBackendVersion, ipfsApiUrl, swarmPeers }) { @@ -42,7 +42,7 @@ export default function gatewayStatus ({ label: 'panel_statusApiAddress', labelLegend: 'panel_statusApiAddressTitle', value: api, - check: gatewayVersion + check: kuboRpcBackendVersion })} ` diff --git a/add-on/src/popup/browser-action/ipfs-version.js b/add-on/src/popup/browser-action/ipfs-version.js index 7aa265e19..988352ba6 100644 --- a/add-on/src/popup/browser-action/ipfs-version.js +++ b/add-on/src/popup/browser-action/ipfs-version.js @@ -11,20 +11,19 @@ function statusEntry ({ label, labelLegend, title, value, check, valueClass = '' value = value || value === 0 ? value : offline return html`