neutralinojs/neutralino.js

URL Protocol Handler

SavageCore opened this issue · 0 comments

As of now in order to support custom://url-protocols you have to create a URL Protocol key in regedit and then parse the args with global NL_ARGS, the major downside to this is the app always starts again, it cannot listen to protocol requests. Can this be extended?

Electron docs for reference.

For anyone wanting the commands for regediting they're as below:

const path = NL_PATH.replace(/\//g, '\\') // Convert path to backslashes for Windows
const filePath = path + '\\demo-app-win_x64.exe'

const {exitCode} = await Neutralino.os.execCommand('reg add HKEY_CLASSES_ROOT\\custom /v "URL Protocol" /t REG_SZ /f')
if (exitCode === 1) {
  // console.log('Failed to install registry keys. Please run as administrator.')
  await Neutralino.app.exit(1)
}
await Neutralino.os.execCommand(`reg add HKEY_CLASSES_ROOT\\custom \\shell\\open\\command /f /ve /d ""${filePath}" "%1"" /t REG_SZ`)

Edit: Sorry just saw neutralinojs/neutralinojs#1044, not sure which repo this request belongs in!