You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Add a function to check for valid callback url
This commit is contained in:
@ -7,6 +7,7 @@ const Logger = require('@joplin/lib/Logger').default;
|
|||||||
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
|
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
|
||||||
const envFromArgs = require('@joplin/lib/envFromArgs');
|
const envFromArgs = require('@joplin/lib/envFromArgs');
|
||||||
const packageInfo = require('./packageInfo.js');
|
const packageInfo = require('./packageInfo.js');
|
||||||
|
const { isCallbackUrl } = require('@joplin/lib/ProtocolUtils');
|
||||||
|
|
||||||
// Electron takes the application name from package.json `name` and
|
// Electron takes the application name from package.json `name` and
|
||||||
// displays this in the tray icon toolip and message box titles, however in
|
// 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');
|
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);
|
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath, isDebugMode, initialUrl);
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
export function isCallbackUrl(s: string) {
|
||||||
|
return s.startsWith('joplin://x-callback-url/');
|
||||||
|
}
|
||||||
|
|
||||||
export function getNoteUrl(noteId: string) {
|
export function getNoteUrl(noteId: string) {
|
||||||
return `joplin://x-callback-url/openNote?id=${noteId}`;
|
return `joplin://x-callback-url/openNote?id=${noteId}`;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user