Dawnline 0.20.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 / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions

- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode.
- **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V).
- **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request.
- **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds.
- **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person.
- **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router.
- **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch.
- **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away.
- **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once.
- **Undo.** An action done from a card or a request is undone from its toast.
- **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own.
- **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name.
- **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking.
- **Check access and Health know the networks behind routers.**
- **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st.
- Extra data lasts until that person's month ends; «Reset usage» starts the month anew.
- A limit is for a month or for the whole term; the admin and the portal show when it resets.
- Charts that said «this month» show the last 30 days.
- After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st.
- **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped.
- **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone.
- **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence.
- **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
This commit is contained in:
Aemeath committed 2026-11-13 09:43:50 +03:00
1 parent f8130e39a8
commit ac90575b0b
788 files changed
+139244 -41720

No files matched your search

+255
View File
@@ -0,0 +1,255 @@
import { beforeAll, describe, expect, it } from 'vitest';
import {
SECTIONS,
deviceUrl,
href,
logUrl,
peopleAt,
peopleUrl,
personUrl,
placesUrl,
sectionOf,
healthUrl,
serverUrl,
settingsUrl,
sectionPlace,
withCloseUp,
} from '../src/admin/shell/routes';
import { follow, listOf, parseRoute, routeQuery } from '../src/admin/people/route';
import { target } from '../src/admin/shell/redirects';
import { partOf } from '../src/admin/pages/settings/route';
beforeAll(() => {
Object.assign(globalThis, { L: { url: (p: string) => `/cgi-bin/luci/${p}` } });
});
describe('sections', () => {
it('knows the section of every view', () => {
expect(SECTIONS).toEqual(['overview', 'log', 'settings']);
expect(sectionOf('log', '')).toBe('log');
expect(sectionOf('activity', '')).toBe('log');
// a server's page stands behind Overview: its own view, and People (a person, a device, Places) inside its frame
expect(sectionOf('server', '')).toBe('overview');
expect(sectionOf('server', 'server=s1&p=core')).toBe('overview');
expect(sectionOf('people', '')).toBe('overview');
expect(sectionOf('people', 'view=map&device=d1')).toBe('overview');
expect(sectionOf('person', 'id=p1&device=d1')).toBe('overview');
expect(sectionOf('device', 'id=d1')).toBe('overview');
expect(sectionOf('places', 'sheet=places&device=d1')).toBe('overview');
// Settings: the router's own sections; the old System page leads there
expect(sectionOf('settings', '')).toBe('settings');
expect(sectionOf('settings', 'p=backups')).toBe('settings');
expect(sectionOf('system', 'open=updates')).toBe('settings');
expect(sectionOf('updates', '')).toBe('settings');
// Overview, and Dawnline's own menu item (an alias of it); Health is Overview's now
expect(sectionOf('overview', '')).toBe('overview');
expect(sectionOf('dawnline', '')).toBe('overview');
expect(sectionOf('health', '')).toBe('overview');
expect(sectionOf('system', 'open=health')).toBe('overview');
expect(sectionOf('diagnostics', '')).toBe('overview');
expect(sectionOf('diagnostics', 'tab=log')).toBe('log');
expect(sectionOf('elsewhere', '')).toBeNull();
});
it('opens every section on a page that lights its tab', () => {
expect(SECTIONS[0]).toBe('overview');
for (const s of SECTIONS) {
const p = sectionPlace(s);
expect(sectionOf(p.view, p.query ?? '')).toBe(s);
}
expect(sectionPlace('settings')).toEqual({ view: 'settings' });
});
});
describe('addresses', () => {
it('builds them with L.url; a person, a device and places are People with the old query names', () => {
const at = '/cgi-bin/luci/admin/services/dawnline/';
expect(href({ view: 'log' })).toBe(`${at}log`);
expect(href({ view: 'settings', query: 'p=entry' })).toBe(`${at}settings?p=entry`);
expect(personUrl('p 1')).toBe(`${at}people?id=p+1`);
expect(personUrl('p1', 'traffic')).toBe(`${at}people?id=p1&s=traffic`);
expect(deviceUrl('d&2')).toBe(`${at}people?device=d%262`);
expect(deviceUrl('d1', 'setup')).toBe(`${at}people?device=d1&sheet=setup`);
expect(placesUrl()).toBe(`${at}people?view=map`);
expect(placesUrl({ person: 'p1' })).toBe(`${at}people?view=map&id=p1`);
expect(placesUrl({ server: 's1' })).toBe(`${at}people?view=map&server=s1`);
expect(placesUrl({ device: 'd1' })).toBe(`${at}people?device=d1&sheet=places`);
expect(peopleUrl('s1')).toBe(`${at}people?server=s1`);
expect(peopleUrl('s1', 'config')).toBe(`${at}people?server=s1&need=config`);
expect(peopleUrl()).toBe(`${at}people`);
expect(peopleAt({ view: 'map', device: 'd1', range: '7d' })).toBe(`${at}people?view=map&device=d1&range=7d`);
expect(logUrl({ device: 'd1' })).toBe(`${at}log?device=d1`);
expect(logUrl({ kind: 'problems' })).toBe(`${at}log?kind=problems`);
expect(logUrl()).toBe(`${at}log`);
expect(logUrl({ kind: 'problems', day: 'yesterday' })).toBe(`${at}log?kind=problems&day=yesterday`);
expect(logUrl({ server: 's1', q: '176.59' })).toBe(`${at}log?server=s1&q=176.59`);
// a server's page: its Overview, a part of its settings, its people and places (the People view in its frame)
expect(serverUrl()).toBe(`${at}server`);
expect(serverUrl('s1')).toBe(`${at}server?server=s1`);
expect(serverUrl('s1', 'core')).toBe(`${at}server?server=s1&p=core`);
expect(serverUrl('s1', 'people')).toBe(`${at}people?server=s1`);
expect(serverUrl('s1', 'places')).toBe(`${at}people?view=map&server=s1`);
// where something is set: a router's section in Settings, a stage of a server's path on the server's page
expect(settingsUrl('backups')).toBe(`${at}settings?p=backups`);
expect(settingsUrl('backups', 's1')).toBe(`${at}settings?p=backups`);
expect(settingsUrl()).toBe(`${at}server`);
expect(settingsUrl(undefined, 's1')).toBe(`${at}server?server=s1`);
expect(settingsUrl('home', 's1')).toBe(`${at}server?server=s1&p=network&s=home`);
expect(settingsUrl('entry')).toBe(`${at}server?p=general&s=entry`);
expect(settingsUrl('disguise', 's2')).toBe(`${at}server?server=s2&p=core&s=disguise`);
expect(settingsUrl('check', 's1')).toBe(`${at}server?server=s1&s=check`);
expect(healthUrl()).toBe(`${at}overview?s=health`);
});
});
describe('the People route', () => {
it('reads an address and writes it back the same', () => {
expect(parseRoute('')).toEqual(listOf({}));
expect(routeQuery(parseRoute('id=p1&group=need&sort=-traffic'))).toBe('id=p1&group=need&sort=-traffic');
expect(routeQuery(parseRoute('range=7d&view=map&server=s1'))).toBe('view=map&server=s1&range=7d');
// a device's panel takes the person's place
expect(parseRoute('id=p1&device=d1')).toMatchObject({ id: undefined, device: 'd1' });
expect(routeQuery({ id: 'p1', device: 'd1' })).toBe('device=d1');
// what is not a value of its key is dropped
expect(parseRoute('view=grid&group=all&need=1&range=year')).toEqual(listOf({}));
// the old ?add=1 asks for the Add sheet
expect(parseRoute('add=1').sheet).toBe('add');
expect(parseRoute('device=d1&sheet=setup').sheet).toBe('setup');
});
it('opens a link to an object beside the list as it stands, and takes a link to a view whole', () => {
const cur = parseRoute('view=map&server=s1&range=7d&id=p1');
expect(routeQuery(follow(cur, parseRoute('device=d1')))).toBe('view=map&device=d1&server=s1&range=7d');
expect(routeQuery(follow(cur, parseRoute('id=p2&s=term')))).toBe('view=map&id=p2&server=s1&range=7d&s=term');
// the way back to the list: the panel shuts, the list stays
expect(routeQuery(follow(cur, parseRoute('')))).toBe('view=map&server=s1&range=7d');
expect(routeQuery(follow(parseRoute('group=need&id=p1'), parseRoute('view=map&id=p1')))).toBe('view=map&id=p1');
expect(routeQuery(follow(parseRoute('id=p1'), parseRoute('server=s2')))).toBe('server=s2');
});
});
describe('redirects', () => {
it('sends old addresses on', () => {
expect(target('activity', '')).toEqual({ view: 'log' });
expect(target('diagnostics', 'tab=log')).toEqual({ view: 'log' });
// Diagnostics and Health are Overview's health checks
const health = { view: 'overview', query: 's=health' };
expect(target('health', '')).toEqual(health);
expect(target('diagnostics', '')).toEqual(health);
expect(target('diagnostics', 'tab=health')).toEqual(health);
expect(target('system', 'open=health')).toEqual(health);
// Components and the System page's rows are the router's own sections of Settings
expect(target('updates', '')).toEqual({ view: 'settings', query: 'p=updates' });
expect(target('system', '')).toEqual({ view: 'settings', query: 'p=updates' });
expect(target('system', 'open=portal')).toEqual({ view: 'settings', query: 'p=portal' });
expect(target('system', 'open=backups')).toEqual({ view: 'settings', query: 'p=backups' });
expect(target('system', 'open=history')).toEqual({ view: 'settings', query: 'p=history' });
expect(target('system', 'open=remove')).toEqual({ view: 'settings', query: 'p=remove' });
expect(target('system', 'open=nonsense')).toEqual({ view: 'settings', query: 'p=updates' });
// Settings keeps the router's sections: its old queries are sent on, and a server's path (it was Settings'
// own) goes to the server's page
expect(target('settings', '')).toBeNull();
expect(target('settings', 'p=portal')).toBeNull();
expect(target('settings', 'p=nonsense')).toBeNull();
expect(target('settings', 'p=portal&server=s1')).toEqual({ view: 'settings', query: 'p=portal' });
expect(target('settings', 'server=s1')).toEqual({ view: 'server', query: 'server=s1' });
expect(target('settings', 'p=home&server=s1')).toEqual({ view: 'server', query: 'server=s1&p=network&s=home' });
expect(target('settings', 'p=entry')).toEqual({ view: 'server', query: 'p=general&s=entry' });
expect(target('settings', 'p=rollout&server=s2')).toEqual({ view: 'server', query: 'server=s2&s=rollout' });
expect(target('settings', 'section=backups')).toEqual({ view: 'settings', query: 'p=backups' });
expect(target('settings', 'section=map')).toEqual({ view: 'settings', query: 'p=history' });
expect(target('settings', 'tab=map')).toEqual({ view: 'settings', query: 'p=history' });
expect(target('settings', 'section=logs')).toEqual({ view: 'settings', query: 'p=history' });
expect(target('settings', 'section=danger')).toEqual({ view: 'settings', query: 'p=remove' });
expect(target('settings', 'section=portal')).toEqual({ view: 'settings', query: 'p=portal' });
expect(target('settings', 'tab=general')).toEqual({ view: 'settings', query: 'p=updates' });
// a server's People section is People, filtered to that server; its old filters are the groups now
expect(target('server', 'server=s1&section=people&filter=online')).toEqual({ view: 'people', query: 'server=s1' });
expect(target('server', 'section=people')).toEqual({ view: 'people', query: undefined });
// the server's page is a page of its own; its old rows (?open=) and the Servers page's sections before them
// (?section=) are parts of it
expect(target('server', '')).toBeNull();
expect(target('server', 'server=s2')).toBeNull();
expect(target('server', 'server=s2&p=core')).toBeNull();
expect(target('server', 'server=s1&open=home')).toEqual({ view: 'server', query: 'server=s1&p=network&s=home' });
expect(target('server', 'open=check')).toEqual({ view: 'server', query: 's=check' });
expect(target('server', 'open=nonsense')).toEqual({ view: 'server', query: undefined });
expect(target('server', 'server=s1&section=connection')).toEqual({ view: 'server', query: 'server=s1&p=general&s=entry' });
expect(target('server', 'section=access')).toEqual({ view: 'server', query: 'p=network&s=home' });
expect(target('server', 'server=s2&section=awg')).toEqual({ view: 'server', query: 'server=s2&p=core&s=disguise' });
expect(target('server', 'section=tunnel')).toEqual({ view: 'server', query: 'p=network&s=tunnel' });
expect(target('server', 'section=advanced')).toEqual({ view: 'server', query: 'p=core&s=devices' });
expect(target('server', 'server=s1&section=overview')).toEqual({ view: 'server', query: 'server=s1' });
expect(target('server', 'section=overview')).toEqual({ view: 'server', query: undefined });
// Overview is a page of its own again
expect(target('overview', 'server=s1')).toBeNull();
expect(target('overview', '')).toBeNull();
});
it('sends a person, a device and Places into People, keeping the query names', () => {
expect(target('person', 'id=p1')).toEqual({ view: 'people', query: 'id=p1' });
expect(target('person', 'id=p+1&open=traffic')).toEqual({ view: 'people', query: 'id=p+1&s=traffic' });
expect(target('person', 'id=p1&open=networks')).toEqual({ view: 'people', query: 'id=p1&s=reach' });
// the devices row is the panel's first block: nothing to scroll to
expect(target('person', 'id=p1&open=devices')).toEqual({ view: 'people', query: 'id=p1' });
expect(target('person', 'id=p1&add=1')).toEqual({ view: 'people', query: 'id=p1&sheet=add' });
// older still: a person's page with a device's drawer open
expect(target('person', 'id=p1&device=d+1')).toEqual({ view: 'people', query: 'device=d+1' });
expect(target('person', '')).toEqual({ view: 'people', query: undefined });
expect(target('device', 'id=d1')).toEqual({ view: 'people', query: 'device=d1' });
expect(target('device', 'id=d1&sheet=setup')).toEqual({ view: 'people', query: 'device=d1&sheet=setup' });
expect(target('device', 'id=d1&sheet=places&device=d1')).toEqual({ view: 'people', query: 'device=d1&sheet=places' });
expect(target('places', '')).toEqual({ view: 'people', query: 'view=map' });
expect(target('places', 'person=p1')).toEqual({ view: 'people', query: 'view=map&id=p1' });
expect(target('places', 'server=s1')).toEqual({ view: 'people', query: 'view=map&server=s1' });
expect(target('places', 'person=p1&sheet=places&device=d1')).toEqual({ view: 'people', query: 'device=d1&sheet=places' });
});
it('leaves pages of their own alone', () => {
expect(target('log', '')).toBeNull();
expect(target('settings', 'p=updates')).toBeNull();
expect(target('server', 'server=s1&p=network&s=home')).toBeNull();
expect(target('overview', 's=health')).toBeNull();
expect(target('people', 'id=p1')).toBeNull();
expect(target('people', 'view=map')).toBeNull();
});
});
describe('the close-up in the address', () => {
it('adds and takes away sheet=places&device=, keeping what the page had', () => {
const at = 'http://r/cgi-bin/luci/admin/services/dawnline/';
expect(withCloseUp(`${at}overview`, 'd1')).toBe('/cgi-bin/luci/admin/services/dawnline/overview?sheet=places&device=d1');
expect(withCloseUp(`${at}overview?sheet=places&device=d1`, null)).toBe('/cgi-bin/luci/admin/services/dawnline/overview');
expect(withCloseUp(`${at}log?device=d1&sheet=places`, null)).toBe('/cgi-bin/luci/admin/services/dawnline/log?device=d1');
expect(withCloseUp(`${at}log?device=d1`, 'd1')).toBe('/cgi-bin/luci/admin/services/dawnline/log?device=d1&sheet=places');
// on People ?device= is the open panel: it stays when the close-up shuts
expect(withCloseUp(`${at}people?view=map&device=d1`, 'd1')).toBe(
'/cgi-bin/luci/admin/services/dawnline/people?view=map&device=d1&sheet=places',
);
expect(withCloseUp(`${at}people?view=map&device=d1&sheet=places`, null)).toBe(
'/cgi-bin/luci/admin/services/dawnline/people?view=map&device=d1',
);
});
it("keeps a person's page theirs: all their devices, or the one picked as pick=", () => {
const at = 'http://r/cgi-bin/luci/admin/services/dawnline/';
expect(withCloseUp(`${at}people?id=p1`, null, true)).toBe('/cgi-bin/luci/admin/services/dawnline/people?id=p1&sheet=places');
expect(withCloseUp(`${at}people?id=p1&sheet=places`, 'd2', true)).toBe(
'/cgi-bin/luci/admin/services/dawnline/people?id=p1&sheet=places&pick=d2',
);
expect(withCloseUp(`${at}people?id=p1&sheet=places&pick=d2`, null, true)).toBe(
'/cgi-bin/luci/admin/services/dawnline/people?id=p1&sheet=places',
);
// closed: back to the person's page
expect(withCloseUp(`${at}people?id=p1&sheet=places&pick=d2`, null)).toBe('/cgi-bin/luci/admin/services/dawnline/people?id=p1');
});
});
describe('the Settings route', () => {
it('names one of the router’s sections; none, or one that does not exist: Updates', () => {
for (const p of ['updates', 'portal', 'defaults', 'history', 'backups', 'remove']) expect(partOf(`p=${p}`)).toBe(p);
expect(partOf('')).toBe('updates');
expect(partOf('p=tunnel&server=s2')).toBe('updates');
expect(partOf('p=health')).toBe('updates');
});
});