Files
2026-10-31 00:48:18 +01:00

622 lines
26 KiB
JavaScript

/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
const { MakerDMG } = require('@electron-forge/maker-dmg')
const { MakerFlatpak } = require('@electron-forge/maker-flatpak')
const { MakerSquirrel } = require('@electron-forge/maker-squirrel')
const { MakerWix } = require('@electron-forge/maker-wix')
const { MakerZIP } = require('@electron-forge/maker-zip')
const cheerio = require('cheerio')
const mri = require('mri')
const fs = require('node:fs')
const path = require('node:path')
const semver = require('semver')
const { resolveBuildConfig, resolveTalkPath } = require('./build/resolveBuildConfig.js')
const packageJSON = require('./package.json')
const { MIN_REQUIRED_BUILT_IN_TALK_VERSION } = require('./src/constants.js')
require('dotenv').config()
const SUPPORTED_ARCHS = ['x64', 'arm64', 'universal']
const argArch = mri(process.argv).arch
const systemArch = SUPPORTED_ARCHS.includes(process.arch) ? process.arch : 'x64'
const TARGET_ARCH = SUPPORTED_ARCHS.includes(argArch) ? argArch : systemArch
const BUILD_CONFIG = resolveBuildConfig()
const TALK_PATH = resolveTalkPath()
console.info('Building with a build configuration:')
console.info(JSON.stringify(BUILD_CONFIG, null, 2))
/**
* Generate the distribution name
*
* @param {'darwin'|'linux'|'win32'} platform - Distribution target platform
* @param {'arm64'|'universal'|'x64'} arch - Distribution target architecture
* @param {string} ext - File extension
* @return {string} The distribution name, e.g., Nextcloud.Talk-v1.0.0-macos-x64.dmg
* @example Nextcloud.Talk-macos-universal.dmg
* @example Nextcloud.Talk-linux-x64.flatpak
* @example Nextcloud.Talk-windows-x64.exe
* @example Nextcloud.Talk-beta-windows-x64.exe
*/
function generateDistName(platform, arch, ext) {
// Map technical platform name to user-friendly
const platformTitles = {
darwin: 'macos',
linux: 'linux',
win32: 'windows',
}
const archTitles = {
x64: 'x64',
arm64: 'arm64',
}
const platformTitle = platformTitles[platform] ?? platform
const archTitle = archTitles[arch] ?? arch
const CHANNEL = process.env.CHANNEL ?? 'stable'
const channel = CHANNEL !== 'stable' ? CHANNEL : ''
const name = BUILD_CONFIG.applicationName.replace(/[^a-z0-9]/gi, '.')
return [name, channel, platformTitle, archTitle].filter(Boolean).join('-') + ext
}
/**
* Move the artifact to the correct location
*
* @param {string} artifactPath - The path to the distribution
* @param {string} platform - platform
* @param {string} arch - architecture
* @return {string} - The new path to the distribution
*/
function fixArtifactName(artifactPath, platform, arch) {
const artifactName = path.basename(artifactPath)
const ext = path.extname(artifactName)
// For Squirrel.Windows names are configurable in the maker
if (platform === 'win32' && ext === '.exe') {
return artifactPath
}
const name = generateDistName(platform, arch, ext)
const output = path.join(path.dirname(artifactPath), name)
if (name !== artifactName) {
console.log(`Renaming ${artifactName} to ${name}`)
fs.renameSync(artifactPath, output)
}
return output
}
/**
* Convert signWithParams string to @electron/windows-sign options
* to fix issues of @electron/windows-sign
*
* @param {string} signWithParams - @electron/windows-sign's signWithParams string
* @return {object} - @electron/windows-sign options
*/
function signWithParamsToWindowsSignOptions(signWithParams) {
// @electron/windows-sign options
const windowsSign = {}
// Split args values without quotes wrap
// Otherwise @electron/windows-sign will treat double quotes as part of the value
// See: https://github.com/electron/windows-sign/issues/45
const parsed = [...signWithParams.matchAll(/(?:([^\s"]+)|"([^"]*)")+/g)].map((matched) => matched[1] || matched[2])
// @electron/windows-sign has some default options that define signtool params.
// Duplicating any param leads to an error in the signtool.
// So avoid this, any param that can be defined in options must be set as an option
// and removed from params string.
// See: https://github.com/electron/windows-sign/issues/46
// Note: multiple hashes is not supported
const extractOption = (param, option) => {
const index = parsed.indexOf(param)
if (index !== -1) {
const withValue = parsed[index + 1] && !parsed[index + 1].startsWith('/')
windowsSign[option] = withValue ? parsed[index + 1] : true
parsed.splice(index, withValue ? 2 : 1)
}
}
extractOption('/a', 'automaticallySelectCertificate')
extractOption('/as', 'appendSignature')
extractOption('/tr', 'timestampServer')
extractOption('/td', 'hashes')
extractOption('/t', 'timestampServer')
extractOption('/f', 'certificateFile')
extractOption('/p', 'certificatePassword')
extractOption('/fd', 'hashes')
extractOption('/d', 'description')
extractOption('/du', 'website')
extractOption('/debug', 'debug')
if (windowsSign.hashes) {
// @electron/window-sign only supports lower case hash
windowsSign.hashes = windowsSign.hashes.toLowerCase()
}
// Set parsed to an array to avoid quoting issues
windowsSign.signWithParams = parsed
return windowsSign
}
const hasMacosSign = !!(process.env.APPLE_ID && process.env.APPLE_ID_PASSWORD && process.env.APPLE_TEAM_ID)
const hasWindowsSign = !!process.env.WINDOWS_SIGN_PARAMS
let talkPackageJson
module.exports = {
hooks: {
generateAssets() {
if (!fs.existsSync(TALK_PATH)) {
throw new Error(`Path does not exist TALK_PATH=${TALK_PATH}`)
}
try {
talkPackageJson = require(path.join(TALK_PATH, 'package.json'))
} catch {
throw new Error(`No Nextcloud Talk (spreed repository) has been found in TALK_PATH=${TALK_PATH}`)
}
if (talkPackageJson.name !== '@nextcloud/talk' && talkPackageJson.name !== 'talk') {
throw new Error(`No Nextcloud Talk (spreed repository) but "${talkPackageJson.name}" has been found in TALK_PATH=${TALK_PATH}`)
}
if (semver.lte(talkPackageJson.version, MIN_REQUIRED_BUILT_IN_TALK_VERSION)) {
throw new Error(`The minimum supported version of built-in Nextcloud Talk is ${MIN_REQUIRED_BUILT_IN_TALK_VERSION}, but ${talkPackageJson.version} has been found in TALK_PATH=${TALK_PATH}`)
}
if (!fs.existsSync(path.join(TALK_PATH, 'node_modules'))) {
throw new Error(`No Nextcloud Talk (spreed repository) dependencies are installed.\nTry to execute \`npm ci --prefix="${TALK_PATH}"\``)
}
},
postStart() {
console.log(`Started with built-in Nextcloud Talk v${talkPackageJson.version} on path: ${TALK_PATH}`)
},
postPackage() {
console.log(`Packaged with built-in Nextcloud Talk v${talkPackageJson.version} on path: ${TALK_PATH}`)
},
postMake(config, makeResults) {
// All makers have different output paths, incl. folder structure, and filenames.
// In most of them, there is no option to specify or override it.
// Hotfix: manually move files to the correct location.
// Alternatives
// - create own makers
// - fork electron/forge makers, add features and upstream
// - do not use electron-forge makers
return makeResults.map((makeResult) => ({
...makeResult,
artifacts: makeResult.artifacts.map((artifact) => fixArtifactName(artifact, makeResult.platform, makeResult.arch)),
}))
},
},
rebuildConfig: {
// Do not rebuild any modules until explicitly specified
onlyModules: [],
},
// https://electron.github.io/packager/main/interfaces/Options.html
packagerConfig: {
// Common
name: BUILD_CONFIG.applicationName,
icon: path.join(__dirname, './img/icons/icon'),
appCopyright: BUILD_CONFIG.copyright,
asar: true,
// Windows
win32metadata: {
CompanyName: BUILD_CONFIG.companyName,
},
// macOS
appBundleId: BUILD_CONFIG.appleAppBundleId,
darwinDarkModeSupport: true,
// https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8
appCategoryType: 'public.app-category.business',
extendInfo: path.join(__dirname, './resources/macos/entitlements.plist'),
osxSign: hasMacosSign && {},
osxNotarize: hasMacosSign && {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
},
makers: [
// https://github.com/electron-userland/electron-wix-msi/
// https://js.electronforge.io/interfaces/_electron_forge_maker_wix.MakerWixConfig.html
// https://github.com/bitdisaster/Squirrel.Msi/
// Prerequisites:
// 1. winget install WiXToolset.WiXToolset
// 2. Add C:\Program Files (x86)\WiX Toolset v3.14\bin\ to PATH
BUILD_CONFIG.windowsMsi && new MakerWix({
appUserModelId: BUILD_CONFIG.winAppId,
// electron-wix-msi tries to get FileDescription from the packaged app without using packagerConfig.win32metadata.FileDescription
// It may fail to read it and falls back to options.description, which is not correct:
// FileDescription is .exe's FriendlyApplicationName and must be the human readable application name, not a short description
// Workaround: using application name here to make sure the FileDescription is the executable name
// Caveats: losing the description in start menu/desktop shortcuts title on hover
description: BUILD_CONFIG.applicationName,
exe: `${BUILD_CONFIG.applicationName}.exe`,
name: BUILD_CONFIG.applicationName,
icon: path.join(__dirname, 'img/icons/icon.ico'),
manufacturer: BUILD_CONFIG.companyName,
shortName: BUILD_CONFIG.applicationNameSanitized,
upgradeCode: BUILD_CONFIG.winUpgradeCode,
arch: 'x64', // electron-wix-msi defaults to x86 and arm64 is not supported
// Pass the version explicitly
// otherwise MakerWix makes versions with prerelease tags invalid semantic version
// which breaks app launch via stub executable
// See: https://github.com/electron/forge/issues/3805
version: packageJSON.version,
ui: {
images: {
background: path.join(__dirname, 'img/wix-background.bmp'),
banner: path.join(__dirname, 'img/wix-banner.bmp'),
},
},
windowsSign: hasWindowsSign && signWithParamsToWindowsSignOptions(process.env.WINDOWS_SIGN_PARAMS),
// A firewall exception must be added for the "C:/Program Files/Nextcloud Talk/app-version/Nextcloud Talk.exe".
// Otherwise, a user is prompt to do it on the first call after every upgrade,
// And it is only possible from an admin user
// WiX Docs: https://docs.firegiant.com/wix3/xsd/firewall/firewallexception/
// Unfortunately there is no way to specify the FirewallException via electron-wix-msi options
// And there is no way to provide a custom MSICreator class to the @electron-forge/maker-wix
// The only option is to override the instance method.
// See also:
// - https://github.com/electron-userland/electron-wix-msi/blob/master/src/creator.ts#L330
// - https://js.electronforge.io/interfaces/_electron_forge_maker_wix.MakerWixConfig.html#beforeCreate
// For testing (pwsh):
// (Get-NetFirewallRule -DisplayName "Nextcloud Talk" | Get-NetFirewallApplicationFilter).Program
extensions: ['WixFirewallExtension'],
async beforeCreate(creator) {
const originalCreateWxs = creator.createWxs.bind(creator)
creator.createWxs = async function() {
const wxs = await originalCreateWxs()
const $ = cheerio.load(wxs.wxsContent, { xmlMode: true })
$('Wix').attr('xmlns:firewall', 'http://schemas.microsoft.com/wix/FirewallExtension')
// <Directory Name="app-{version}> -> <Component> -> <File Name="Nextcloud Talk.exe>
// Represents: C:/Program Files/Nextcloud Talk/app-{version}/Nextcloud Talk.exe
const $executableFile = $(`Directory[Name^="app-"] > Component > File[Name="${BUILD_CONFIG.applicationName}.exe"]`)
$('<firewall:FirewallException></firewall:FirewallException>').attr({
Id: $executableFile.attr('Id') + '_firewall_exception',
Name: BUILD_CONFIG.applicationName,
Description: `Allow network traffic for ${BUILD_CONFIG.applicationName}`,
Scope: 'any',
IgnoreFailure: 'yes',
}).appendTo($executableFile)
// The file must be re-saved
const wxsContent = $.xml()
fs.writeFileSync(wxs.wxsFile, wxsContent, 'utf8')
return {
...wxs,
wxsContent,
}
}
},
}),
// https://github.com/squirrel/squirrel.windows
// https://js.electronforge.io/interfaces/_electron_forge_maker_squirrel.InternalOptions.SquirrelWindowsOptions.html#setupExe
BUILD_CONFIG.windowsExe && new MakerSquirrel({
// App/Filenames
name: BUILD_CONFIG.winSquirrelAppId,
setupExe: generateDistName('win32', TARGET_ARCH, '.exe'),
setupMsi: generateDistName('win32', TARGET_ARCH, '.msi'),
exe: `${BUILD_CONFIG.applicationName}.exe`,
// Covered by WiX
noMsi: true,
// Meta
title: BUILD_CONFIG.applicationName,
authors: BUILD_CONFIG.companyName,
owners: BUILD_CONFIG.companyName,
description: BUILD_CONFIG.description,
// Icons
setupIcon: path.join(__dirname, './img/icons/icon.ico'),
iconUrl: 'https://raw.githubusercontent.com/nextcloud/talk-desktop/refs/heads/main/img/icons/icon.ico',
// Install/Update Loading
loadingGif: path.join(__dirname, './img/squirrel-install-loading.gif'),
// Signing
signWithParams: hasWindowsSign && process.env.WINDOWS_SIGN_PARAMS,
}),
// https://js.electronforge.io/interfaces/_electron_forge_maker_dmg.MakerDMGConfig.html
BUILD_CONFIG.macosDmg && new MakerDMG({
icon: path.join(__dirname, 'img/icons/icon.icns'),
background: path.join(__dirname, 'img/dmg-background.png'),
// https://github.com/LinusU/node-appdmg?tab=readme-ov-file#specification
additionalDMGOptions: {
// Background does not work when the title has spaces or special characters
title: BUILD_CONFIG.applicationNameSanitized,
},
}),
// https://js.electronforge.io/classes/_electron_forge_maker_flatpak.MakerFlatpak-1.html
BUILD_CONFIG.linuxFlatpak && new MakerFlatpak({
// https://js.electronforge.io/classes/_electron_forge_maker_flatpak.MakerFlatpak-1.html#config
options: {
id: BUILD_CONFIG.linuxAppId,
// The default binary name in flatpak builder is packageJSON.name while the actual binary name from packager is applicationName
// Requires to be set explicitly
bin: BUILD_CONFIG.applicationName,
productName: BUILD_CONFIG.applicationName,
description: BUILD_CONFIG.description,
genericName: 'Video and Chat Communication',
branch: 'stable',
// https://specifications.freedesktop.org/icon-theme-spec/latest/
icon: {
scalable: path.resolve(__dirname, 'img/talk-icon-rounded-spaced.svg'),
},
// https://specifications.freedesktop.org/menu-spec/latest/category-registry.html
categories: [
// Main Category
'Network',
// Additional Categories
'InstantMessaging',
'Chat',
'VideoConference',
],
// Available versions: https://freedesktop-sdk.gitlab.io/documentation/updating-sdk/release-notes/
runtimeVersion: '25.08',
// Available versions: https://github.com/flathub/org.electronjs.Electron2.BaseApp/
baseVersion: '25.08',
// Based on https://github.com/malept/electron-installer-flatpak/blob/main/src/installer.js
// Available versions: https://github.com/refi64/zypak/releases
modules: [
{
name: 'zypak',
sources: [
{
type: 'git',
url: 'https://github.com/refi64/zypak',
tag: 'v2025.09',
},
],
},
],
// Useful links:
// - Flatpak Sandbox docs: https://docs.flatpak.org/en/latest/sandbox-permissions.html
// - Flatpak for Electron docs: https://docs.flatpak.org/en/latest/electron.html
// - Flatpak finish args reference: https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-build-finish
//
// Most of the OS integration goes through Portals, but some features still requires specific DBus interfaces
// The list of additionally allowed DBus interfaces must be minimal, based on the actual needs
// When adding new interfaces, always add a comment with the motivation and a proof reference when possible
//
// How to find the required interfaces:
// - Try run without permissions and check for errors
// - Run with DBus logs:
// flatpak run --log-session-bus --log-system-bus com.nextcloud.talk
// - Run with different permissions, for example:
// flatpak run --talk-name=org.kde.StatusNotifierWatcher com.nextcloud.talk
// - Check Electron and Chromium source code
// - Use dbus-monitor for monitoring DBus calls, for example:
// dbus-monitor --session "interface='org.kde.StatusNotifierWatcher'"
// - Some data can be retrieved with other events, for example, getting result with <ID> from the monitor above:
// dbus-send --session --print-reply --dest=:<ID> /StatusNotifierItem org.freedesktop.DBus.Properties.GetAll string:org.kde.StatusNotifierItem
finishArgs: [
// Network access
'--share=network',
// IPC is required for x11 performance
'--share=ipc',
// Wayland rendering with x11 only as a fallback
'--socket=wayland',
'--socket=fallback-x11',
// Audio input/output
'--socket=pulseaudio',
// All devices access - it is the only way to have webcam devices access
// It also includes required for Chromium and video processing GPU access (--device=dri)
'--device=all',
// Mouse cursor scaling on HiDPI displays under Wayland
// Ref: https://docs.flatpak.org/en/latest/electron.html
'--env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons',
// Chromium uses TMPDIR for:
// - Single instance lock file (Electron app.requestSingleInstanceLock)
// - Status (system tray) icon image
// Preferred tmpdir location in Flatpak is ${XDG_RUNTIME_DIR}/app/${FLATPAK_ID}
// Using variables in the path requires creating a wrapper launcher script
// A wrapper launcher is problematic with @electron-forge/maker-flatpak
// Temporal workaround: use /var/tmp as permanent storage on the host
// TODO: use flatpak builder without @electron-forge/maker-flatpak with a proper wrapper launcher script, exporting TMPDIR="${XDG_RUNTIME_DIR}/app/${FLATPAK_ID}"
'--filesystem=/var/tmp',
'--env=TMPDIR=/var/tmp',
// File transfer (Clipboard, Drag-n-Drop) works in Flatpak via portal (org.freedesktop.portal.FileTransfer) and requires no filesystem access.
//
// As for September 2026:
// - It covers GTK 4, GNOME, KDE (for example, Nautilus on Ubuntu GNOME, Dolphin on Fedora KDE)
// - It fails on Cinnamon, MATE, XFCE, and other desktop environments on GTK 3/Qt/Rust
//
// On unsupported environments full filesystem read access with "--filesystem=host:ro" is required,
// Which is not acceptable for a sandboxed distribution.
// A special case - files dragged from the desktop, which may use DE extension rather than the file manager,
// Examples:
// - Ubuntu 26 with DING (Desktop icons NG) v49 on GTK 3 (should be fine on v50 with GTK 4)
//
// An acceptable workaround - allow read-only access to the desktop folder to cover Ubuntu as a popular distribution
'--filesystem=xdg-desktop:ro',
// Status icon (System tray)
// Electron uses Chromium API: https://github.com/electron/electron/blob/v41.2.0/shell/browser/ui/tray_icon_linux.cc#L8
// Chromium source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.166:chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc;l=60
'--talk-name=org.kde.StatusNotifierWatcher',
// Idle Status (Web IdleDetector API, Electron powerMonitor)
// Electron uses Chromium API: https://github.com/electron/electron/blob/v41.2.0/shell/browser/api/electron_api_power_monitor.cc
// Chromium source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.166:ui/base/idle/idle_linux.cc;l=44-58
// And: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:ui/ozone/platform/wayland/host/org_gnome_mutter_idle_monitor.cc;l=27
'--talk-name=org.freedesktop.ScreenSaver',
'--talk-name=org.cinnamon.ScreenSaver',
'--talk-name=org.gnome.ScreenSaver',
'--talk-name=org.mate.ScreenSaver',
'--talk-name=org.xfce.ScreenSaver',
'--talk-name=org.gnome.Mutter.IdleMonitor',
// Web Screen Wake Lock API, Electron powerSaveBlocker
// Electron uses Chromium API: https://github.com/electron/electron/blob/v41.2.0/shell/browser/api/electron_api_power_save_blocker.cc#L14
// Chromium source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.166:services/device/wake_lock/power_save_blocker/power_save_blocker_linux.cc;l=62-72
'--talk-name=org.freedesktop.PowerManagement',
'--talk-name=org.gnome.SessionManager',
// In addition, Electron powerMonitor event listener uses power observer via system_bus
// We don't use these events, but some users reported errors missing this interface
// Might be used for Web IdleDetector's events (like locked) or Web Screen Wake Lock API (Inhibit) when other interfaces are not available
// Ref: https://github.com/nextcloud/talk-desktop/issues/1629
// Electron source: https://github.com/electron/electron/blob/v41.2.0/shell/browser/lib/power_observer_linux.cc
'--system-talk-name=org.freedesktop.login1',
// App badge counter (app.setBadgeCount) on Ubuntu
// Electron uses unity::SetDownloadCount: https://github.com/electron/electron/blob/v41.2.0/shell/browser/browser_linux.cc#L145-L147
// Which uses libunity: https://github.com/electron/electron/blob/v41.2.0/shell/browser/linux/unity_service.cc
// libunity source: https://git.launchpad.net/libunity/tree/src/unity-launcher.vala
'--talk-name=com.canonical.Unity',
// Uncomment when used
// Safe Storage and Cookies encryption
// Electron uses Chromium: https://github.com/electron/electron/blob/v41.2.0/shell/browser/api/electron_api_safe_storage.cc#L7
// Chromium sources:
// - https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/os_crypt/sync/os_crypt_linux.cc;l=23
// - https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/os_crypt/sync/key_storage_linux.cc;l=21-26
// - https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/os_crypt/sync/libsecret_util_linux.cc;l=37
// - https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/os_crypt/sync/kwallet_dbus.cc;l=23-24
// - https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/os_crypt/async/browser/freedesktop_secret_key_provider.h
// (org.kde.kwalletd is ignored as legacy)
// '--talk-name=org.freedesktop.secrets',
// '--talk-name=org.kde.kwalletd5',
// '--talk-name=org.kde.kwalletd6',
// Uncomment when needed
// Makes sense for video/audio files playback, but currently it is triggered for calls as well (TODO: find out why)
// Media controls (MPRIS)
// Chromium source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:components/system_media_controls/linux/system_media_controls_linux.cc;l=107
// '--own-name=org.mpris.MediaPlayer2.chromium.*',
// Uncomment when used
// Global menu bar (macos-like app menu) on KDE/Unity
// Source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:chrome/browser/ui/views/frame/dbus_appmenu_registrar.cc;l=23
// '--talk-name=com.canonical.AppMenu.Registrar',
// Uncomment when used
// Web Battery Status API
// Source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:services/device/battery/battery_status_manager_linux-inl.h;l=9
// Source: https://source.chromium.org/chromium/chromium/src/+/refs/tags/146.0.7680.179:services/device/battery/battery_status_manager_linux.cc
// --system-talk-name=org.freedesktop.UPower
// Uncomment if users report issues with native notifications with DBus access missing
// System notifications with libnotify
// Not needed, since [email protected] it uses a portal
// '--talk-name=org.freedesktop.Notifications',
],
},
}),
BUILD_CONFIG.linuxZip && new MakerZIP({}, ['linux']),
].filter(Boolean),
plugins: [
{
name: '@electron-forge/plugin-webpack',
config: {
mainConfig: './webpack.main.config.js',
devContentSecurityPolicy: `default-src 'self' 'unsafe-inline' data: blob: ${process.env.NEXTCLOUD_DEV_SERVER_HOSTS || '*'}; script-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob:`,
port: 3000, // The default for this plugin
loggerPort: 9005, // The default is 9000, but it conflicts with Talk API
devServer: {
// Allow using app host
allowedHosts: 'all',
client: {
overlay: false,
// When serving a page from a custom host
// WS hostname must be set explicitly
webSocketURL: {
hostname: 'localhost',
},
},
},
renderer: {
config: './webpack.renderer.config.js',
entryPoints: [
{
name: 'talk_desktop__window_welcome',
html: './src/welcome/welcome.html',
js: './src/welcome/welcome.main.ts',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_authentication',
html: './src/authentication/renderer/authentication.html',
js: './src/authentication/renderer/authentication.main.js',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_talk',
html: './src/talk/renderer/talk.html',
js: './src/talk/renderer/talk.main.ts',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_help',
html: './src/help/renderer/help.html',
js: './src/help/renderer/help.app.js',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_upgrade',
html: './src/upgrade/renderer/upgrade.html',
js: './src/upgrade/renderer/upgrade.main.ts',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_callbox',
html: './src/callbox/renderer/callbox.html',
js: './src/callbox/renderer/callbox.main.ts',
preload: {
js: './src/preload.js',
},
},
{
name: 'talk_desktop__window_certificate',
html: './src/certificate/renderer/certificate.html',
js: './src/certificate/renderer/certificate.main.ts',
preload: {
js: './src/preload.js',
},
},
],
},
},
},
],
}