feature: the VPN, the router, the name server and WebDAV are components switched on the System tab and installed on demand, Caddy from the Ubuntu archive is a dependency and serves every HTTP and HTTPS port, HTTPS is chosen at install, its certificate is of the Servers Issuing CA or self-signed by default, of ACME or of another CA, the issuing CAs are in one tab, a locked account is unlocked again, the name of a CA is fixed once the CA exists, and a run of setup is no longer cut short by a change.
Release / release (push) Failing after 8s

This commit is contained in:
slawek committed 2026-11-24 05:51:27 +01:00
1 parent a649331aa2
commit a7bfabcb89
97 files changed
+4498 -1834

No files matched your search

+55 -27
View File
@@ -11,15 +11,19 @@ import { useEffect, useState, type FormEvent } from 'react'
import OtpDialog from './OtpDialog.tsx'
import PasskeyDialog from './PasskeyDialog.tsx'
import ProfileDialog from './ProfileDialog.tsx'
import { Section } from './ServerPanel.tsx'
import { Board, BoardButtons, useBoard, type BoardPanel } from './PanelBoard.tsx'
import Toolbar from './Toolbar.tsx'
import { ACCOUNT_SHAPE, CODE_PATTERN, USER_SHAPE, request, type Account, type User } from './api.ts'
/** The localStorage key of the page's layout. */
const LAYOUT_KEY = 'linux-manager-ui.account-layout'
/**
* The account of the signed-in user, from the server's /account, in two columns: the details with Change password,
* which opens the password dialog, and the passkeys in the first row, the enrolment for one-time passwords and the
* OpenVPN and the Apple VPN profile of a user with a certificate in the second. Each change but the removal of a
* passkey takes the current password and, for an enrolled user, a current code. A changed password ends the session,
* through onPasswordChanged.
* through onPasswordChanged. The panels are on a PanelBoard whose layout is kept in the browser.
*/
export default function AccountPanel(props: { onPasswordChanged: () => void }) {
const [account, setAccount] = useState<Account | null>(null)
@@ -35,6 +39,7 @@ export default function AccountPanel(props: { onPasswordChanged: () => void }) {
const [addingPasskey, setAddingPasskey] = useState(false)
const [profile, setProfile] = useState<'openvpn' | 'apple' | null>(null)
const [passkeyError, setPasskeyError] = useState<string | null>(null)
const board = useBoard(LAYOUT_KEY)
useEffect(() => {
request<Account>('GET', '/account', ACCOUNT_SHAPE)
@@ -100,20 +105,28 @@ export default function AccountPanel(props: { onPasswordChanged: () => void }) {
['One-time passwords', account.otp ? 'enrolled' : 'not enrolled'],
]
return (
<Box sx={{ display: 'grid', gap: 2, gridTemplateColumns: { xs: '1fr', md: '1fr 1fr' }, alignItems: 'start' }}>
<Section title="Account">
<Box component="dl" sx={{ display: 'grid', gridTemplateColumns: 'max-content 1fr', columnGap: 2, rowGap: 0.5, m: 0 }}>
{rows.map(([label, value]) => (
<Box key={label} sx={{ display: 'contents' }}>
<Typography component="dt" variant="body2" color="text.secondary">{label}</Typography>
<Typography component="dd" variant="body2" sx={{ m: 0 }}>{value}</Typography>
</Box>
))}
</Box>
<Button variant="outlined" startIcon={<Password />} sx={{ mt: 2 }} onClick={() => setChangingPassword(true)}>Change password</Button>
</Section>
<Section title="Passkeys">
const panels: BoardPanel[] = [
{
id: 'account',
title: 'Account',
content: (
<>
<Box component="dl" sx={{ display: 'grid', gridTemplateColumns: 'max-content 1fr', columnGap: 2, rowGap: 0.5, m: 0 }}>
{rows.map(([label, value]) => (
<Box key={label} sx={{ display: 'contents' }}>
<Typography component="dt" variant="body2" color="text.secondary">{label}</Typography>
<Typography component="dd" variant="body2" sx={{ m: 0 }}>{value}</Typography>
</Box>
))}
</Box>
<Button variant="outlined" startIcon={<Password />} sx={{ mt: 2 }} onClick={() => setChangingPassword(true)}>Change password</Button>
</>
),
},
{
id: 'passkeys',
title: 'Passkeys',
content: (
<Stack sx={{ gap: 2, alignItems: 'flex-start' }}>
{passkeyError && <Alert severity="error" sx={{ whiteSpace: 'pre-line', alignSelf: 'stretch' }}>{passkeyError}</Alert>}
{account.passkeys.length === 0
@@ -144,8 +157,12 @@ export default function AccountPanel(props: { onPasswordChanged: () => void }) {
)}
<Button variant="outlined" startIcon={<Key />} onClick={() => setAddingPasskey(true)}>Add a passkey</Button>
</Stack>
</Section>
<Section title="One-time passwords">
),
},
{
id: 'otp',
title: 'One-time passwords',
content: (
<Stack sx={{ gap: 2, alignItems: 'flex-start' }}>
<Typography variant="body2" color="text.secondary">
{account.otp
@@ -154,15 +171,26 @@ export default function AccountPanel(props: { onPasswordChanged: () => void }) {
</Typography>
<Button variant="outlined" onClick={() => setEnrolling(true)}>{account.otp ? 'Replace the authenticator' : 'Enrol'}</Button>
</Stack>
</Section>
{account.certificate && (
<Section title="VPN profiles">
<Stack sx={{ gap: 2, alignItems: 'flex-start' }}>
<Button variant="outlined" startIcon={<Download />} onClick={() => setProfile('openvpn')}>Download the OpenVPN profile</Button>
<Button variant="outlined" startIcon={<Apple />} onClick={() => setProfile('apple')}>Download the Apple VPN profile (IKEv2)</Button>
</Stack>
</Section>
)}
),
},
...(account.certificate ? [{
id: 'profiles',
title: 'VPN profiles',
content: (
<Stack sx={{ gap: 2, alignItems: 'flex-start' }}>
<Button variant="outlined" startIcon={<Download />} onClick={() => setProfile('openvpn')}>Download the OpenVPN profile</Button>
<Button variant="outlined" startIcon={<Apple />} onClick={() => setProfile('apple')}>Download the Apple VPN profile (IKEv2)</Button>
</Stack>
),
}] : []),
]
return (
<Box component="section">
<Toolbar description="The account you are signed in with.">
<BoardButtons board={board} />
</Toolbar>
<Board board={board} panels={panels} />
<Dialog open={changingPassword} onClose={closePasswordDialog} fullWidth maxWidth="xs">
<form onSubmit={changePassword}>
<DialogTitle>Change password</DialogTitle>