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

- Components tab replaces Updates: Dawnline, the AmneziaWG build for this
  firmware (Slava-Shchipunov 2.0 or 2Grey 3.1, Russian translation) and
  the system packages Dawnline adds, each checked, installed, reinstalled
  or rolled back in place, with What's new, versions and an activity log
- Automatic updates: daily check, install at a set time or right away,
  per component; AmneziaWG is left out by default and an automatic run
  never switches its build or generation
- Downloads verified against GitHub's sha256; mirrors are used only when
  GitHub is unreachable and the hash is known
- New installer: checks firmware, clock, space and DNS, lets you pick a
  release, shows the plan and asks first; --dry-run
- New uninstaller removes everything Dawnline added (cron, nft, firewall,
  routing, interfaces, packages it installed); --dry-run
- Works without AmneziaWG on the router: Overview, the setup wizard,
  Health and Components say what is missing and offer to install it
- Overview shows failed health checks as notices with their fix
- People list no longer reads the config from the browser: private keys
  stay on the router; personal links are fetched on demand
- Config changes are serialized under one lock, the nft table loads
  atomically and fails closed, and Dawnline never touches network
  sections it did not create
- The portal never opens system ports, keeps disabled devices disabled,
  rate-limits per address and counts days by the router's clock
- Settings and Diagnostics load their heavy parts in the background
- Release notes are written from the commits since the previous release
- Backend and admin UI split into small single-purpose modules
This commit is contained in:
Aemeath committed 2026-10-16 02:14:15 +03:00
1 parent 70a932b8ea
commit 34293fb8e5
158 files changed
+17418 -10022

No files matched your search

@@ -0,0 +1,92 @@
// Dawnline updater: the OpenWrt packages Dawnline adds — the home-like link
// (ip-full, kmod-veth) and HTTPS plus certificates for the personal portal —
// checked against and updated from the OpenWrt feeds.
// ctx is the updater's job context (see usr/libexec/dawnline/updater).
import * as pkg from 'dawnline.pkg';
/** What Dawnline itself adds to OpenWrt (the rest of LuCI, ucode, rpcd and uhttpd is the stock system). */
export const NAMES = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme' ];
// Packages released together with each of the above, updated as a set so OpenSSL never ends up
// half old and half new.
const FAMILY = [
[ /^ip-full$/, /^ip-/ ],
[ /^(libustream-openssl|openssl-util)$/, /^(libustream-openssl|libopenssl|openssl-util$)/ ],
[ /^(acme|luci-app-acme$)/, /^acme/ ],
];
function family(p) {
for (let f in FAMILY)
if (match(p, f[0]))
return f[1];
return null;
}
/** The packages to update for these names: each one plus its upgradable family. */
function with_family(names, up) {
let set = {};
for (let n in names) {
if (up[n])
set[n] = true;
let f = family(n);
if (f)
for (let u in keys(up))
if (match(u, f))
set[u] = true;
}
return sort(keys(set));
}
/** refresh: update the package lists first (a check by hand or on schedule). */
export function check(ctx, refresh) {
if (refresh ?? true) {
ctx.phase('Refreshing package lists');
pkg.refresh();
}
let up = pkg.upgradable();
let res = {}, all = {};
for (let p in NAMES) {
let v = pkg.version(p);
let set = v ? with_family([ p ], up) : [];
res[p] = { installed: v, latest: v && up[p] ? up[p] : null, with: filter(set, (x) => x != p) };
for (let x in set)
all[x] = true;
}
let n = length(keys(all));
ctx.log(n ? `${n} package update${n == 1 ? '' : 's'} in the feeds: ${join(', ', sort(keys(all)))}` : 'System packages are up to date');
return { pkgs: res, updates: n, status: n ? 'outdated' : 'latest' };
};
/** arg: name,name,… (only names Dawnline manages): missing ones are installed, present ones updated with their family. */
export function install(ctx, arg) {
let names = filter(split(arg ?? '', ','), (x) => x != '');
for (let n in names)
if (index(NAMES, n) < 0)
die(`${n} is not a package Dawnline manages`);
if (!length(names))
die('Nothing to install');
ctx.phase('Refreshing package lists');
pkg.refresh(ctx.log);
let missing = filter(names, (n) => pkg.version(n) == null);
let have = with_family(filter(names, (n) => pkg.version(n) != null), pkg.upgradable());
if (length(have)) {
ctx.phase(`Updating ${join(', ', have)}`);
if (!pkg.upgrade(have, ctx.log))
die('Update failed');
}
if (length(missing)) {
ctx.phase(`Installing ${join(', ', missing)}`);
if (!pkg.add(missing, ctx.log))
die('Installation failed');
}
// The portal's HTTPS runs in uhttpd; a piece that just arrived lets the portal or the home-like link start.
let touched = [ ...missing, ...have ];
if (length(filter(missing, (n) => match(n, /^(openssl-util|libustream|ip-full|kmod-veth)/)))) {
ctx.after('apply');
ctx.after('uhttpd');
}
else if (length(filter(touched, (n) => match(n, /^(libustream|libopenssl)/))))
ctx.after('uhttpd');
return { updated: have, installed: missing, check: check(ctx, false) };
};