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)
53 lines
1.9 KiB
Ucode
53 lines
1.9 KiB
Ucode
// Dawnline — changes to /etc/config/dawnline, the one way: under the config
|
|
// lock, against a model loaded inside that lock, committed with the file kept
|
|
// private. rpcd, the portal, the CLI and the agent all go through here, so
|
|
// no change is made on a stale model and none is lost to another writer.
|
|
|
|
import { lock, unlock } from 'dawnline.util';
|
|
import * as core from 'dawnline.core';
|
|
import { _ } from 'dawnline.i18n';
|
|
|
|
/** Section names that are never ids of people, devices, servers, services or circles. */
|
|
export const RESERVED_IDS = [ 'settings', 'main', 'global', 'defaults' ];
|
|
|
|
/**
|
|
* Commit the dawnline config and keep it readable by root only. A commit
|
|
* that did not reach flash (full or read-only overlay) is an error: the
|
|
* caller's change never happened, and nothing downstream may act on it.
|
|
*/
|
|
export function commit(c) {
|
|
if (!c.commit(core.CONFIG)) {
|
|
let why = c.error();
|
|
die(why != null ? sprintf(_("Couldn't save /etc/config/dawnline: %s. Is the flash full?"), why)
|
|
: _("Couldn't save /etc/config/dawnline: the write failed. Is the flash full?"));
|
|
}
|
|
system('chmod 600 /etc/config/dawnline');
|
|
};
|
|
|
|
/**
|
|
* Run fn(c, m) with the config lock held, on a fresh cursor and model; commit
|
|
* when fn returns (the return value is passed on). Anything fn throws aborts
|
|
* without committing and is rethrown with the same message.
|
|
*/
|
|
export function transact(fn) {
|
|
let l = lock('config');
|
|
try {
|
|
let c = core.open_cursor();
|
|
let m = core.load(c);
|
|
let r = fn(c, m);
|
|
commit(c);
|
|
unlock(l);
|
|
return r;
|
|
}
|
|
catch (e) {
|
|
unlock(l);
|
|
die(e.message ?? `${e}`);
|
|
}
|
|
};
|
|
|
|
/** Is `id` used by anything in the model (any kind of section), or reserved? */
|
|
export function id_taken(m, id) {
|
|
return index(RESERVED_IDS, id) >= 0 || m.servers?.[id] != null || m.people?.[id] != null || m.devices?.[id] != null ||
|
|
m.services?.[id] != null || m.circles?.[id] != null;
|
|
};
|