mobile: show login screen for stock browsers when not authenticated
Nightly Build / build (push) Successful in 6m48s
Nightly Build / build (push) Successful in 6m48s
Add an inline auth gate to mobile.html that checks /api/auth/me on load. Skipped when ?native=true (the iOS shell handles auth in background). Includes a vanilla JS login form (no Lit) reusing the existing login styles. Bump version to 0.1.2.
This commit is contained in:
Generated
+1
-1
@@ -4172,7 +4172,7 @@ checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "skald"
|
name = "skald"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ resolver = "2"
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "skald"
|
name = "skald"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { LitElement, html, nothing } from 'lit';
|
import { LitElement, html, nothing } from 'lit';
|
||||||
import { t } from '../lib/i18n.js';
|
import { t } from '../lib/i18n.js';
|
||||||
|
import { LoginPage } from './login-page.js';
|
||||||
import './shared/inbox-page.js';
|
import './shared/inbox-page.js';
|
||||||
import './shared/chat-page.js';
|
import './shared/chat-page.js';
|
||||||
import './shared/projects-page.js';
|
import './shared/projects-page.js';
|
||||||
@@ -7,6 +8,8 @@ import './shared/settings-page.js';
|
|||||||
import './shared/file-viewer-mobile.js';
|
import './shared/file-viewer-mobile.js';
|
||||||
import './shared/tool-detail-mobile.js';
|
import './shared/tool-detail-mobile.js';
|
||||||
|
|
||||||
|
customElements.define('login-page', LoginPage);
|
||||||
|
|
||||||
// Sections addressable via the URL hash — same routing style as the desktop
|
// Sections addressable via the URL hash — same routing style as the desktop
|
||||||
// sidebar (web/components/sidebar.js). The native iOS shell and mobile browsers
|
// sidebar (web/components/sidebar.js). The native iOS shell and mobile browsers
|
||||||
// share this router so the URL always reflects the active section: native menu
|
// share this router so the URL always reflects the active section: native menu
|
||||||
|
|||||||
+23
-1
@@ -41,6 +41,7 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" />
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/variables.css" />
|
<link rel="stylesheet" href="css/variables.css" />
|
||||||
|
<link rel="stylesheet" href="css/setup-page.css" />
|
||||||
<link rel="stylesheet" href="css/copilot-messages.css" />
|
<link rel="stylesheet" href="css/copilot-messages.css" />
|
||||||
<link rel="stylesheet" href="css/inbox-cards.css" />
|
<link rel="stylesheet" href="css/inbox-cards.css" />
|
||||||
<link rel="stylesheet" href="css/file-viewer.css" />
|
<link rel="stylesheet" href="css/file-viewer.css" />
|
||||||
@@ -65,7 +66,28 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<mobile-app></mobile-app>
|
<mobile-app id="mobile-app"></mobile-app>
|
||||||
|
<login-page id="login-page" style="display:none"></login-page>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
// Native shell handles auth in background — never gate it.
|
||||||
|
if (new URLSearchParams(location.search).get('native') === 'true') return;
|
||||||
|
|
||||||
|
var app = document.getElementById('mobile-app');
|
||||||
|
var login = document.getElementById('login-page');
|
||||||
|
|
||||||
|
fetch('/api/auth/me').then(function (res) {
|
||||||
|
if (res.ok) return; // logged in — show app
|
||||||
|
app.style.display = 'none'; // 401 — show login
|
||||||
|
login.style.display = '';
|
||||||
|
}).catch(function () {
|
||||||
|
app.style.display = 'none'; // network error — show login
|
||||||
|
login.style.display = '';
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
<script type="module" src="components/mobile-app.js"></script>
|
<script type="module" src="components/mobile-app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user