Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
Auto-fix formatting issues
GitHub Action71dbf44802ed
diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rsindex 0ce25de6..c643698c 100644--- a/src-tauri/src/app/invoke.rs+++ b/src-tauri/src/app/invoke.rs@@ -127,4 +127,4 @@ pub fn update_theme_mode(app: AppHandle, mode: String) {};let _ = window.set_theme(Some(theme));}-}\ No newline at end of file+}diff --git a/src-tauri/src/inject/auth.js b/src-tauri/src/inject/auth.jsindex f48caa25..c045baa0 100644--- a/src-tauri/src/inject/auth.js+++ b/src-tauri/src/inject/auth.js@@ -2,71 +2,71 @@// Check if URL matches OAuth/authentication patternsfunction matchesAuthUrl(url, baseUrl = window.location.href) {- try {- const urlObj = new URL(url, baseUrl);- const hostname = urlObj.hostname.toLowerCase();- const pathname = urlObj.pathname.toLowerCase();- const fullUrl = urlObj.href.toLowerCase();+ try {+ const urlObj = new URL(url, baseUrl);+ const hostname = urlObj.hostname.toLowerCase();+ const pathname = urlObj.pathname.toLowerCase();+ const fullUrl = urlObj.href.toLowerCase();- // Common OAuth providers and paths- const oauthPatterns = [- /accounts\.google\.com/,- /accounts\.google\.[a-z]+/,- /login\.microsoftonline\.com/,- /github\.com\/login/,- /facebook\.com\/.*\/dialog/,- /twitter\.com\/oauth/,- /appleid\.apple\.com/,- /\/oauth\//,- /\/auth\//,- /\/authorize/,- /\/login\/oauth/,- /\/signin/,- /\/login/,- /servicelogin/,- /\/o\/oauth2/,- ];-- const isMatch = oauthPatterns.some(- (pattern) =>- pattern.test(hostname) ||- pattern.test(pathname) ||- pattern.test(fullUrl),- );+ // Common OAuth providers and paths+ const oauthPatterns = [+ /accounts\.google\.com/,+ /accounts\.google\.[a-z]+/,+ /login\.microsoftonline\.com/,+ /github\.com\/login/,+ /facebook\.com\/.*\/dialog/,+ /twitter\.com\/oauth/,+ /appleid\.apple\.com/,+ /\/oauth\//,+ /\/auth\//,+ /\/authorize/,+ /\/login\/oauth/,+ /\/signin/,+ /\/login/,+ /servicelogin/,+ /\/o\/oauth2/,+ ];- if (isMatch) {- console.log("[Pake] OAuth URL detected:", url);- }+ const isMatch = oauthPatterns.some(+ (pattern) =>+ pattern.test(hostname) ||+ pattern.test(pathname) ||+ pattern.test(fullUrl),+ );- return isMatch;- } catch (e) {- return false;+ if (isMatch) {+ console.log("[Pake] OAuth URL detected:", url);}++ return isMatch;+ } catch (e) {+ return false;+ }}// Check if URL is an OAuth/authentication linkfunction isAuthLink(url) {- return matchesAuthUrl(url);+ return matchesAuthUrl(url);}// Check if this is an OAuth/authentication popupfunction isAuthPopup(url, name) {- // Check for known authentication window names- const authWindowNames = [- "AppleAuthentication",- "oauth2",- "oauth",- "google-auth",- "auth-popup",- "signin",- "login",- ];+ // Check for known authentication window names+ const authWindowNames = [+ "AppleAuthentication",+ "oauth2",+ "oauth",+ "google-auth",+ "auth-popup",+ "signin",+ "login",+ ];- if (authWindowNames.includes(name)) {- return true;- }+ if (authWindowNames.includes(name)) {+ return true;+ }- return matchesAuthUrl(url);+ return matchesAuthUrl(url);}// Export functions to global scopediff --git a/src-tauri/src/inject/theme_refresh.js b/src-tauri/src/inject/theme_refresh.jsindex 041ad285..b86d7dcc 100644--- a/src-tauri/src/inject/theme_refresh.js+++ b/src-tauri/src/inject/theme_refresh.js@@ -62,16 +62,25 @@ document.addEventListener("DOMContentLoaded", () => {// This is useful when the site relies purely on CSS media queries without classes.if (!detected) {const bodyBg = window.getComputedStyle(document.body).backgroundColor;- const htmlBg = window.getComputedStyle(document.documentElement).backgroundColor;-+ const htmlBg = window.getComputedStyle(+ document.documentElement,+ ).backgroundColor;+// Check body first, then htmlif (bodyBg && bodyBg !== "rgba(0, 0, 0, 0)" && bodyBg !== "transparent") {mode = isDarkColor(bodyBg) ? "dark" : "light";- } else if (htmlBg && htmlBg !== "rgba(0, 0, 0, 0)" && htmlBg !== "transparent") {+ } else if (+ htmlBg &&+ htmlBg !== "rgba(0, 0, 0, 0)" &&+ htmlBg !== "transparent"+ ) {mode = isDarkColor(htmlBg) ? "dark" : "light";} else {// Strategy 3: System Preference (Last Resort)- if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {+ if (+ window.matchMedia &&+ window.matchMedia("(prefers-color-scheme: dark)").matches+ ) {mode = "dark";}}@@ -91,7 +100,9 @@ document.addEventListener("DOMContentLoaded", () => {setTimeout(updateTheme, 100);// Watch for system theme changes- window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", updateTheme);+ window+ .matchMedia("(prefers-color-scheme: dark)")+ .addEventListener("change", updateTheme);// Watch for DOM changes// We observe attributes for class changes, and also style changes just in case@@ -102,12 +113,12 @@ document.addEventListener("DOMContentLoaded", () => {observer.observe(document.documentElement, {attributes: true,attributeFilter: ["class", "data-theme", "style"],- subtree: false+ subtree: false,});-- observer.observe(document.body, {- attributes: true,++ observer.observe(document.body, {+ attributes: true,attributeFilter: ["class", "data-theme", "style"],- subtree: false+ subtree: false,});});