From 99acc43ff0f190ae79bd99f946ebdffab9c50272 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 16 Jun 2026 01:25:02 +0700 Subject: [PATCH 1/2] fix(android): use intent:// protocol for deep link return from system browser Replace custom zeavisedu:// scheme in callback HTML with Chrome's native intent:// protocol which directly opens the target Android app by package name. Includes browser_fallback_url for non-app scenarios. Also updates the HTML page with better UX: auto-redirect via JS, fallback button, and copyable URL for manual paste. Co-Authored-By: Claude --- apps/api/src/routes/auth.ts | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/apps/api/src/routes/auth.ts b/apps/api/src/routes/auth.ts index 6a80ddc..4b2e29c 100644 --- a/apps/api/src/routes/auth.ts +++ b/apps/api/src/routes/auth.ts @@ -64,23 +64,38 @@ function decodeGoogleIdToken(idToken: string): GoogleIdPayload { } /** - * Render a page for the Android system browser that redirects back to the - * Tauri app via a custom scheme (zeavisedu://). The app's AndroidManifest - * must register an intent filter for this scheme. + * Render a page for the Android system browser that uses Chrome's native + * `intent://` protocol to open the Tauri app with the session URL. + * Falls back to a clickable button if the intent is blocked. */ function renderTauriDeepLinkPage(targetUrl: string): Response { - // Rewrite https://... to zeavisedu://... for the custom scheme - const deepLink = targetUrl.replace(/^https?:\/\//, 'zeavisedu://'); + // Extract the path + query from the full URL for the intent + let pathAndQuery = '/login'; + try { + const u = new URL(targetUrl); + pathAndQuery = u.pathname + u.search + u.hash; + } catch { /* use default */ } + + const displayUrl = targetUrl.replace(/"/g, '"'); + const escapedPath = pathAndQuery.replace(/"/g, '"'); + // intent:// scheme: Chrome on Android opens the target app by package name + // browser_fallback_url: shown if the app isn't installed + const intentUrl = `intent:${escapedPath}#Intent;scheme=zeavisedu;package=com.zeavis.edu;S.browser_fallback_url=${encodeURIComponent(targetUrl)};end`; + const html = ` Kembali ke ZeaVis Edu -
-

Login berhasil!
Kembali ke aplikasi...

-Buka ZeaVis Edu -

Jika tombol tidak berfungsi, salin URL ini:
${deepLink.replace(/

+
+

Login Google berhasil!
Kembali ke aplikasi...

+Buka ZeaVis Edu +

Jika tombol di atas tidak berfungsi, salin dan buka URL ini di aplikasi ZeaVis Edu:

+${displayUrl.replace(//g, '>')}
- + `; return new Response(html, { status: 200, From 254fe19bb6f795822bf792d7d57c9ec142807d5b Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 16 Jun 2026 01:49:03 +0700 Subject: [PATCH 2/2] feat(android): always load live web URL so APK never needs rebuild for web changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Android, the app navigates to the live production URL immediately after setup. The APK becomes a thin shell — bundled frontend is only a placeholder for the ~1 second before redirect. All web updates (deploy web) take effect instantly on all installed APKs. Co-Authored-By: Claude --- apps/tauri/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/tauri/src/lib.rs b/apps/tauri/src/lib.rs index c4fe7a0..8606073 100644 --- a/apps/tauri/src/lib.rs +++ b/apps/tauri/src/lib.rs @@ -3,6 +3,18 @@ pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_deep_link::init()) + .setup(|app| { + // On Android, always load from the live web URL so the APK + // never needs to be rebuilt when web changes. The APK is a + // thin shell — the web app is always up to date. + #[cfg(target_os = "android")] + { + if let Some(window) = app.get_webview_window("main") { + let _ = window.navigate("https://zeavisedu.asepharyana.my.id"); + } + } + Ok(()) + }) .run(tauri::generate_context!()) .expect("error while running tauri application"); }