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 / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions
- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode. - **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V). - **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request. - **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds. - **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person. - **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router. - **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch. - **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away. - **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once. - **Undo.** An action done from a card or a request is undone from its toast. - **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own. - **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name. - **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking. - **Check access and Health know the networks behind routers.** - **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st. - Extra data lasts until that person's month ends; «Reset usage» starts the month anew. - A limit is for a month or for the whole term; the admin and the portal show when it resets. - Charts that said «this month» show the last 30 days. - After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st. - **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped. - **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone. - **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence. - **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
47 lines
6.6 KiB
Markdown
47 lines
6.6 KiB
Markdown
# AGENTS.md — Dawnline
|
||
|
||
Guidance for coding agents working in this repository (`tickcount/luci-app-dawnline`): an AmneziaWG access server for OpenWrt with a LuCI admin UI and a personal portal. `CLAUDE.md` points here.
|
||
|
||
## Important
|
||
|
||
Always build code cleanly, modularly, and with proper architecture and separation of concerns. Never simply bolt on a feature because I asked for it. If you can’t find an easy way to build it naturally, and you'd recommend a refactor to make the whole thing cleanly, stop your work ahead of time and say so.
|
||
|
||
## Rules
|
||
|
||
- `rules/code-standards.md` — how all code is written: decomposition, one locked writer, fail closed, validation at the boundary, comments and commits.
|
||
- `rules/backend-go.md` — the backend (`backend/`, Go: the program `dawnlined`): packages, the stream's rules, what things cost on the router, checks. `docs/backend.md` — how it came to be, the stream's protocol, what each part is held to.
|
||
- `rules/frontend.md` — TypeScript admin UI and portal: layout of `web/src`, the admin's four LuCI modules and their size budget, pollers and the live revision.
|
||
- `rules/shell.md` — install, uninstall, init and CI scripts.
|
||
- `rules/ui-design.md` — how the admin UI and the portal look: one design system inside LuCI, modern product quality, mock first from the real code and CSS, verified in the browser.
|
||
- `DESIGN.md` — the design system of the personal portal and the admin: tokens, components, layout and motion, measured on the live page. Read it before any work on the portal (`web/src/portal`, and what it uses from `web/src/shared`) or the admin's pages (`web/src/admin`); a change to how they look or move updates it in the same change.
|
||
- `rules/i18n.md` — translations: every visible string and backend message wrapped, the catalogs, the Russian style guide and glossary. Anything added to the admin UI or the portal is localized in the same change; anything removed takes its catalog entries with it.
|
||
- `rules/release-notes.md` — how a release's points and any list of «what changed» are collected: from the code against production, key changes only, a rework told whole, in English.
|
||
|
||
This repo usually sits inside the router-admin workspace (`../AGENTS.md`). Its rules apply to anything that touches the router: read-only first, backup before mutating, router shell as a literal stdin heredoc over SSH (`../rules/`).
|
||
|
||
## Layout
|
||
|
||
- `package/luci-app-dawnline/root/` — what lands on the router beside the backend's binary: the init script, the shell around the backend in `usr/bin/dawnline` and `usr/libexec/dawnline/` (`updater`, `fetch-backend`, `postupdate`, `resolver`), the portal's assets in `usr/share/dawnline/portal/`, the version in `usr/share/dawnline/version`, the rpcd ACL and the LuCI menu. There is no ucode: the backend is Go.
|
||
- `backend/` — the backend (`dawnlined`), one static binary: the stream and the pages' methods (`ubus`, `hub`, `api`, `methods`), the watcher and the minute's work (`watch`, `chores`, `watchdog`, `geo`), putting the settings into effect (`apply`, `nft`, `store`, `uci`, `model`), the portal (`portal`), the updater and the command line (`updater`, `pkgmgr`, `cli`), `daemon` and `cmd/dawnlined`. A release publishes it for each architecture as `dawnlined-<version>-<goarch>`; `fetch-backend` puts the right one on a router (`docs/backend.md`).
|
||
- `web/` — TypeScript sources of the admin UI (`src/admin`: the LuCI modules `dawnline.app`, `dawnline.style`, `dawnline.map` and `dawnline.qr`) and the portal (`src/portal`), shared code in `src/shared`; `npm run build` writes the bundles under `package/` (git-ignored: CI builds them before packaging); `npm run build:demo` writes the two demos into `web/dist/` (the portal's, which is the public preview, and the admin's, which the README's pictures are taken from). `web/i18n/` — the string catalogs' tools (`extract.ts`, `po.ts`, `lmo.ts`).
|
||
- `package/luci-app-dawnline/po/` — the admin's catalog (`templates/dawnline.pot`, `ru/dawnline.po`): luci.mk builds the `luci-i18n-dawnline-ru` package from it. The portal's catalog is `web/src/portal/i18n/ru.po`, bundled into the portal.
|
||
- `install.sh`, `uninstall.sh` — the standalone installer and uninstaller (both have `--dry-run`).
|
||
- `scripts/` — `backend-container.sh` (the backend's checks, needs docker), `build-backend.sh` (the binary for one architecture), `deploy.sh` (dev deploy over SSH), `build-packages.sh`, `build-release.sh`, `release-notes.sh`, and the screenshot tools.
|
||
|
||
## Checks before a commit or deploy
|
||
|
||
- `scripts/backend-container.sh` (needs docker) after any change under `backend/` or to the rpcd ACL: gofmt, vet, unit tests, and the tests against a real ubusd, rpcd and uhttpd on OpenWrt 24.10 and 25.12. The goldens in `backend/*/testdata` are the removed ucode backend's own answers (0.18.0), fixed: a deliberate change of behaviour changes its golden by hand, in the same change, and says why.
|
||
- In `web/`: `npm run format:check`, `npm run typecheck` (sources and tests), `npm run lint` (oxlint), `npm run knip` (unused exports and dependencies), `npm run i18n:check` (after changing visible text: `npm run i18n`, translate the new entries in each `ru.po`), `npm test`, `npm run build` — and commit the catalogs (the bundles stay out of git; CI fails when the build leaves a file under `package/` that `.gitignore` does not cover).
|
||
- `shellcheck -S warning` for the shell scripts (CI finds them by shebang).
|
||
- A tag builds only after CI passes on it (`build.yml` calls `ci.yml`).
|
||
|
||
## Releases
|
||
|
||
- A release is one commit on `main` titled `Dawnline X.Y.Z`; its body is `- ` points, which become the GitHub release notes and "What's new" in Settings › Updates. Work from a branch is squashed into that one commit.
|
||
- The points are collected as `rules/release-notes.md` says: from the difference with the last release, not from the commit messages alone.
|
||
- Bump the version in `package/luci-app-dawnline/Makefile` (`PKG_VERSION`), `package/luci-app-dawnline/root/usr/share/dawnline/version`, `web/package.json` and `web/package-lock.json` (CI checks they agree).
|
||
- No `Co-Authored-By` or other agent attribution in commits.
|
||
- Push `main`, then an annotated tag `vX.Y.Z` ("Dawnline X.Y.Z"); the "Build packages" workflow publishes the `.ipk`, `.apk` (the app and `luci-i18n-dawnline-ru`) and `sha256sums.txt`.
|
||
- Re-cutting a release (fixes before anyone installs) rewrites `main`: force-push, `gh release delete vX.Y.Z --cleanup-tag`, cancel a running build of the old tag, tag again. Only with the user's go-ahead.
|
||
- On the router, install a release the way Settings → Updates does: `/usr/libexec/dawnline/updater install app@vX.Y.Z` (verified against the release's sha256).
|