Add a function to check for valid callback url

pull/5302/head
Roman 2021-08-14 20:20:16 +01:00
parent 047883bd27
commit f454c4e33b
2 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,7 @@ const Logger = require('@joplin/lib/Logger').default;
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
const envFromArgs = require('@joplin/lib/envFromArgs');
const packageInfo = require('./packageInfo.js');
const { isCallbackUrl } = require('@joplin/lib/ProtocolUtils');
// Electron takes the application name from package.json `name` and
// displays this in the tray icon toolip and message box titles, however in
@ -44,7 +45,7 @@ if (env === 'dev' && process.platform === 'win32') {
electronApp.setAsDefaultProtocolClient('joplin');
}
const initialUrl = process.argv.find((arg) => arg.startsWith('joplin://'));
const initialUrl = process.argv.find((arg) => isCallbackUrl(arg));
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath, isDebugMode, initialUrl);

View File

@ -1,3 +1,7 @@
export function isCallbackUrl(s: string) {
return s.startsWith('joplin://x-callback-url/');
}
export function getNoteUrl(noteId: string) {
return `joplin://x-callback-url/openNote?id=${noteId}`;
}