Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pkg/mac/build-functions.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# shellcheck shell=bash

# uname -m returns "x86_64" on Intel, but we need "x64"
ARCH="x64"
if [ "$(uname -m)" == "arm64" ]; then
ARCH="arm64"
fi

_setup_env() {
FUNCS_DIR=$(cd "$(dirname "$0")" && pwd)/../..
APP_RELEASE=$(grep "^APP_RELEASE" "${FUNCS_DIR}/web/version.py" | cut -d"=" -f2 | sed 's/ //g')
Expand All @@ -11,7 +17,7 @@ _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"
DMG_NAME="${DIST_ROOT}/$(echo "${APP_NAME}" | sed 's/ //g' | awk '{print tolower($0)}')-${APP_LONG_VERSION}-${ARCH}.dmg"
PYTHON_OS_VERSION="11"
}

Expand All @@ -27,20 +33,14 @@ _build_runtime() {

test -d "${BUILD_ROOT}" || mkdir "${BUILD_ROOT}"
# Get a fresh copy of electron
# uname -m returns "x86_64" on Intel, but we need "x64"
ELECTRON_ARCH="x64"
if [ "$(uname -m)" == "arm64" ]; then
ELECTRON_ARCH="arm64"
fi

ELECTRON_VERSION="$(npm info electron version)"

pushd "${BUILD_ROOT}" > /dev/null || exit
while true;do
wget "https://github.com/electron/electron/releases/download/v${ELECTRON_VERSION}/electron-v${ELECTRON_VERSION}-darwin-${ELECTRON_ARCH}.zip" && break
rm "electron-v${ELECTRON_VERSION}-darwin-${ELECTRON_ARCH}.zip"
wget "https://github.com/electron/electron/releases/download/v${ELECTRON_VERSION}/electron-v${ELECTRON_VERSION}-darwin-${ARCH}.zip" && break
rm "electron-v${ELECTRON_VERSION}-darwin-${ARCH}.zip"
done
unzip "electron-v${ELECTRON_VERSION}-darwin-${ELECTRON_ARCH}.zip"
unzip "electron-v${ELECTRON_VERSION}-darwin-${ARCH}.zip"
popd > /dev/null || exit
# WGET END

Expand Down
10 changes: 5 additions & 5 deletions runtime/src/js/autoUpdaterHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/js/pgadmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1171,9 +1171,11 @@ def _get_sql_for_edit_mode(self, data, parallel_dict, all_ids_dict,
old_data['proparallel'] = \
parallel_dict[old_data['proparallel']]

if self.node_type == 'function' and \
old_data['dependsonextensions'] is None:
old_data['dependsonextensions'] = []
if self.node_type == 'function':
old_data['dependsonextensions'] = \
old_data.get('dependsonextensions') or []
data['dependsonextensions'] = \
data.get('dependsonextensions') or []

# If any of the below argument is changed,
# then CREATE OR REPLACE SQL statement should be called
Expand Down
2 changes: 1 addition & 1 deletion web/pgadmin/browser/static/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions web/pgadmin/misc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from urllib.request import urlopen
from urllib.parse import unquote
from pgadmin.settings import get_setting, store_setting
import html

MODULE_NAME = 'misc'

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions web/pgadmin/static/js/BrowserComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion web/pgadmin/static/js/components/FormComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
Loading