Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33319968
D5882.1768841325.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D5882.1768841325.diff
View Options
diff --git a/desktop/forge.config.cjs b/desktop/forge.config.cjs
--- a/desktop/forge.config.cjs
+++ b/desktop/forge.config.cjs
@@ -90,6 +90,19 @@
],
},
},
+ {
+ name: '@electron-forge/maker-squirrel',
+ platforms: ['win32'],
+ config: {
+ name: 'Comm',
+ title: 'Comm',
+ authors: 'Comm',
+ description: 'Comm is a private messaging app for communities!',
+ iconUrl: 'https://comm-external.s3.amazonaws.com/icon.ico',
+ setupIcon: 'icons/icon.ico',
+ loadingGif: 'icons/win_installer.gif',
+ },
+ },
],
plugins: [new BabelPlugin()],
hooks: {
diff --git a/desktop/icons/icon.ico b/desktop/icons/icon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/desktop/icons/win_installer.gif b/desktop/icons/win_installer.gif
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/desktop/package.json b/desktop/package.json
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -31,6 +31,7 @@
"@babel/preset-env": "^7.13.12",
"@electron-forge/cli": "^6.0.4",
"@electron-forge/maker-dmg": "^6.0.4",
+ "@electron-forge/maker-squirrel": "^6.0.4",
"@electron-forge/plugin-base": "^6.0.4",
"electron": "^22.0.0",
"fs-extra": "^10.1.0",
diff --git a/desktop/src/handle-squirrel-event.js b/desktop/src/handle-squirrel-event.js
new file mode 100644
--- /dev/null
+++ b/desktop/src/handle-squirrel-event.js
@@ -0,0 +1,41 @@
+import { spawn } from 'child_process';
+import { app } from 'electron';
+import path from 'path';
+
+// Squirrel will start the app with additional flags during installing,
+// uninstalling and updating so we can for example create or delete shortcuts.
+// After handling some of these events the app will be closed. If this function
+// returns false, the app should start normally.
+export function handleSquirrelEvent() {
+ if (process.argv.length === 1) {
+ return false;
+ }
+
+ const updateExe = path.resolve(process.execPath, '..', '..', 'Update.exe');
+ const commExeName = path.basename(process.execPath);
+
+ const spawnUpdate = args => {
+ return spawn(updateExe, args, { detached: true }).on('close', app.quit);
+ };
+
+ const squirrelEvent = process.argv[1];
+ switch (squirrelEvent) {
+ case '--squirrel-install':
+ case '--squirrel-updated':
+ spawnUpdate(['--createShortcut', commExeName]);
+ return true;
+
+ case '--squirrel-uninstall':
+ spawnUpdate(['--removeShortcut', commExeName]);
+ return true;
+
+ case '--squirrel-obsolete':
+ app.quit();
+ return true;
+
+ case '--squirrel-firstrun':
+ return false;
+ }
+
+ return false;
+}
diff --git a/desktop/src/main.js b/desktop/src/main.js
--- a/desktop/src/main.js
+++ b/desktop/src/main.js
@@ -9,6 +9,8 @@
import fs from 'fs';
import path from 'path';
+import { handleSquirrelEvent } from './handle-squirrel-event';
+
const isDev = process.env.ENV === 'dev';
const url = isDev ? 'http://localhost/comm/' : 'https://web.comm.app';
const isMac = process.platform === 'darwin';
@@ -85,6 +87,11 @@
minHeight: 600,
titleBarStyle: 'hidden',
trafficLightPosition: { x: 20, y: 24 },
+ titleBarOverlay: {
+ color: '#0A0A0A',
+ symbolColor: '#FFFFFF',
+ height: 64,
+ },
backgroundColor: '#0A0A0A',
webPreferences: {
preload: path.resolve(__dirname, 'preload.js'),
@@ -221,27 +228,39 @@
});
};
-app.setName('Comm');
-setApplicationMenu();
+const run = () => {
+ app.setName('Comm');
+ setApplicationMenu();
-(async () => {
- await app.whenReady();
+ (async () => {
+ await app.whenReady();
- ipcMain.on('set-badge', (event, value) => {
- app.dock.setBadge(value?.toString() ?? '');
- });
+ ipcMain.on('set-badge', (event, value) => {
+ if (isMac) {
+ app.dock.setBadge(value?.toString() ?? '');
+ }
+ });
- show();
+ show();
- app.on('activate', () => {
- if (BrowserWindow.getAllWindows().length === 0) {
- show();
+ app.on('activate', () => {
+ if (BrowserWindow.getAllWindows().length === 0) {
+ show();
+ }
+ });
+ })();
+
+ app.on('window-all-closed', () => {
+ if (!isMac) {
+ app.quit();
}
});
-})();
+};
-app.on('window-all-closed', () => {
- if (!isMac) {
- app.quit();
+if (app.isPackaged && process.platform === 'win32') {
+ if (!handleSquirrelEvent()) {
+ run();
}
-});
+} else {
+ run();
+}
diff --git a/yarn.lock b/yarn.lock
--- a/yarn.lock
+++ b/yarn.lock
@@ -1772,6 +1772,17 @@
optionalDependencies:
electron-installer-dmg "^4.0.0"
+"@electron-forge/maker-squirrel@^6.0.4":
+ version "6.0.4"
+ resolved "https://registry.yarnpkg.com/@electron-forge/maker-squirrel/-/maker-squirrel-6.0.4.tgz#21b09a5165b27cc156e3c15989f7fe157752d8ac"
+ integrity sha512-1bZ5RgSex5Y45HSuOqjki2oHIq/CquVPP5sLYhObd2p2ABj4ZzyqErNFK1eerDIjoesici3KKCASqBpKf2N90Q==
+ dependencies:
+ "@electron-forge/maker-base" "^6.0.4"
+ "@electron-forge/shared-types" "^6.0.4"
+ fs-extra "^10.0.0"
+ optionalDependencies:
+ electron-winstaller "^5.0.0"
+
"@electron-forge/plugin-base@^6.0.4":
version "6.0.4"
resolved "https://registry.yarnpkg.com/@electron-forge/plugin-base/-/plugin-base-6.0.4.tgz#a3b62e006632dab66d35f845ca61e09745ccbb82"
@@ -9671,6 +9682,17 @@
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592"
integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==
+electron-winstaller@^5.0.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/electron-winstaller/-/electron-winstaller-5.1.0.tgz#528ed08a65858dd678d9178e8ae24f82a4e12271"
+ integrity sha512-4wlZzkUm5cJNiOtp5wL804+QpygdKTKkrZJXA3sSDEI2XnCVPv0kxmxUvVw4KHBwbNS+Yox89agEr+VkR7kxww==
+ dependencies:
+ "@electron/asar" "^3.2.1"
+ debug "^4.1.1"
+ fs-extra "^7.0.1"
+ lodash.template "^4.2.2"
+ temp "^0.9.0"
+
electron@^11.1.0:
version "11.5.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-11.5.0.tgz#f1650543b9d8f2047d3807755bdb120153ed210f"
@@ -15196,6 +15218,11 @@
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
+lodash._reinterpolate@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
+ integrity sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA==
+
lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
@@ -15281,6 +15308,21 @@
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==
+lodash.template@^4.2.2:
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
+ integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==
+ dependencies:
+ lodash._reinterpolate "^3.0.0"
+ lodash.templatesettings "^4.0.0"
+
+lodash.templatesettings@^4.0.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
+ integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==
+ dependencies:
+ lodash._reinterpolate "^3.0.0"
+
lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
@@ -21743,6 +21785,14 @@
dependencies:
rimraf "~2.6.2"
+temp@^0.9.0:
+ version "0.9.4"
+ resolved "https://registry.yarnpkg.com/temp/-/temp-0.9.4.tgz#cd20a8580cb63635d0e4e9d4bd989d44286e7620"
+ integrity sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==
+ dependencies:
+ mkdirp "^0.5.1"
+ rimraf "~2.6.2"
+
tempy@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/tempy/-/tempy-0.3.0.tgz#6f6c5b295695a16130996ad5ab01a8bd726e8bf8"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 4:48 PM (7 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5957329
Default Alt Text
D5882.1768841325.diff (8 KB)
Attached To
Mode
D5882: [desktop] Base windows config
Attached
Detach File
Event Timeline
Log In to Comment