From 543149fb146229deaffe3a9898220dab35a0a009 Mon Sep 17 00:00:00 2001 From: Anil Sahoo Date: Mon, 13 Oct 2025 15:20:02 +0530 Subject: [PATCH] =?UTF-8?q?1.=20Fixed=20the=20issue=20where=20auto-update?= =?UTF-8?q?=20was=20not=20working=20for=20macOS=20x64=20arch=20machines=20?= =?UTF-8?q?as=20pgadmin4=20zip=20file=20name=20has=20x86=5F64=20in=20it.?= =?UTF-8?q?=202.=20Improved=20error=20handling=20in=20the=20/upgrade=5Fche?= =?UTF-8?q?ck=20API=20by=20replacing=20the=20static=20=E2=80=9CFailed=20to?= =?UTF-8?q?=20check=20for=20update=E2=80=9D=20message=20for=20Windows=20us?= =?UTF-8?q?ers=20with=20a=20dynamic=20error=20message.=203.=20Fixed=20the?= =?UTF-8?q?=20CSS=20issue=20affecting=20the=20close=20icon=20in=20the=20wa?= =?UTF-8?q?rning=20notifier.=204.=20Removed=20trailing=20periods=20from=20?= =?UTF-8?q?helper=20texts=20and=20notifier=20messages=20in=20the=20app?= =?UTF-8?q?=E2=80=99s=20auto-update=20workflow.=20#9133?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/mac/build-functions.sh | 9 ++++++++- runtime/src/js/autoUpdaterHandler.js | 10 +++++----- runtime/src/js/menu.js | 2 +- runtime/src/js/pgadmin.js | 4 ++-- web/pgadmin/browser/static/js/browser.js | 2 +- web/pgadmin/misc/__init__.py | 10 ++++++---- web/pgadmin/static/js/BrowserComponent.jsx | 4 ++-- web/pgadmin/static/js/components/FormComponents.jsx | 1 - 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/pkg/mac/build-functions.sh b/pkg/mac/build-functions.sh index 09c993886..3d0eaa5da 100644 --- a/pkg/mac/build-functions.sh +++ b/pkg/mac/build-functions.sh @@ -11,7 +11,14 @@ _setup_env() { APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX} fi BUNDLE_DIR="${BUILD_ROOT}/${APP_NAME}.app" - DMG_NAME="${DIST_ROOT}"/$(echo "${APP_NAME}" | sed 's/ //g' | awk '{print tolower($0)}')-"${APP_LONG_VERSION}-$(uname -m).dmg" + + # uname -m returns "x86_64" on Intel, but we need "x64" + DMG_ARCH="$(uname -m)" + if [ "${DMG_ARCH}" == "x86_64" ]; then + DMG_ARCH="x64" + fi + + DMG_NAME="${DIST_ROOT}/$(echo "${APP_NAME}" | sed 's/ //g' | awk '{print tolower($0)}')-${APP_LONG_VERSION}-${DMG_ARCH}.dmg" PYTHON_OS_VERSION="11" } diff --git a/runtime/src/js/autoUpdaterHandler.js b/runtime/src/js/autoUpdaterHandler.js index 5e2f0774a..9d9525e34 100644 --- a/runtime/src/js/autoUpdaterHandler.js +++ b/runtime/src/js/autoUpdaterHandler.js @@ -21,24 +21,24 @@ export function updateConfigAndMenus(event, configStore, pgAdminMainScreen, menu // This function registers autoUpdater event listeners ONCE function registerAutoUpdaterEvents({ pgAdminMainScreen, configStore, menuCallbacks }) { autoUpdater.on('checking-for-update', () => { - misc.writeServerLog('[Auto-Updater]: Checking for update...'); + misc.writeServerLog('[Auto-Updater]: Checking for update.'); }); autoUpdater.on('update-available', () => { updateConfigAndMenus('update-available', configStore, pgAdminMainScreen, menuCallbacks); - misc.writeServerLog('[Auto-Updater]: Update downloading...'); + misc.writeServerLog('[Auto-Updater]: Update downloading.'); pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { update_downloading: true }); }); autoUpdater.on('update-not-available', () => { updateConfigAndMenus('update-not-available', configStore, pgAdminMainScreen, menuCallbacks); - misc.writeServerLog('[Auto-Updater]: No update available...'); + misc.writeServerLog('[Auto-Updater]: No update available.'); pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { no_update_available: true }); }); autoUpdater.on('update-downloaded', () => { updateConfigAndMenus('update-downloaded', configStore, pgAdminMainScreen, menuCallbacks); - misc.writeServerLog('[Auto-Updater]: Update downloaded...'); + misc.writeServerLog('[Auto-Updater]: Update downloaded.'); pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { update_downloaded: true }); }); @@ -82,7 +82,7 @@ function handleSendDataForAppUpdate({ try { autoUpdater.setFeedURL({ url: serverUrl }); - misc.writeServerLog('[Auto-Updater]: Initiating update check...'); + misc.writeServerLog('[Auto-Updater]: Initiating update check.'); autoUpdater.checkForUpdates(); } catch (err) { misc.writeServerLog('[Auto-Updater]: Error setting autoUpdater feed URL: ' + err.message); diff --git a/runtime/src/js/menu.js b/runtime/src/js/menu.js index c349cca21..be4fe1bbb 100644 --- a/runtime/src/js/menu.js +++ b/runtime/src/js/menu.js @@ -75,7 +75,7 @@ function handleAutoUpdateMenu(menuFile, configStore, callbacks) { menuFile.submenu.unshift({ name: 'mnu_restart_to_update', id: 'mnu_restart_to_update', - label: 'Restart to Update...', + label: 'Restart to Update', enabled: true, priority: 998, click: callbacks['restart_to_update'], diff --git a/runtime/src/js/pgadmin.js b/runtime/src/js/pgadmin.js index d07493607..5e661a338 100644 --- a/runtime/src/js/pgadmin.js +++ b/runtime/src/js/pgadmin.js @@ -443,14 +443,14 @@ function notifyUpdateInstalled() { try { // Notify renderer if (pgAdminMainScreen) { - misc.writeServerLog('[Auto-Updater]: Update installed successfully...'); + misc.writeServerLog('[Auto-Updater]: Update installed successfully.'); setTimeout(() => { pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true}); }, 10000); } else { // If main screen not ready, wait and send after it's created app.once('browser-window-created', (event, window) => { - misc.writeServerLog('[Auto-Updater]: Update installed successfully...'); + misc.writeServerLog('[Auto-Updater]: Update installed successfully.'); setTimeout(() => { pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true}); }, 10000); diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index cbe6eaf47..35b2a9668 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -282,7 +282,7 @@ define('pgadmin.browser', [ }); const isDesktopWithAutoUpdate = pgAdmin.server_mode == 'False' && data.check_for_auto_updates && data.auto_update_url !== ''; const isUpdateAvailable = data.outdated && data.upgrade_version_int > data.current_version_int; - const noUpdateMessage = 'No update available...'; + const noUpdateMessage = 'No update available.'; // This is for desktop installers whose auto_update_url is mentioned in https://www.pgadmin.org/versions.json if (isDesktopWithAutoUpdate) { if (isUpdateAvailable) { diff --git a/web/pgadmin/misc/__init__.py b/web/pgadmin/misc/__init__.py index 21e338d1e..43d0a6558 100644 --- a/web/pgadmin/misc/__init__.py +++ b/web/pgadmin/misc/__init__.py @@ -34,6 +34,7 @@ import ssl from urllib.request import urlopen from urllib.parse import unquote from pgadmin.settings import get_setting, store_setting +import html MODULE_NAME = 'misc' @@ -389,10 +390,11 @@ def upgrade_check(): if response.getcode() == 200: data = json.loads(response.read().decode('utf-8')) current_app.logger.debug('Response data: %s' % data) - except Exception: - current_app.logger.exception( - 'Exception when checking for update') - return internal_server_error('Failed to check for update') + except Exception as e: + current_app.logger.exception(e) + # Escaping the error message to prevent HTML execution in UI + escaped_error = html.escape(str(e)) + return internal_server_error(errormsg=escaped_error) if data and config.UPGRADE_CHECK_KEY and \ config.UPGRADE_CHECK_KEY in data: diff --git a/web/pgadmin/static/js/BrowserComponent.jsx b/web/pgadmin/static/js/BrowserComponent.jsx index bfe5e4c71..4055982cc 100644 --- a/web/pgadmin/static/js/BrowserComponent.jsx +++ b/web/pgadmin/static/js/BrowserComponent.jsx @@ -198,9 +198,9 @@ export default function BrowserComponent({pgAdmin}) { if (data?.check_version_update) { pgAdmin.Browser.check_version_update(true); } else if (data.update_downloading) { - appAutoUpdateNotifier('Update downloading...', 'info', null, 10000); + appAutoUpdateNotifier('Update downloading.', 'info', null, 10000); } else if (data.no_update_available) { - appAutoUpdateNotifier('No update available...', 'info', null, 10000); + appAutoUpdateNotifier('No update available.', 'info', null, 10000); } else if (data.update_downloaded) { const UPDATE_DOWNLOADED_MESSAGE = gettext('An update is ready. Restart the app now to install it, or later to keep using the current version.'); appAutoUpdateNotifier(UPDATE_DOWNLOADED_MESSAGE, 'warning', installUpdate, null, 'Update downloaded', 'update_downloaded'); diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index 2ea8e7134..ece76443c 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -1287,7 +1287,6 @@ const StyledNotifierMessageBox = styled(Box)(({theme}) => ({ backgroundColor: theme.palette.warning.light, '& .FormFooter-iconWarning': { color: theme.palette.warning.main, - marginBottom: theme.spacing(8), }, }, '& .FormFooter-message': {