Dawnline 0.16.3
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

- Move Dawnline to Services in LuCI and update links and documentation.
- Make activity messages clearer, including device renames and person-specific history.
- Prune redundant frontend tests.
This commit is contained in:
Aemeath committed 2026-10-31 12:21:53 +03:00
1 parent f2b5ba101b
commit b0d9982796
37 files changed
+452 -243

No files matched your search

+1 -1
View File
@@ -448,7 +448,7 @@ function overviewTile(srv: Server): HTMLElement {
return E('div', { class: 'dl-bento-tile dl-disg' }, [
E('div', { class: 'dl-bento-head' }, [
E('span', { class: 'dl-metric-label' }, _('Disguise')),
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')),
E('a', { href: `${L.url('admin/services/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')),
]),
E('div', { class: 'dl-disg-id' }, [
E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')),
+1 -1
View File
@@ -434,7 +434,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
},
_('Clear'),
),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All activity')),
E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('All activity')),
]),
]),
log,
+92 -29
View File
@@ -69,7 +69,8 @@ function eventIcon(st: Names, e: LogEvent): string {
/** A router day (YYYY-MM-DD) in the page's language; anything else as it came. */
const routerDay = (s: string) => (/^\d{4}-\d{2}-\d{2}$/.test(s) ? fmtDay(s) : s);
export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
export function eventText(st: Pick<Status, 'people'>, e: LogEvent, personId?: string): Node[] {
const scoped = personId !== undefined && e.person === personId;
const person = st.people.find((p) => p.id === e.person);
const who = person?.name ?? e.pname ?? e.person ?? '';
const dev = person?.devices.find((d) => d.id === e.device)?.name ?? e.dname ?? '';
@@ -88,33 +89,49 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
const w = _('You');
return s.startsWith(`${w} `) ? [E('span', { class: 'dl-you' }, w), ...say(s.slice(w.length), ...args)] : say(s, ...args);
};
const wd = b(dev ? `${who} · ${dev}` : who);
const wd = b(scoped ? dev || _('a device') : dev ? `${who} · ${dev}` : who);
const detail = plainDetail(e);
const devName = b(detail || dev || _('a device'));
const by = eventBy(e);
if (by === 'admin')
switch (e.type) {
case 'device_added':
return you(_('You added device %s for %s'), devName, b(who));
return scoped ? you(_('You added device %s'), devName) : you(_('You added device %s for %s'), devName, b(who));
case 'device_removed':
return you(_('You removed device %s from %s'), devName, b(who));
return scoped ? you(_('You removed device %s'), devName) : you(_('You removed device %s from %s'), devName, b(who));
case 'paused':
return you(_('You paused person %s'), b(who));
return scoped ? you(_('You paused access')) : you(_('You paused person %s'), b(who));
case 'resumed':
return you(_('You resumed person %s'), b(who));
return scoped ? you(_('You resumed access')) : you(_('You resumed person %s'), b(who));
case 'device_changed': {
const d = b(dev || _('a device'));
if (detail.startsWith('renamed from '))
return [...you(_('You renamed device %s of %s'), d, b(who)), m(` · ${fmt(_('was %s'), detail.slice(13))}`)];
if (detail === 'turned off') return you(_('You turned off device %s of %s'), d, b(who));
if (detail === 'turned on') return you(_('You turned on device %s of %s'), d, b(who));
return [
...(scoped ? you(_('You renamed device %s'), d) : you(_('You renamed device %s of %s'), d, b(who))),
m(` · ${fmt(_('was %s'), detail.slice(13))}`),
];
if (detail === 'turned off')
return scoped ? you(_('You turned off device %s'), d) : you(_('You turned off device %s of %s'), d, b(who));
if (detail === 'turned on')
return scoped ? you(_('You turned on device %s'), d) : you(_('You turned on device %s of %s'), d, b(who));
// Its own link options by name ("mtu, keepalive"), as person_changed lists a person's.
return [...you(_('You changed device %s of %s'), d, b(who)), ...(detail ? [m(` · ${deviceChangedText(detail)}`)] : [])];
return [
...(scoped ? you(_('You changed device %s'), d) : you(_('You changed device %s of %s'), d, b(who))),
...(detail ? [m(` · ${deviceChangedText(detail)}`)] : []),
];
}
case 'device_keys':
return [...you(_('You issued new keys for device %s of %s'), devName, b(who)), m(` · ${_('it needs its new configuration')}`)];
return [
...(scoped
? you(_('You issued new keys for device %s'), devName)
: you(_('You issued new keys for device %s of %s'), devName, b(who))),
m(` · ${_('it needs its new configuration')}`),
];
case 'link_changed':
return [...you(_('You issued a new link for person %s'), b(who)), m(` · ${_('the old link stopped working')}`)];
return [
...(scoped ? you(_('You issued a new personal link')) : you(_('You issued a new link for person %s'), b(who))),
m(` · ${_('the old link stopped working')}`),
];
}
switch (e.type) {
case 'connect':
@@ -136,35 +153,77 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
);
case 'device_added':
return by === 'portal'
? say(_('Person %s added device %s on their portal'), b(who), devName)
: say(_('Person %s added device %s'), b(who), devName);
? scoped
? say(_('Device %s added on the portal'), devName)
: say(_('Person %s added device %s on their portal'), b(who), devName)
: scoped
? say(_('Device %s added'), devName)
: say(_('Person %s added device %s'), b(who), devName);
case 'device_removed':
return by === 'portal'
? say(_('Person %s removed device %s on their portal'), b(who), devName)
: say(_('Person %s removed device %s'), b(who), devName);
? scoped
? say(_('Device %s removed on the portal'), devName)
: say(_('Person %s removed device %s on their portal'), b(who), devName)
: scoped
? say(_('Device %s removed'), devName)
: say(_('Person %s removed device %s'), b(who), devName);
case 'device_changed':
if (detail.startsWith('renamed from '))
return [
...(by === 'portal'
? scoped
? say(_('Device %s renamed on the portal'), b(dev || _('a device')))
: say(_('Person %s renamed device %s on their portal'), b(who), b(dev || _('a device')))
: say(_('Device %s renamed'), wd)),
m(` · ${fmt(_('was %s'), detail.slice(13))}`),
];
if (detail === 'turned off') return say(_('Device %s turned off'), wd);
if (detail === 'turned on') return say(_('Device %s turned on'), wd);
return [...say(_('Device %s changed'), wd), ...(detail ? [m(` · ${deviceChangedText(detail)}`)] : [])];
case 'device_keys':
return say(_('Person %s issued new keys for device %s on their portal'), b(who), devName);
return scoped
? say(_('New keys issued for device %s on the portal'), devName)
: say(_('Person %s issued new keys for device %s on their portal'), b(who), devName);
case 'person_added':
return you(_('You added person %s'), b(e.detail ?? who));
return scoped ? you(_('You added this person')) : you(_('You added person %s'), b(e.detail ?? who));
case 'person_removed':
return you(_('You removed person %s'), b(e.detail ?? who));
return scoped ? you(_('You removed this person')) : you(_('You removed person %s'), b(e.detail ?? who));
case 'person_changed':
// The detail lists changed fields by their option names (device_limit, expire_action).
return [...you(_('You changed person %s'), b(who)), ...(detail ? [m(` · ${changedText(detail)}`)] : [])];
return [
...(scoped ? you(_('You changed settings')) : you(_('You changed person %s'), b(who))),
...(detail ? [m(` · ${changedText(detail)}`)] : []),
];
case 'expiring': {
const n = daysOf(e.detail ?? '');
return n != null
? say(N_(n, 'Person %s’s access ends in %s day', 'Person %s’s access ends in %s days'), b(who), m(num(n)))
: say(_('Person %s’s access ends in a few days'), b(who));
? scoped
? say(N_(n, 'Access ends in %s day', 'Access ends in %s days'), m(num(n)))
: say(N_(n, 'Person %s’s access ends in %s day', 'Person %s’s access ends in %s days'), b(who), m(num(n)))
: scoped
? say(_('Access ends in a few days'))
: say(_('Person %s’s access ends in a few days'), b(who));
}
case 'expired_kept':
return say(_('Person %s’s end date passed (%s) · access kept'), b(who), m(routerDay(e.detail ?? '')));
return scoped
? say(_('End date passed (%s) · access kept'), m(routerDay(e.detail ?? '')))
: say(_('Person %s’s end date passed (%s) · access kept'), b(who), m(routerDay(e.detail ?? '')));
case 'paused':
return e.detail ? say(_('Person %s paused - %s'), b(who), m(reasonText(e.detail))) : say(_('Person %s paused'), b(who));
return e.detail
? scoped
? say(_('Access paused - %s'), m(reasonText(e.detail)))
: say(_('Person %s paused - %s'), b(who), m(reasonText(e.detail)))
: scoped
? say(_('Access paused'))
: say(_('Person %s paused'), b(who));
case 'resumed':
return e.detail && e.detail !== 'active'
? say(_('Person %s resumed - %s'), b(who), m(reasonText(e.detail)))
: say(_('Person %s resumed'), b(who));
? scoped
? say(_('Access resumed - %s'), m(reasonText(e.detail)))
: say(_('Person %s resumed - %s'), b(who), m(reasonText(e.detail)))
: scoped
? say(_('Access resumed'))
: say(_('Person %s resumed'), b(who));
case 'portal_blocked':
return say(
_('%s blocked %s for 15 min after too many wrong codes'),
@@ -172,7 +231,7 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
e.detail === 'all Cloudflare visitors' ? m(_('all Cloudflare visitors')) : mono(e.detail ?? ''),
);
case 'devices_removed':
return say(_('Person %s - all devices removed, end date reached'), b(who));
return scoped ? say(_('All devices removed, end date reached')) : say(_('Person %s - all devices removed, end date reached'), b(who));
case 'device_failing':
return [...say(_('Device %s has a connection problem'), wd), ...(e.detail ? [m(` · ${linkStatesText(e.detail)}`)] : [])];
case 'device_recovered':
@@ -196,7 +255,11 @@ function serverPill(st: Names, e: LogEvent): HTMLElement | '' {
}
/** An activity event as a row; `time` replaces the "5 min ago" (`now` is the router's clock). */
export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { server?: boolean; time?: string } = {}): HTMLElement {
export function eventRow(
st: Names & { now?: number },
e: LogEvent,
opts: { server?: boolean; time?: string; person?: string } = {},
): HTMLElement {
const sys = SYSTEM_EVENT[e.type];
const by = eventBy(e);
return E('div', { class: `dl-row${by === 'admin' ? ' dl-ev-by-admin' : sys ? ` dl-ev-by-system ${sys[1]}` : ''}` }, [
@@ -205,7 +268,7 @@ export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { serv
: sys
? E('span', { class: 'dl-ev-tile sys' }, icon(sys[0]))
: E('span', { class: `dl-ev-tile ev ${EVENT_TONE[e.type] ?? ''}` }, icon(eventIcon(st, e))),
E('span', { class: 'dl-row-main' }, eventText(st, e)),
E('span', { class: 'dl-row-main' }, eventText(st, e, opts.person)),
opts.server === false ? '' : serverPill(st, e),
E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, opts.time ?? ago(e.ts, st.now)),
]);
+1 -1
View File
@@ -51,7 +51,7 @@ function moved(tab: '' | 'log') {
return () => ({
load: () => {
ui.menu?.flushCache();
location.replace(`${L.url('admin/network/dawnline/diagnostics')}${tab ? `?tab=${tab}` : ''}`);
location.replace(`${L.url('admin/services/dawnline/diagnostics')}${tab ? `?tab=${tab}` : ''}`);
return new Promise(() => {});
},
render: () => document.createElement('div'),
+1 -1
View File
@@ -65,7 +65,7 @@ export function activity(page: ComponentsPage): HTMLElement {
E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Activity')),
E('span', { class: 'dl-spacer' }),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All in Log →')),
E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('All in Log →')),
]),
h.length
? E('div', {}, h.slice(0, 8).map(row))
+1 -1
View File
@@ -160,7 +160,7 @@ export class ComponentsPage {
E('div', { class: 'dl-row-actions' }, [
E(
'a',
{ class: 'cbi-button cbi-button-neutral dl-icon-btn', href: `${L.url('admin/network/dawnline/settings')}?section=updates` },
{ class: 'cbi-button cbi-button-neutral dl-icon-btn', href: `${L.url('admin/services/dawnline/settings')}?section=updates` },
[icon('edit'), ' ', _('Settings')],
),
button([icon('refresh'), ' ', _('Check all')], () => this.op('check', _('Checking all components')), 'neutral', {
+7 -7
View File
@@ -34,7 +34,7 @@ interface Attention {
function attention(st: Status): Attention[] {
const out: Attention[] = [];
const link = (href: string, t: string) => E('a', { href }, t);
const diagnostics = () => link(L.url('admin/network/dawnline/diagnostics'), _('Open Diagnostics'));
const diagnostics = () => link(L.url('admin/services/dawnline/diagnostics'), _('Open Diagnostics'));
const today = todayOf(st.series);
// AmneziaWG itself can't run: the health notice says so once, not "Tunnel down" for every server.
const awg = !!st.awg_state && !st.awg_state.ok;
@@ -111,12 +111,12 @@ function attention(st: Status): Attention[] {
text: [
fmt(_('Internet through the LAN is off: %s'), st.like_home.error),
' ',
link(L.url('admin/network/dawnline/diagnostics'), _('Details')),
link(L.url('admin/services/dawnline/diagnostics'), _('Details')),
],
});
// Only while setting up: an admin who keeps the portal off has decided so.
if (!st.settings.portal_enabled && !st.people.length)
out.push({ tone: '', text: [_('The personal portal is off.'), ' ', link(L.url('admin/network/dawnline/settings'), _('Turn on'))] });
out.push({ tone: '', text: [_('The personal portal is off.'), ' ', link(L.url('admin/services/dawnline/settings'), _('Turn on'))] });
return out;
}
@@ -221,7 +221,7 @@ export class ServerOverview {
E(
'div',
{ class: 'dl-map-off' },
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))),
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/services/dawnline/settings') }, _('Turn them on in Settings'))),
),
]);
const map = (this.map = new ConnectionMap(
@@ -268,7 +268,7 @@ export class ServerOverview {
E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Needs attention')),
E('span', { class: 'dl-spacer' }),
E('a', { href: L.url('admin/network/dawnline/diagnostics') }, _('Health')),
E('a', { href: L.url('admin/services/dawnline/diagnostics') }, _('Health')),
]),
att.length
? att
@@ -292,7 +292,7 @@ export class ServerOverview {
E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Activity')),
E('span', { class: 'dl-spacer' }),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('View all')),
E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('View all')),
]),
events.length
? events.map((e) => eventRow(st, e))
@@ -428,7 +428,7 @@ export class ServerOverview {
'a',
{
class: 'dl-onl-p sm more',
href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(this.srvId)}&section=people&filter=online`,
href: `${L.url('admin/services/dawnline/server')}?server=${encodeURIComponent(this.srvId)}&section=people&filter=online`,
title: _('Everyone online'),
click: (ev: Event) => {
if (this.go) {
+2 -2
View File
@@ -281,7 +281,7 @@ export class PeoplePage {
{ class: 'alert-message warning' },
fill(
_('No server yet. %s before adding people.'),
E('a', { href: L.url('admin/network/dawnline/server') }, _('Run the setup wizard')),
E('a', { href: L.url('admin/services/dawnline/server') }, _('Run the setup wizard')),
),
),
E('div', { class: 'dl-toolbar' }, [
@@ -847,7 +847,7 @@ export class PeoplePage {
' ',
E(
'a',
{ class: 'cbi-button cbi-button-neutral', href: `${L.url('admin/network/dawnline/settings')}?section=portal` },
{ class: 'cbi-button cbi-button-neutral', href: `${L.url('admin/services/dawnline/settings')}?section=portal` },
_('Open Settings'),
),
' ',
+4 -4
View File
@@ -34,7 +34,7 @@ function mapCard(page: PersonPage): HTMLElement {
E(
'div',
{ class: 'dl-map-off' },
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))),
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/services/dawnline/settings') }, _('Turn them on in Settings'))),
),
]);
const map = new ConnectionMap(
@@ -64,7 +64,7 @@ export function placesPart(page: PersonPage): HTMLElement | null {
E('span', { class: 'dl-sub' }, _('City-level, from the client IP')),
]),
E('span', { class: 'dl-spacer' }),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/settings') }, _('Turn on')),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/services/dawnline/settings') }, _('Turn on')),
]);
if (page.mapOpen) return page.map && page.parts.places.contains(page.map.el) ? null : mapCard(page);
const since = st.now - 30 * 86400;
@@ -108,10 +108,10 @@ export function activityPart(page: PersonPage): HTMLElement {
const e = latest[i];
let n = 1;
while (e.type === 'roam' && latest[i + n]?.type === 'roam' && latest[i + n].device === e.device) n++;
const row = eventRow(st, e, { server: false });
const row = eventRow(st, e, { server: false, person: p.id });
if (n > 1) {
const main = row.querySelector('.dl-row-main') as HTMLElement;
dom.content(main, [...eventText(st, e).slice(0, 3), E('span', { class: 'dl-muted' }, plural(n, '%s time', '%s times'))]);
dom.content(main, [...eventText(st, e, p.id).slice(0, 3), E('span', { class: 'dl-muted' }, plural(n, '%s time', '%s times'))]);
main.title = latest
.slice(i, i + n)
.map((x) => x.detail ?? '')
+2 -2
View File
@@ -1,4 +1,4 @@
// Person page (admin/network/dawnline/person?id=…): devices as cards,
// Person page (admin/services/dawnline/person?id=…): devices as cards,
// locations, activity, and access & limits that apply immediately.
// The parts live in ./header, ./devices, ./limits, ./pickers, ./activity and
// ./dialogs; this class holds the state, the poller and the edits.
@@ -66,7 +66,7 @@ export class PersonPage {
return E('div', { class: 'dl-empty' }, [
E('h3', {}, _('Person not found')),
E('p', {}, _('They may have been removed.')),
E('a', { class: 'cbi-button', href: L.url('admin/network/dawnline/server') }, _('Back to Servers')),
E('a', { class: 'cbi-button', href: L.url('admin/services/dawnline/server') }, _('Back to Servers')),
]);
this.p = p;
for (const k of ['crumbs', 'head', 'devices', 'traffic', 'places', 'activity', 'limits'] as Part[]) this.parts[k] = E('div', {});
+2 -2
View File
@@ -48,7 +48,7 @@ const url = (server?: string, section?: string) => {
if (server) q.set('server', server);
if (section && section !== 'overview') q.set('section', section);
const s = q.toString();
return `${L.url('admin/network/dawnline/server')}${s ? `?${s}` : ''}`;
return `${L.url('admin/services/dawnline/server')}${s ? `?${s}` : ''}`;
};
export class ServerPage {
@@ -846,7 +846,7 @@ export class ServerPage {
'warn',
_('AmneziaWG’s kernel module doesn’t load on this firmware'),
_('Try another build in Components, or update OpenWrt. The server can’t start until it loads.'),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/updates') }, _('Open Components')),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/services/dawnline/updates') }, _('Open Components')),
),
])
: '';
+2 -2
View File
@@ -134,9 +134,9 @@ export const MOVE_MS = 1600;
/** The shimmer sets off once the place it leaves has started to go gray (a share of the move). */
const LEAVE = 0.12;
/** The shimmer's length, a share of the arc: longer than the arc, so most of it is lit mid-move. */
export const BAND = 1.3;
const BAND = 1.3;
/** ± this around the shimmer's middle is fully lit; it fades out to ±BAND/2. */
export const FLAT = 0.32;
const FLAT = 0.32;
/** A move into stay `k` (from stay k − 1), or stay `k` itself, `ms` long from `start`. */
export interface Step {
+2 -2
View File
@@ -2,9 +2,9 @@
/** A server's People section (Servers page). */
export function peopleUrl(server?: string): string {
return `${L.url('admin/network/dawnline/server')}?${server ? `server=${encodeURIComponent(server)}&` : ''}section=people`;
return `${L.url('admin/services/dawnline/server')}?${server ? `server=${encodeURIComponent(server)}&` : ''}section=people`;
}
export function personUrl(id: string, device?: string): string {
return `${L.url('admin/network/dawnline/person')}?id=${encodeURIComponent(id)}${device ? `&device=${encodeURIComponent(device)}` : ''}`;
return `${L.url('admin/services/dawnline/person')}?id=${encodeURIComponent(id)}${device ? `&device=${encodeURIComponent(device)}` : ''}`;
}
+2 -2
View File
@@ -48,7 +48,7 @@ export function fixAction(c: HealthCheck, run: (fix: string) => void, refresh: (
// install:awg installs AmneziaWG itself (the build for this firmware), the rest come from the feeds.
if (fix.startsWith('install:')) return button(_('Install'), () => installFeature(fix.slice(8) as keyof Needs, refresh), kind);
if (fix === 'updates')
return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/network/dawnline/updates') }, fixLabel(fix));
return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/services/dawnline/updates') }, fixLabel(fix));
return button(fixLabel(fix), () => run(fix), kind);
}
@@ -89,7 +89,7 @@ export function healthNotices(checks: HealthCheck[], run: (fix: string) => void,
),
),
rest > 0
? E('a', { class: 'dl-row dl-notices-more', href: L.url('admin/network/dawnline/diagnostics') }, [
? E('a', { class: 'dl-row dl-notices-more', href: L.url('admin/services/dawnline/diagnostics') }, [
fmt(_('%s more in Diagnostics'), num(rest)),
E('span', { class: 'dl-spacer' }),
'→',