APK architecture change: replaces bundled React SPA with minimal redirect page that always loads live web content. No more APK rebuilds for web changes. Root cause of OAuth failure on Android: 1. Cold-start deep links lost — APK's old bundled JS called onOpenUrl() (warm-start listener only) but NOT getCurrent() which is required for cold-start deep links. Fix: redirect page + setupDeepLinkHandler both call getCurrent() before redirecting/navigating. 2. Session cookie was dropped — renderTauriDeepLinkPage returned a raw new Response() which overwrote the Set-Cookie header set by the callback handler. Fix: inject Set-Cookie into the Response. 3. tauri.conf.json frontendDist → "./web/dist-tauri" (redirect page) 4. Added @tauri-apps/plugin-deep-link and @tauri-apps/plugin-opener as web app deps so live-web imports work in Tauri WebView. Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.4 KiB
HTML
45 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>ZeaVis Edu</title>
|
|
<script>
|
|
var LIVE = 'https://zeavisedu.asepharyana.my.id';
|
|
var T = window.__TAURI_INTERNALS__;
|
|
|
|
function navigate(path) {
|
|
window.location.replace(LIVE + path);
|
|
}
|
|
|
|
// On cold start, check if the app was opened via a deep link (Google OAuth)
|
|
// before redirecting to the live web app.
|
|
if (T && T.invoke) {
|
|
T.invoke('plugin:deep-link|get_current')
|
|
.then(function(urls) {
|
|
if (urls && urls.length > 0 && urls[0]) {
|
|
try {
|
|
var u = new URL(urls[0]);
|
|
var target = u.pathname + u.search + u.hash;
|
|
if (target && target !== '/') {
|
|
// Preserve full path + query (e.g. /login?token=xxx)
|
|
navigate(target);
|
|
return;
|
|
}
|
|
} catch (e) { /* malformed URL — fall through */ }
|
|
}
|
|
// No deep link — redirect to live app home
|
|
navigate('/');
|
|
})
|
|
.catch(function() { navigate('/'); });
|
|
} else {
|
|
// Not in Tauri (dev mode or unknown) — redirect to live
|
|
navigate('/');
|
|
}
|
|
</script>
|
|
</head>
|
|
<body style="background:#f0fdf4;font-family:sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0">
|
|
<p style="color:#16a34a">Memuat ZeaVis Edu...</p>
|
|
</body>
|
|
</html>
|