From 0aeee5b7a3d5996c85d113613c84595c64e5b5ca Mon Sep 17 00:00:00 2001 From: Salah Benmoussati <51402489+sbenmoussati@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:19:20 +0100 Subject: [PATCH] Revert "SDA-4472 (Migrate Symphony.config & installVariant into /Library/Preference) (#2090)" (#2094) This reverts commit be01c781b28164bedf3e7f8d1e26cc569209d880. --- installer/mac/postinstall.sh | 154 +++----------- package-lock.json | 373 +++++++++++++++++++++++++-------- spec/__mocks__/electron.ts | 4 - spec/childWindowHandle.spec.ts | 4 - spec/dialogHandler.spec.ts | 41 ---- spec/plistHandler.spec.ts | 54 ----- src/app/config-handler.ts | 26 +-- src/app/plist-handler.ts | 96 --------- 8 files changed, 320 insertions(+), 432 deletions(-) delete mode 100644 spec/plistHandler.spec.ts delete mode 100644 src/app/plist-handler.ts diff --git a/installer/mac/postinstall.sh b/installer/mac/postinstall.sh index 9e864f78..fea8cb6f 100755 --- a/installer/mac/postinstall.sh +++ b/installer/mac/postinstall.sh @@ -3,112 +3,11 @@ ## Create file path variables ## settingsFilePath='/tmp/sym_settings.txt' permissionsFilePath='/tmp/sym_permissions.txt' -plistFileName="com.symphony.electron-desktop.plist" -userName=$(stat -f%Su /dev/console) -plistFilePath="/Users/$userName/Library/Preferences/$plistFileName" - -echo "$plistFilePath" -echo "$userName" -echo "$EUID" - -# Create a plist file it not exist -if [ ! -f "$plistFilePath" ] -then - # Add a default entry - echo "Plist file does not exists creating new file" - if [ "$EUID" -ne 0 ]; then - defaults write "$plistFilePath" ApplicationName Symphony - else - sudo -u "$userName" defaults write "$plistFilePath" ApplicationName Symphony - fi -fi - -#Set default value -if [ "$EUID" -ne 0 ]; then - defaults write "$plistFilePath" url -string "https://my.symphony.com" - defaults write "$plistFilePath" autoUpdateUrl -string "" - defaults write "$plistFilePath" autoUpdateChannel -string "latest" - defaults write "$plistFilePath" isAutoUpdateEnabled -bool true - defaults write "$plistFilePath" isPodUrlEditable -bool true - defaults write "$plistFilePath" forceAutoUpdate -bool false - defaults write "$plistFilePath" autoUpdateCheckInterval -string "30" - defaults write "$plistFilePath" enableBrowserLogin -bool false - defaults write "$plistFilePath" browserLoginAutoConnect -bool false - defaults write "$plistFilePath" overrideUserAgent -bool false - defaults write "$plistFilePath" minimizeOnClose -string "ENABLED" - defaults write "$plistFilePath" launchOnStartup -string "ENABLED" - defaults write "$plistFilePath" alwaysOnTop -string "DISABLED" - defaults write "$plistFilePath" bringToFront -string "DISABLED" - defaults write "$plistFilePath" whitelistUrl -string "*" - defaults write "$plistFilePath" isCustomTitleBar -string "ENABLED" - defaults write "$plistFilePath" memoryRefresh -string "ENABLED" - defaults write "$plistFilePath" memoryThreshold -string "800" - defaults write "$plistFilePath" devToolsEnabled -bool true - defaults write "$plistFilePath" contextIsolation -bool true - defaults write "$plistFilePath" contextOriginUrl -string "" - defaults write "$plistFilePath" disableGpu -bool false - defaults write "$plistFilePath" enableRendererLogs -bool false - defaults write "$plistFilePath" ctWhitelist -array - defaults write "$plistFilePath" podWhitelist -array - defaults write "$plistFilePath" position -string "upper-right" - defaults write "$plistFilePath" display -string "" - defaults write "$plistFilePath" authServerWhitelist -string "" - defaults write "$plistFilePath" authNegotiateDelegateWhitelist -string "" - defaults write "$plistFilePath" disableThrottling -string "DISABLED" - defaults write "$plistFilePath" media -bool true - defaults write "$plistFilePath" geolocation -bool true - defaults write "$plistFilePath" notifications -bool true - defaults write "$plistFilePath" midiSysex -bool true - defaults write "$plistFilePath" pointerLock -bool true - defaults write "$plistFilePath" fullscreen -bool true - defaults write "$plistFilePath" openExternal -bool true - defaults write "$plistFilePath" autoLaunchPath -string "" - defaults write "$plistFilePath" userDataPath -string "" - defaults write "$plistFilePath" chromeFlags -string "" - defaults write "$plistFilePath" betaAutoUpdateChannelEnabled -bool true -else - sudo -u "$userName" defaults write "$plistFilePath" url -string "https://my.symphony.com" - sudo -u "$userName" defaults write "$plistFilePath" autoUpdateUrl -string "" - sudo -u "$userName" defaults write "$plistFilePath" autoUpdateChannel -string "latest" - sudo -u "$userName" defaults write "$plistFilePath" isAutoUpdateEnabled -bool true - sudo -u "$userName" defaults write "$plistFilePath" isPodUrlEditable -bool true - sudo -u "$userName" defaults write "$plistFilePath" forceAutoUpdate -bool false - sudo -u "$userName" defaults write "$plistFilePath" autoUpdateCheckInterval -string "30" - sudo -u "$userName" defaults write "$plistFilePath" enableBrowserLogin -bool false - sudo -u "$userName" defaults write "$plistFilePath" browserLoginAutoConnect -bool false - sudo -u "$userName" defaults write "$plistFilePath" overrideUserAgent -bool false - sudo -u "$userName" defaults write "$plistFilePath" minimizeOnClose -string "ENABLED" - sudo -u "$userName" defaults write "$plistFilePath" launchOnStartup -string "ENABLED" - sudo -u "$userName" defaults write "$plistFilePath" alwaysOnTop -string "DISABLED" - sudo -u "$userName" defaults write "$plistFilePath" bringToFront -string "DISABLED" - sudo -u "$userName" defaults write "$plistFilePath" whitelistUrl -string "*" - sudo -u "$userName" defaults write "$plistFilePath" isCustomTitleBar -string "ENABLED" - sudo -u "$userName" defaults write "$plistFilePath" memoryRefresh -string "ENABLED" - sudo -u "$userName" defaults write "$plistFilePath" memoryThreshold -string "800" - sudo -u "$userName" defaults write "$plistFilePath" devToolsEnabled -bool true - sudo -u "$userName" defaults write "$plistFilePath" contextIsolation -bool true - sudo -u "$userName" defaults write "$plistFilePath" contextOriginUrl -string "" - sudo -u "$userName" defaults write "$plistFilePath" disableGpu -bool false - sudo -u "$userName" defaults write "$plistFilePath" enableRendererLogs -bool false - sudo -u "$userName" defaults write "$plistFilePath" ctWhitelist -array - sudo -u "$userName" defaults write "$plistFilePath" podWhitelist -array - sudo -u "$userName" defaults write "$plistFilePath" position -string "upper-right" - sudo -u "$userName" defaults write "$plistFilePath" display -string "" - sudo -u "$userName" defaults write "$plistFilePath" authServerWhitelist -string "" - sudo -u "$userName" defaults write "$plistFilePath" authNegotiateDelegateWhitelist -string "" - sudo -u "$userName" defaults write "$plistFilePath" disableThrottling -string "DISABLED" - sudo -u "$userName" defaults write "$plistFilePath" media -bool true - sudo -u "$userName" defaults write "$plistFilePath" geolocation -bool true - sudo -u "$userName" defaults write "$plistFilePath" notifications -bool true - sudo -u "$userName" defaults write "$plistFilePath" midiSysex -bool true - sudo -u "$userName" defaults write "$plistFilePath" pointerLock -bool true - sudo -u "$userName" defaults write "$plistFilePath" fullscreen -bool true - sudo -u "$userName" defaults write "$plistFilePath" openExternal -bool true - sudo -u "$userName" defaults write "$plistFilePath" autoLaunchPath -string "" - sudo -u "$userName" defaults write "$plistFilePath" userDataPath -string "" - sudo -u "$userName" defaults write "$plistFilePath" chromeFlags -string "" - sudo -u "$userName" defaults write "$plistFilePath" betaAutoUpdateChannelEnabled -bool true -fi +installPath="$2" +configPath="/Symphony.app/Contents/config" +configFilePath="${installPath}${configPath}/Symphony.config" +installVariantPath="${installPath}${configPath}/InstallVariant.info" +newPath=${configFilePath} ## Get Symphony Settings from the temp file ## pod_url=$(sed -n '1p' ${settingsFilePath}); @@ -136,25 +35,25 @@ pod_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$pod_url") context_origin_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$context_origin_url") ## Replace the default settings with the user selected settings ## -plutil -replace url -string "$pod_url_escaped" "$plistFilePath" -plutil -replace contextOriginUrl -string "$context_origin_url_escaped" "$plistFilePath" -plutil -replace minimizeOnClose -string "$minimize_on_close" "$plistFilePath" -plutil -replace alwaysOnTop -string "$always_on_top" "$plistFilePath" -plutil -replace launchOnStartup -string "$launch_on_startup" "$plistFilePath" -plutil -replace bringToFront -string "$bring_to_front" "$plistFilePath" -plutil -replace devToolsEnabled -bool "$dev_tools_enabled" "$plistFilePath" -plutil -replace enableBrowserLogin -bool "$enable_browser_login" "$plistFilePath" -plutil -replace browserLoginAutoConnect -bool "$browser_login_autoconnect" "$plistFilePath" +sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url_escaped\"#g" "${newPath}" +sed -i "" -E "s#\"contextOriginUrl\" ?: ?\".*\"#\"contextOriginUrl\"\: \"$context_origin_url_escaped\"#g" "${newPath}" +sed -i "" -E "s#\"minimizeOnClose\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"minimizeOnClose\":\ \"$minimize_on_close\"#g" "${newPath}" +sed -i "" -E "s#\"alwaysOnTop\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"alwaysOnTop\":\ \"$always_on_top\"#g" "${newPath}" +sed -i "" -E "s#\"launchOnStartup\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"launchOnStartup\":\ \"$launch_on_startup\"#g" "${newPath}" +sed -i "" -E "s#\"bringToFront\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"bringToFront\":\ \"$bring_to_front\"#g" "${newPath}" +sed -i "" -E "s#\"devToolsEnabled\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"devToolsEnabled\":\ $dev_tools_enabled#g" "${newPath}" +sed -i "" -E "s#\"enableBrowserLogin\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"enableBrowserLogin\":\ $enable_browser_login#g" "${newPath}" +sed -i "" -E "s#\"browserLoginAutoConnect\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"browserLoginAutoConnect\":\ $browser_login_autoconnect#g" "${newPath}" ## Add settings force auto update force_auto_update=$(sed -n '10p' ${settingsFilePath}); if [ "$force_auto_update" = "" ]; then force_auto_update=false; fi -plutil -replace forceAutoUpdate -bool "$force_auto_update" "$plistFilePath" +sed -i "" -E "s#\"forceAutoUpdate\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"forceAutoUpdate\":\ $force_auto_update#g" "${newPath}" ## Add settings is pod url editable is_pod_url_editable=$(sed -n '11p' ${settingsFilePath}); if [ "$is_pod_url_editable" = "" ]; then is_pod_url_editable=true; fi -plutil -replace isPodUrlEditable -bool "$is_pod_url_editable" "$plistFilePath" +sed -i "" -E "s#\"isPodUrlEditable\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"isPodUrlEditable\":\ $is_pod_url_editable#g" "${newPath}" ## Get Symphony Permissions from the temp file ## media=$(sed -n '1p' ${permissionsFilePath}); @@ -175,17 +74,16 @@ if [ "$full_screen" = "" ]; then full_screen=true; fi if [ "$open_external_app" = "" ]; then open_external_app=true; fi ## Replace the default permissions with the user selected permissions ## -plutil -replace media -bool "$media" "$plistFilePath" -plutil -replace geolocation -bool "$geo_location" "$plistFilePath" -plutil -replace notifications -bool "$notifications" "$plistFilePath" -plutil -replace midiSysex -bool "$midi_sysex" "$plistFilePath" -plutil -replace pointerLock -bool "$pointer_lock" "$plistFilePath" -plutil -replace fullscreen -bool "$full_screen" "$plistFilePath" -plutil -replace openExternal -bool "$open_external_app" "$plistFilePath" +sed -i "" -E "s#\"media\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"media\":\ $media#g" "${newPath}" +sed -i "" -E "s#\"geolocation\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"geolocation\":\ $geo_location#g" "${newPath}" +sed -i "" -E "s#\"notifications\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"notifications\":\ $notifications#g" "${newPath}" +sed -i "" -E "s#\"midiSysex\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"midiSysex\":\ $midi_sysex#g" "${newPath}" +sed -i "" -E "s#\"pointerLock\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"pointerLock\":\ $pointer_lock#g" "${newPath}" +sed -i "" -E "s#\"fullscreen\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"fullscreen\":\ $full_screen#g" "${newPath}" +sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"openExternal\":\ $open_external_app#g" "${newPath}" ## Remove the temp settings & permissions file created ## -# rm -f ${settingsFilePath} -# rm -f ${permissionsFilePath} +rm -f ${settingsFilePath} +rm -f ${permissionsFilePath} -uuid=$(uuidgen) -plutil -replace installVariant -string "$uuid" "$plistFilePath" \ No newline at end of file +uuidgen > "${installVariantPath}" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9ddcea4b..4885c381 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "symphony", - "version": "24.4.0", + "version": "24.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "symphony", - "version": "24.4.0", + "version": "24.3.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@types/lazy-brush": "^1.0.0", - "adm-zip": "^0.5.10", + "archiver": "5.3.1", "async.map": "0.5.2", "classnames": "2.2.6", "electron-dl": "3.5.0", @@ -3170,14 +3170,6 @@ "node": ">=0.4.0" } }, - "node_modules/adm-zip": { - "version": "0.5.10", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/adm-zip/-/adm-zip-0.5.10.tgz", - "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==", - "engines": { - "node": ">=6.0" - } - }, "node_modules/agent-base": { "version": "6.0.2", "dev": true, @@ -3562,6 +3554,54 @@ "dev": true, "license": "ISC" }, + "node_modules/archiver": { + "version": "5.3.1", + "license": "MIT", + "dependencies": { + "archiver-utils": "^2.1.0", + "async": "^3.2.3", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.0.0", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/archiver-utils": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.7", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, "node_modules/archy": { "version": "1.0.0", "dev": true, @@ -3915,7 +3955,6 @@ }, "node_modules/async": { "version": "3.2.3", - "dev": true, "license": "MIT" }, "node_modules/async-done": { @@ -4302,7 +4341,6 @@ }, "node_modules/base64-js": { "version": "1.5.1", - "dev": true, "funding": [ { "type": "github", @@ -4349,7 +4387,6 @@ }, "node_modules/bl": { "version": "4.1.0", - "dev": true, "license": "MIT", "dependencies": { "buffer": "^5.5.0", @@ -4393,7 +4430,6 @@ }, "node_modules/brace-expansion": { "version": "1.1.11", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -4676,7 +4712,6 @@ }, "node_modules/buffer": { "version": "5.7.1", - "dev": true, "funding": [ { "type": "github", @@ -4713,7 +4748,6 @@ }, "node_modules/buffer-crc32": { "version": "0.2.13", - "dev": true, "license": "MIT", "engines": { "node": "*" @@ -5449,9 +5483,32 @@ "dev": true, "license": "MIT" }, + "node_modules/compress-commons": { + "version": "4.1.1", + "license": "MIT", + "dependencies": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/compress-commons/node_modules/crc32-stream": { + "version": "4.0.2", + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/concat-map": { "version": "0.0.1", - "dev": true, "license": "MIT" }, "node_modules/concat-stream": { @@ -5572,7 +5629,6 @@ }, "node_modules/core-util-is": { "version": "1.0.2", - "dev": true, "license": "MIT" }, "node_modules/cosmiconfig": { @@ -5616,6 +5672,16 @@ "buffer": "^5.1.0" } }, + "node_modules/crc-32": { + "version": "1.2.2", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/create-ecdh": { "version": "4.0.4", "dev": true, @@ -7032,7 +7098,6 @@ }, "node_modules/end-of-stream": { "version": "1.4.4", - "dev": true, "license": "MIT", "dependencies": { "once": "^1.4.0" @@ -8120,6 +8185,10 @@ "node": ">=0.10.0" } }, + "node_modules/fs-constants": { + "version": "1.0.0", + "license": "MIT" + }, "node_modules/fs-extra": { "version": "8.1.0", "dev": true, @@ -8318,7 +8387,6 @@ }, "node_modules/glob": { "version": "7.1.6", - "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -9684,7 +9752,6 @@ }, "node_modules/ieee754": { "version": "1.2.1", - "dev": true, "funding": [ { "type": "github", @@ -9814,7 +9881,6 @@ }, "node_modules/inflight": { "version": "1.0.6", - "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -9823,7 +9889,6 @@ }, "node_modules/inherits": { "version": "2.0.4", - "dev": true, "license": "ISC" }, "node_modules/ini": { @@ -10356,7 +10421,6 @@ }, "node_modules/isarray": { "version": "1.0.0", - "dev": true, "license": "MIT" }, "node_modules/isbinaryfile": { @@ -11864,7 +11928,6 @@ }, "node_modules/lazystream": { "version": "1.0.0", - "dev": true, "license": "MIT", "dependencies": { "readable-stream": "^2.0.5" @@ -11875,7 +11938,6 @@ }, "node_modules/lazystream/node_modules/readable-stream": { "version": "2.3.7", - "dev": true, "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", @@ -12097,6 +12159,14 @@ "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "license": "MIT" + }, + "node_modules/lodash.difference": { + "version": "4.5.0", + "license": "MIT" + }, "node_modules/lodash.escape": { "version": "4.0.1", "dev": true, @@ -12106,6 +12176,10 @@ "version": "4.1.2", "license": "MIT" }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "license": "MIT" + }, "node_modules/lodash.flattendeep": { "version": "4.4.0", "dev": true, @@ -12120,6 +12194,10 @@ "version": "4.5.0", "license": "MIT" }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "license": "MIT" + }, "node_modules/lodash.memoize": { "version": "3.0.4", "dev": true, @@ -12130,6 +12208,10 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.union": { + "version": "4.6.0", + "license": "MIT" + }, "node_modules/log-symbols": { "version": "4.1.0", "dev": true, @@ -12603,7 +12685,6 @@ }, "node_modules/minimatch": { "version": "3.1.2", - "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -13165,7 +13246,6 @@ }, "node_modules/normalize-path": { "version": "3.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -13513,7 +13593,6 @@ }, "node_modules/once": { "version": "1.4.0", - "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -13870,7 +13949,6 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -14406,7 +14484,6 @@ }, "node_modules/process-nextick-args": { "version": "2.0.1", - "dev": true, "license": "MIT" }, "node_modules/progress": { @@ -14823,7 +14900,6 @@ }, "node_modules/readable-stream": { "version": "3.6.0", - "dev": true, "license": "MIT", "dependencies": { "inherits": "^2.0.3", @@ -14834,6 +14910,30 @@ "node": ">= 6" } }, + "node_modules/readdir-glob": { + "version": "1.1.2", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/realpath-native": { "version": "2.0.0", "dev": true, @@ -15335,7 +15435,6 @@ }, "node_modules/safe-buffer": { "version": "5.1.2", - "dev": true, "license": "MIT" }, "node_modules/safe-regex": { @@ -16349,7 +16448,6 @@ }, "node_modules/string_decoder": { "version": "1.1.1", - "dev": true, "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" @@ -16810,6 +16908,20 @@ "node": ">=10" } }, + "node_modules/tar-stream": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/tar/node_modules/fs-minipass": { "version": "2.1.0", "dev": true, @@ -17674,7 +17786,6 @@ }, "node_modules/util-deprecate": { "version": "1.0.2", - "dev": true, "license": "MIT" }, "node_modules/uuid": { @@ -18072,7 +18183,6 @@ }, "node_modules/wrappy": { "version": "1.0.2", - "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { @@ -18253,6 +18363,18 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zip-stream": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "archiver-utils": "^2.1.0", + "compress-commons": "^4.1.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } } }, "dependencies": { @@ -20459,11 +20581,6 @@ "version": "7.2.0", "dev": true }, - "adm-zip": { - "version": "0.5.10", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/adm-zip/-/adm-zip-0.5.10.tgz", - "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==" - }, "agent-base": { "version": "6.0.2", "dev": true, @@ -20720,6 +20837,47 @@ "version": "2.0.0", "dev": true }, + "archiver": { + "version": "5.3.1", + "requires": { + "archiver-utils": "^2.1.0", + "async": "^3.2.3", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.0.0", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + } + }, + "archiver-utils": { + "version": "2.1.0", + "requires": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, "archy": { "version": "1.0.0", "dev": true @@ -20954,8 +21112,7 @@ "optional": true }, "async": { - "version": "3.2.3", - "dev": true + "version": "3.2.3" }, "async-done": { "version": "1.3.2", @@ -21228,8 +21385,7 @@ } }, "base64-js": { - "version": "1.5.1", - "dev": true + "version": "1.5.1" }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -21252,7 +21408,6 @@ }, "bl": { "version": "4.1.0", - "dev": true, "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -21289,7 +21444,6 @@ }, "brace-expansion": { "version": "1.1.11", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -21517,7 +21671,6 @@ }, "buffer": { "version": "5.7.1", - "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -21536,8 +21689,7 @@ "dev": true }, "buffer-crc32": { - "version": "0.2.13", - "dev": true + "version": "0.2.13" }, "buffer-equal": { "version": "0.0.1", @@ -22034,9 +22186,26 @@ "version": "1.3.0", "dev": true }, + "compress-commons": { + "version": "4.1.1", + "requires": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "dependencies": { + "crc32-stream": { + "version": "4.0.2", + "requires": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + } + } + } + }, "concat-map": { - "version": "0.0.1", - "dev": true + "version": "0.0.1" }, "concat-stream": { "version": "1.6.2", @@ -22130,8 +22299,7 @@ } }, "core-util-is": { - "version": "1.0.2", - "dev": true + "version": "1.0.2" }, "cosmiconfig": { "version": "7.0.0", @@ -22164,6 +22332,9 @@ "buffer": "^5.1.0" } }, + "crc-32": { + "version": "1.2.2" + }, "create-ecdh": { "version": "4.0.4", "dev": true, @@ -23138,7 +23309,6 @@ }, "end-of-stream": { "version": "1.4.4", - "dev": true, "requires": { "once": "^1.4.0" } @@ -23907,6 +24077,9 @@ "map-cache": "^0.2.2" } }, + "fs-constants": { + "version": "1.0.0" + }, "fs-extra": { "version": "8.1.0", "dev": true, @@ -24033,7 +24206,6 @@ }, "glob": { "version": "7.1.6", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -24993,8 +25165,7 @@ } }, "ieee754": { - "version": "1.2.1", - "dev": true + "version": "1.2.1" }, "ignore": { "version": "5.1.8", @@ -25065,15 +25236,13 @@ }, "inflight": { "version": "1.0.6", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { - "version": "2.0.4", - "dev": true + "version": "2.0.4" }, "ini": { "version": "1.3.8", @@ -25386,8 +25555,7 @@ } }, "isarray": { - "version": "1.0.0", - "dev": true + "version": "1.0.0" }, "isbinaryfile": { "version": "5.0.0", @@ -26453,14 +26621,12 @@ }, "lazystream": { "version": "1.0.0", - "dev": true, "requires": { "readable-stream": "^2.0.5" }, "dependencies": { "readable-stream": { "version": "2.3.7", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -26615,6 +26781,12 @@ "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, + "lodash.defaults": { + "version": "4.2.0" + }, + "lodash.difference": { + "version": "4.5.0" + }, "lodash.escape": { "version": "4.0.1", "dev": true @@ -26622,6 +26794,9 @@ "lodash.escaperegexp": { "version": "4.1.2" }, + "lodash.flatten": { + "version": "4.4.0" + }, "lodash.flattendeep": { "version": "4.4.0", "dev": true @@ -26633,6 +26808,9 @@ "lodash.isequal": { "version": "4.5.0" }, + "lodash.isplainobject": { + "version": "4.0.6" + }, "lodash.memoize": { "version": "3.0.4", "dev": true @@ -26641,6 +26819,9 @@ "version": "4.7.0", "dev": true }, + "lodash.union": { + "version": "4.6.0" + }, "log-symbols": { "version": "4.1.0", "dev": true, @@ -26979,7 +27160,6 @@ }, "minimatch": { "version": "3.1.2", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -27373,8 +27553,7 @@ } }, "normalize-path": { - "version": "3.0.0", - "dev": true + "version": "3.0.0" }, "normalize-url": { "version": "6.1.0", @@ -27592,7 +27771,6 @@ }, "once": { "version": "1.4.0", - "dev": true, "requires": { "wrappy": "1" } @@ -27832,8 +28010,7 @@ "version": "4.0.0" }, "path-is-absolute": { - "version": "1.0.1", - "dev": true + "version": "1.0.1" }, "path-is-inside": { "version": "1.0.2", @@ -28168,8 +28345,7 @@ "dev": true }, "process-nextick-args": { - "version": "2.0.1", - "dev": true + "version": "2.0.1" }, "progress": { "version": "2.0.3", @@ -28478,13 +28654,32 @@ }, "readable-stream": { "version": "3.6.0", - "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, + "readdir-glob": { + "version": "1.1.2", + "requires": { + "minimatch": "^5.1.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.6", + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "realpath-native": { "version": "2.0.0", "dev": true @@ -28838,8 +29033,7 @@ "devOptional": true }, "safe-buffer": { - "version": "5.1.2", - "dev": true + "version": "5.1.2" }, "safe-regex": { "version": "1.1.0", @@ -29547,7 +29741,6 @@ }, "string_decoder": { "version": "1.1.1", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -29885,6 +30078,16 @@ } } }, + "tar-stream": { + "version": "2.2.0", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + }, "temp-file": { "version": "3.4.0", "dev": true, @@ -30463,8 +30666,7 @@ } }, "util-deprecate": { - "version": "1.0.2", - "dev": true + "version": "1.0.2" }, "uuid": { "version": "3.4.0", @@ -30763,8 +30965,7 @@ } }, "wrappy": { - "version": "1.0.2", - "dev": true + "version": "1.0.2" }, "write-file-atomic": { "version": "3.0.3", @@ -30885,6 +31086,14 @@ "yocto-queue": { "version": "0.1.0", "dev": true + }, + "zip-stream": { + "version": "4.1.0", + "requires": { + "archiver-utils": "^2.1.0", + "compress-commons": "^4.1.0", + "readable-stream": "^3.6.0" + } } } } diff --git a/spec/__mocks__/electron.ts b/spec/__mocks__/electron.ts index 7fac9f02..c2a0f5b4 100644 --- a/spec/__mocks__/electron.ts +++ b/spec/__mocks__/electron.ts @@ -290,10 +290,6 @@ export const screen = { }), }; -export const systemPreferences = { - getUserDefault: jest.fn(), -}; - export const remote = { app, getCurrentWindow, diff --git a/spec/childWindowHandle.spec.ts b/spec/childWindowHandle.spec.ts index 1bb8e9cc..cc5d5ab8 100644 --- a/spec/childWindowHandle.spec.ts +++ b/spec/childWindowHandle.spec.ts @@ -60,10 +60,6 @@ jest.mock('../src/app/auto-update-handler', () => { return {}; }); -jest.mock('../src/app/config-handler', () => { - return {}; -}); - describe('child window handle', () => { it('should set open window handler', () => { const spy = jest.spyOn(webContents, 'setWindowOpenHandler'); diff --git a/spec/dialogHandler.spec.ts b/spec/dialogHandler.spec.ts index 23f4b9a8..65e8f9a0 100644 --- a/spec/dialogHandler.spec.ts +++ b/spec/dialogHandler.spec.ts @@ -39,47 +39,6 @@ jest.mock('../src/app/window-handler', () => { }; }); -jest.mock('../src/app/plist-handler', () => { - return {}; -}); -jest.mock('../src/app/config-handler', () => { - return { - CloudConfigDataTypes: { - NOT_SET: 'NOT_SET', - ENABLED: 'ENABLED', - DISABLED: 'DISABLED', - }, - config: { - getConfigFields: jest.fn(() => { - return { - minimizeOnClose: 'ENABLED', - launchOnStartup: 'ENABLED', - alwaysOnTop: 'ENABLED', - isAlwaysOnTop: 'ENABLED', - bringToFront: 'ENABLED', - devToolsEnabled: true, - }; - }), - getGlobalConfigFields: jest.fn(() => { - return { - devToolsEnabled: true, - }; - }), - getFilteredCloudConfigFields: jest.fn(() => { - return { - devToolsEnabled: true, - }; - }), - getCloudConfigFields: jest.fn(() => { - return { - devToolsEnabled: true, - }; - }), - updateUserConfig: jest.fn(), - }, - }; -}); - jest.mock('../src/renderer/notification', () => { return { setupNotificationPosition: jest.fn(), diff --git a/spec/plistHandler.spec.ts b/spec/plistHandler.spec.ts deleted file mode 100644 index dbbf71ba..00000000 --- a/spec/plistHandler.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { getAllUserDefaults } from '../src/app/plist-handler'; - -describe('Plist Handler', () => { - it('should return config object', () => { - expect(getAllUserDefaults()).toStrictEqual({ - alwaysOnTop: undefined, - autoLaunchPath: undefined, - autoUpdateChannel: undefined, - autoUpdateCheckInterval: undefined, - autoUpdateUrl: undefined, - betaAutoUpdateChannelEnabled: undefined, - bringToFront: undefined, - browserLoginAutoConnect: undefined, - chromeFlags: { - authNegotiateDelegateWhitelist: undefined, - authServerWhitelist: undefined, - disableThrottling: undefined, - }, - contextIsolation: undefined, - contextOriginUrl: undefined, - ctWhitelist: undefined, - devToolsEnabled: undefined, - disableGpu: undefined, - enableBrowserLogin: undefined, - enableRendererLogs: undefined, - forceAutoUpdate: undefined, - isAutoUpdateEnabled: undefined, - isCustomTitleBar: undefined, - isPodUrlEditable: undefined, - launchOnStartup: undefined, - memoryRefresh: undefined, - memoryThreshold: undefined, - minimizeOnClose: undefined, - notificationSettings: { - display: undefined, - position: undefined, - }, - overrideUserAgent: undefined, - permissions: { - fullscreen: undefined, - geolocation: undefined, - media: undefined, - midiSysex: undefined, - notifications: undefined, - openExternal: undefined, - pointerLock: undefined, - }, - podWhitelist: undefined, - url: undefined, - userDataPath: undefined, - whitelistUrl: undefined, - }); - }); -}); diff --git a/src/app/config-handler.ts b/src/app/config-handler.ts index b2cab785..acd77563 100644 --- a/src/app/config-handler.ts +++ b/src/app/config-handler.ts @@ -1,4 +1,4 @@ -import { app, dialog, powerSaveBlocker, systemPreferences } from 'electron'; +import { app, dialog, powerSaveBlocker } from 'electron'; import * as fs from 'fs'; import * as path from 'path'; @@ -16,7 +16,6 @@ import { SDAUserSessionActionTypes, } from './bi/interface'; import { terminateC9Shell } from './c9-shell-handler'; -import { getAllUserDefaults } from './plist-handler'; import { appStats } from './stats'; const writeFile = util.promisify(fs.writeFile); @@ -787,20 +786,12 @@ class Config { * Reads a stores the global config file */ private readGlobalConfig() { - if (isMac) { - this.globalConfig = getAllUserDefaults(); - logger.info( - `config-handler: Global configuration from plist: `, - this.globalConfig, - ); - return; - } if (!fs.existsSync(this.globalConfigPath)) { throw new Error( `Global config file missing! App will not run as expected!`, ); } - /*if (fs.existsSync(this.tempGlobalConfigFilePath)) { + if (fs.existsSync(this.tempGlobalConfigFilePath)) { this.globalConfig = this.parseConfigData( fs.readFileSync(this.tempGlobalConfigFilePath, 'utf8'), ); @@ -813,7 +804,7 @@ class Config { this.copyGlobalConfig(); } return; - }*/ + } const parsedConfigData = this.parseConfigData( fs.readFileSync(this.globalConfigPath, 'utf8'), ); @@ -827,17 +818,6 @@ class Config { * Reads the install variant from a file */ private readInstallVariant() { - if (isMac) { - this.installVariant = systemPreferences.getUserDefault( - 'installVariant', - 'string', - ); - logger.info( - `config-handler: Install variant from plist: `, - this.installVariant, - ); - return; - } this.installVariant = fs.readFileSync(this.installVariantPath, 'utf8'); logger.info(`config-handler: Install variant: `, this.installVariant); } diff --git a/src/app/plist-handler.ts b/src/app/plist-handler.ts deleted file mode 100644 index d08d2316..00000000 --- a/src/app/plist-handler.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { systemPreferences } from 'electron'; -import { logger } from '../common/logger'; -import { IConfig } from './config-handler'; - -const GENERAL_SETTINGS = { - url: 'string', - autoUpdateUrl: 'string', - autoUpdateChannel: 'string', - isAutoUpdateEnabled: 'boolean', - isPodUrlEditable: 'boolean', - forceAutoUpdate: 'boolean', - autoUpdateCheckInterval: 'string', - enableBrowserLogin: 'boolean', - browserLoginAutoConnect: 'boolean', - overrideUserAgent: 'boolean', - minimizeOnClose: 'string', - launchOnStartup: 'string', - alwaysOnTop: 'string', - bringToFront: 'string', - whitelistUrl: 'string', - isCustomTitleBar: 'string', - memoryRefresh: 'string', - memoryThreshold: 'string', - devToolsEnabled: 'boolean', - contextIsolation: 'boolean', - contextOriginUrl: 'string', - disableGpu: 'boolean', - enableRendererLogs: 'boolean', - ctWhitelist: 'array', - podWhitelist: 'array', - autoLaunchPath: 'string', - userDataPath: 'string', - chromeFlags: 'string', - betaAutoUpdateChannelEnabled: 'boolean', -}; - -const NOTIFICATION_SETTINGS = { - position: 'string', - display: 'string', -}; - -const CHROME_FLAGS = { - authServerWhitelist: 'string', - authNegotiateDelegateWhitelist: 'string', - disableThrottling: 'string', -}; - -const PERMISSIONS = { - media: 'boolean', - geolocation: 'boolean', - notifications: 'boolean', - midiSysex: 'boolean', - pointerLock: 'boolean', - fullscreen: 'boolean', - openExternal: 'boolean', -}; - -export const getAllUserDefaults = (): IConfig => { - const settings: any = {}; - - Object.keys(GENERAL_SETTINGS).map((key) => { - settings[key] = systemPreferences.getUserDefault( - key, - GENERAL_SETTINGS[key], - ); - }); - Object.keys(NOTIFICATION_SETTINGS).map((key) => { - if (!settings.notificationSettings) { - settings.notificationSettings = {}; - } - settings.notificationSettings[key] = systemPreferences.getUserDefault( - key, - NOTIFICATION_SETTINGS[key], - ); - }); - Object.keys(CHROME_FLAGS).map((key) => { - if (!settings.chromeFlags) { - settings.chromeFlags = {}; - } - settings.chromeFlags[key] = systemPreferences.getUserDefault( - key, - CHROME_FLAGS[key], - ); - }); - Object.keys(PERMISSIONS).map((key) => { - if (!settings.permissions) { - settings.permissions = {}; - } - settings.permissions[key] = systemPreferences.getUserDefault( - key, - PERMISSIONS[key], - ); - }); - logger.info('plist-handler: getting all user defaults', settings); - return settings; -};