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

+62 -25
View File
@@ -9,7 +9,8 @@ import { button, iconButton } from '../ui/button';
import { cancelButton, closeModal, modal } from '../ui/modal';
import { copyText } from '../ui/files';
import { errorText, notify } from '../ui/toast';
import { NAME, checkVerdict, isOurJob, jobComponent, mmss, runningComponent, verText } from './jobs';
import { fmt } from '../../shared/i18n';
import { checkVerdict, componentName, isOurJob, jobComponent, mmss, runningComponent, verText } from './jobs';
export interface OpOptions {
/** Modal title, e.g. "Updating Dawnline". */
@@ -35,16 +36,16 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
const comp = follow ? runningComponent(follow) : jobComponent(what!);
const isCheck = follow ? follow.action === 'check' : what!.startsWith('check');
const opened = Date.now();
const name = E('b', {}, NAME[comp] ?? (comp === 'all' ? 'All components' : 'Dawnline'));
const name = E('b', {}, componentName(comp) ?? (comp === 'all' ? _('All components') : 'Dawnline'));
const ver = E('span', { class: 'dl-pill dl-mono' }, o.version ?? '');
const phase = E('span', { class: 'dl-pill info', hidden: true });
const timer = E('span', {}, '0:00');
const log = E('pre', { class: 'dl-log' }, 'Operation started. Waiting for log output…');
const log = E('pre', { class: 'dl-log' }, _('Operation started. Waiting for log output…'));
const result = E('div', {});
const actions = E('div', { class: 'dl-op-actions' });
let lines: string[] = [];
const setActions = (nodes: Node[]) => dom.content(actions, nodes);
const closeBtn = (danger = false) => cancelButton('Close', danger);
const closeBtn = (danger = false) => cancelButton(_('Close'), danger);
modal(
o.title,
@@ -57,8 +58,8 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
E('span', { class: 'dl-faint dl-op-timer' }, [icon('clock'), timer]),
]),
E('div', { class: 'dl-op-loghead' }, [
E('b', {}, 'Operation log'),
iconButton('copy', 'Copy log', () => copyText(lines.join('\n'), 'Log copied')),
E('b', {}, _('Operation log')),
iconButton('copy', _('Copy log'), () => copyText(lines.join('\n'), _('Log copied'))),
]),
log,
result,
@@ -70,7 +71,7 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
E(
'button',
{ class: 'cbi-button cbi-button-neutral spinning', type: 'button', disabled: 'disabled' },
isCheck ? 'Checking…' : 'Working…',
isCheck ? _('Checking…') : _('Working…'),
),
]);
@@ -144,12 +145,12 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
phase.hidden = false;
if (!job || job.state === 'running') {
phase.className = 'dl-pill warn';
phase.textContent = 'No answer';
phase.textContent = _('No answer');
dom.content(
result,
E('div', { class: 'dl-comp-status warn' }, [
icon('alert'),
E('span', {}, 'The router stopped answering. The job may still finish: reopen Components in a minute.'),
E('span', {}, _('The router stopped answering. The job may still finish: reopen Components in a minute.')),
]),
);
setActions([closeBtn()]);
@@ -158,21 +159,25 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
}
if (job.state === 'failed') {
phase.className = 'dl-pill bad';
phase.textContent = 'Failed';
phase.textContent = _('Failed');
dom.content(
result,
E('div', { class: 'dl-comp-status bad' }, [
icon('x'),
E('span', {}, [E('b', {}, job.error ?? 'Operation failed'), isCheck ? '' : '. Nothing else was changed.']),
// The router's error may end its own sentence: one full stop either way.
E('span', {}, [
E('b', {}, (job.error ?? _('Operation failed')).replace(/\.$/, '')),
isCheck ? '' : `. ${_('Nothing else was changed.')}`,
]),
]),
);
setActions([button('Copy log', () => copyText(lines.join('\n'), 'Log copied')), closeBtn(true)]);
notify(`${NAME[comp] ?? 'Update'}: ${job.error ?? 'failed'}`, 'error');
setActions([button(_('Copy log'), () => copyText(lines.join('\n'), _('Log copied'))), closeBtn(true)]);
notify(`${componentName(comp) ?? _('Update', 'noun')}: ${job.error ?? _('failed')}`, 'error');
o.onDone?.(st);
return job;
}
phase.className = 'dl-pill ok';
phase.textContent = 'Finished';
phase.textContent = _('Finished');
if (isCheck && st) {
const v = checkVerdict(st, comp);
dom.content(
@@ -186,7 +191,7 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
o.onDone?.(st);
if (v.update && o.onUpdate) {
const s = st;
setActions([closeBtn(), button(`Update to ${v.update}`, () => o.onUpdate!(s), 'positive')]);
setActions([closeBtn(), button(fmt(_('Update to %s'), v.update), () => o.onUpdate!(s), 'positive')]);
} else {
setActions([closeBtn()]);
// Nothing to do: the modal goes away on its own (as in the check toast).
@@ -194,39 +199,71 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
}
return job;
}
// The admin's translation: LuCI's web server restarts two seconds after the
// job to read it (or forget it); the page then reloads in its new language.
const lang = /^app:(lang:|nolang$)/.exec(job.component ?? '');
if (lang) {
const reload = () => {
ui.menu?.flushCache();
location.reload();
};
dom.content(
result,
E('div', { class: 'dl-comp-status ok' }, [
icon('check'),
E('span', {}, [
E('b', {}, lang[1] === 'nolang' ? _('The translation is removed.') : _('The translation is installed.')),
' ',
_('Reloading the page…'),
]),
]),
);
setActions([closeBtn(), button(_('Reload now'), reload, 'positive')]);
await sleep(4000);
if (result.isConnected) reload();
return job;
}
// Dawnline itself: rpcd and the service restart; reload the page once they answer with the new version.
if (comp === 'app' && job.to) {
const target = job.to;
const msg = E('span', {}, 'Waiting for the router to restart its services…');
const msg = E('span', {}, _('Waiting for the router to restart its services…'));
dom.content(
result,
E('div', { class: 'dl-comp-status ok' }, [icon('check'), E('span', {}, [E('b', {}, `Dawnline ${target} is installed. `), msg])]),
E('div', { class: 'dl-comp-status ok' }, [
icon('check'),
E('span', {}, [E('b', {}, fmt(_('Dawnline %s is installed.'), target)), ' ', msg]),
]),
);
const reload = () => {
ui.menu?.flushCache();
location.reload();
};
setActions([closeBtn(), button('Reload now', reload, 'positive')]);
notify(`Dawnline updated to ${target}`, 'success', 6000);
setActions([closeBtn(), button(_('Reload now'), reload, 'positive')]);
notify(fmt(_('Dawnline updated to %s'), target), 'success', 6000);
for (let n = 1; n <= 30; n++) {
msg.textContent = `Waiting for the router to restart its services (${n} of 30)…`;
msg.textContent = fmt(_('Waiting for the router to restart its services (%s of 30)…'), n);
await sleep(1500);
const s = await api.updatesStatus().catch(() => null);
if (s?.version === target) {
msg.textContent = 'Services are back. Reloading…';
msg.textContent = _('Services are back. Reloading…');
setTimeout(reload, 800);
return job;
}
}
msg.textContent = 'Services restarted. Reload the page to use the new version.';
msg.textContent = _('Services restarted. Reload the page to use the new version.');
return job;
}
const changed = [...((job.result?.pkgs?.updated as string[]) ?? []), ...((job.result?.pkgs?.installed as string[]) ?? [])];
const done =
comp === 'pkgs'
? `Updated ${[...((job.result?.pkgs?.updated as string[]) ?? []), ...((job.result?.pkgs?.installed as string[]) ?? [])].join(', ') || 'system packages'}`
? changed.length
? fmt(_('Updated %s'), changed.join(', '))
: _('Updated system packages')
: comp === 'amneziawg'
? `AmneziaWG${job.to ? ` ${job.to}` : ''} is installed`
: 'Operation completed';
? job.to
? fmt(_('AmneziaWG %s is installed'), job.to)
: _('AmneziaWG is installed')
: _('Operation completed');
dom.content(result, E('div', { class: 'dl-comp-status ok' }, [icon('check'), E('span', {}, done)]));
setActions([closeBtn()]);
notify(done, 'success');