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

+73
View File
@@ -0,0 +1,73 @@
// Live pages: a poller with "newest answer wins", and repaints that leave a
// region alone while the keyboard focus is inside it (typing, a picker, a
// focused button), so a background refresh never takes it away.
/**
* Request tickets: an answer is shown only if nothing newer was shown before
* it. `claim()` invalidates everything in flight (an edit's own answer wins).
*/
export class Sequence {
private n = 0;
private shown = 0;
next(): number {
return ++this.n;
}
/** True (and marks `t` shown) unless a newer answer was shown already. */
take(t: number): boolean {
if (t < this.shown) return false;
this.shown = t;
return true;
}
claim(): void {
this.shown = ++this.n;
}
}
export interface PollerOptions<T> {
/** One request; rejections and null count as "no answer". */
fetch: () => Promise<T | null>;
/** Paint an answer; `quiet` for the periodic ones. */
apply: (data: T, quiet: boolean) => void;
/** Seconds between ticks. */
every: number;
/** Ticks are skipped while this is false (e.g. the page is not on screen). */
active?: () => boolean;
}
export interface Poller<T> {
/** Fetch and apply now (unless a newer answer arrives first); resolves with what was applied. */
refresh(quiet?: boolean): Promise<T | null>;
/** An edit is about to repaint: answers already on their way are dropped. */
claim(): void;
stop(): void;
}
export function createPoller<T>(o: PollerOptions<T>): Poller<T> {
const seq = new Sequence();
const refresh = async (quiet = false): Promise<T | null> => {
const t = seq.next();
const d = await o.fetch().catch(() => null);
if (d == null || !seq.take(t)) return null;
o.apply(d, quiet);
return d;
};
const tick = () => ((o.active?.() ?? true) ? refresh(true) : Promise.resolve(null));
poll.add(tick, o.every);
return { refresh, claim: () => seq.claim(), stop: () => poll.remove(tick) };
}
/** The keyboard focus (or an open native picker's input) is inside `el`. */
export function focusInside(el: Element | null | undefined): boolean {
const a = document.activeElement;
return !!el && !!a && a !== document.body && el.contains(a);
}
/**
* Replace a region's content, unless this is a quiet repaint and the focus is
* inside it; then it keeps what is on screen until the next one.
*/
export function repaint(el: HTMLElement, content: Parameters<typeof dom.content>[1], quiet = false): boolean {
if (quiet && focusInside(el)) return false;
dom.content(el, content);
return true;
}