feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and Manager ports, the Shell page is an entry of the page menu, and the web interface passes its lint.
Release / release (push) Successful in 26s
Release / release (push) Successful in 26s
This commit is contained in:
1 parent
4b5318c676
commit
0cec95c19b
72 files changed
+910
-861
No files matched your search
@@ -3,12 +3,15 @@ import Edit from '@mui/icons-material/Edit'
|
||||
import Refresh from '@mui/icons-material/Refresh'
|
||||
import { Alert, Box, Button, Chip, Stack } from '@mui/material'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Board, BoardButtons, useBoard, type BoardPanel } from './PanelBoard.tsx'
|
||||
import { Board, BoardButtons, type BoardPanel } from './PanelBoard.tsx'
|
||||
import { useBoard } from './useBoard.ts'
|
||||
import RemoteAccessDialog from './RemoteAccessDialog.tsx'
|
||||
import Toolbar from './Toolbar.tsx'
|
||||
import WireGuardConfigDialog from './WireGuardConfigDialog.tsx'
|
||||
import WireGuardPeers from './WireGuardPeers.tsx'
|
||||
import { Copyable, Grid, IPSEC_HEADS, Pairs, bytes, ipsecRows, text } from './ServerPanel.tsx'
|
||||
import { Copyable, Grid, Pairs } from './ServerPanel.tsx'
|
||||
import { bytes, text } from './format.ts'
|
||||
import { IPSEC_HEADS, ipsecRows } from './ipsec.ts'
|
||||
import {
|
||||
DETAILS_SHAPE, REMOTE_ACCESS_LABELS, REMOTE_ACCESS_SECTION_SHAPES, REMOTE_ACCESS_SHAPE, STATUS_SHAPE, USERS_SHAPE, request,
|
||||
type RemoteAccess, type RemoteAccessSystem, type RouterDetails, type RouterStatus, type Users,
|
||||
@@ -41,7 +44,7 @@ export default function RemoteAccessPanel(props: { system: RemoteAccessSystem })
|
||||
const [access, setAccess] = useState<RemoteAccess | null>(null)
|
||||
const [status, setStatus] = useState<RouterStatus | null>(null)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [busy, setBusy] = useState(true)
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [showConfig, setShowConfig] = useState(false)
|
||||
const board = useBoard(LAYOUT_KEYS[props.system])
|
||||
@@ -52,30 +55,33 @@ export default function RemoteAccessPanel(props: { system: RemoteAccessSystem })
|
||||
// IKEv2's: the server's details with its IPsec SAs and connections, those of IKEv2 access being all but site to site.
|
||||
const ikev2 = props.system === 'p2s'
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
setBusy(true)
|
||||
try {
|
||||
const [nextAccess, nextStatus, nextUsers, nextDetails] = await Promise.all([
|
||||
request<RemoteAccess>('GET', '/remote-access', REMOTE_ACCESS_SHAPE),
|
||||
request<RouterStatus>('GET', '/status/full', STATUS_SHAPE),
|
||||
wireguard ? request<Users>('GET', '/users', USERS_SHAPE) : null,
|
||||
wireguard || ikev2 ? request<RouterDetails>('GET', '/config', DETAILS_SHAPE) : null,
|
||||
])
|
||||
setAccess(nextAccess)
|
||||
setStatus(nextStatus)
|
||||
setUsers(nextUsers)
|
||||
setDetails(nextDetails)
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setError((caught as Error).message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
/** Reads the access of the system with what it shows; the state changes only once the server answers. */
|
||||
const read = useCallback(async () => {
|
||||
await Promise.all([
|
||||
request<RemoteAccess>('GET', '/remote-access', REMOTE_ACCESS_SHAPE),
|
||||
request<RouterStatus>('GET', '/status/full', STATUS_SHAPE),
|
||||
wireguard ? request<Users>('GET', '/users', USERS_SHAPE) : null,
|
||||
wireguard || ikev2 ? request<RouterDetails>('GET', '/config', DETAILS_SHAPE) : null,
|
||||
])
|
||||
.then(([nextAccess, nextStatus, nextUsers, nextDetails]) => {
|
||||
setAccess(nextAccess)
|
||||
setStatus(nextStatus)
|
||||
setUsers(nextUsers)
|
||||
setDetails(nextDetails)
|
||||
setError(null)
|
||||
}, (caught) => setError((caught as Error).message))
|
||||
.finally(() => setBusy(false))
|
||||
}, [wireguard, ikev2])
|
||||
|
||||
/** Reads the access again, busy until the server answers. */
|
||||
const refresh = useCallback(() => {
|
||||
setBusy(true)
|
||||
return read()
|
||||
}, [read])
|
||||
|
||||
useEffect(() => {
|
||||
void refresh()
|
||||
}, [refresh])
|
||||
void read()
|
||||
}, [read])
|
||||
|
||||
async function save(settings: Record<string, unknown>) {
|
||||
await request('PUT', `/remote-access/${props.system}`, REMOTE_ACCESS_SECTION_SHAPES[props.system], settings)
|
||||
|
||||
Reference in new issue
Block a user