SDA-3589 (Fix issues with All user installations) (#1456)

* SDA-3589 - Fix installer.nsh script

* SDA-3589 - Fix import position

* SDA-3589 - No UI installer

* SDA-3589 - Remove abort for now

* SDA-3589 - Disable abort script

* SDA-3589 - Fix all user installation

* SDA-3589 - sign nsis exe file

* SDA-3589 - Remove cloud 9 extra dir
This commit is contained in:
Kiran Niranjan
2022-07-20 14:30:16 +05:30
committed by GitHub
parent b064c4189f
commit 9c10c1a4eb
12 changed files with 123 additions and 42 deletions
+75 -19
View File
@@ -1,26 +1,82 @@
!include LogicLib.nsh
; Uninstall existing Symphony before installing a new version
!macro uninstallSymphony
StrCpy $0 0
SetRegView 64
loop:
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
StrCmp $1 "" done
ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName"
${If} $2 == "Symphony"
ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
ExecWait '$3 /qn'
${EndIf}
IntOp $0 $0 + 1
Goto loop
done:
Var PerUser
Var AllUser
Function uninstallSymphony
StrCpy $0 0
SetRegView 64
loop:
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
StrCmp $1 "" done
ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName"
${If} $2 == "Symphony"
ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
ExecWait '$3 /qn'
${EndIf}
IntOp $0 $0 + 1
Goto loop
done:
FunctionEnd
!macro bothM
MessageBox MB_OK "Auto update not supported as there is two version installed"
!macroend
; Preinstall script
!macro preInit
SetRegView 64
!insertmacro uninstallSymphony
!macro perUserM
Call uninstallSymphony
Sleep 10000
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony"
!macroend
!macro allUserM
${IfNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated
Quit
${endif}
Call uninstallSymphony
Sleep 10000
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony"
!macroend
!macro abortM
; MessageBox MB_OK "Something went wrong!! Could not find existing SDA"
!macroend
!macro validateInstallation
IfFileExists $PROGRAMFILES64\Symphony\Symphony\Symphony.exe 0 +2
StrCpy $AllUser "exists"
IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\Symphony.exe 0 +2
StrCpy $PerUser "exists"
!macroend
!macro preInit
!insertmacro validateInstallation
${If} $PerUser == "exists"
${AndIf} $AllUser == "exists"
!insertmacro bothM
${ElseIf} $PerUser == "exists"
!insertmacro perUserM
${ElseIf} $AllUser == "exists"
!insertmacro allUserM
${Else}
!insertmacro abortM
${EndIf}
!macroend
!macro customUnInit
!insertmacro validateInstallation
${If} $AllUser == "exists"
${IfNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated
Quit
${endif}
${EndIf}
!macroend
+2 -10
View File
@@ -72,7 +72,6 @@
},
"optionalDependencies": {
"@symphony/symphony-c9-shell": "3.14.99-37",
"auto-update": "file:auto_update",
"screen-share-indicator-frame": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#v1.4.13",
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet2.git#9.2.2",
"winreg": "^1.2.4"
@@ -80,8 +79,8 @@
},
"auto_update": {
"version": "0.0.1",
"hasInstallScript": true,
"optional": true
"extraneous": true,
"hasInstallScript": true
},
"node_modules/@ava/babel-plugin-throws-helper": {
"version": "4.0.0",
@@ -4178,10 +4177,6 @@
"node": ">= 4.5.0"
}
},
"node_modules/auto-update": {
"resolved": "auto_update",
"link": true
},
"node_modules/ava": {
"version": "2.4.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/ava/-/ava-2.4.0.tgz",
@@ -28408,9 +28403,6 @@
"integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=",
"dev": true
},
"auto-update": {
"version": "file:auto_update"
},
"ava": {
"version": "2.4.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/ava/-/ava-2.4.0.tgz",
+3 -9
View File
@@ -46,8 +46,9 @@
"asarUnpack": "**/*.node",
"nsis": {
"perMachine": false,
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"oneClick": true,
"allowToChangeInstallationDirectory": false,
"allowElevation": false,
"include": "build/installer.nsh",
"uninstallDisplayName": "${productName}"
},
@@ -105,13 +106,6 @@
{
"from": "node_modules/screen-snippet/ScreenSnippet.exe",
"to": "ScreenSnippet.exe"
},
{
"from": "node_modules/@symphony/symphony-c9-shell/shell",
"to": "cloud9",
"filter": [
"**/*"
]
}
]
},
+6
View File
@@ -128,6 +128,12 @@ IF %errorlevel% neq 0 (
exit /b -1
)
call %SIGNING_FILE_PATH% ..\..\dist\win-unpacked\Symphony-%SYMVER%-win.exe
IF %errorlevel% neq 0 (
echo "Signing failed"
exit /b -1
)
call %SIGNING_FILE_PATH% ..\..\library\indexvalidator-x64.exe
IF %errorlevel% neq 0 (
echo "Signing failed"
+12 -1
View File
@@ -16,7 +16,6 @@ import {
AnalyticsElements,
MenuActionTypes,
} from './analytics-handler';
import { autoLaunchInstance as autoLaunch } from './auto-launch-controller';
import { CloudConfigDataTypes, config, IConfig } from './config-handler';
import { gpuRestartDialog, titleBarChangeDialog } from './dialog-handler';
import { exportCrashDumps, exportLogs } from './reports-handler';
@@ -34,6 +33,7 @@ import {
zoomOut,
} from './window-utils';
import { autoLaunchInstance as autoLaunch } from './auto-launch-controller';
import { autoUpdate } from './auto-update-handler';
export const menuSections = {
@@ -78,6 +78,7 @@ let {
memoryRefresh,
isCustomTitleBar,
devToolsEnabled,
isAutoUpdateEnabled,
} = config.getConfigFields([
'minimizeOnClose',
'launchOnStartup',
@@ -86,6 +87,7 @@ let {
'memoryRefresh',
'isCustomTitleBar',
'devToolsEnabled',
'isAutoUpdateEnabled',
]) as IConfig;
let initialAnalyticsSent = false;
@@ -222,6 +224,7 @@ export class AppMenu {
memoryRefresh = configData.memoryRefresh;
isCustomTitleBar = configData.isCustomTitleBar;
devToolsEnabled = configData.devToolsEnabled;
isAutoUpdateEnabled = configData.isAutoUpdateEnabled;
// fetch updated cloud config
this.cloudConfig = config.getFilteredCloudConfigFields(
@@ -286,6 +289,7 @@ export class AppMenu {
click: (_item) => {
autoUpdate.checkUpdates();
},
visible: isMac && isAutoUpdateEnabled,
label: i18n.t('Check for updates')(),
},
this.buildSeparator(),
@@ -666,6 +670,13 @@ export class AppMenu {
},
],
},
{
click: (_item) => {
autoUpdate.checkUpdates();
},
visible: isWindowsOS && isAutoUpdateEnabled,
label: i18n.t('Check for updates')(),
},
{
label: i18n.t('About Symphony')(),
visible: isWindowsOS || isLinux,
+8 -1
View File
@@ -10,6 +10,7 @@ import { windowHandler } from './window-handler';
export class AutoUpdate {
public isUpdateAvailable: boolean = false;
public didPublishDownloadProgress: boolean = false;
public autoUpdater: MacUpdater | NsisUpdater | undefined = undefined;
constructor() {
@@ -50,12 +51,17 @@ export class AutoUpdate {
this.autoUpdater.on('download-progress', (info) => {
const mainWebContents = windowHandler.mainWebContents;
// Display client banner
if (mainWebContents && !mainWebContents.isDestroyed()) {
if (
mainWebContents &&
!mainWebContents.isDestroyed() &&
!this.didPublishDownloadProgress
) {
mainWebContents.send('display-client-banner', {
reason: 'autoUpdate',
action: 'download-progress',
data: info,
});
this.didPublishDownloadProgress = true;
}
});
@@ -112,6 +118,7 @@ export class AutoUpdate {
public downloadUpdate = async (): Promise<void> => {
logger.info('auto-update-handler: download update');
if (this.autoUpdater) {
this.didPublishDownloadProgress = false;
await this.autoUpdater.downloadUpdate();
}
};
+3
View File
@@ -374,6 +374,9 @@ ipcMain.on(
case apiCmds.downloadUpdate:
autoUpdate.downloadUpdate();
break;
case apiCmds.checkForUpdates:
autoUpdate.checkUpdates();
break;
default:
break;
}
+2 -1
View File
@@ -5,7 +5,6 @@ import { isDevEnv, isLinux, isMac } from '../common/env';
import { logger } from '../common/logger';
import { getCommandLineArgs } from '../common/utils';
import { cleanUpAppCache, createAppCacheFile } from './app-cache-handler';
import { autoLaunchInstance } from './auto-launch-controller';
import { setChromeFlags, setSessionProperties } from './chrome-flags';
import { config } from './config-handler';
import './dialog-handler';
@@ -14,6 +13,8 @@ import { handlePerformanceSettings } from './perf-handler';
import { protocolHandler } from './protocol-handler';
import { ICustomBrowserWindow, windowHandler } from './window-handler';
import { autoLaunchInstance } from './auto-launch-controller';
// Set automatic period substitution to false because of a bug in draft js on the client app
// See https://perzoinc.atlassian.net/browse/SDA-2215 for more details
if (isMac) {
+1 -1
View File
@@ -22,7 +22,6 @@ import { i18n, LocaleType } from '../common/i18n';
import { logger } from '../common/logger';
import { getDifferenceInDays, getGuid, getRandomTime } from '../common/utils';
import { whitelistHandler } from '../common/whitelist-handler';
import { autoLaunchInstance } from './auto-launch-controller';
import {
CloudConfigDataTypes,
config,
@@ -48,6 +47,7 @@ import {
} from './window-handler';
import { notification } from '../renderer/notification';
import { autoLaunchInstance } from './auto-launch-controller';
import { autoUpdate } from './auto-update-handler';
import { mainEvents } from './main-event-handler';
+1
View File
@@ -70,6 +70,7 @@ export enum apiCmds {
closeCloud9Pipe = 'close-cloud9-pipe',
updateAndRestart = 'update-and-restart',
downloadUpdate = 'download-update',
checkForUpdates = 'check-for-updates',
}
export enum apiName {
+1
View File
@@ -96,6 +96,7 @@ if (ssfWindow.ssf) {
connectCloud9Pipe: ssfWindow.ssf.connectCloud9Pipe,
updateAndRestartSDA: ssfWindow.ssf.updateAndRestart,
downloadUpdate: ssfWindow.ssf.downloadUpdate,
checkForUpdates: ssfWindow.ssf.checkForUpdates,
});
}
+9
View File
@@ -872,6 +872,15 @@ export class SSFApi {
cmd: apiCmds.downloadUpdate,
});
}
/**
* Allows JS to check for updates
*/
public checkForUpdates(): void {
ipcRenderer.send(apiName.symphonyApi, {
cmd: apiCmds.checkForUpdates,
});
}
}
/**