Refresh UI when receiving deep link

This commit is contained in:
Will Chen
2025-04-22 21:56:43 -07:00
parent ae2cb0fc6b
commit 42b759d85c
7 changed files with 90 additions and 10 deletions

View File

@@ -152,6 +152,13 @@ app.on("open-url", (event, url) => {
function handleDeepLinkReturn(url: string) {
// example url: "dyad://supabase-oauth-return?token=a&refreshToken=b"
const parsed = new URL(url);
// Intentionally do NOT log the full URL which may contain sensitive tokens.
log.log(
"Handling deep link: protocol",
parsed.protocol,
"hostname",
parsed.hostname
);
if (parsed.protocol !== "dyad:") {
dialog.showErrorBox(
"Invalid Protocol",
@@ -170,6 +177,11 @@ function handleDeepLinkReturn(url: string) {
return;
}
handleSupabaseOAuthReturn({ token, refreshToken, expiresIn });
// Send message to renderer to trigger re-render
mainWindow?.webContents.send("deep-link-received", {
type: parsed.hostname,
url,
});
}
}