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

+37 -18
View File
@@ -14,7 +14,7 @@ import LogsPanel from './LogsPanel.tsx'
import MetricsPanel from './MetricsPanel.tsx'
import DockerPanel from './DockerPanel.tsx'
import DnsPanel from './DnsPanel.tsx'
import PageMenu, { CA_PATH, DOCKER_PATH, REMOTE_ACCESS_PATH, SHELL_PATH, SITES_PATH, SITE_TO_SITE_PATH, USERS_PATH, USER_PATH } from './PageMenu.tsx'
import PageMenu, { CA_PATH, DNS_PATH, DOCKER_PATH, REMOTE_ACCESS_PATH, SHELL_PATH, SITES_PATH, SITE_TO_SITE_PATH, USERS_PATH, USER_PATH } from './PageMenu.tsx'
import NetworkPanel from './NetworkPanel.tsx'
import RemoteAccessPanel from './RemoteAccessPanel.tsx'
import ServerPanel from './ServerPanel.tsx'
@@ -31,7 +31,7 @@ import SiteToSiteStatusPanel from './SiteToSiteStatusPanel.tsx'
import ThemeMenu from './ThemeMenu.tsx'
import UsersPanel from './UsersPanel.tsx'
import {
ACCOUNT_SHAPE, DETAILS_SHAPE, SESSION_EXPIRED, SESSION_SHAPE, request, type Account, type Info, type RemoteAccessSystem,
ACCOUNT_SHAPE, DETAILS_SHAPE, INFO_SHAPE, SESSION_EXPIRED, SESSION_SHAPE, request, type Account, type Info, type RemoteAccessSystem,
type RouterDetails, type Session,
} from './api.ts'
@@ -39,16 +39,16 @@ import {
type View = 'router' | 'metrics' | 'logs' | 'backup' | 'system'
type UsersView = 'users' | 'groups' | 'service-accounts'
type SiteToSiteView = 'status' | 'network' | 'connections'
type SitesView = 'sites' | 'files' | 'dns'
type SitesView = 'sites' | 'files'
/** The help topic of each tab of the Web Sites page. */
const SITES_TOPICS: Record<SitesView, string> = { sites: 'sites.md', files: 'site-files.md', dns: 'dns.md' }
const SITES_TOPICS: Record<SitesView, string> = { sites: 'sites.md', files: 'site-files.md' }
/** The prefix of the sessionStorage keys of the pages the account and the shell page were opened from, by their paths. */
const RETURN_KEY = 'linux-manager-ui.return:'
/** The pages of an administrator besides Router, which every other path shows. */
const PAGE_PATHS = [USER_PATH, USERS_PATH, SITE_TO_SITE_PATH, REMOTE_ACCESS_PATH, CA_PATH, SITES_PATH, DOCKER_PATH, SHELL_PATH]
const PAGE_PATHS = [USER_PATH, USERS_PATH, SITE_TO_SITE_PATH, REMOTE_ACCESS_PATH, CA_PATH, SITES_PATH, DNS_PATH, DOCKER_PATH, SHELL_PATH]
/** The help topic of each page, a document of /docs; the Router, the Identities and the Web Sites page have one per tab. */
const HELP_TOPICS: Record<string, string> = {
@@ -56,6 +56,7 @@ const HELP_TOPICS: Record<string, string> = {
[SITE_TO_SITE_PATH]: 'site-to-site.md',
[REMOTE_ACCESS_PATH]: 'remote-access.md',
[CA_PATH]: 'certificates.md',
[DNS_PATH]: 'dns.md',
[DOCKER_PATH]: 'docker.md',
[SHELL_PATH]: 'shell.md',
}
@@ -68,7 +69,7 @@ const HELP_KEY = 'linux-manager-ui.help'
* every path, it then shows the user's own account; at USERS_PATH the server's users, groups or service accounts; at
* SITE_TO_SITE_PATH its site-to-site connections, their state and its network with its routes; at REMOTE_ACCESS_PATH its IKEv2, OpenVPN and
* WireGuard access; at CA_PATH its certificates; at SITES_PATH its web
* sites, the files of a site, opened from the sites too, and its name server; at DOCKER_PATH the state of Docker; at SHELL_PATH a shell on the server; otherwise the state of the server, with the update information of its packages in
* sites and the files of a site, opened from the sites too; at DNS_PATH its name server, while it is on; at DOCKER_PATH the state of Docker; at SHELL_PATH a shell on the server; otherwise the state of the server, with the update information of its packages in
* the Status panel, its metrics, its logs, its backups or the updates of its system's packages. A page shows one tab at a time, each read only while shown. An
* administrator switches pages with the page menu at the right end of the header; the button with the user's name,
* left of Sign out, opens the user's own account, and an administrator's shell button, left of it, the shell; pressed
@@ -86,12 +87,17 @@ export default function App(props: { info: Info }) {
const [sitesView, setSitesView] = useState<SitesView>('sites')
const [filesSite, setFilesSite] = useState<string | null>(null)
const [session, setSession] = useState<Session | null | undefined>(undefined)
// /api/info again once signed in, as the version is told only with a session.
const [info, setInfo] = useState<Info>(props.info)
const [role, setRole] = useState<{ name: string; admin: boolean } | null>(null)
// The router and the VPN components as router.enabled and vpn.enabled of /config, and whether Docker is installed;
// null while not known, when every page shows.
const [components, setComponents] = useState<{ router: boolean; vpn: boolean; docker: boolean } | null>(null)
const [components, setComponents] = useState<{ router: boolean; vpn: boolean; dns: boolean; docker: boolean } | null>(null)
// Raised by the System tab's components, so that the pages follow a component switched there.
const [componentsRead, setComponentsRead] = useState(0)
const routerOff = components?.router === false
const vpnOff = components?.vpn === false
const dnsOff = components?.dns === false
const dockerMissing = components?.docker === false
const page = PAGE_PATHS.find((path) => path === window.location.pathname) ?? '/'
const userPage = page === USER_PATH
@@ -137,6 +143,7 @@ export default function App(props: { info: Info }) {
request<Account>('GET', '/account', ACCOUNT_SHAPE)
.then((account) => setRole({ name: session.name, admin: account.admin }))
.catch(() => setRole({ name: session.name, admin: false }))
request<Info>('GET', '/info', INFO_SHAPE).then(setInfo).catch(() => undefined)
}, [session])
useEffect(() => {
@@ -147,10 +154,11 @@ export default function App(props: { info: Info }) {
.then((details) => setComponents({
router: details.configuration.router?.enabled === true,
vpn: details.configuration.vpn?.enabled === true,
dns: details.configuration.dns?.enabled === true,
docker: details.docker.installed,
}))
.catch(() => setComponents(null))
}, [admin])
}, [admin, componentsRead])
/** Opens the page of the path, keeping the page it was opened from in sessionStorage, or returns to that page from it. */
function toggle(path: string) {
@@ -184,14 +192,16 @@ export default function App(props: { info: Info }) {
<Typography variant="h5" component="h1">
Ubuntu Linux Manager
</Typography>
<Typography variant="caption" color="text.secondary" sx={{ fontFamily: 'monospace' }}>
{props.info.version ?? 'development'}
</Typography>
{session && (
<Typography variant="caption" color="text.secondary" sx={{ fontFamily: 'monospace' }}>
{info.version ?? 'development'}
</Typography>
)}
</Stack>
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
Server status page:{' '}
{props.info.status_url
? <Link href={props.info.status_url} target="_blank" rel="noreferrer">{props.info.status_url}</Link>
{info.status_url
? <Link href={info.status_url} target="_blank" rel="noreferrer">{info.status_url}</Link>
: <b>not configured</b>}
</Typography>
</Box>
@@ -244,7 +254,7 @@ export default function App(props: { info: Info }) {
</Tooltip>
)}
{session && admin && (
<PageMenu path={page} hidden={[...(vpnOff ? [REMOTE_ACCESS_PATH] : []), ...(dockerMissing ? [DOCKER_PATH] : [])]} />
<PageMenu path={page} hidden={[...(vpnOff ? [REMOTE_ACCESS_PATH] : []), ...(dnsOff ? [DNS_PATH] : []), ...(dockerMissing ? [DOCKER_PATH] : [])]} />
)}
</Stack>
</Stack>
@@ -263,7 +273,6 @@ export default function App(props: { info: Info }) {
<Tabs value={sitesView} onChange={(_event, next: SitesView) => setSitesView(next)} sx={{ mb: 3, borderBottom: 1, borderColor: 'divider' }}>
<Tab value="sites" label="Sites" />
<Tab value="files" label="Files" />
<Tab value="dns" label="DNS" />
</Tabs>
{sitesView === 'sites' && (
<SitesPanel
@@ -274,7 +283,17 @@ export default function App(props: { info: Info }) {
/>
)}
{sitesView === 'files' && <SiteFiles key={filesSite ?? ''} site={filesSite} onSite={setFilesSite} />}
{sitesView === 'dns' && <DnsPanel />}
</>
)}
{session && admin && page === DNS_PATH && dnsOff && (
<Typography color="text.secondary">
The name server is off on this server: it is switched on on the System tab of the Server page.
</Typography>
)}
{session && admin && page === DNS_PATH && !dnsOff && (
<>
<Typography variant="h6" component="h2" sx={{ mb: 2 }}>DNS</Typography>
<DnsPanel />
</>
)}
{session && admin && page === DOCKER_PATH && dockerMissing && (
@@ -294,7 +313,7 @@ export default function App(props: { info: Info }) {
)}
{session && admin && page === REMOTE_ACCESS_PATH && vpnOff && (
<Typography color="text.secondary">
The VPN is off on this server: IKEv2, OpenVPN and WireGuard need vpn.enabled in the configuration.
The VPN is off on this server: it is switched on on the System tab of the Server page.
</Typography>
)}
{session && admin && page === REMOTE_ACCESS_PATH && !vpnOff && (
@@ -344,7 +363,7 @@ export default function App(props: { info: Info }) {
{view === 'metrics' && <MetricsPanel />}
{view === 'logs' && <LogsPanel />}
{view === 'backup' && <BackupPanel />}
{view === 'system' && <SystemPanel />}
{view === 'system' && <SystemPanel onComponentsChange={() => setComponentsRead((value) => value + 1)} />}
</>
)}
</Container>