Reworks how devices connect to an OpenChamber server, end to end. Pairing v2: - One-time pairing links/QR codes (openchamber://connect?v=2) carrying a set of transport candidates (LAN/tunnel/relay) and a single-use secret redeemed server-side; no tokens embedded in links - Add-a-device dialog written for first-time users: intent-based transport choice (Anywhere / Home network only / This computer only) with plain-language descriptions, transparent fallback checkboxes, server-authoritative LAN detection, high-res QR dialog - Private relay folded into pairing as a transport candidate with a demand-driven lifecycle (enables when a relay device is paired, disables when none remain) Multi-transport devices: - A saved device holds all its transports and one token; mobile re-probes on connect, resume, and network change and hot-switches LAN<->relay seamlessly (no re-pairing, no remount, session preserved) - Desktop can import relay pairing links, switch to relay hosts through the E2EE tunnel, and restore a relay default host after relaunch Device management: - Device list (web + desktop) shows live per-device connectivity with the active transport (Connected - Local network / Relay) and platform badges (iOS/Android/macOS/Windows/Linux) - One physical device = one record: stable per-install dedupe keys across pairing and password re-login; typed pairing label names the device, paired devices name the connection by the issuing server hostname - Trusted desktop-local client manages all devices (list, revoke, clear revoked); relay host reaps dead client sockets after 3 missed keepalives Android: - LAN transport unblocked (cleartext + mixed content, mirroring iOS ATS exceptions); resume re-probe retries through network flux and silently auto-reconnects from a disconnected state
72 lines
2.5 KiB
TypeScript
72 lines
2.5 KiB
TypeScript
import React from 'react';
|
|
import { Dialog } from '@base-ui/react/dialog';
|
|
import { cn } from '@/lib/utils';
|
|
import { useI18n } from '@/lib/i18n';
|
|
import { SettingsView } from './SettingsView';
|
|
|
|
interface SettingsWindowProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
}
|
|
|
|
/**
|
|
* Settings rendered as a centered window with blurred backdrop.
|
|
* Used for desktop and web (non-mobile) environments.
|
|
*/
|
|
export const SettingsWindow: React.FC<SettingsWindowProps> = ({ open, onOpenChange }) => {
|
|
const { t } = useI18n();
|
|
const descriptionId = React.useId();
|
|
|
|
const hasOpenFloatingMenu = React.useCallback(() => {
|
|
if (typeof document === 'undefined') {
|
|
return false;
|
|
}
|
|
|
|
return Boolean(
|
|
document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]')
|
|
);
|
|
}, []);
|
|
|
|
return (
|
|
<Dialog.Root
|
|
open={open}
|
|
onOpenChange={(next) => {
|
|
if (!next && hasOpenFloatingMenu()) return;
|
|
onOpenChange(next);
|
|
}}
|
|
>
|
|
<Dialog.Portal>
|
|
<Dialog.Backdrop
|
|
className={cn(
|
|
'fixed inset-0 z-50 bg-black/50 dark:bg-black/75',
|
|
'transition-opacity duration-150 ease-out',
|
|
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0',
|
|
)}
|
|
/>
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center pointer-events-none">
|
|
<Dialog.Popup
|
|
aria-describedby={descriptionId}
|
|
className={cn(
|
|
'relative pointer-events-auto',
|
|
'w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]',
|
|
'rounded-xl border shadow-none overflow-hidden origin-center',
|
|
'bg-background',
|
|
'transition-all duration-150 ease-out',
|
|
'data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]',
|
|
'data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]',
|
|
// Dim this window when a nested dialog (e.g. "Add a device") opens
|
|
// on top of it, mirroring how the page behind a dialog is dimmed.
|
|
'data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]',
|
|
)}
|
|
>
|
|
<Dialog.Description id={descriptionId} className="sr-only">
|
|
{t('settings.window.description')}
|
|
</Dialog.Description>
|
|
<SettingsView onClose={() => onOpenChange(false)} isWindowed />
|
|
</Dialog.Popup>
|
|
</div>
|
|
</Dialog.Portal>
|
|
</Dialog.Root>
|
|
);
|
|
};
|