Dawnline 0.5.0
Build packages / Version (push) Waiting to run

- Where people connect from is a globe map now: live arcs from each
  person to the server, grey ones for the last 24 h, 7 or 30 days, avatars
  instead of dots, the server's own marker, and a light map in light mode;
  it zooms to fit the people shown and follows them as they come and go
- Markers that overlap move apart with a pointer to their spot; people
  next to the server fold into a count on it; a click zooms in and opens a
  floating card (never clipped by the map), closing flies back
- The person page maps where they connected from, older places fading;
  the device panel lists its places in order, and connections from the LAN
  or through the router's own address stay off the maps ("LAN" in grey)
- Setup and new servers check the UDP port (taken by another program, a
  forward or another server) and the subnet (three numbers + .x, a private
  range not in use) as you type; the default port is 4500
- The personal portal can share the server's port number (TCP beside UDP);
  its port is checked against forwards and other services
- A new server comes up at once: the kernel module is loaded and the
  network restarted when OpenWrt doesn't know AmneziaWG yet
- A turned-off server is a state of its own: no "tunnel down" or DNS
  warnings, "Turned off" in yellow, a white Turn on, and people on it are
  not shown as paused
- Pause everyone is removed: turning a server off does the same (a router
  left paused keeps its servers off after the update)
- People: a stopped person's card fades and says why across its bottom,
  with the one action that lifts it (Resume, +10 GB, Extend 1 month);
  people held by a limit or end date sort below the others, paused last
- The person page shows the state as text ("Paused") with a Resume
  button, also while their server is off
- The portal tells a paused or ended person just that, even with the
  server off, and lets them change nothing until the admin lifts it (the
  router refuses too); its notices look like Overview's
- Automatic MTU: with the field empty the tunnel, computers and routers
  get 1380 minus AmneziaWG S4 (1368 on Maximum), phones and tablets 1280;
  a typed MTU still caps phones and tablets at 1280, and servers on the
  old default 1380 move to automatic (phones and tablets get "Update
  config", their old files keep working)
- Only procd's agent runs: a second copy (started by hand or left over)
  refuses to start or is ended within 5 minutes, so no more stray paused
  and resumed events; a device that leaves the tunnel is offline at once
- The installer picks the newest release (it took the lowest), DNS
  lookups can't hang, and tooltips and floating cards close on scroll and
  on leaving the page
This commit is contained in:
Aemeath committed 2026-10-17 01:03:23 +03:00
1 parent 29b1d7dfd7
commit 972e522518
60 files changed
+1966 -636

No files matched your search

+57 -34
View File
@@ -12,7 +12,8 @@ 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, needRow, row } from '../ui/layout';
import { card, group, liveRow, needRow, row } from '../ui/layout';
import { portalPortHelp, portHelp, rangeHelp, rangeOf, subnetOf } from '../netcheck';
import { icon } from '../../shared/icons';
import { duration } from '../../shared/format';
import { accessCards } from '../interfaces';
@@ -158,7 +159,7 @@ export class ServerPage {
this.paint();
},
},
[E('i', { class: `dot ${x.up ? 'ok' : 'bad'}` }), E('b', {}, x.name)],
[E('i', { class: `dot ${!x.enabled ? 'warn' : x.up ? 'ok' : 'bad'}` }), E('b', {}, x.name)],
),
),
E('button', { type: 'button', class: 'dl-srvtab add', click: () => this.addServer() }, [icon('plus'), 'Add server']),
@@ -264,22 +265,16 @@ export class ServerPage {
/** Name and state, the address bar, and the page actions. */
head(srv: Server): HTMLElement {
const st = this.st;
const part = (ic: string, body: (Node | string)[]) => E('span', { class: 'dl-addrbar-seg' }, [icon(ic), ...body]);
const addr = srv.endpoint || '—';
// "Turn on" while the server is off (turning off lives in Connection; the same
// button also lifts an old router-wide pause).
const off = !srv.enabled || st.settings.paused_all;
// "Turn on" while the server is off (turning off lives in Connection).
const actions = E('div', { class: 'dl-actions' }, [
off
!srv.enabled
? button(
[icon('play'), ' Turn on'],
async () => {
if (st.settings.paused_all && !(await attempt(() => api.pauseAll(false)))) return;
if (!srv.enabled) await this.save(srv, { enabled: '1' }, 'Server turned on');
else await this.refresh();
},
'positive',
() => this.save(srv, { enabled: '1' }, 'Server turned on'),
// White, as the other main actions (Add person).
'add',
)
: '',
]);
@@ -289,10 +284,10 @@ export class ServerPage {
E('h2', { class: 'dl-h1' }, srv.name),
E(
'span',
{ class: `dl-pill ${!srv.enabled ? 'off' : srv.up ? 'ok' : 'bad'}` },
// Off on purpose is a warning (yellow), not a failure (red).
{ class: `dl-pill ${!srv.enabled ? 'warn' : srv.up ? 'ok' : 'bad'}` },
!srv.enabled ? 'Turned off' : srv.up ? 'Running' : srv.blocked ? 'Can’t start' : 'Not running',
),
st.settings.paused_all && srv.enabled ? E('span', { class: 'dl-pill warn' }, 'Off') : '',
E('span', { class: 'dl-spacer' }),
actions,
]),
@@ -478,7 +473,8 @@ export class ServerPage {
name: d.name,
endpoint: d.endpoint,
port: d.port,
subnet: d.subnet,
// The tunnel's first three numbers ("10.77.0"): it is that /24.
range: rangeOf(d.subnet),
preset: 'standard' as Method,
// Off by default: the portal opens a port on WAN, so it is a choice.
portal: false,
@@ -488,11 +484,20 @@ export class ServerPage {
wan_zone: d.wan_zone,
};
let step = 0;
// 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 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' });
const field = (key: 'id' | 'name' | 'endpoint' | 'port' | 'subnet' | 'portal_port', attrs: Record<string, unknown> = {}) => {
const field = (key: 'id' | 'name' | 'endpoint' | 'port' | 'range' | 'portal_port', attrs: Record<string, unknown> = {}) => {
const el = input(String(state[key]), attrs);
el.addEventListener('input', () => {
(state as any)[key] = key === 'port' || key === 'portal_port' ? Number(el.value) : el.value.trim();
if (key === 'port' || key === 'portal_port') (state as any)[key] = el.value.trim() === '' ? 0 : Number(el.value);
else (state as any)[key] = el.value.trim();
if (key === 'port' && portalSame) state.portal_port = state.port;
if (key === 'portal_port') portalSame = state.portal_port === state.port;
});
return el;
};
@@ -525,31 +530,39 @@ export class ServerPage {
render: () =>
E('div', { class: 'dl-wizard-groups' }, [
group('globe', 'Listening', 'Where devices reach AmneziaWG from the internet', [
row(
'UDP port',
field('port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }),
'Opened on the WAN firewall automatically. A random high port is fine.',
),
liveRow('UDP port', field('port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }), portHelpNow),
]),
group('network', 'Tunnel network', 'Addresses devices get inside the tunnel', [
row(
'Tunnel subnet',
field('subnet', { class: 'cbi-input-text dl-mono' }),
`Must not overlap your networks (${d.taken.join(', ') || 'none found'}).`,
),
(() => {
const el = field('range', {
class: 'cbi-input-text dl-w-range dl-mono',
'aria-label': 'First three numbers of the device addresses',
});
return liveRow(
'Device addresses',
el,
rangeHelpNow,
E('span', { class: 'dl-suffixed' }, [el, E('span', { class: 'dl-mono' }, '.x')]),
);
})(),
]),
group('shield', 'Disguise', 'So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard', [
methodPicker(d.awg, state.preset, (m) => (state.preset = m), undefined, d.awg_state?.tools !== false),
]),
]),
check: () => (!state.port || !state.subnet ? 'Fill in the UDP port and subnet.' : null),
check: () => {
const p = portHelpNow();
if (p.bad) return `UDP port: ${p.text}`;
const r = rangeHelpNow();
return r.bad ? `Device addresses: ${r.text}` : null;
},
};
const portalPage: Page = {
id: 'portal',
title: 'Portal',
render: () => {
const portalPort = field('portal_port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' });
const portRow = row('Listening port', portalPort, 'TCP port on WAN for the portal; the whole port belongs to it.');
const portRow = liveRow('Listening port', portalPort, portalHelpNow);
portRow.hidden = !state.portal;
// Off | On, Off first: the same segmented control as in Settings.
const onOff = seg(
@@ -580,6 +593,11 @@ export class ServerPage {
]),
]);
},
check: () => {
if (!state.portal) return null;
const h = portalHelpNow();
return h.bad ? `Portal port: ${h.text}` : null;
},
};
const pages = (): Page[] => [serverPage, awgPage, extra ? null : portalPage].filter((x): x is Page => x != null);
const aw = d.awg_state;
@@ -666,7 +684,7 @@ export class ServerPage {
state.name,
d.ifname,
state.port,
state.subnet,
subnetOf(state.range),
state.endpoint,
d.mtu,
state.preset,
@@ -678,10 +696,15 @@ export class ServerPage {
),
'Server created',
);
if (r)
setTimeout(() => {
if (!r) return;
// A network restart drops the connection to LuCI for a few seconds.
if (r.network_restart) notify('Restarting the network so it knows AmneziaWG: back in a few seconds');
setTimeout(
() => {
location.href = url(r.id);
}, 1500);
},
r.network_restart ? 10000 : 1500,
);
},
'positive',
{ disabled: missing.length > 0, title: missing.length ? 'Install AmneziaWG first' : null },