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
94 lines
3.7 KiB
TypeScript
94 lines
3.7 KiB
TypeScript
// Components → system packages: one row per feature in use (the home-like
|
||
// link; HTTPS and certificates while the portal is on).
|
||
|
||
import type { UpdateComponent } from '../../api';
|
||
import { button } from '../../ui/button';
|
||
import { confirmDialog } from '../../ui/modal';
|
||
import { E } from '../../e';
|
||
import type { ComponentsPage, MenuEntry } from './index';
|
||
|
||
const SYS_ITEMS: { title: string; sub: string; pkgs: string[]; feature: 'home' | 'https' | 'acme'; optional?: boolean }[] = [
|
||
{ title: 'Home-like link', sub: 'Policy routing and the veth pair', pkgs: ['ip-full', 'kmod-veth'], feature: 'home' },
|
||
{ title: 'HTTPS for the portal', sub: 'OpenSSL for uhttpd', pkgs: ['libustream-openssl', 'openssl-util'], feature: 'https' },
|
||
{
|
||
title: 'Certificates (ACME)',
|
||
sub: 'Let’s Encrypt certificate for the portal',
|
||
pkgs: ['acme', 'acme-acmesh-dnsapi'],
|
||
feature: 'acme',
|
||
optional: true,
|
||
},
|
||
];
|
||
|
||
const ICONS: Record<string, string> = { home: 'network', https: 'lock', acme: 'file' };
|
||
|
||
export function packageRows(page: ComponentsPage, p: UpdateComponent | undefined): { rows: Node[]; updates: number; total: number } {
|
||
const st = page.st;
|
||
const pkgs = p?.pkgs ?? {};
|
||
const items = SYS_ITEMS.filter((it) => (it.feature === 'home' ? st.home : st.portal));
|
||
const runPkgs = async (names: string[], what: string, shown = names) => {
|
||
const ok = await confirmDialog(
|
||
`Update ${what}?`,
|
||
`${shown.join(', ')} from the OpenWrt feeds. Services that use them restart for a moment.`,
|
||
'Update',
|
||
);
|
||
if (ok) void page.op(`pkgs:${names.join(',')}`, `Updating ${what}`);
|
||
};
|
||
const menu: (MenuEntry | null)[] = [
|
||
{ label: 'Check system packages', ic: 'refresh', run: () => page.op('check:packages', 'Checking system packages') },
|
||
{
|
||
label: 'Open the OpenWrt package list',
|
||
ic: 'globe',
|
||
run: () => window.open('https://openwrt.org/packages/start', '_blank', 'noopener'),
|
||
},
|
||
];
|
||
let updates = 0;
|
||
const rows = items.map((it) => {
|
||
const present = it.pkgs.filter((x) => pkgs[x]?.installed);
|
||
const upd = [...new Set(present.flatMap((x) => [...(pkgs[x]?.latest ? [x] : []), ...(pkgs[x]?.with ?? [])]))];
|
||
const lacks = st.needs?.[it.feature] ?? it.pkgs.filter((x) => !pkgs[x]?.installed);
|
||
const main = present.find((x) => pkgs[x]?.latest);
|
||
const vers = present.map((x) => `${x} ${pkgs[x]?.installed ?? ''}`).join(', ');
|
||
if (lacks.length)
|
||
return page.row(
|
||
ICONS[it.feature],
|
||
it.title,
|
||
[`${it.optional ? 'not installed' : `missing ${lacks.join(', ')}`}`],
|
||
[
|
||
button('Install', () => page.op(`pkgs:${lacks.join(',')}`, `Installing ${it.title}`), it.optional ? 'neutral' : 'positive', {
|
||
disabled: page.busy,
|
||
}),
|
||
E('span', { class: 'dl-comp-ic' }, page.more(menu)),
|
||
],
|
||
);
|
||
if (p && upd.length) {
|
||
updates++;
|
||
return page.row(
|
||
ICONS[it.feature],
|
||
it.title,
|
||
main ? [`${pkgs[main]!.installed} → ${pkgs[main]!.latest}`, upd.length > 1 ? ` · +${upd.length - 1}` : ''] : [upd.join(', ')],
|
||
[
|
||
button(
|
||
'Update',
|
||
() =>
|
||
runPkgs(
|
||
present.filter((x) => pkgs[x]?.latest || pkgs[x]?.with?.length),
|
||
it.title,
|
||
upd,
|
||
),
|
||
'neutral',
|
||
{ disabled: page.busy },
|
||
),
|
||
E('span', { class: 'dl-comp-ic' }, page.more(menu)),
|
||
],
|
||
);
|
||
}
|
||
return page.row(
|
||
ICONS[it.feature],
|
||
it.title,
|
||
[vers || it.sub],
|
||
[page.state('pkgs', p, ''), E('span', { class: 'dl-comp-ic' }, page.more(menu))],
|
||
);
|
||
});
|
||
return { rows, updates, total: items.length };
|
||
}
|