mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
ae0d4e4520
Everything the server's UI does differently inside the iOS and Android app lives under src/native and is inert in a browser. Sign-in: SSO and the passkey button go through the system browser (signInThroughBrowser), because identity providers refuse embedded browsers and WebAuthn needs a domain association no build can have for every server. The browser end is the new /native-handoff page: it signs the user in if needed and hands the session over only after an explicit tap, so a link carrying somebody else's challenge cannot pass a session on silently. The verifier is hashed with @noble/hashes because crypto.subtle is missing on the plain-http servers many home networks use. An OIDC-only install no longer bounces to the IdP inside the WebView, and passkey management is hidden in the app. Downloads: the WebView cannot save a blob, so downloadBlob, downloadFile and openFile write to the app cache and open the share sheet. The eight places that built their own download anchor now use downloadBlob, which they should have anyway. The rest: "Change server" on the login page and in the account settings, the splash hides after the first frame, Android's back button walks history before it leaves the app, the status bar follows the scheme, and on iOS the start page is refreshed and every chunk of the build (listed in the new asset-manifest.json) is pulled into WebKit's cache so the app can start without network.
26 lines
1002 B
TypeScript
26 lines
1002 B
TypeScript
import React from 'react'
|
|
import { Server } from 'lucide-react'
|
|
import { useTranslation } from '../../i18n'
|
|
import { nativeServerHost } from '../../native/platform'
|
|
import { TrekShell } from '../../native/trekShell'
|
|
import Section from './Section'
|
|
|
|
/** Only inside the iOS/Android app: which server it talks to, and the way to another one. */
|
|
export default function NativeServerSection(): React.ReactElement | null {
|
|
const { t } = useTranslation()
|
|
const host = nativeServerHost()
|
|
if (!host) return null
|
|
return (
|
|
<Section title={t('native.settings.server')} icon={Server}>
|
|
<p className="text-body text-content-secondary">{t('native.settings.serverHint', { server: host })}</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => { void TrekShell.resetServer() }}
|
|
className="rounded-lg border border-edge bg-surface-card px-4 py-2 text-body font-medium text-content hover:bg-surface-hover"
|
|
>
|
|
{t('native.changeServer')}
|
|
</button>
|
|
</Section>
|
|
)
|
|
}
|