Dawnline 0.14.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

- A device is renamed where its name stands on its card: a click on the
  name, Return or Space on it, or Rename in the ⋯ menu turns it into a
  field with the name selected. Return saves, and the words shimmer until
  the router answers. Esc or a click elsewhere puts the old name back. The
  rename window is gone, and the page no longer redraws under a name being
  edited
- Device names take up to 20 characters: letters of any language, digits,
  spaces and - _ . The router refuses anything else when a device is added
  or renamed, so a name can't carry symbols into configurations, file
  names or the AmneziaVPN key. The portal and the admin turn a character
  like that away as it is typed: the field shakes, its outline goes red
  and a short line says why. Suggested names (a phone's model, "Phone 2")
  are stripped of such characters and cut to fit. Names set before this
  stay as they are
- LAN Bypass: Add a device, in the portal and in the admin, has a switch
  that keeps the device's own local network (printer, TV, NAS) reachable
  while it is connected. It is off by default and stays as chosen; the
  admin's device drawer shows it. With home and internet access the switch
  says which addresses still lead to the home network
- Health warns when a server's home network is on one of the subnets home
  routers come with (192.168.0.x, 192.168.1.x and others). People with
  home access who connect from a network on the same addresses reach your
  home instead of their own, LAN Bypass or not
- The router tells when a device can't connect properly. After the problem
  lasts three minutes, the portal card and the admin drawer name it:
  can't finish connecting (the network may block it), connected but no
  data (an outdated configuration, and the card offers Reconnect), on two
  devices at once, or a connection that keeps dropping. Activity lists
  these under Problems, one line per device per hour, and says when the
  device connects normally again
- The set-up sheet's connection line follows what the device does:
  waiting, can't finish, connected, or connected but no data. The sheet
  closes by itself only once data comes through. On the device itself and
  for a router, the steps regroup to what fixes the problem: "Set it up
  again" when the handshake never finishes, "Add the connection again"
  ("Import the configuration again" for a router) when no data comes
- Set-up in the portal: a QR code too long for a camera to read gives its
  place to a code that opens the set-up link (a LAN Bypass configuration
  or a long AmneziaVPN key can be that long). A TV, box or NAS added from
  a phone gets the steps for setting up from another device. Back from
  "Open on the device" keeps the kind, LAN Bypass and the name typed. The
  packet-size note under the kinds is gone
- The portal on phones keeps its place: nothing jumps when an access row
  opens or folds, a notice comes or goes, or Safari redraws the cards. A
  reload, or coming back from the VPN app, opens where the page was. Cards
  glide to their new height, and an animation interrupted half-way goes on
  from where it is instead of snapping. A double click no longer closes
  the sheet it just opened
- In the admin, a device's drawer has its own MTU and keep-alive (empty
  means the server's), each with a Change dialog. A change touches only
  that device's configuration and restarts nothing on the router. Opening
  the drawer no longer counts as handing out the configuration: "Update
  config" stays until the new configuration is shown as a QR code,
  downloaded or copied ("Show the new configuration"). New keys set the
  device up again, as the portal's Reconnect does
- "Speed now" on a server's Overview is live: one point a second over the
  last two minutes, all there as soon as the Overview opens. The agent
  keeps those two minutes in memory and writes them out only while someone
  is looking
- Disguise values that AmneziaWG refuses or crashes on are stopped before
  they reach the kernel. That covers overlapping H1-H4, Jmin above Jmax,
  broken I1-I5 tags, padding under 12 with header protection, and more.
  Import and restore refuse them. After a hand edit in uci, the server's
  tunnel stays down and Health and the service log say why and what to do.
  Errors are full sentences in the reader's language
- The header protection key no longer shows in the status that read-only
  users can see: the Server page says only that the key is set, and each
  device's configuration still has it. The server no longer turns off
  WireGuard's protection against handshake floods (devices keep
  DisableCookies). A device can't be added with a server's own key
- An AmneziaWG update whose kernel module can't be swapped (another
  AmneziaWG interface holds the old one) no longer fails. It is installed,
  the tunnels come back on the old module, and Health and Components say
  the update starts after a reboot. On apk firmware, an install that apk
  left at the old version counts as failed. A module installed by hand is
  recorded, so after a firmware upgrade Health can tell that it is gone
- Dawnline reads only its own tunnels, each one separately. Another
  AmneziaWG interface on the router no longer slows the agent's
  once-a-second check, has its keys read or breaks Dawnline's reads. A
  portal request reads only that person's server: one process however many
  servers there are
- Fewer false disconnects: a tunnel that netifd sets up again no longer
  logs everyone as leaving and coming back, and a device with a long
  keep-alive stays online between handshakes. One configuration on two
  devices isn't logged as roaming every few seconds, and new keys end the
  old session at once. A tunnel that is missing devices is synced within a
  minute, and traffic across a tunnel restart is no longer undercounted
- Renaming a server no longer restarts its tunnel. If a tunnel's interface
  is edited outside Dawnline (LuCI, uci), the watchdog sets it up again
  with Dawnline's settings and names only the changed options. The routing
  rules for "Internet like a home device" change one at a time, new ones
  first, so traffic never falls between them. Health and the Server page
  warn when the address's AAAA record isn't this router's, or the router
  has no public IPv6: devices that prefer IPv6 fail to connect
- The README screenshots come in English and Russian; the portal's are
  taken from its demo. The demo has a switch beside × in the set-up sheet
  to show each state of the connection line. In Russian, long labels in
  the admin's wide option buttons wrap under their icon. DESIGN.md
  describes the switch, renaming on the card, the shimmer, the shake and
  how the portal scrolls. New tests cover link states, the meter, access,
  Health, firewall rules, network settings and packages
This commit is contained in:
Aemeath committed 2026-10-22 00:11:50 +03:00
1 parent 58492be021
commit dc0f159447
155 files changed
+11062 -1461

No files matched your search

+261
View File
@@ -0,0 +1,261 @@
#!/usr/bin/env node
// Capture the raw README screenshots of the personal portal into
// docs/screenshots/raw/ (2x PNG): the page (portal.png) and the three steps of
// adding a phone in front of it (portal-add-1..3.png: Add a device, the set-up
// sheet waiting, the phone connected), each sheet alone on a transparent page.
// The Russian ones take a -ru suffix. scripts/frame-screenshots.py then frames
// them for the README.
//
// The portal is its demo build (web/dist/demo, `npm run build:demo`, built
// first unless --no-build): the real portal over a router that lives in the
// page, so no one's real page is shown and adding a device adds none. It is
// opened as https://vpn.example.com/<code> and every file is answered from the
// build over the DevTools protocol (scripts/cdp.mjs), so its personal link
// reads like one. The cast is made up here: the demo's own three devices (the
// ones its router keeps, so adding one works) under other names, three more
// shown beside them, and the person's and the server's names.
//
// scripts/capture-portal.mjs [--lang en,ru] [--no-build]
import { execFileSync } from 'node:child_process';
import { readFileSync, writeFileSync } from 'node:fs';
import { dirname, extname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { die, launch, sleep } from './cdp.mjs';
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const WEB = join(ROOT, 'web');
const DEMO = join(WEB, 'dist', 'demo');
const RAW = join(ROOT, 'docs', 'screenshots', 'raw');
const SCALE = 2;
/** The page's width, as the README shot always had it. */
const WIDTH = 1320;
/** Around a sheet in its capture: left, top, right, bottom (frame-screenshots.py FLOW_MARGIN). */
const MARGIN = [56, 40, 56, 72];
const ORIGIN = 'https://vpn.example.com';
/** The demo's personal link (web/src/portal/demo/index.html, data-base). */
const CODE = 'kelino-sarupa-motive';
const NAMES = { person: 'Aemeath', server: 'Ames Gateway' };
/** The device this page is open on (its card says "This device"). */
const HERE = 'MacBook Air';
/** The phone added in the steps. */
const NEW = 'Pixel 9';
const SLOTS = 8;
const args = { langs: ['en', 'ru'], build: true };
for (let i = 2; i < process.argv.length; i++) {
const a = process.argv[i];
if (a === '--lang') args.langs = (process.argv[++i] ?? die('--lang needs a value')).split(',');
else if (a === '--no-build') args.build = false;
else die(`unknown argument ${a}`);
}
const DAY = 86400;
const now = () => Math.floor(Date.now() / 1000);
/**
* What the demo's router keeps (its DemoDb, in localStorage before the page loads): three devices, so one more
* fits its limit of four and the steps add it for real.
*/
function demoDb(t) {
const dev = (id, name, kind, n, gb, hs, days) => ({
id,
name,
kind,
n,
gb,
hs,
connectAt: 0,
created: t - days * DAY,
by: 'admin',
stale: false,
});
return {
scenario: 'normal',
devs: [
dev('d_mac', HERE, 'computer', 2, 5.4, t - 20, 60),
dev('d_iph', 'iPhone 16', 'phone', 3, 2.3, t - 40, 58),
dev('d_gal', 'Galaxy S24', 'phone', 4, 0.66, t - 26 * 3600, 30),
],
next: 5,
};
}
/**
* The page's side, before it loads: the language, the router's devices, the demo's own chrome hidden, and every
* answer of its router touched on the way to the page (the names, this device, the slots, the devices shown
* beside the ones it keeps).
*/
const prelude = (lang, db) => `(() => {
try {
localStorage.setItem('dl.lang', ${JSON.stringify(lang)});
localStorage.setItem('dawnline-demo', ${JSON.stringify(JSON.stringify(db))});
} catch {}
const NAMES = ${JSON.stringify(NAMES)}, HERE = ${JSON.stringify(HERE)}, SLOTS = ${SLOTS};
const extra = (devs, t) => {
const like = (d, o) => ({ ...d, link: null, setup: null, online: false, config_stale: false, created_by: 'admin', ...o });
const mac = devs.find((d) => d.name === HERE) ?? devs[0];
const none = { handshake: 0, endpoint: '', month: [0, 0], total: [0, 0], spark: mac.spark.map(() => [0, 0]) };
const scale = (p, f) => p.map((v) => Math.round(v * f));
return [
like(mac, { id: 'x_tv', name: 'Living room TV', kind: 'other', address: '10.8.0.6', handshake: t - 3 * 3600,
config_stale: true, month: scale(mac.month, 1.13), total: scale(mac.total, 1.4),
spark: mac.spark.map((p) => scale(p, 1.1)), created: t - 45 * 86400 }),
like(mac, { id: 'x_ipad', name: 'iPad', kind: 'tablet', address: '10.8.0.7', created: t - 2 * 86400, ...none }),
like(mac, { id: 'x_rtr', name: 'Cottage router', kind: 'router', address: '10.8.0.8', created: t - 86400, ...none }),
];
};
const touch = (st) => {
if (!st?.person) return;
const own = st.person.devices;
st.person.name = NAMES.person;
if (st.server) st.server.name = NAMES.server;
st.person.devices = [...own, ...extra(own, st.now)];
st.person.device_limit = SLOTS;
st.can_add = st.person.devices.length < SLOTS;
st.here = own.find((d) => d.name === HERE)?.id ?? null;
};
let inner = window.fetch;
Object.defineProperty(window, 'fetch', {
configurable: true,
get: () => inner,
// The demo's router takes fetch over (demo/serve.ts): its answers pass through here.
set: (f) => {
inner = async (...a) => {
const r = await f(...a);
if (!String(a[0] instanceof Request ? a[0].url : a[0]).includes('/api/')) return r;
let j;
try { j = await r.clone().json(); } catch { return r; }
touch(j?.person ? j : j?.state);
return new Response(JSON.stringify(j), { status: r.status, headers: { 'content-type': 'application/json' } });
};
},
});
addEventListener('DOMContentLoaded', () => {
const s = document.createElement('style');
// The demo's chip and GitHub pill go, and the path takes the row again, as on a router's page.
s.textContent = '.dm-chip, .dm-gh { display: none !important; } .cr-path { flex: 1 !important; }';
document.head.append(s);
});
})()`;
const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml', '.woff2': 'font/woff2' };
/** Answer the page's requests from the demo build: its page for the personal link, its files by name. */
async function serve(page) {
page.on('Fetch.requestPaused', async (e) => {
const path = new URL(e.request.url).pathname;
const file = path === `/${CODE}` || path === '/' ? 'index.html' : path.slice(1);
let body;
try {
body = readFileSync(join(DEMO, file));
} catch {
await page.send('Fetch.fulfillRequest', { requestId: e.requestId, responseCode: 404, body: '' }).catch(() => {});
return;
}
await page.send('Fetch.fulfillRequest', {
requestId: e.requestId,
responseCode: 200,
responseHeaders: [{ name: 'Content-Type', value: TYPES[extname(file)] ?? 'application/octet-stream' }],
body: body.toString('base64'),
});
});
await page.send('Fetch.enable', { patterns: [{ urlPattern: `${ORIGIN}/*`, requestStage: 'Request' }] });
}
async function shoot(page, file, clip) {
const { data } = await page.send('Page.captureScreenshot', {
format: 'png',
clip: { ...clip, scale: 1 },
captureBeyondViewport: true,
});
writeFileSync(join(RAW, file), Buffer.from(data, 'base64'));
console.log(`${file}: ${Math.round(clip.width)}x${Math.round(clip.height)} (x${SCALE})`);
}
// The page's content: everything on screen but full-width or full-height wrappers, 36px around it (as the
// README shot always was; what waits off screen, as a field's measuring copy does, is no content).
const PAGE_CLIP = `(() => {
let l = innerWidth, r = 0, b = 0;
for (const e of document.querySelectorAll('#app *')) {
const x = e.getBoundingClientRect();
if (!x.width || !x.height || x.width > innerWidth - 40 || x.height > innerHeight - 40) continue;
if (x.left < 0 || x.right > innerWidth) continue;
l = Math.min(l, x.left);
r = Math.max(r, x.right);
b = Math.max(b, x.bottom);
}
return { x: l - 36, y: 0, width: r - l + 72, height: b + 40 };
})()`;
// The open sheet alone: the page and the scrim out of sight on a transparent page, MARGIN around the sheet.
const SHEET_CLIP = `(() => {
const r = document.querySelector('.sheet-root.open .sheet').getBoundingClientRect();
const [l, t, rr, b] = ${JSON.stringify(MARGIN)};
return { x: r.left - l, y: r.top - t, width: r.width + l + rr, height: r.height + t + b };
})()`;
const ALONE = `(() => {
const s = document.createElement('style');
s.id = 'alone';
s.textContent = 'html, body { background: transparent !important; } #app { visibility: hidden !important; } .scrim { display: none !important; }';
document.head.append(s);
})()`;
async function capture(lang) {
const suffix = lang === 'en' ? '' : `-${lang}`;
const b = await launch([`--lang=${lang}`]);
const { page, evaluate, go, waitSel } = b;
try {
await page.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'dark' }] });
await page.send('Emulation.setDeviceMetricsOverride', { width: WIDTH, height: 1400, deviceScaleFactor: SCALE, mobile: false });
// Where the page paints nothing (a sheet alone), the capture is transparent.
await page.send('Emulation.setDefaultBackgroundColorOverride', { color: { r: 0, g: 0, b: 0, a: 0 } });
await serve(page);
await page.send('Page.addScriptToEvaluateOnNewDocument', { source: prelude(lang, demoDb(now())) });
await go(`${ORIGIN}/${CODE}`);
await waitSel('.dev[data-id]');
await sleep(2500);
await shoot(page, `portal${suffix}.png`, await evaluate(PAGE_CLIP));
// 1: Add a device, a phone, its name typed in.
await evaluate(`document.querySelector('.dev.add').click()`);
await waitSel('.sheet-root.open .kinds');
await sleep(900);
await evaluate(`document.querySelectorAll('.sheet-root.open .kind')[1].click()`);
await sleep(500);
await evaluate(`(() => { const i = document.querySelector('.sheet-root.open .field input'); i.focus(); i.select(); })()`);
await page.send('Input.insertText', { text: NEW });
await evaluate(`document.activeElement.blur()`);
await sleep(900);
await evaluate(ALONE);
await shoot(page, `portal-add-1${suffix}.png`, await evaluate(SHEET_CLIP));
await evaluate(`document.getElementById('alone').remove()`);
// 2: the set-up sheet, waiting for the phone, its link open as a code for the phone's camera (the page
// opens on the app's row, whose code a key makes too dense to read at this size).
await evaluate(`document.querySelector('.sheet-root.open .field .go').click()`);
await waitSel('.sheet-root.open .way');
await sleep(1200);
await evaluate(`document.querySelector('.sheet-root.open .acc-row:not(.open) .acc-head').click()`);
await sleep(1500);
await evaluate(ALONE);
await shoot(page, `portal-add-2${suffix}.png`, await evaluate(SHEET_CLIP));
await evaluate(`document.getElementById('alone').remove()`);
// 3: connected (the demo's phone does within 6-9 s), what was under the way folded away.
await waitSel('.sheet-root.open .way.done', 15000);
await sleep(1150);
await evaluate(ALONE);
await shoot(page, `portal-add-3${suffix}.png`, await evaluate(SHEET_CLIP));
page.close();
} finally {
await b.close();
}
}
async function main() {
if (args.build) execFileSync('npm', ['run', '--silent', 'build:demo'], { cwd: WEB, stdio: 'inherit' });
for (const lang of args.langs) await capture(lang);
}
main().catch((e) => die(e.message));