Files
dawnline/web/src/admin/cores/common.ts
T
Aemeath 972e522518
Build packages / Version (push) Waiting to run
Dawnline 0.5.0
- Where people connect from is a globe map now: live arcs from each
  person to the server, grey ones for the last 24 h, 7 or 30 days, avatars
  instead of dots, the server's own marker, and a light map in light mode;
  it zooms to fit the people shown and follows them as they come and go
- Markers that overlap move apart with a pointer to their spot; people
  next to the server fold into a count on it; a click zooms in and opens a
  floating card (never clipped by the map), closing flies back
- The person page maps where they connected from, older places fading;
  the device panel lists its places in order, and connections from the LAN
  or through the router's own address stay off the maps ("LAN" in grey)
- Setup and new servers check the UDP port (taken by another program, a
  forward or another server) and the subnet (three numbers + .x, a private
  range not in use) as you type; the default port is 4500
- The personal portal can share the server's port number (TCP beside UDP);
  its port is checked against forwards and other services
- A new server comes up at once: the kernel module is loaded and the
  network restarted when OpenWrt doesn't know AmneziaWG yet
- A turned-off server is a state of its own: no "tunnel down" or DNS
  warnings, "Turned off" in yellow, a white Turn on, and people on it are
  not shown as paused
- Pause everyone is removed: turning a server off does the same (a router
  left paused keeps its servers off after the update)
- People: a stopped person's card fades and says why across its bottom,
  with the one action that lifts it (Resume, +10 GB, Extend 1 month);
  people held by a limit or end date sort below the others, paused last
- The person page shows the state as text ("Paused") with a Resume
  button, also while their server is off
- The portal tells a paused or ended person just that, even with the
  server off, and lets them change nothing until the admin lifts it (the
  router refuses too); its notices look like Overview's
- Automatic MTU: with the field empty the tunnel, computers and routers
  get 1380 minus AmneziaWG S4 (1368 on Maximum), phones and tablets 1280;
  a typed MTU still caps phones and tablets at 1280, and servers on the
  old default 1380 move to automatic (phones and tablets get "Update
  config", their old files keep working)
- Only procd's agent runs: a second copy (started by hand or left over)
  refuses to start or is ended within 5 minutes, so no more stray paused
  and resumed events; a device that leaves the tunnel is offline at once
- The installer picks the newest release (it took the lowest), DNS
  lookups can't hang, and tooltips and floating cards close on scroll and
  on leaving the page
2026-10-17 01:03:23 +03:00

38 lines
1.8 KiB
TypeScript

// What every tunnel core gives the admin (cores/index.ts holds the registry),
// what a core's settings card gets from the Server page, and that card's head.
import type { ClientConfig, Server, Status } from '../../shared/types';
import { E } from '../e';
/** What the Server page hands a core's settings card. */
export interface CoreCtx {
st: Status;
/** server_update with these values, then refresh. */
save: (values: Record<string, unknown>, ok?: string) => Promise<void>;
refresh: () => Promise<void>;
}
/** A tunnel core (AmneziaWG today): its name and the pieces of the admin that differ per core. */
export interface Core {
id: string;
/** "AmneziaWG": the server section, the address bar, the settings card. */
label: string;
/** Server → <label>: the core's own settings. */
settingsCard(ctx: CoreCtx, srv: Server): HTMLElement;
/** Overview: how the tunnel looks on the wire (the disguise tile). */
overviewTile(srv: Server): HTMLElement;
/** How a device connects: file / key / QR. */
connectBlock(cfg: ClientConfig, initial?: 'file' | 'key' | 'qr'): Promise<HTMLElement>;
/** What a QR code for the device carries. */
qrText(cfg: ClientConfig): string;
/** The key the device's app imports (⋯ → Copy key), with the menu label. */
appKey?: { label: string; make(cfg: ClientConfig): Promise<string> };
/** The config file the device imports, with the menu label. */
file: { label: string; make(cfg: ClientConfig): { name: string; text: string } };
}
/** Name and a short line: the head of a core's settings card (the server's header already says whether it runs). */
export function coreHead(title: string, sub: string): HTMLElement {
return E('div', { class: 'dl-corehead' }, [E('h3', {}, title), sub ? E('span', { class: 'dl-sub' }, sub) : '']);
}