Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: keep auth links inside app when popup windows are enabled

Mihai - Alexandru Chindrișdf350a7e21fd
diff --git a/src-tauri/src/inject/event.js b/src-tauri/src/inject/event.js
index b67a6f04..cac8725c 100644
--- a/src-tauri/src/inject/event.js
+++ b/src-tauri/src/inject/event.js
@@ -503,9 +503,26 @@ document.addEventListener("DOMContentLoaded", () => {
const absoluteUrl = hrefUrl.href;
let filename = anchorElement.download || getFilenameFromUrl(absoluteUrl);
- // Early check: Allow OAuth/authentication links to navigate naturally
+ // Keep OAuth/authentication flows inside the app when popup support is enabled.
if (window.isAuthLink(absoluteUrl)) {
- console.log("[Pake] Allowing OAuth navigation to:", absoluteUrl);
+ console.log("[Pake] Handling OAuth navigation in-app:", absoluteUrl);
+
+ if (window.pakeConfig?.new_window) {
+ e.preventDefault();
+ e.stopImmediatePropagation();
+
+ const authWindow = originalWindowOpen.call(
+ window,
+ absoluteUrl,
+ "_blank",
+ "width=1200,height=800,scrollbars=yes,resizable=yes",
+ );
+
+ if (!authWindow) {
+ window.location.href = absoluteUrl;
+ }
+ }
+
return;
}