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

+50 -18
View File
@@ -1,27 +1,44 @@
import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, Stack, Switch, Typography } from '@mui/material'
import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, MenuItem, Stack, TextField, Typography } from '@mui/material'
import { useState, type FormEvent } from 'react'
import type { HttpsSettings } from './api.ts'
import { HTTPS_CERTIFICATES, type HttpsCertificateSource, type HttpsChange, type HttpsSettings } from './api.ts'
/** The labels of the sources of the server's certificate. */
export const CERTIFICATE_LABELS: Record<HttpsCertificateSource, string> = {
acme: 'ACME',
'self-signed': 'Self-signed',
ca: 'Servers Issuing CA of the server\'s PKI',
external: 'Another CA: a CSR signed there, or a PFX',
}
/**
* A dialog that switches the CA of the certificates Caddy obtains on the server: Let's Encrypt's staging environment,
* https.acme_staging, or Caddy's default CAs. onSave sends acme_staging; the dialog closes when it succeeds and shows
* the server's message when it fails.
* A dialog that edits where the certificate of the server's FQDN comes from, https.certificate: the ACME CA of
* AcmeSettingsDialog, a self-signed certificate valid for https.self_signed_days, the Servers Issuing CA, or another
* CA's certificate, imported on the Server tab of the Certificates page; self-signed is selected while the first setup
* has not chosen one. onSave sends the source and the validity
* only; the dialog closes when it succeeds and shows the server's message when it fails.
*/
export default function HttpsSettingsDialog(props: {
current: HttpsSettings
onSave: (settings: { acme_staging: boolean }) => Promise<void>
onSave: (settings: HttpsChange) => Promise<void>
onCancel: () => void
}) {
const [staging, setStaging] = useState(props.current.acme_staging)
const [certificate, setCertificate] = useState<HttpsCertificateSource>(props.current.certificate || 'self-signed')
const [days, setDays] = useState(String(props.current.self_signed_days))
const [saving, setSaving] = useState(false)
const [error, setError] = useState<string | null>(null)
const daysProblem = /^\d{1,4}$/.test(days) && Number(days) >= 1 && Number(days) <= 3650 ? '' : '1 to 3650 days.'
const blocked = certificate === 'self-signed' && daysProblem !== ''
async function submit(event: FormEvent) {
event.preventDefault()
if (blocked) {
return
}
setSaving(true)
setError(null)
try {
await props.onSave({ acme_staging: staging })
await props.onSave(certificate === 'self-signed' ? { certificate, self_signed_days: Number(days) } : { certificate })
} catch (caught) {
setError((caught as Error).message)
setSaving(false)
@@ -30,24 +47,39 @@ export default function HttpsSettingsDialog(props: {
return (
<Dialog open onClose={(_event, reason) => reason !== 'backdropClick' && props.onCancel()} maxWidth="sm" fullWidth slotProps={{ paper: { component: 'form', onSubmit: submit } }}>
<DialogTitle>HTTPS settings</DialogTitle>
<DialogTitle>HTTPS certificate</DialogTitle>
<DialogContent>
<Stack sx={{ gap: 2, pt: 1 }}>
{error && <Alert severity="error" sx={{ whiteSpace: 'pre-line' }}>{error}</Alert>}
<FormControlLabel control={<Switch checked={staging} onChange={(event) => setStaging(event.target.checked)} />} label="Let's Encrypt staging CA" />
<Typography variant="body2" color="text.secondary">
{staging
? 'Caddy takes every certificate from Let\'s Encrypt\'s staging environment, the web sites\' included. Its rate limits are far higher, but no browser trusts its certificates: for routers rebuilt often, for tests only.'
: 'Caddy takes its certificates from Let\'s Encrypt, and from ZeroSSL when Let\'s Encrypt refuses, such as for its limit of 5 certificates a week for the same name.'}
</Typography>
{staging !== props.current.acme_staging && (
<Alert severity="info">The server runs its setup again, which applies the change.</Alert>
<TextField select label="Certificate of the server" value={certificate} onChange={(event) => setCertificate(event.target.value as HttpsCertificateSource)}>
{HTTPS_CERTIFICATES.map((item) => <MenuItem key={item} value={item}>{CERTIFICATE_LABELS[item]}</MenuItem>)}
</TextField>
{certificate === 'acme' && (
<Typography variant="body2" color="text.secondary">
Caddy takes the certificate from the ACME CA, which its own settings choose.
</Typography>
)}
{certificate === 'self-signed' && (
<TextField
label="Validity (days)"
value={days}
error={daysProblem !== ''}
helperText={daysProblem || 'The server makes a new one when a third of it is left.'}
slotProps={{ htmlInput: { inputMode: 'numeric' } }}
onChange={(event) => setDays(event.target.value.trim())}
/>
)}
{certificate === 'external' && (
<Typography variant="body2" color="text.secondary">
The certificate is imported on this tab, from a CSR the server makes or as a PFX file. The server serves a self-signed certificate until then.
</Typography>
)}
<Alert severity="info">The server runs its setup again, which applies the change.</Alert>
</Stack>
</DialogContent>
<DialogActions>
<Button onClick={props.onCancel} disabled={saving}>Cancel</Button>
<Button type="submit" variant="contained" disabled={saving || staging === props.current.acme_staging}>Save</Button>
<Button type="submit" variant="contained" disabled={saving || blocked}>Save</Button>
</DialogActions>
</Dialog>
)