From 983fb3ae3c832b33a7259d56d74a56a6db60e32f Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 23 Apr 2025 20:23:51 -0400 Subject: Client works with electron-builder --- index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'index.js') diff --git a/index.js b/index.js index 37e0691..69af246 100644 --- a/index.js +++ b/index.js @@ -11,16 +11,24 @@ autoUpdater.logger = log; autoUpdater.logger.transports.file.level = 'info'; const pluginPaths = { - win32: path.join(__dirname, 'plugin/pepflashplayer.dll'), - darwin: path.join(__dirname, 'plugin/PepperFlashPlayer.plugin'), - linux: path.join(__dirname, 'plugin/libpepflashplayer.so') -} + win32: path.join(app.getAppPath(), 'plugin/pepflashplayer.dll'), + darwin: path.join(app.getAppPath(), 'plugin/PepperFlashPlayer.plugin'), + linux: path.join(app.getAppPath(), 'plugin/libpepflashplayer.so') +}; const pluginName = pluginPaths[process.platform]; if (process.platform === 'linux') app.commandLine.appendSwitch('--no-sandbox'); app.commandLine.appendSwitch('ignore-certificate-errors'); -app.commandLine.appendSwitch('ppapi-flash-path', pluginName); + +if (process.mainModule.filename.includes('app.asar')) { + const unpackedPath = pluginName.replace('app.asar', 'app.asar.unpacked'); + console.log(`Adjusted plugin path for asar: ${unpackedPath}`); + app.commandLine.appendSwitch('ppapi-flash-path', unpackedPath); +} else { + app.commandLine.appendSwitch('ppapi-flash-path', pluginName); +} + app.commandLine.appendSwitch('ppapi-flash-version', '31.0.0.122'); app.on('window-all-closed', () => { -- cgit v1.2.3