diff --git a/forge.config.js b/forge.config.js index d9d84d09..ecfc4f83 100644 --- a/forge.config.js +++ b/forge.config.js @@ -6,18 +6,30 @@ const path = require('node:path') const fs = require('node:fs') const semver = require('semver') +const packageJSON = require('./package.json') const { MIN_REQUIRED_BUILT_IN_TALK_VERSION } = require('./src/constants.js') require('dotenv').config() +const CONFIG = { + // General + applicationName: packageJSON.productName, + applicationNameSanitized: packageJSON.productName.replaceAll(' ', '-'), + companyName: 'Nextcloud GmbH', + description: packageJSON.description, + + // macOS + macAppId: 'com.nextcloud.NextcloudTalk', + // Windows + winAppId: 'NextcloudTalk', +} + +const YEAR = new Date().getFullYear() + const TALK_PATH = path.resolve(__dirname, process.env.TALK_PATH ?? 'spreed') let talkPackageJson module.exports = { - packagerConfig: { - icon: './img/icons/icon', - }, - hooks: { generateAssets() { if (!fs.existsSync(process.env.TALK_PATH)) { @@ -50,22 +62,55 @@ module.exports = { rebuildConfig: {}, + packagerConfig: { + // Common + name: CONFIG.applicationName, + icon: path.join(__dirname, 'img/icons/icon'), + appCopyright: `Copyright © ${YEAR} ${CONFIG.companyName}`, + asar: true, + + // Windows + win32metadata: { + CompanyName: CONFIG.companyName, + }, + + // macOS + appBundleId: 'com.nextcloud.NextcloudTalk', // TODO: Check with iOS devs + darwinDarkModeSupport: true, + appCategoryType: 'public.app-category.social-networking', // LSApplicationCategoryType | https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html + }, + makers: [ - // { - // name: '@electron-forge/maker-squirrel', - // config: {}, - // }, { - name: '@electron-forge/maker-zip', - // platforms: ['darwin'], + name: '@electron-forge/maker-squirrel', + platforms: ['win32'], + config: { + // App/Filenames + name: CONFIG.winAppId, + setupExe: `${CONFIG.applicationNameSanitized}-v${packageJSON.version}-win-x64.exe`, + exe: `${CONFIG.applicationName}.exe`, + + // Meta + title: CONFIG.applicationName, + authors: CONFIG.companyName, + owners: CONFIG.companyName, + description: CONFIG.description, + + // Icons + setupIcon: './img/icons/icon.ico', + iconUrl: 'https://raw.githubusercontent.com/nextcloud/talk-desktop/refs/heads/main/img/icons/icon.ico', + + // TODO: Check if this is as useful as WIX + // noMsi: false, + // setupMsi: `${CONFIG.applicationNameSanitized}-v${packageJSON.version}-win-x64.msi`, + + // TODO: Sign + // certificateFile: + // certificatePassword: + }, }, // { - // name: '@electron-forge/maker-deb', - // config: {}, - // }, - // { - // name: '@electron-forge/maker-rpm', - // config: {}, + // name: '@electron-forge/maker-zip', // }, ], diff --git a/src/main.js b/src/main.js index 50d4eb4f..0b5fa562 100644 --- a/src/main.js +++ b/src/main.js @@ -12,7 +12,7 @@ const { createAuthenticationWindow } = require('./authentication/authentication. const { openLoginWebView } = require('./authentication/login.window.js') const { createHelpWindow } = require('./help/help.window.js') const { createUpgradeWindow } = require('./upgrade/upgrade.window.js') -const { getOs, isLinux, isMac, isWayland } = require('./shared/os.utils.js') +const { getOs, isLinux, isMac, isWayland, isWindows } = require('./shared/os.utils.js') const { createTalkWindow } = require('./talk/talk.window.js') const { createWelcomeWindow } = require('./welcome/welcome.window.js') const { installVueDevtools } = require('./install-vue-devtools.js') @@ -33,7 +33,17 @@ const ARGUMENTS = { const APP_NAME = process.env.NODE_ENV !== 'development' ? path.parse(app.getPath('exe')).name : 'Nextcloud Talk (dev)' app.setName(APP_NAME) app.setPath('userData', path.join(app.getPath('appData'), app.getName())) -app.setAppUserModelId(app.getName()) +if (isWindows()) { + // TODO: get actual name from the build + app.setAppUserModelId('com.squirrel.NextcloudTalk.NextcloudTalk') +} + +/** + * Handle creating/removing shortcuts on Windows when installing/uninstalling + */ +if (require('electron-squirrel-startup')) { + app.quit() +} /** * Only one instance is allowed at time @@ -49,11 +59,6 @@ if (process.env.NODE_ENV === 'production') { setupReleaseNotificationScheduler(2 * 60) } -// Handle creating/removing shortcuts on Windows when installing/uninstalling. -// if (require('electron-squirrel-startup')) { -// app.quit(); -// } - ipcMain.on('app:quit', () => app.quit()) ipcMain.handle('app:getOs', () => getOs()) ipcMain.handle('app:getAppName', () => app.getName())