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

- Russian translation. The admin pages, the LuCI menu and the router's
  messages (errors, Health checks, update steps, the service log) come in
  Russian with the new luci-i18n-dawnline-ru package, released beside the
  app. LuCI shows it when its language is Russian, or "auto" with a Russian
  browser
- The translation installs with install.sh when LuCI is in Russian (or with
  --lang ru), follows every Dawnline update and rollback, and can be added
  or removed in Components → Dawnline → Translation
- The portal speaks the visitor's language: it opens in the system's
  language and switches between English and Russian in place, from the
  language pill beside its QR code. It carries its own translation and needs
  no package
- Set-up steps quote the apps' own menus word for word, in Russian too:
  AmneziaVPN is "+ → Insert → Continue" (it has no "Add server"), and the
  Mac and Windows menus of WireGuard and AmneziaWG have their real names
- Questions in the portal (Reconnect, Remove) read from the left edge and
  close with Cancel, without ×
- Numbers, sizes and dates follow the page's language. A server that can't
  start says why in one sentence; event details and service log lines read
  as whole sentences
- README in Russian (README_ru.md). rules/i18n.md: how strings are written
  and translated; CI checks the catalogs (npm run i18n:check)
This commit is contained in:
Aemeath committed 2026-10-20 19:33:52 +03:00
1 parent caed976e63
commit 2f2aaf6c34
173 files changed
+25645 -2823

No files matched your search

+129 -80
View File
@@ -16,6 +16,7 @@ import { keepaliveHelp, mtuHelp, portHelp, type PortHold } from '../netcheck';
import { vpnKey } from '../../shared/vpnkey';
import { icon } from '../../shared/icons';
import { methodInfo, methodPicker, type Method, defaultMethod, legacyTitle } from '../disguise';
import { fmt, fill, num, plural } from '../../shared/i18n';
import { coreHead, type Core, type CoreCtx } from './common';
/** `.conf` names of the disguise parameters, in file order. */
@@ -73,31 +74,38 @@ function paramsView(o: Record<string, string>): HTMLElement | null {
};
const jc = Number(o.jc || 0);
const signature = (o.i1 ?? '').includes('0x8580')
? 'A first packet shaped like a DNS answer.'
: 'Extra packets sent before the handshake.';
? _('A first packet shaped like a DNS answer.')
: _('Extra packets sent before the handshake.');
const conf = keys.map(([k, n]) => `${n} = ${o[k]}`).join('\n');
const body = E('div', { class: 'dl-pgrid' }, [
group(
'Junk packets',
_('Junk packets'),
'zap',
jc ? `${jc} random packet${jc === 1 ? '' : 's'} of ${o.jmin}–${o.jmax} bytes before each handshake.` : 'No junk packets.',
jc
? fmt(
N_(jc, '%s random packet of %s–%s bytes before each handshake.', '%s random packets of %s–%s bytes before each handshake.'),
num(jc),
o.jmin,
o.jmax,
)
: _('No junk packets.'),
['jc', 'jmin', 'jmax'],
),
group('Padding', 'archive', 'Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.', [
's1',
's2',
's3',
's4',
]),
group('Packet types', 'key', 'The values that replace WireGuard’s recognisable message types.', ['h1', 'h2', 'h3', 'h4']),
group('Signatures', 'globe', signature, ['i1', 'i2', 'i3', 'i4', 'i5']),
group('Protection', 'lock', 'AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.', [
group(
_('Padding'),
'archive',
_('Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.'),
['s1', 's2', 's3', 's4'],
),
group(_('Packet types'), 'key', _('The values that replace WireGuard’s recognisable message types.'), ['h1', 'h2', 'h3', 'h4']),
group(_('Signatures'), 'globe', signature, ['i1', 'i2', 'i3', 'i4', 'i5']),
group(_('Protection'), 'lock', _('AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.'), [
'header_protection_key',
'content_padding_addition',
'random_trailers',
'disable_cookies',
]),
group('Timing', 'clock', 'Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.', [
group(_('Timing'), 'clock', _('Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.'), [
'rekey_after_time',
'rekey_timeout',
'reject_after_time',
@@ -108,7 +116,7 @@ function paramsView(o: Record<string, string>): HTMLElement | null {
return E('details', { class: 'dl-params' }, [
E('summary', {}, [
icon('chevron'),
E('span', {}, 'Current parameters'),
E('span', {}, _('Current parameters')),
E('span', { class: 'dl-pcount' }, String(keys.length)),
E('span', { class: 'dl-spacer' }),
E(
@@ -118,10 +126,10 @@ function paramsView(o: Record<string, string>): HTMLElement | null {
class: 'dl-linkbtn',
click: (ev: Event) => {
ev.preventDefault();
copyText(conf, 'Parameters copied');
copyText(conf, _('Parameters copied'));
},
},
'Copy as config',
_('Copy as config'),
),
]),
body,
@@ -158,11 +166,11 @@ function fileCard(cfg: AwgConfig): HTMLElement {
click: (ev: Event) => {
ev.preventDefault();
reveal = !reveal;
dom.content(eye, [icon(reveal ? 'x' : 'key'), reveal ? 'Hide key' : 'Show key']);
dom.content(eye, [icon(reveal ? 'x' : 'key'), reveal ? _('Hide key') : _('Show key')]);
paint();
},
},
[icon('key'), 'Show key'],
[icon('key'), _('Show key')],
);
paint();
const size = new Blob([cfg.conf]).size;
@@ -171,14 +179,14 @@ function fileCard(cfg: AwgConfig): HTMLElement {
E('span', { class: 'dl-filecard-ic' }, '.conf'),
E('span', { class: 'dl-stack' }, [
E('span', { class: 'dl-mono dl-ellipsis' }, cfg.filename),
E('span', { class: 'dl-sub' }, `AmneziaWG · ${size} bytes`),
E('span', { class: 'dl-sub' }, `AmneziaWG · ${plural(size, '%s byte', '%s bytes')}`),
]),
button([icon('download'), ' Download'], () => downloadFile(cfg.filename, cfg.conf, 'application/octet-stream'), 'positive'),
button([icon('download'), ' ', _('Download')], () => downloadFile(cfg.filename, cfg.conf, 'application/octet-stream'), 'positive'),
]),
E('details', { class: 'dl-params' }, [
E('summary', {}, [
icon('chevron'),
E('span', {}, 'Configuration'),
E('span', {}, _('Configuration')),
E('span', { class: 'dl-spacer' }),
eye,
E(
@@ -188,10 +196,10 @@ function fileCard(cfg: AwgConfig): HTMLElement {
class: 'dl-chipbtn',
click: (ev: Event) => {
ev.preventDefault();
copyText(cfg.conf, 'Configuration copied');
copyText(cfg.conf, _('Configuration copied'));
},
},
[icon('copy'), 'Copy'],
[icon('copy'), _('Copy')],
),
]),
pre,
@@ -212,7 +220,7 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr
return E(
'div',
{ class: 'dl-hint' },
'This device generated its own keys in the browser, so its full configuration only exists on that device.',
_('This device generated its own keys in the browser, so its full configuration only exists on that device.'),
);
const key = await vpnKey(cfg, cfg.server);
const panes: Record<string, () => Node> = {
@@ -222,13 +230,20 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr
E(
'span',
{ class: 'dl-sub' },
plainWg(cfg) ? 'Scan with AmneziaVPN or any WireGuard app on the device.' : 'Scan with AmneziaVPN or AmneziaWG on the device.',
plainWg(cfg)
? _('Scan with AmneziaVPN or any WireGuard app on the device.')
: _('Scan with AmneziaVPN or AmneziaWG on the device.'),
),
]),
key: () =>
E('div', { class: 'dl-stack gap8' }, [
E('div', { class: 'dl-linkbox' }, [E('span', { class: 'dl-mono' }, key), button('Copy', () => copyText(key, 'Key copied'))]),
E('span', { class: 'dl-sub' }, 'AmneziaVPN → Add server → Insert key. Keep it private.'),
E('div', { class: 'dl-linkbox' }, [E('span', { class: 'dl-mono' }, key), button(_('Copy'), () => copyText(key, _('Key copied')))]),
// The app's own labels (portal/setup.ts has where they come from): + in its bottom bar, Insert, Continue.
E(
'span',
{ class: 'dl-sub' },
fmt(_('AmneziaVPN → %s. Keep it private.'), ['+', _('Insert', 'AmneziaVPN app'), _('Continue', 'AmneziaVPN app')].join(' → ')),
),
]),
file: () => fileCard(cfg),
};
@@ -239,9 +254,9 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr
dom.content(body, panes[id]());
};
for (const [id, label] of [
['file', 'File'],
['key', 'Key'],
['qr', 'QR code'],
['file', _('File')],
['key', _('Key')],
['qr', _('QR code')],
])
seg.appendChild(E('button', { type: 'button', 'data-id': id, click: () => show(id) }, label));
show(initial);
@@ -254,14 +269,24 @@ async function applyDisguise(ctx: CoreCtx, srv: Server, m: Method, same: boolean
const people = ctx.st.people.filter((p) => p.server === srv.id);
const devices = people.reduce((n, p) => n + p.devices.length, 0);
const ok = await confirmDialog(
same ? 'Generate new disguise values?' : `Switch to ${info.title}?`,
`${devices} AmneziaWG device${devices === 1 ? ' stops' : 's stop'} connecting until ${devices === 1 ? 'it imports its' : 'they import their'} configuration again (from their personal link or from you).${m === 'max' ? ' They need an app with AmneziaWG 3.1.' : m === 'balanced' ? ' They need an app with AmneziaWG 2.0 or newer.' : ''}${ctx.st.servers.length === 1 && devices ? ' To keep the old disguise for some people, add a second server and move them there.' : ''}`,
same ? 'Generate and apply' : 'Switch and apply',
same ? _('Generate new disguise values?') : fmt(_('Switch to %s?'), info.title),
[
plural(
devices,
'%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).',
'%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you).',
),
m === 'max' ? _('They need an app with AmneziaWG 3.1.') : m === 'balanced' ? _('They need an app with AmneziaWG 2.0 or newer.') : '',
ctx.st.servers.length === 1 && devices ? _('To keep the old disguise for some people, add a second server and move them there.') : '',
]
.filter(Boolean)
.join(' '),
same ? _('Generate and apply') : _('Switch and apply'),
true,
);
if (!ok) return;
if (await attempt(() => api.serverObfuscation(srv.id, m), same ? 'New values applied' : `${info.title} applied`)) {
notify('Devices are marked “Update config” until they import again.', 'info', 6000);
if (await attempt(() => api.serverObfuscation(srv.id, m), same ? _('New values applied') : fmt(_('%s applied'), info.title))) {
notify(_('Devices are marked “Update config” until they import again.'), 'info', 6000);
await ctx.refresh();
}
}
@@ -271,7 +296,7 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
const st: Status = ctx.st;
const port = input(String(srv.port), { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' });
const mtu = input(srv.mtu ? String(srv.mtu) : '', {
placeholder: 'Auto',
placeholder: _('Auto'),
inputmode: 'numeric',
class: 'cbi-input-text dl-w-port dl-mono',
});
@@ -280,17 +305,25 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
let selected: Method = current ?? defaultMethod(st.awg);
const apply = button('', () => applyDisguise(ctx, srv, selected, selected === current), 'neutral');
const label = () =>
dom.content(apply, selected === current ? [icon('reset'), ' Generate new values'] : [`Switch to ${methodInfo(selected)!.title}`]);
dom.content(
apply,
selected === current ? [icon('reset'), ' ', _('Generate new values')] : [fmt(_('Switch to %s'), methodInfo(selected)!.title)],
);
label();
const tools = st.awg_state?.tools !== false;
// Who holds which port arrives once the card is built (netstat on the
// router); until then the port is only checked for its range.
let holds: PortHold[] = [];
const portRow = liveRow('UDP port', port, () =>
const portRow = liveRow(_('UDP port'), port, () =>
portHelp(
Number(port.value),
holds,
`Opened on the WAN firewall automatically.${Number(port.value) === 4500 ? ' 4500 is IPsec’s port: most networks let it through.' : ''}`,
[
_('Opened on the WAN firewall automatically.'),
Number(port.value) === 4500 ? _('4500 is IPsec’s port: most networks let it through.') : '',
]
.filter(Boolean)
.join(' '),
),
);
api
@@ -301,27 +334,30 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
})
.catch(() => {});
const mtuRow = liveRow('MTU', mtu, () => mtuHelp(mtu.value, srv.mtus));
const kaRow = liveRow('Keep-alive', ka, () => keepaliveHelp(ka.value));
const kaRow = liveRow(_('Keep-alive'), ka, () => keepaliveHelp(ka.value));
return card(
'',
[
coreHead('AmneziaWG', srv.ifname),
group('globe', 'Listening', 'Where devices reach this core from the internet', [portRow]),
group('file', 'In every device configuration', 'Changing these marks devices “Update config” until they import again', [
group('globe', _('Listening'), _('Where devices reach this core from the internet'), [portRow]),
group('file', _('In every device configuration'), _('Changing these marks devices “Update config” until they import again'), [
mtuRow,
kaRow,
]),
group('shield', 'Disguise', 'So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard', [
group('shield', _('Disguise'), _('So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard'), [
// A server from before 0.8 on the old junk-only disguise: it runs, but is no longer offered.
legacyTitle(srv.preset)
? callout('warn', [
E('b', {}, legacyTitle(srv.preset)!),
' is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to ',
E('b', {}, 'Balanced'),
' or ',
E('b', {}, 'Maximum'),
': devices import their configuration again.',
])
? callout(
'warn',
fill(
_(
'%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again.',
),
E('b', {}, legacyTitle(srv.preset)!),
E('b', {}, _('Balanced')),
E('b', {}, _('Maximum')),
),
)
: '',
methodPicker(
st.awg,
@@ -335,29 +371,31 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
),
// Only about an installed AmneziaWG: without one the server page says what to install.
tools && !st.awg.v3
? callout('info', [
'This router runs an older AmneziaWG. ',
E('b', {}, 'Maximum'),
' becomes available with kmod-amneziawg and amneziawg-tools 3.1.',
])
? callout(
'info',
fill(
_('This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1.'),
E('b', {}, _('Maximum')),
),
)
: '',
paramsView(srv.obf ?? {}) ?? '',
E('div', { class: 'dl-row-end' }, [
E('span', { class: 'dl-sub' }, 'Applies at once: every AmneziaWG device imports its configuration again.'),
E('span', { class: 'dl-sub' }, _('Applies at once: every AmneziaWG device imports its configuration again.')),
apply,
]),
]),
E('details', { class: 'dl-params' }, [
E('summary', {}, [icon('chevron'), E('span', {}, 'Tunnel'), E('span', { class: 'dl-pcount' }, '3')]),
E('summary', {}, [icon('chevron'), E('span', {}, _('Tunnel')), E('span', { class: 'dl-pcount' }, '3')]),
E('div', { class: 'dl-params-body' }, [
row('Interface', E('span', { class: 'dl-mono' }, `${srv.ifname} · router ${srv.address}`)),
row('Tunnel subnet', E('span', { class: 'dl-mono' }, srv.subnet), 'Device addresses come from it.'),
row(_('Interface'), E('span', { class: 'dl-mono' }, `${srv.ifname} · ${fmt(_('router %s'), srv.address)}`)),
row(_('Tunnel subnet'), E('span', { class: 'dl-mono' }, srv.subnet), _('Device addresses come from it.')),
row(
'Server public key',
_('Server public key'),
E('span', { class: 'dl-keyrow' }, [
E('code', { class: 'dl-mono' }, srv.public_key),
button([icon('copy')], () => copyText(srv.public_key, 'Public key copied'), 'neutral', {
title: 'Copy',
button([icon('copy')], () => copyText(srv.public_key, _('Public key copied')), 'neutral', {
title: _('Copy'),
class: 'cbi-button cbi-button-neutral dl-icon-only sm',
}),
]),
@@ -366,9 +404,9 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
]),
],
[
E('span', { class: 'dl-sub' }, 'Port, MTU and keep-alive apply at once.'),
E('span', { class: 'dl-sub' }, _('Port, MTU and keep-alive apply at once.')),
button(
'Save',
_('Save'),
() => {
// The help lines already say what is wrong: do not send it anyway.
const bad = firstBad([portRow, mtuRow, kaRow]);
@@ -376,7 +414,7 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
notify(bad, 'warning');
return;
}
return ctx.save({ port: port.value, mtu: mtu.value, keepalive: ka.value }, 'AmneziaWG saved');
return ctx.save({ port: port.value, mtu: mtu.value, keepalive: ka.value }, _('AmneziaWG saved'));
},
'positive',
),
@@ -395,30 +433,30 @@ function overviewTile(srv: Server): HTMLElement {
[0, 1, 2, 3].map((i) => E('i', { class: i < n ? 'on' : '' })),
);
const chips: string[] = [];
if (+o.jc) chips.push(`${o.jc} junk · ${o.jmin}–${o.jmax} B`);
if (+o.jc) chips.push(`${plural(+o.jc, '%s junk', '%s junk')} · ${o.jmin}–${o.jmax} ${_('B')}`);
const pad = ['s1', 's2', 's3', 's4'].filter((k) => +o[k]).map((k) => `${k.toUpperCase()} ${o[k]}`);
if (pad.length) chips.push(pad.slice(0, 2).join(' · ') + (pad.length > 2 ? ` +${pad.length - 2}` : ''));
if (['h1', 'h2', 'h3', 'h4'].some((k) => o[k] && o[k] !== String(['h1', 'h2', 'h3', 'h4'].indexOf(k) + 1))) chips.push('H1–H4 random');
if (o.i1) chips.push(/0x(8580|0100)0001/.test(o.i1) ? 'DNS-like first packets' : 'Signature packets');
if (o.header_protection_key) chips.push('Encrypted headers');
if (!chips.length) chips.push(m?.id === 'off' ? 'Plain WireGuard' : 'No values yet');
if (['h1', 'h2', 'h3', 'h4'].some((k) => o[k] && o[k] !== String(['h1', 'h2', 'h3', 'h4'].indexOf(k) + 1))) chips.push(_('H1–H4 random'));
if (o.i1) chips.push(/0x(8580|0100)0001/.test(o.i1) ? _('DNS-like first packets') : _('Signature packets'));
if (o.header_protection_key) chips.push(_('Encrypted headers'));
if (!chips.length) chips.push(m?.id === 'off' ? _('Plain WireGuard') : _('No values yet'));
return E('div', { class: 'dl-bento-tile dl-disg' }, [
E('div', { class: 'dl-bento-head' }, [
E('span', { class: 'dl-metric-label' }, 'Disguise'),
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, 'Change'),
E('span', { class: 'dl-metric-label' }, _('Disguise')),
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')),
]),
E('div', { class: 'dl-disg-id' }, [
E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')),
E('span', { class: 'dl-stack' }, [
E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? 'Custom')),
E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? 'Switch to Balanced or Maximum' : 'Set by hand'),
E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? _('Custom', 'disguise'))),
E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? _('Switch to Balanced or Maximum') : _('Set by hand')),
]),
]),
m
? E('div', { class: 'dl-disg-meters' }, [
E('span', {}, 'Stealth'),
E('span', {}, _('Stealth')),
segs(m.stealth, 'acc'),
E('span', {}, 'Speed'),
E('span', {}, _('Speed')),
segs(m.speed, 'ok'),
])
: '',
@@ -437,6 +475,17 @@ export const awg: Core = {
overviewTile,
connectBlock,
qrText: (cfg) => cfg.conf,
appKey: { label: 'Copy AmneziaVPN config', make: (cfg) => vpnKey(cfg, cfg.server) },
file: { label: 'Download AmneziaWG config', make: (cfg) => ({ name: cfg.filename, text: cfg.conf }) },
// Labels are getters: the text is made when a menu is drawn.
appKey: {
get label() {
return _('Copy AmneziaVPN config');
},
make: (cfg) => vpnKey(cfg, cfg.server),
},
file: {
get label() {
return _('Download AmneziaWG config');
},
make: (cfg) => ({ name: cfg.filename, text: cfg.conf }),
},
};