From 00d41cee5632dab86f7a93b1bc965cb3a896417a Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 31 Jul 2024 17:43:28 +0800 Subject: [PATCH] fix: deeplink navigate Signed-off-by: Innei --- src/main/index.ts | 2 +- src/main/window.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index d500dd7f2..df9ca3567 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -133,7 +133,7 @@ function bootsharp() { const { height, resizable, width } = options || {} createWindow({ - extraPath: url.replace(DEEPLINK_SCHEME, "/"), + extraPath: `#${url.replace(DEEPLINK_SCHEME, "/")}`, width: width ?? 800, height: height ?? 600, resizable, diff --git a/src/main/window.ts b/src/main/window.ts index 1a2796f68..8e2dfaf61 100644 --- a/src/main/window.ts +++ b/src/main/window.ts @@ -8,6 +8,7 @@ import { BrowserWindow, Menu, shell } from "electron" import { getIconPath } from "./helper" import { store } from "./lib/store" +import { logger } from "./logger" import { cancelPollingUpdateUnreadCount, pollingUpdateUnreadCount, @@ -69,12 +70,20 @@ export function createWindow( window.loadURL( process.env["ELECTRON_RENDERER_URL"] + (options?.extraPath || ""), ) + + logger.log( + process.env["ELECTRON_RENDERER_URL"] + (options?.extraPath || ""), + ) } else { + const openPath = path.resolve( + __dirname, + `../renderer/index.html${options?.extraPath || ""}`, + ) window.loadFile( - path.resolve( - __dirname, - `../renderer/index.html${options?.extraPath || ""}`, - ), + openPath, + ) + logger.log( + openPath, ) }