Dawnline 0.8.0
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions

- Every field says what is wrong as you type, in the router's own words,
  and Save refuses what the router would: UDP port when editing a server,
  MTU, keep-alive, public address, DNS for devices, person name, device
  limit, end date and data limit, device names (the next free "Phone 2"
  is offered), home services, circles, portal title, redirect and other
  addresses, defaults, update time
- Cyrillic names give Latin ids, hostnames and file names; names are
  counted in characters, the rule names the characters it refuses; end
  dates must exist on the calendar; a mistyped extra portal address is
  refused instead of dropped
- The public address is checked on the router as it is typed: points at
  this router, at another address, behind Cloudflare, or the WAN is
  private or CGNAT; the wizard says so before the first step, never
  pre-fills a private WAN address and says where its suggestion came
  from; the Connection card says when the server was last reached from
  the internet; IPv6 names and literals work throughout
- A person can be moved to another server from their page; a server's
  tunnel network can be changed in the Danger zone (devices are
  renumbered and marked "Update config"); WAN and LAN zones come from the
  router's actual devices; when the public IPv4 changed, one click puts
  the new one in
- Over the data limit or outside the allowed hours the tunnel stays
  connected and the portal explains why nothing gets through, instead of
  a silent handshake failure; Health's "devices loaded" compares the
  peers themselves, not their count
- Portal: install links for this platform, two first steps on a first
  visit, the phone's back button closes a sheet, the file goes through
  the share sheet into the app, two QR codes (AmneziaVPN camera, AmneziaWG
  and WireGuard apps), the sheet notices the first connection
- Admin: Enter submits a dialog, arrow keys walk the menus, Find in People
  ("/" focuses it), a device of a paused, ended or over-limit person says
  so, "Keep access" past its end date is said on the Overview, Allowed
  hours enforce nothing until saved, the invite card shares the link
- Health warns when another package's policy routing (mwan3, pbr) sends
  tunnel traffic past the home-device path
- CLI: person ls, device ls, log with -n, --since, --level, --src and
  --json; exit code 2 for an unknown command and 1 when health finds an
  error; person rm asks for --yes when devices would go; devices added
  from the command line get their event and "issued" marker like the
  UI's
- Three disguises: Off, Balanced and Maximum. Standard and Strong (1.0-style
  junk only, which networks learned to spot) are no longer offered; a server
  still on one keeps running and its card says to switch. A new server gets
  the strongest disguise its router can run
- Portal: setting up a device is one sheet with two steps. Get the app
  (AmneziaVPN first; AmneziaWG, and WireGuard with the disguise off, behind
  "Another app") from the store of the device in hand, with the GitHub release
  where no store has it and the version the server needs said once; then add
  the connection (open in AmneziaVPN, copy the key, share or download the
  file). A device set up from another device gets its link to take there, as a
  QR code for a phone; a phone set up from a computer also gets the connection
  as a code, one code revealed at a time so the camera cannot read the wrong one
- Portal motion: the first visit comes in once (blocks in reading order,
  meters fill, the sun rises in the logo); a repaint glides cards to their
  new places and brings changed values into focus; sheets slide up on
  phones and can be pulled down, come into focus on a computer, follow
  their content's height and turn into the next sheet in place; tabs and
  segments slide, menus, tooltips and toasts grow out of what opened them,
  copy buttons turn into a check, buttons waiting for the router spin;
  with reduced motion only the fades remain
- Portal: while a device is set up, a card at the top shows the way from
  it to the router with a light running along it; on the first connection
  the way fills green, the steps fold away and the sheet closes by itself.
  The first connection is the first fresh handshake, so it is no longer
  missed while the watcher catches up (or after new keys), and the device's
  card goes on to Connected
- Portal: QR codes are light dots on a black card, fuller on dense keys,
  with "Show a light code" for scanners that read only dark on light (every
  code switches, the choice is kept); the link and code a set-up sheet
  hands to another device open that device's set-up there at once
- Portal: Remove and New keys ask in a small alert with the action's icon;
  the open one of two cards is not a button; device names are no longer
  repeated in every line of the set-up sheet; the code card lines up with
  the rest of its card (a class clash gave it the page's padding); text
  keeps the arrow cursor, store badges and link buttons are not underlined
This commit is contained in:
Aemeath committed 2026-10-18 23:28:10 +03:00
1 parent fd9543ce68
commit 466ca6c7b0
69 files changed
+5182 -686

No files matched your search

+176 -29
View File
@@ -12,13 +12,13 @@ import { cancelButton, closeModal, confirmDialog, modal } from '../ui/modal';
import { copyText } from '../ui/files';
import { attempt, errorText, notify } from '../ui/toast';
import { input, seg, sw } from '../ui/controls';
import { card, group, liveRow, needRow, row } from '../ui/layout';
import { portalPortHelp, portHelp, rangeHelp, rangeOf, subnetOf } from '../netcheck';
import { card, firstBad, group, liveRow, needRow, row } from '../ui/layout';
import { dnsHelp, endpointProbe, hostHelp, nameHelp, portalPortHelp, portHelp, rangeHelp, rangeOf, subnetOf } from '../netcheck';
import { icon } from '../../shared/icons';
import { duration } from '../../shared/format';
import { ago, duration } from '../../shared/format';
import { accessCards } from '../interfaces';
import { checkAccess, whoReaches } from '../access';
import { methodPicker, type Method } from '../disguise';
import { defaultMethod, methodPicker } from '../disguise';
import { coreOf } from '../cores';
import { installAwg } from '../pkgs';
import { createPoller, focusInside, repaint, type Poller } from '../state/poller';
@@ -299,7 +299,7 @@ export class ServerPage {
{ type: 'button', class: 'dl-addrbar-seg main', title: 'Copy address', click: () => copyText(addr, 'Address copied') },
[icon('globe'), E('span', { class: 'dl-mono' }, addr), icon('copy')],
),
part('tunnel', [E('span', { class: 'dl-mono' }, `${coreOf(srv).label} :${srv.port}`)]),
part(coreOf(srv).id === 'awg' ? 'amneziawg' : 'tunnel', [E('span', { class: 'dl-mono' }, `${coreOf(srv).label} :${srv.port}`)]),
srv.up ? part('clock', [`up ${duration(srv.uptime)}`]) : '',
]),
// The reason the tunnel can't run at all ("can't use the network interface awg0: it exists and isn't Dawnline's").
@@ -318,7 +318,7 @@ export class ServerPage {
const dns = input(srv.dns.join(', '), { placeholder: 'This router (recommended)', class: 'cbi-input-text dl-mono' });
const people = this.st.people.filter((p) => p.server === srv.id).length;
const toggle = button(
srv.enabled ? 'Turn off' : 'Turn on',
[icon(srv.enabled ? 'pause' : 'play'), srv.enabled ? ' Turn off' : ' Turn on'],
async () => {
if (
srv.enabled &&
@@ -334,24 +334,51 @@ export class ServerPage {
},
srv.enabled ? 'negative' : 'positive',
);
const portalHost = this.st.settings.portal_host;
const nameRow = liveRow('Name', name, () => nameHelp(name.value, [], 'Shown to people in their portal and apps.'));
// Where the address points is checked on the router as it is typed (debounced).
const ep = endpointProbe(
() => ({ host: endpoint.value, port: srv.port, id: srv.id }),
(h, id, port) => api.endpointProbe(h, id, port),
() => epRow.refresh(),
{ empty: portalHost ? `Empty = the portal’s address (${portalHost}).` : 'Empty = the portal’s address.' },
);
const epRow = liveRow('Public address', endpoint, ep.help);
endpoint.addEventListener('input', ep.schedule);
ep.schedule();
const reached = srv.reached
? `Reached from the internet ${ago(srv.reached, this.st.now)}.`
: 'Never reached from the internet yet — test with a phone on mobile data.';
const dnsRow = liveRow('DNS for devices', dns, () => dnsHelp(dns.value, srv.address));
return E('div', { class: 'dl-stack gap16' }, [
card(
'Connection',
[
E('p', { class: 'dl-muted' }, 'The name people see, where devices find the router, and DNS. The port is on AmneziaWG.'),
group('router', 'Server', 'What people see', [row('Name', name, 'Shown to people in their portal and apps.')]),
group('globe', 'Devices connect to', 'Where the router answers from the internet', [
row(
'Public address',
endpoint,
'Hostname or IP of the router on the internet. A DDNS name keeps links working when your IP changes. It must not go through Cloudflare: use a DNS-only name or an IP.',
),
]),
group('file', 'For every device', 'Changing it marks devices “Update config” until they import again', [
row('DNS for devices', dns, 'Empty = this router, which sends each query where your home network would.'),
]),
group('router', 'Server', 'What people see', [nameRow]),
group(
'globe',
'Devices connect to',
'A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)',
[epRow, E('div', { class: `dl-sub ${srv.reached ? 'ok' : 'warn'}` }, reached)],
),
group('file', 'For every device', 'Changing it marks devices “Update config” until they import again', [dnsRow]),
],
[
E('span'),
button(
'Save',
() => {
const bad = firstBad([nameRow, epRow, dnsRow]);
if (bad) {
notify(bad, 'warning');
return;
}
return this.save(srv, { name: name.value, endpoint: endpoint.value, dns: dns.value });
},
'positive',
),
],
[E('span'), button('Save', () => this.save(srv, { name: name.value, endpoint: endpoint.value, dns: dns.value }), 'positive')],
),
card(
'Danger zone',
@@ -369,6 +396,21 @@ export class ServerPage {
]),
E('div', { class: 'dl-setrow-ctl' }, toggle),
]),
E('div', { class: 'dl-setrow' }, [
E('div', { class: 'dl-stack' }, [
E('span', { class: 'dl-setrow-label' }, 'Change the tunnel network'),
E(
'span',
{ class: 'dl-sub' },
`Devices have ${rangeOf(srv.subnet)}.x addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again.`,
),
]),
E(
'div',
{ class: 'dl-setrow-ctl' },
button([icon('edit'), ' Change'], () => this.changeSubnet(srv), 'negative'),
),
]),
E('div', { class: 'dl-setrow' }, [
E('div', { class: 'dl-stack' }, [
E('span', { class: 'dl-setrow-label' }, 'Remove server'),
@@ -434,6 +476,55 @@ export class ServerPage {
);
}
/** A new tunnel network: checked as you type against the router's networks, then every device renumbered. */
async changeSubnet(srv: Server) {
const taken = await attempt(() => api.serverPorts(srv.id));
if (!taken) return;
const nets = taken.networks ?? [];
const devices = this.st.people.filter((p) => p.server === srv.id).reduce((n, p) => n + p.devices.length, 0);
const range = input(rangeOf(srv.subnet), { class: 'cbi-input-text dl-mono dl-w-range' });
const rangeRow = liveRow('Address range', range, () => rangeHelp(range.value, nets, ''));
modal(
'Change the tunnel network',
[
rangeRow,
E(
'p',
{ class: 'dl-muted' },
devices
? `${devices} device${devices === 1 ? ' gets a new address and stops' : 's get new addresses and stop'} connecting until ${devices === 1 ? 'it imports its' : 'they import their'} configuration again (from their personal link or from you).`
: 'No devices on this server yet: nothing else changes.',
),
],
[
cancelButton(),
' ',
button(
'Change',
async () => {
const h = rangeRow.help();
if (h.bad) {
notify(h.text, 'warning');
return;
}
const subnet = subnetOf(range.value);
if (subnet === srv.subnet) {
closeModal();
return;
}
if (await attempt(() => api.serverUpdate(srv.id, { subnet }), 'Tunnel network changed')) {
closeModal();
if (devices) notify('Devices are marked “Update config” until they import again.', 'info', 6000);
await this.refresh();
}
},
'negative',
),
],
);
setTimeout(() => range.select(), 50);
}
async remove(srv: Server) {
const people = this.st.people.filter((p) => p.server === srv.id);
modal(
@@ -477,7 +568,7 @@ export class ServerPage {
port: d.port,
// The tunnel's first three numbers ("10.77.0"): it is that /24.
range: rangeOf(d.subnet),
preset: 'standard' as Method,
preset: defaultMethod(d.awg),
// Off by default: the portal opens a port on WAN, so it is a choice.
portal: false,
portal_port: d.portal_port || 8443,
@@ -489,7 +580,45 @@ export class ServerPage {
// The portal takes the server's port number (TCP beside UDP) until it is changed by hand.
let portalSame = !extra && state.portal_port === state.port;
const ipLinks = () => /^\d{1,3}(\.\d{1,3}){3}$/.test(state.endpoint);
const portHelpNow = () => portHelp(state.port, d.udp_taken ?? [], 'Opened on the WAN firewall automatically.');
const portHelpNow = () =>
portHelp(
state.port,
d.udp_taken ?? [],
`Opened on the WAN firewall automatically.${state.port === 4500 ? ' 4500 is IPsec’s port: most networks let it through.' : ''}`,
);
const FROM: Record<string, string> = {
ddns: 'From your DDNS name.',
cert: 'From your Let’s Encrypt certificate.',
wan: 'Your WAN address now — it may change; a DDNS name is better.',
portal: 'The portal’s address.',
};
const ep = endpointProbe(
() => ({ host: state.endpoint, port: state.port }),
(h, _id, port) => api.endpointProbe(h, '', port),
() => epRow?.refresh(),
{ idle: () => (state.endpoint === d.endpoint && d.endpoint_from ? (FROM[d.endpoint_from] ?? '') : '') },
);
let epRow: ReturnType<typeof liveRow> | null = null;
// Nobody on the internet reaches a private or CGNAT address: say it before the first step.
const wanNote =
d.wan_kind === 'cgnat' || d.wan_kind === 'private'
? needRow(
'alert',
'warn',
d.wan_kind === 'cgnat' ? 'Your router has no public address (CGNAT)' : `Your router is behind another router (WAN ${d.wan_ip})`,
d.wan_kind === 'cgnat'
? 'The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address.'
: 'Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here.',
'',
)
: '';
const restartNote =
d.awg_state?.tools && d.awg_state.handler === false
? E('div', { class: 'dl-note warn' }, [
icon('alert'),
E('span', {}, 'Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started.'),
])
: '';
const rangeHelpNow = () => rangeHelp(state.range, d.networks ?? [], rangeOf(d.subnet));
const portalHelpNow = () => portalPortHelp(state.portal_port, d.tcp_taken ?? [], ipLinks());
const root = E('div', { class: 'dl-wizard' });
@@ -513,18 +642,36 @@ export class ServerPage {
E(
'p',
{ class: 'dl-muted' },
'Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.',
extra
? 'One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page.'
: 'Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.',
),
group('router', 'Server', 'What people see', [row('Name', field('name'), 'Shown to people in their portal and apps.')]),
group('globe', 'Devices connect to', 'Where the router answers from the internet', [
row(
'Public address',
field('endpoint', { placeholder: 'vpn.example.com', class: 'cbi-input-text dl-mono' }),
'Hostname or IP address of your router on the internet. Not through Cloudflare: use a DNS-only name or an IP.',
),
group('router', 'Server', 'What people see', [
liveRow('Name', field('name'), () => nameHelp(state.name, [], 'Shown to people in their portal and apps.')),
]),
group(
'globe',
'Devices connect to',
'A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT',
[
(() => {
const el = field('endpoint', { placeholder: 'vpn.example.com', class: 'cbi-input-text dl-mono' });
epRow = liveRow('Public address', el, ep.help);
el.addEventListener('input', ep.schedule);
ep.schedule();
return epRow;
})(),
],
),
wanNote,
restartNote,
]),
check: () => (!state.endpoint ? 'Fill in the public address.' : null),
check: () => {
const n = nameHelp(state.name);
if (n.bad) return `Name: ${n.text}`;
const h = hostHelp(state.endpoint, state.port);
return h.bad ? `Public address: ${h.text}` : null;
},
};
const awgPage: Page = {
id: 'awg',