diff options
author | Christoph Settgast <csett86@web.de> | 2021-03-11 21:28:31 +0100 |
---|---|---|
committer | Saúl Ibarra Corretgé <s@saghul.net> | 2021-03-15 00:20:20 +0100 |
commit | 5c49372e11eeb396fbc5a8b80234c463c89d40b5 (patch) | |
tree | c6591602ad199fc859ba2042473ad3cedb98b005 | |
parent | 9b09a4bfa9d875cd45fd81879a3c1895fd372502 (diff) |
Enhancements to make it more Mac App Store (mas) compatible
- disable the autoupdater if running as mas (was not working anyway, just logging an error on every start)
- replace check via app.requestSingleInstanceLock() with LSMultipleInstancesProhibited in Info.plist
due to https://github.com/electron/electron/issues/15958
- Quit the app also when all windows are closed to conform to macOS Human Interface Guidelines
Comments from review:
If the application is a single-window app, it might be appropriate to save data and quit the app when the main window is closed.
- "asarUnpack": "**/*.node" to also sign the native addons when packaging
- add the required mas-specific entitlements which include the app-sandbox key
Signed-off-by: Christoph Settgast <csett86@web.de>
-rw-r--r-- | main.js | 12 | ||||
-rw-r--r-- | package.json | 9 | ||||
-rw-r--r-- | resources/entitlements.mas.inherit.plist | 10 | ||||
-rw-r--r-- | resources/entitlements.mas.plist | 16 |
4 files changed, 40 insertions, 7 deletions
@@ -162,7 +162,9 @@ function createJitsiMeetWindow() { setApplicationMenu(); // Check for Updates. - autoUpdater.checkForUpdatesAndNotify(); + if (!process.mas) { + autoUpdater.checkForUpdatesAndNotify(); + } // Load the previous window state with fallback to defaults. const windowState = windowStateKeeper({ @@ -290,8 +292,9 @@ function handleProtocolCall(fullProtocolCall) { /** * Force Single Instance Application. + * Handle this on darwin via LSMultipleInstancesProhibited in Info.plist as below does not work on MAS */ -const gotInstanceLock = app.requestSingleInstanceLock(); +const gotInstanceLock = process.platform === 'darwin' ? true : app.requestSingleInstanceLock(); if (!gotInstanceLock) { app.quit(); @@ -345,10 +348,7 @@ app.on('second-instance', (event, commandLine) => { }); app.on('window-all-closed', () => { - // Don't quit the application on macOS. - if (process.platform !== 'darwin') { - app.quit(); - } + app.quit(); }); // remove so we can register each time as we run the app. diff --git a/package.json b/package.json index c56f92e..c896c82 100644 --- a/package.json +++ b/package.json @@ -39,11 +39,18 @@ "hardenedRuntime": true, "entitlements": "entitlements.mac.plist", "entitlementsInherit": "entitlements.mac.plist", + "asarUnpack": "**/*.node", "extendInfo": { "NSCameraUsageDescription": "Jitsi Meet requires access to your camera in order to make video-calls.", - "NSMicrophoneUsageDescription": "Jitsi Meet requires access to your microphone in order to make calls (audio/video)." + "NSMicrophoneUsageDescription": "Jitsi Meet requires access to your microphone in order to make calls (audio/video).", + "LSMultipleInstancesProhibited": true } }, + "mas": { + "entitlements": "resources/entitlements.mas.plist", + "entitlementsInherit": "resources/entitlements.mas.inherit.plist", + "hardenedRuntime": false + }, "linux": { "artifactName": "jitsi-meet-${arch}.${ext}", "category": "VideoConference;AudioVideo;Audio;Video;Network", diff --git a/resources/entitlements.mas.inherit.plist b/resources/entitlements.mas.inherit.plist new file mode 100644 index 0000000..656b548 --- /dev/null +++ b/resources/entitlements.mas.inherit.plist @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.app-sandbox</key> + <true/> + <key>com.apple.security.inherit</key> + <true/> +</dict> +</plist> diff --git a/resources/entitlements.mas.plist b/resources/entitlements.mas.plist new file mode 100644 index 0000000..2cb754e --- /dev/null +++ b/resources/entitlements.mas.plist @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.app-sandbox</key> + <true/> + <key>com.apple.security.network.client</key> + <true/> + <key>com.apple.security.device.camera</key> + <true/> + <key>com.apple.security.device.audio-input</key> + <true/> + <key>com.apple.security.device.microphone</key> + <true/> +</dict> +</plist> |