From cb2244674b3ee082a5d7556a92ff56df2a7f0298 Mon Sep 17 00:00:00 2001 From: ianmsutherland <46490770+ianmsutherland@users.noreply.github.com> Date: Fri, 20 Feb 2026 00:10:50 -0600 Subject: [PATCH] Omit colon when apiPort is undefined or empty --- background.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 8896b22..decf800 100644 --- a/background.js +++ b/background.js @@ -8,7 +8,7 @@ function setBadge(text, color) { async function checkServerStatus() { try { const { url } = await getCredentials(); - if (!url || url === 'undefined://undefined:undefined') { + if (!url || url === 'undefined://undefined:undefined' || url === 'undefined://undefined') { setBadge('?', '#888'); // Gray - not configured return false; } @@ -31,10 +31,14 @@ async function checkServerStatus() { async function getCredentials() { const credentials = await browser.storage.local.get(['apiScheme', 'apiHost', 'apiPort', 'apiUsername', 'apiPassword']); + const portSuffix = credentials.apiPort != null && credentials.apiPort !== '' + ? `:${credentials.apiPort}` + : ''; + return { username: credentials.apiUsername, password: credentials.apiPassword, - url: `${credentials.apiScheme}://${credentials.apiHost}:${credentials.apiPort}`, + url: `${credentials.apiScheme}://${credentials.apiHost}${portSuffix}`, credentials: credentials }; } @@ -246,3 +250,4 @@ browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { loginTabs.delete(tabId); } }); +