SDA-4476 - Add // nosemgrep (#2096)

SDA-4476 - Add installVariant to defaults

SDA-4476 - Initialize plist file

Revert "Revert "SDA-4472 (Migrate Symphony.config & installVariant into /Library/Preference) (#2090)" (#2094)"

This reverts commit 0aeee5b7a3.
This commit is contained in:
Kiran Niranjan
2024-02-19 15:11:50 +05:30
committed by GitHub
parent 75d1253b17
commit db0d878747
9 changed files with 445 additions and 336 deletions

View File

@@ -3,11 +3,25 @@
## Create file path variables ## ## Create file path variables ##
settingsFilePath='/tmp/sym_settings.txt' settingsFilePath='/tmp/sym_settings.txt'
permissionsFilePath='/tmp/sym_permissions.txt' permissionsFilePath='/tmp/sym_permissions.txt'
installPath="$2" plistFileName="com.symphony.electron-desktop.plist"
configPath="/Symphony.app/Contents/config" userName=$(stat -f%Su /dev/console)
configFilePath="${installPath}${configPath}/Symphony.config" plistFilePath="/Users/$userName/Library/Preferences/$plistFileName"
installVariantPath="${installPath}${configPath}/InstallVariant.info"
newPath=${configFilePath} 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
## Get Symphony Settings from the temp file ## ## Get Symphony Settings from the temp file ##
pod_url=$(sed -n '1p' ${settingsFilePath}); pod_url=$(sed -n '1p' ${settingsFilePath});
@@ -34,26 +48,14 @@ if [ "$browser_login_autoconnect" = "" ]; then browser_login_autoconnect=false;
pod_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$pod_url") pod_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$pod_url")
context_origin_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$context_origin_url") context_origin_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$context_origin_url")
## Replace the default settings with the user selected settings ##
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 ## Add settings force auto update
force_auto_update=$(sed -n '10p' ${settingsFilePath}); force_auto_update=$(sed -n '10p' ${settingsFilePath});
if [ "$force_auto_update" = "" ]; then force_auto_update=false; fi if [ "$force_auto_update" = "" ]; then force_auto_update=false; fi
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 ## Add settings is pod url editable
is_pod_url_editable=$(sed -n '11p' ${settingsFilePath}); is_pod_url_editable=$(sed -n '11p' ${settingsFilePath});
if [ "$is_pod_url_editable" = "" ]; then is_pod_url_editable=true; fi if [ "$is_pod_url_editable" = "" ]; then is_pod_url_editable=true; fi
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 ## ## Get Symphony Permissions from the temp file ##
media=$(sed -n '1p' ${permissionsFilePath}); media=$(sed -n '1p' ${permissionsFilePath});
@@ -73,17 +75,97 @@ if [ "$pointer_lock" = "" ]; then pointer_lock=true;fi
if [ "$full_screen" = "" ]; then full_screen=true; fi if [ "$full_screen" = "" ]; then full_screen=true; fi
if [ "$open_external_app" = "" ]; then open_external_app=true; fi if [ "$open_external_app" = "" ]; then open_external_app=true; fi
## Replace the default permissions with the user selected permissions ## uuid=$(uuidgen)
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}" #Set default value
sed -i "" -E "s#\"notifications\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"notifications\":\ $notifications#g" "${newPath}" if [ "$EUID" -ne 0 ]; then
sed -i "" -E "s#\"midiSysex\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"midiSysex\":\ $midi_sysex#g" "${newPath}" defaults write "$plistFilePath" url -string "$pod_url_escaped"
sed -i "" -E "s#\"pointerLock\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"pointerLock\":\ $pointer_lock#g" "${newPath}" defaults write "$plistFilePath" autoUpdateUrl -string ""
sed -i "" -E "s#\"fullscreen\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"fullscreen\":\ $full_screen#g" "${newPath}" defaults write "$plistFilePath" autoUpdateChannel -string "latest"
sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"openExternal\":\ $open_external_app#g" "${newPath}" defaults write "$plistFilePath" isAutoUpdateEnabled -bool true
defaults write "$plistFilePath" isPodUrlEditable -bool true
defaults write "$plistFilePath" forceAutoUpdate -bool "$force_auto_update"
defaults write "$plistFilePath" autoUpdateCheckInterval -string "30"
defaults write "$plistFilePath" enableBrowserLogin -bool "$enable_browser_login"
defaults write "$plistFilePath" browserLoginAutoConnect -bool "$browser_login_autoconnect"
defaults write "$plistFilePath" overrideUserAgent -bool false
defaults write "$plistFilePath" minimizeOnClose -string "$minimize_on_close"
defaults write "$plistFilePath" launchOnStartup -string "$launch_on_startup"
defaults write "$plistFilePath" alwaysOnTop -string "$always_on_top"
defaults write "$plistFilePath" bringToFront -string "$bring_to_front"
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 "$dev_tools_enabled"
defaults write "$plistFilePath" contextIsolation -bool true
defaults write "$plistFilePath" contextOriginUrl -string "$context_origin_url_escaped"
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 "$media"
defaults write "$plistFilePath" geolocation -bool "$geo_location"
defaults write "$plistFilePath" notifications -bool "$notifications"
defaults write "$plistFilePath" midiSysex -bool "$midi_sysex"
defaults write "$plistFilePath" pointerLock -bool "$pointer_lock"
defaults write "$plistFilePath" fullscreen -bool "$full_screen"
defaults write "$plistFilePath" openExternal -bool "$open_external_app"
defaults write "$plistFilePath" autoLaunchPath -string ""
defaults write "$plistFilePath" userDataPath -string ""
defaults write "$plistFilePath" chromeFlags -string ""
defaults write "$plistFilePath" betaAutoUpdateChannelEnabled -bool true
defaults write "$plistFilePath" installVariant -string "$uuid"
else
sudo -u "$userName" defaults write "$plistFilePath" url -string "$pod_url_escaped"
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 "$force_auto_update"
sudo -u "$userName" defaults write "$plistFilePath" autoUpdateCheckInterval -string "30"
sudo -u "$userName" defaults write "$plistFilePath" enableBrowserLogin -bool "$enable_browser_login"
sudo -u "$userName" defaults write "$plistFilePath" browserLoginAutoConnect -bool "$browser_login_autoconnect"
sudo -u "$userName" defaults write "$plistFilePath" overrideUserAgent -bool false
sudo -u "$userName" defaults write "$plistFilePath" minimizeOnClose -string "$minimize_on_close"
sudo -u "$userName" defaults write "$plistFilePath" launchOnStartup -string "$launch_on_startup"
sudo -u "$userName" defaults write "$plistFilePath" alwaysOnTop -string "$always_on_top"
sudo -u "$userName" defaults write "$plistFilePath" bringToFront -string "$bring_to_front"
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 "$dev_tools_enabled"
sudo -u "$userName" defaults write "$plistFilePath" contextIsolation -bool true
sudo -u "$userName" defaults write "$plistFilePath" contextOriginUrl -string "$context_origin_url_escaped"
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 "$media"
sudo -u "$userName" defaults write "$plistFilePath" geolocation -bool "$geo_location"
sudo -u "$userName" defaults write "$plistFilePath" notifications -bool "$notifications"
sudo -u "$userName" defaults write "$plistFilePath" midiSysex -bool "$midi_sysex"
sudo -u "$userName" defaults write "$plistFilePath" pointerLock -bool "$pointer_lock"
sudo -u "$userName" defaults write "$plistFilePath" fullscreen -bool "$full_screen"
sudo -u "$userName" defaults write "$plistFilePath" openExternal -bool "$open_external_app"
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
sudo -u "$userName" defaults write "$plistFilePath" installVariant -string "$uuid"
fi
## Remove the temp settings & permissions file created ## ## Remove the temp settings & permissions file created ##
rm -f ${settingsFilePath} rm -f ${settingsFilePath}
rm -f ${permissionsFilePath} rm -f ${permissionsFilePath}
uuidgen > "${installVariantPath}"

373
package-lock.json generated
View File

@@ -1,17 +1,17 @@
{ {
"name": "symphony", "name": "symphony",
"version": "24.3.0", "version": "24.4.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "symphony", "name": "symphony",
"version": "24.3.0", "version": "24.4.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@types/lazy-brush": "^1.0.0", "@types/lazy-brush": "^1.0.0",
"archiver": "5.3.1", "adm-zip": "^0.5.10",
"async.map": "0.5.2", "async.map": "0.5.2",
"classnames": "2.2.6", "classnames": "2.2.6",
"electron-dl": "3.5.0", "electron-dl": "3.5.0",
@@ -3170,6 +3170,14 @@
"node": ">=0.4.0" "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": { "node_modules/agent-base": {
"version": "6.0.2", "version": "6.0.2",
"dev": true, "dev": true,
@@ -3554,54 +3562,6 @@
"dev": true, "dev": true,
"license": "ISC" "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": { "node_modules/archy": {
"version": "1.0.0", "version": "1.0.0",
"dev": true, "dev": true,
@@ -3955,6 +3915,7 @@
}, },
"node_modules/async": { "node_modules/async": {
"version": "3.2.3", "version": "3.2.3",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/async-done": { "node_modules/async-done": {
@@ -4341,6 +4302,7 @@
}, },
"node_modules/base64-js": { "node_modules/base64-js": {
"version": "1.5.1", "version": "1.5.1",
"dev": true,
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -4387,6 +4349,7 @@
}, },
"node_modules/bl": { "node_modules/bl": {
"version": "4.1.0", "version": "4.1.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"buffer": "^5.5.0", "buffer": "^5.5.0",
@@ -4430,6 +4393,7 @@
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
@@ -4712,6 +4676,7 @@
}, },
"node_modules/buffer": { "node_modules/buffer": {
"version": "5.7.1", "version": "5.7.1",
"dev": true,
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -4748,6 +4713,7 @@
}, },
"node_modules/buffer-crc32": { "node_modules/buffer-crc32": {
"version": "0.2.13", "version": "0.2.13",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": "*" "node": "*"
@@ -5483,32 +5449,9 @@
"dev": true, "dev": true,
"license": "MIT" "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": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/concat-stream": { "node_modules/concat-stream": {
@@ -5629,6 +5572,7 @@
}, },
"node_modules/core-util-is": { "node_modules/core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/cosmiconfig": { "node_modules/cosmiconfig": {
@@ -5672,16 +5616,6 @@
"buffer": "^5.1.0" "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": { "node_modules/create-ecdh": {
"version": "4.0.4", "version": "4.0.4",
"dev": true, "dev": true,
@@ -7098,6 +7032,7 @@
}, },
"node_modules/end-of-stream": { "node_modules/end-of-stream": {
"version": "1.4.4", "version": "1.4.4",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"once": "^1.4.0" "once": "^1.4.0"
@@ -8185,10 +8120,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/fs-constants": {
"version": "1.0.0",
"license": "MIT"
},
"node_modules/fs-extra": { "node_modules/fs-extra": {
"version": "8.1.0", "version": "8.1.0",
"dev": true, "dev": true,
@@ -8387,6 +8318,7 @@
}, },
"node_modules/glob": { "node_modules/glob": {
"version": "7.1.6", "version": "7.1.6",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
@@ -9752,6 +9684,7 @@
}, },
"node_modules/ieee754": { "node_modules/ieee754": {
"version": "1.2.1", "version": "1.2.1",
"dev": true,
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -9881,6 +9814,7 @@
}, },
"node_modules/inflight": { "node_modules/inflight": {
"version": "1.0.6", "version": "1.0.6",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"once": "^1.3.0", "once": "^1.3.0",
@@ -9889,6 +9823,7 @@
}, },
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/ini": { "node_modules/ini": {
@@ -10421,6 +10356,7 @@
}, },
"node_modules/isarray": { "node_modules/isarray": {
"version": "1.0.0", "version": "1.0.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/isbinaryfile": { "node_modules/isbinaryfile": {
@@ -11928,6 +11864,7 @@
}, },
"node_modules/lazystream": { "node_modules/lazystream": {
"version": "1.0.0", "version": "1.0.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"readable-stream": "^2.0.5" "readable-stream": "^2.0.5"
@@ -11938,6 +11875,7 @@
}, },
"node_modules/lazystream/node_modules/readable-stream": { "node_modules/lazystream/node_modules/readable-stream": {
"version": "2.3.7", "version": "2.3.7",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
@@ -12159,14 +12097,6 @@
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" "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": { "node_modules/lodash.escape": {
"version": "4.0.1", "version": "4.0.1",
"dev": true, "dev": true,
@@ -12176,10 +12106,6 @@
"version": "4.1.2", "version": "4.1.2",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.flatten": {
"version": "4.4.0",
"license": "MIT"
},
"node_modules/lodash.flattendeep": { "node_modules/lodash.flattendeep": {
"version": "4.4.0", "version": "4.4.0",
"dev": true, "dev": true,
@@ -12194,10 +12120,6 @@
"version": "4.5.0", "version": "4.5.0",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.isplainobject": {
"version": "4.0.6",
"license": "MIT"
},
"node_modules/lodash.memoize": { "node_modules/lodash.memoize": {
"version": "3.0.4", "version": "3.0.4",
"dev": true, "dev": true,
@@ -12208,10 +12130,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.union": {
"version": "4.6.0",
"license": "MIT"
},
"node_modules/log-symbols": { "node_modules/log-symbols": {
"version": "4.1.0", "version": "4.1.0",
"dev": true, "dev": true,
@@ -12685,6 +12603,7 @@
}, },
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
@@ -13246,6 +13165,7 @@
}, },
"node_modules/normalize-path": { "node_modules/normalize-path": {
"version": "3.0.0", "version": "3.0.0",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -13593,6 +13513,7 @@
}, },
"node_modules/once": { "node_modules/once": {
"version": "1.4.0", "version": "1.4.0",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"wrappy": "1" "wrappy": "1"
@@ -13949,6 +13870,7 @@
}, },
"node_modules/path-is-absolute": { "node_modules/path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -14484,6 +14406,7 @@
}, },
"node_modules/process-nextick-args": { "node_modules/process-nextick-args": {
"version": "2.0.1", "version": "2.0.1",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/progress": { "node_modules/progress": {
@@ -14900,6 +14823,7 @@
}, },
"node_modules/readable-stream": { "node_modules/readable-stream": {
"version": "3.6.0", "version": "3.6.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
@@ -14910,30 +14834,6 @@
"node": ">= 6" "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": { "node_modules/realpath-native": {
"version": "2.0.0", "version": "2.0.0",
"dev": true, "dev": true,
@@ -15435,6 +15335,7 @@
}, },
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/safe-regex": { "node_modules/safe-regex": {
@@ -16448,6 +16349,7 @@
}, },
"node_modules/string_decoder": { "node_modules/string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"safe-buffer": "~5.1.0" "safe-buffer": "~5.1.0"
@@ -16908,20 +16810,6 @@
"node": ">=10" "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": { "node_modules/tar/node_modules/fs-minipass": {
"version": "2.1.0", "version": "2.1.0",
"dev": true, "dev": true,
@@ -17786,6 +17674,7 @@
}, },
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/uuid": { "node_modules/uuid": {
@@ -18183,6 +18072,7 @@
}, },
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/write-file-atomic": { "node_modules/write-file-atomic": {
@@ -18363,18 +18253,6 @@
"funding": { "funding": {
"url": "https://github.com/sponsors/sindresorhus" "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": { "dependencies": {
@@ -20581,6 +20459,11 @@
"version": "7.2.0", "version": "7.2.0",
"dev": true "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": { "agent-base": {
"version": "6.0.2", "version": "6.0.2",
"dev": true, "dev": true,
@@ -20837,47 +20720,6 @@
"version": "2.0.0", "version": "2.0.0",
"dev": true "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": { "archy": {
"version": "1.0.0", "version": "1.0.0",
"dev": true "dev": true
@@ -21112,7 +20954,8 @@
"optional": true "optional": true
}, },
"async": { "async": {
"version": "3.2.3" "version": "3.2.3",
"dev": true
}, },
"async-done": { "async-done": {
"version": "1.3.2", "version": "1.3.2",
@@ -21385,7 +21228,8 @@
} }
}, },
"base64-js": { "base64-js": {
"version": "1.5.1" "version": "1.5.1",
"dev": true
}, },
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
"version": "1.0.2", "version": "1.0.2",
@@ -21408,6 +21252,7 @@
}, },
"bl": { "bl": {
"version": "4.1.0", "version": "4.1.0",
"dev": true,
"requires": { "requires": {
"buffer": "^5.5.0", "buffer": "^5.5.0",
"inherits": "^2.0.4", "inherits": "^2.0.4",
@@ -21444,6 +21289,7 @@
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"dev": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@@ -21671,6 +21517,7 @@
}, },
"buffer": { "buffer": {
"version": "5.7.1", "version": "5.7.1",
"dev": true,
"requires": { "requires": {
"base64-js": "^1.3.1", "base64-js": "^1.3.1",
"ieee754": "^1.1.13" "ieee754": "^1.1.13"
@@ -21689,7 +21536,8 @@
"dev": true "dev": true
}, },
"buffer-crc32": { "buffer-crc32": {
"version": "0.2.13" "version": "0.2.13",
"dev": true
}, },
"buffer-equal": { "buffer-equal": {
"version": "0.0.1", "version": "0.0.1",
@@ -22186,26 +22034,9 @@
"version": "1.3.0", "version": "1.3.0",
"dev": true "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": { "concat-map": {
"version": "0.0.1" "version": "0.0.1",
"dev": true
}, },
"concat-stream": { "concat-stream": {
"version": "1.6.2", "version": "1.6.2",
@@ -22299,7 +22130,8 @@
} }
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2" "version": "1.0.2",
"dev": true
}, },
"cosmiconfig": { "cosmiconfig": {
"version": "7.0.0", "version": "7.0.0",
@@ -22332,9 +22164,6 @@
"buffer": "^5.1.0" "buffer": "^5.1.0"
} }
}, },
"crc-32": {
"version": "1.2.2"
},
"create-ecdh": { "create-ecdh": {
"version": "4.0.4", "version": "4.0.4",
"dev": true, "dev": true,
@@ -23309,6 +23138,7 @@
}, },
"end-of-stream": { "end-of-stream": {
"version": "1.4.4", "version": "1.4.4",
"dev": true,
"requires": { "requires": {
"once": "^1.4.0" "once": "^1.4.0"
} }
@@ -24077,9 +23907,6 @@
"map-cache": "^0.2.2" "map-cache": "^0.2.2"
} }
}, },
"fs-constants": {
"version": "1.0.0"
},
"fs-extra": { "fs-extra": {
"version": "8.1.0", "version": "8.1.0",
"dev": true, "dev": true,
@@ -24206,6 +24033,7 @@
}, },
"glob": { "glob": {
"version": "7.1.6", "version": "7.1.6",
"dev": true,
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
"inflight": "^1.0.4", "inflight": "^1.0.4",
@@ -25165,7 +24993,8 @@
} }
}, },
"ieee754": { "ieee754": {
"version": "1.2.1" "version": "1.2.1",
"dev": true
}, },
"ignore": { "ignore": {
"version": "5.1.8", "version": "5.1.8",
@@ -25236,13 +25065,15 @@
}, },
"inflight": { "inflight": {
"version": "1.0.6", "version": "1.0.6",
"dev": true,
"requires": { "requires": {
"once": "^1.3.0", "once": "^1.3.0",
"wrappy": "1" "wrappy": "1"
} }
}, },
"inherits": { "inherits": {
"version": "2.0.4" "version": "2.0.4",
"dev": true
}, },
"ini": { "ini": {
"version": "1.3.8", "version": "1.3.8",
@@ -25555,7 +25386,8 @@
} }
}, },
"isarray": { "isarray": {
"version": "1.0.0" "version": "1.0.0",
"dev": true
}, },
"isbinaryfile": { "isbinaryfile": {
"version": "5.0.0", "version": "5.0.0",
@@ -26621,12 +26453,14 @@
}, },
"lazystream": { "lazystream": {
"version": "1.0.0", "version": "1.0.0",
"dev": true,
"requires": { "requires": {
"readable-stream": "^2.0.5" "readable-stream": "^2.0.5"
}, },
"dependencies": { "dependencies": {
"readable-stream": { "readable-stream": {
"version": "2.3.7", "version": "2.3.7",
"dev": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
"inherits": "~2.0.3", "inherits": "~2.0.3",
@@ -26781,12 +26615,6 @@
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="
}, },
"lodash.defaults": {
"version": "4.2.0"
},
"lodash.difference": {
"version": "4.5.0"
},
"lodash.escape": { "lodash.escape": {
"version": "4.0.1", "version": "4.0.1",
"dev": true "dev": true
@@ -26794,9 +26622,6 @@
"lodash.escaperegexp": { "lodash.escaperegexp": {
"version": "4.1.2" "version": "4.1.2"
}, },
"lodash.flatten": {
"version": "4.4.0"
},
"lodash.flattendeep": { "lodash.flattendeep": {
"version": "4.4.0", "version": "4.4.0",
"dev": true "dev": true
@@ -26808,9 +26633,6 @@
"lodash.isequal": { "lodash.isequal": {
"version": "4.5.0" "version": "4.5.0"
}, },
"lodash.isplainobject": {
"version": "4.0.6"
},
"lodash.memoize": { "lodash.memoize": {
"version": "3.0.4", "version": "3.0.4",
"dev": true "dev": true
@@ -26819,9 +26641,6 @@
"version": "4.7.0", "version": "4.7.0",
"dev": true "dev": true
}, },
"lodash.union": {
"version": "4.6.0"
},
"log-symbols": { "log-symbols": {
"version": "4.1.0", "version": "4.1.0",
"dev": true, "dev": true,
@@ -27160,6 +26979,7 @@
}, },
"minimatch": { "minimatch": {
"version": "3.1.2", "version": "3.1.2",
"dev": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@@ -27553,7 +27373,8 @@
} }
}, },
"normalize-path": { "normalize-path": {
"version": "3.0.0" "version": "3.0.0",
"dev": true
}, },
"normalize-url": { "normalize-url": {
"version": "6.1.0", "version": "6.1.0",
@@ -27771,6 +27592,7 @@
}, },
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"dev": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@@ -28010,7 +27832,8 @@
"version": "4.0.0" "version": "4.0.0"
}, },
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1" "version": "1.0.1",
"dev": true
}, },
"path-is-inside": { "path-is-inside": {
"version": "1.0.2", "version": "1.0.2",
@@ -28345,7 +28168,8 @@
"dev": true "dev": true
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.1" "version": "2.0.1",
"dev": true
}, },
"progress": { "progress": {
"version": "2.0.3", "version": "2.0.3",
@@ -28654,32 +28478,13 @@
}, },
"readable-stream": { "readable-stream": {
"version": "3.6.0", "version": "3.6.0",
"dev": true,
"requires": { "requires": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
"string_decoder": "^1.1.1", "string_decoder": "^1.1.1",
"util-deprecate": "^1.0.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": { "realpath-native": {
"version": "2.0.0", "version": "2.0.0",
"dev": true "dev": true
@@ -29033,7 +28838,8 @@
"devOptional": true "devOptional": true
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2" "version": "5.1.2",
"dev": true
}, },
"safe-regex": { "safe-regex": {
"version": "1.1.0", "version": "1.1.0",
@@ -29741,6 +29547,7 @@
}, },
"string_decoder": { "string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"dev": true,
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "~5.1.0"
} }
@@ -30078,16 +29885,6 @@
} }
} }
}, },
"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": { "temp-file": {
"version": "3.4.0", "version": "3.4.0",
"dev": true, "dev": true,
@@ -30666,7 +30463,8 @@
} }
}, },
"util-deprecate": { "util-deprecate": {
"version": "1.0.2" "version": "1.0.2",
"dev": true
}, },
"uuid": { "uuid": {
"version": "3.4.0", "version": "3.4.0",
@@ -30965,7 +30763,8 @@
} }
}, },
"wrappy": { "wrappy": {
"version": "1.0.2" "version": "1.0.2",
"dev": true
}, },
"write-file-atomic": { "write-file-atomic": {
"version": "3.0.3", "version": "3.0.3",
@@ -31086,14 +30885,6 @@
"yocto-queue": { "yocto-queue": {
"version": "0.1.0", "version": "0.1.0",
"dev": true "dev": true
},
"zip-stream": {
"version": "4.1.0",
"requires": {
"archiver-utils": "^2.1.0",
"compress-commons": "^4.1.0",
"readable-stream": "^3.6.0"
}
} }
} }
} }

View File

@@ -66,6 +66,7 @@
"config/titleBarStyles.css", "config/titleBarStyles.css",
"config/InstallVariant.info", "config/InstallVariant.info",
"dictionaries/**", "dictionaries/**",
"installer/mac/postinstall.sh",
"node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator" "node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator"
], ],
"mac": { "mac": {

View File

@@ -290,6 +290,10 @@ export const screen = {
}), }),
}; };
export const systemPreferences = {
getUserDefault: jest.fn(),
};
export const remote = { export const remote = {
app, app,
getCurrentWindow, getCurrentWindow,

View File

@@ -60,6 +60,10 @@ jest.mock('../src/app/auto-update-handler', () => {
return {}; return {};
}); });
jest.mock('../src/app/config-handler', () => {
return {};
});
describe('child window handle', () => { describe('child window handle', () => {
it('should set open window handler', () => { it('should set open window handler', () => {
const spy = jest.spyOn(webContents, 'setWindowOpenHandler'); const spy = jest.spyOn(webContents, 'setWindowOpenHandler');

View File

@@ -39,6 +39,47 @@ 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', () => { jest.mock('../src/renderer/notification', () => {
return { return {
setupNotificationPosition: jest.fn(), setupNotificationPosition: jest.fn(),

54
spec/plistHandler.spec.ts Normal file
View File

@@ -0,0 +1,54 @@
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,
});
});
});

View File

@@ -1,4 +1,4 @@
import { app, dialog, powerSaveBlocker } from 'electron'; import { app, dialog, powerSaveBlocker, systemPreferences } from 'electron';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
@@ -16,6 +16,7 @@ import {
SDAUserSessionActionTypes, SDAUserSessionActionTypes,
} from './bi/interface'; } from './bi/interface';
import { terminateC9Shell } from './c9-shell-handler'; import { terminateC9Shell } from './c9-shell-handler';
import { getAllUserDefaults, initializePlistFile } from './plist-handler';
import { appStats } from './stats'; import { appStats } from './stats';
const writeFile = util.promisify(fs.writeFile); const writeFile = util.promisify(fs.writeFile);
@@ -174,6 +175,7 @@ class Config {
private readonly appPath: string; private readonly appPath: string;
private readonly globalConfigPath: string; private readonly globalConfigPath: string;
private readonly cloudConfigPath: string; private readonly cloudConfigPath: string;
private readonly postInstallScriptPath: string;
constructor() { constructor() {
this.configFileName = 'Symphony.config'; this.configFileName = 'Symphony.config';
@@ -201,6 +203,9 @@ class Config {
'config', 'config',
this.configFileName, this.configFileName,
); );
this.postInstallScriptPath = isDevEnv
? path.join(this.appPath, path.join('installer', 'mac', 'postinstall.sh'))
: path.join(this.appPath, '..', 'installer', 'mac', 'postinstall.sh');
this.installVariantPath = isDevEnv this.installVariantPath = isDevEnv
? path.join( ? path.join(
@@ -234,8 +239,8 @@ class Config {
this.cloudConfig = {}; this.cloudConfig = {};
this.filteredCloudConfig = {}; this.filteredCloudConfig = {};
this.readGlobalConfig();
this.readInstallVariant(); this.readInstallVariant();
this.readGlobalConfig();
this.readCloudConfig(); this.readCloudConfig();
app.on('before-quit', async (event) => { app.on('before-quit', async (event) => {
@@ -786,25 +791,19 @@ class Config {
* Reads a stores the global config file * Reads a stores the global config file
*/ */
private readGlobalConfig() { private readGlobalConfig() {
if (isMac) {
this.globalConfig = getAllUserDefaults();
logger.info(
`config-handler: Global configuration from plist: `,
this.globalConfig,
);
return;
}
if (!fs.existsSync(this.globalConfigPath)) { if (!fs.existsSync(this.globalConfigPath)) {
throw new Error( throw new Error(
`Global config file missing! App will not run as expected!`, `Global config file missing! App will not run as expected!`,
); );
} }
if (fs.existsSync(this.tempGlobalConfigFilePath)) {
this.globalConfig = this.parseConfigData(
fs.readFileSync(this.tempGlobalConfigFilePath, 'utf8'),
);
logger.info(
`config-handler: temp global config exists using this file: `,
this.tempGlobalConfigFilePath,
this.globalConfig,
);
if (isMac) {
this.copyGlobalConfig();
}
return;
}
const parsedConfigData = this.parseConfigData( const parsedConfigData = this.parseConfigData(
fs.readFileSync(this.globalConfigPath, 'utf8'), fs.readFileSync(this.globalConfigPath, 'utf8'),
); );
@@ -818,6 +817,28 @@ class Config {
* Reads the install variant from a file * Reads the install variant from a file
*/ */
private readInstallVariant() { private readInstallVariant() {
if (isMac) {
this.installVariant = systemPreferences.getUserDefault(
'installVariant',
'string',
);
if (!this.installVariant || this.installVariant === '') {
logger.info(
`config-handler: Initializing new plist file: `,
this.installVariant,
);
initializePlistFile(this.postInstallScriptPath);
this.installVariant = systemPreferences.getUserDefault(
'installVariant',
'string',
);
}
logger.info(
`config-handler: Install variant from plist: `,
this.installVariant,
);
return;
}
this.installVariant = fs.readFileSync(this.installVariantPath, 'utf8'); this.installVariant = fs.readFileSync(this.installVariantPath, 'utf8');
logger.info(`config-handler: Install variant: `, this.installVariant); logger.info(`config-handler: Install variant: `, this.installVariant);
} }

111
src/app/plist-handler.ts Normal file
View File

@@ -0,0 +1,111 @@
import { execSync } from 'child_process';
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;
};
/**
* Initialize plist file
*/
export const initializePlistFile = (path: string) => {
try {
const command = `sh ${path}`;
// nosemgrep
const result = execSync(command);
logger.info('plist-handler: initialized plist file', result.toString());
} catch (error: any) {
logger.error('plist-handler: initialize exception', error?.message);
}
};