fix(electron): deep link handling without running instance (#8661)

fix AF-1586
This commit is contained in:
pengx17
2024-11-01 07:23:38 +00:00
parent 33088500e4
commit 070f5fae49
3 changed files with 21 additions and 5 deletions
@@ -57,6 +57,18 @@ export function setupDeepLink(app: App) {
})
.catch(e => console.error('Failed to restore or create window:', e));
});
app.on('ready', () => {
// app may be brought up without having a running instance
// need to read the url from the command line
const url = process.argv.at(-1);
logger.log('url from argv', process.argv, url);
if (url?.startsWith(`${protocol}://`)) {
handleAffineUrl(url).catch(e => {
logger.error('failed to handle affine url', e);
});
}
});
}
async function handleAffineUrl(url: string) {