1. Fixed the issue where auto-update was not working for macOS x64 arch machines as pgadmin4 zip file name has x86_64 in it.
2. Improved error handling in the /upgrade_check API by replacing the static “Failed to check for update” message for Windows users with a dynamic error message. 3. Fixed the CSS issue affecting the close icon in the warning notifier. 4. Removed trailing periods from helper texts and notifier messages in the app’s auto-update workflow. #9133pull/9244/head
parent
758bbc7272
commit
543149fb14
|
|
@ -11,7 +11,14 @@ _setup_env() {
|
||||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
BUNDLE_DIR="${BUILD_ROOT}/${APP_NAME}.app"
|
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"
|
PYTHON_OS_VERSION="11"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,24 +21,24 @@ export function updateConfigAndMenus(event, configStore, pgAdminMainScreen, menu
|
||||||
// This function registers autoUpdater event listeners ONCE
|
// This function registers autoUpdater event listeners ONCE
|
||||||
function registerAutoUpdaterEvents({ pgAdminMainScreen, configStore, menuCallbacks }) {
|
function registerAutoUpdaterEvents({ pgAdminMainScreen, configStore, menuCallbacks }) {
|
||||||
autoUpdater.on('checking-for-update', () => {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
misc.writeServerLog('[Auto-Updater]: Checking for update...');
|
misc.writeServerLog('[Auto-Updater]: Checking for update.');
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', () => {
|
||||||
updateConfigAndMenus('update-available', configStore, pgAdminMainScreen, menuCallbacks);
|
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 });
|
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { update_downloading: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-not-available', () => {
|
autoUpdater.on('update-not-available', () => {
|
||||||
updateConfigAndMenus('update-not-available', configStore, pgAdminMainScreen, menuCallbacks);
|
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 });
|
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { no_update_available: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
updateConfigAndMenus('update-downloaded', configStore, pgAdminMainScreen, menuCallbacks);
|
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 });
|
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', { update_downloaded: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ function handleSendDataForAppUpdate({
|
||||||
|
|
||||||
try {
|
try {
|
||||||
autoUpdater.setFeedURL({ url: serverUrl });
|
autoUpdater.setFeedURL({ url: serverUrl });
|
||||||
misc.writeServerLog('[Auto-Updater]: Initiating update check...');
|
misc.writeServerLog('[Auto-Updater]: Initiating update check.');
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
misc.writeServerLog('[Auto-Updater]: Error setting autoUpdater feed URL: ' + err.message);
|
misc.writeServerLog('[Auto-Updater]: Error setting autoUpdater feed URL: ' + err.message);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ function handleAutoUpdateMenu(menuFile, configStore, callbacks) {
|
||||||
menuFile.submenu.unshift({
|
menuFile.submenu.unshift({
|
||||||
name: 'mnu_restart_to_update',
|
name: 'mnu_restart_to_update',
|
||||||
id: 'mnu_restart_to_update',
|
id: 'mnu_restart_to_update',
|
||||||
label: 'Restart to Update...',
|
label: 'Restart to Update',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
priority: 998,
|
priority: 998,
|
||||||
click: callbacks['restart_to_update'],
|
click: callbacks['restart_to_update'],
|
||||||
|
|
|
||||||
|
|
@ -443,14 +443,14 @@ function notifyUpdateInstalled() {
|
||||||
try {
|
try {
|
||||||
// Notify renderer
|
// Notify renderer
|
||||||
if (pgAdminMainScreen) {
|
if (pgAdminMainScreen) {
|
||||||
misc.writeServerLog('[Auto-Updater]: Update installed successfully...');
|
misc.writeServerLog('[Auto-Updater]: Update installed successfully.');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true});
|
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true});
|
||||||
}, 10000);
|
}, 10000);
|
||||||
} else {
|
} else {
|
||||||
// If main screen not ready, wait and send after it's created
|
// If main screen not ready, wait and send after it's created
|
||||||
app.once('browser-window-created', (event, window) => {
|
app.once('browser-window-created', (event, window) => {
|
||||||
misc.writeServerLog('[Auto-Updater]: Update installed successfully...');
|
misc.writeServerLog('[Auto-Updater]: Update installed successfully.');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true});
|
pgAdminMainScreen.webContents.send('notifyAppAutoUpdate', {update_installed: true});
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ define('pgadmin.browser', [
|
||||||
});
|
});
|
||||||
const isDesktopWithAutoUpdate = pgAdmin.server_mode == 'False' && data.check_for_auto_updates && data.auto_update_url !== '';
|
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 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
|
// This is for desktop installers whose auto_update_url is mentioned in https://www.pgadmin.org/versions.json
|
||||||
if (isDesktopWithAutoUpdate) {
|
if (isDesktopWithAutoUpdate) {
|
||||||
if (isUpdateAvailable) {
|
if (isUpdateAvailable) {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import ssl
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
from pgadmin.settings import get_setting, store_setting
|
from pgadmin.settings import get_setting, store_setting
|
||||||
|
import html
|
||||||
|
|
||||||
MODULE_NAME = 'misc'
|
MODULE_NAME = 'misc'
|
||||||
|
|
||||||
|
|
@ -389,10 +390,11 @@ def upgrade_check():
|
||||||
if response.getcode() == 200:
|
if response.getcode() == 200:
|
||||||
data = json.loads(response.read().decode('utf-8'))
|
data = json.loads(response.read().decode('utf-8'))
|
||||||
current_app.logger.debug('Response data: %s' % data)
|
current_app.logger.debug('Response data: %s' % data)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
current_app.logger.exception(
|
current_app.logger.exception(e)
|
||||||
'Exception when checking for update')
|
# Escaping the error message to prevent HTML execution in UI
|
||||||
return internal_server_error('Failed to check for update')
|
escaped_error = html.escape(str(e))
|
||||||
|
return internal_server_error(errormsg=escaped_error)
|
||||||
|
|
||||||
if data and config.UPGRADE_CHECK_KEY and \
|
if data and config.UPGRADE_CHECK_KEY and \
|
||||||
config.UPGRADE_CHECK_KEY in data:
|
config.UPGRADE_CHECK_KEY in data:
|
||||||
|
|
|
||||||
|
|
@ -198,9 +198,9 @@ export default function BrowserComponent({pgAdmin}) {
|
||||||
if (data?.check_version_update) {
|
if (data?.check_version_update) {
|
||||||
pgAdmin.Browser.check_version_update(true);
|
pgAdmin.Browser.check_version_update(true);
|
||||||
} else if (data.update_downloading) {
|
} else if (data.update_downloading) {
|
||||||
appAutoUpdateNotifier('Update downloading...', 'info', null, 10000);
|
appAutoUpdateNotifier('Update downloading.', 'info', null, 10000);
|
||||||
} else if (data.no_update_available) {
|
} 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) {
|
} 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.');
|
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');
|
appAutoUpdateNotifier(UPDATE_DOWNLOADED_MESSAGE, 'warning', installUpdate, null, 'Update downloaded', 'update_downloaded');
|
||||||
|
|
|
||||||
|
|
@ -1287,7 +1287,6 @@ const StyledNotifierMessageBox = styled(Box)(({theme}) => ({
|
||||||
backgroundColor: theme.palette.warning.light,
|
backgroundColor: theme.palette.warning.light,
|
||||||
'& .FormFooter-iconWarning': {
|
'& .FormFooter-iconWarning': {
|
||||||
color: theme.palette.warning.main,
|
color: theme.palette.warning.main,
|
||||||
marginBottom: theme.spacing(8),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'& .FormFooter-message': {
|
'& .FormFooter-message': {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue