Contributing
LuCI Bandix is developed on GitHub at timsaya/luci-app-bandix. The backend is a separate project (timsaya/openwrt-bandix). Problems with counting, rate limiting or the HTTP API usually belong there; problems with the pages, translations or the RPC plugin belong here.
Reporting Issues
The issue tracker has two templates:
- Bug report: description and screenshots, system information (OpenWrt version, Bandix versions, network layout), and what you already tried.
- Feature request: what you would like to see.
The templates are bilingual (English and Chinese). See Troubleshooting for the information worth attaching.
Repository Layout
luci-app-bandix/
├── Makefile # OpenWrt package definition (luci.mk)
├── htdocs/luci-static/resources/
│ ├── view/bandix/ # index.js, connection.js, dns.js, settings.js
│ └── bandix/ # devices.js, flows.js, geoip.js, quota.js
├── po/<language>/bandix.po # translations
└── root/usr/
├── libexec/rpcd/luci.bandix # rpcd plugin (shell)
└── share/
├── luci/menu.d/luci-app-bandix.json
├── luci/status/bandix.json
└── rpcd/acl.d/luci-app-bandix.json
tests/ # Node.js and Python tests
docs/images/ # screenshots used in the README
ARCHITECTURE.md # backend architecture notes (Chinese)
Architecture explains how these parts interact.
Running the Tests
The tests extract functions directly from the production files and run them in isolation, so no router is needed.
JavaScript Tests
They use Node.js's built-in test runner and need no npm packages:
node --test tests/devices.test.cjs
node --test tests/flows.test.cjs
node --test tests/geoip.test.cjs
node --test tests/quota.test.cjs
node --test tests/units.test.cjs
node --test tests/wifi.test.cjs
node --test tests/host.test.cjs
| File | Covers |
|---|---|
devices.test.cjs |
Device selection and batch deletion (bandix/devices.js) |
flows.test.cjs |
The flow search index (bandix/flows.js) |
geoip.test.cjs |
GeoIP manager and location formatting (bandix/geoip.js) |
quota.test.cjs |
Quota form and summaries (bandix/quota.js) |
units.test.cjs |
Size and speed formatting and parsing in index.js |
wifi.test.cjs |
Wi-Fi band and channel display helpers in index.js |
host.test.cjs |
Backend host/port handling of the RPC plugin; needs a POSIX sh |
RPC Plugin Tests
test_batch_rpc.py and test_quota_rpc.py run parts of the rpcd plugin with a stubbed curl, so no backend is contacted and nothing is deleted. They need OpenWrt's jshn tools from an SDK or build tree:
JSHN_SH=/path/to/jshn.sh PATH=/path/to/host/bin:$PATH python3 -m unittest tests/test_batch_rpc.py tests/test_quota_rpc.py
Without JSHN_SH set and jshn on PATH, they are skipped.
Translation Test
test_translations.py collects every _('…') string from the JavaScript files and checks that the zh_Hans and zh_Hant catalogs translate all of them with matching placeholders. It needs GNU gettext's msgfmt:
python3 -m unittest tests/test_translations.py
Translations
Catalogs live in luci-app-bandix/po/<language>/bandix.po. The repository currently has es, fr, ja, pl, ru, zh_Hans and zh_Hant. Each language is built into a separate luci-i18n-bandix-<language> package by LuCI's build system.
When you add or change a user-visible string in a view, update the Chinese catalogs at least, since the translation test checks them. Keep placeholders such as %s and %d intact.
Building
The package uses LuCI's standard luci.mk, so it builds like any other LuCI application in an OpenWrt SDK or build tree. The release workflow (.github/workflows/Auto compile with openwrt sdk.yml) does this with the openwrt/gh-action-sdk action and PACKAGES: luci-app-bandix.
The workflow:
- Runs only when triggered manually (
workflow_dispatch) or by arepository_dispatchevent. - Reads
PKG_VERSIONandPKG_RELEASEfrom the Makefile and compares<version>-r<release>with the latest GitHub release tag. - If they differ, creates the release
v<version>-r<release>. - Builds two variants: an
.ipkwith thex86_64-24.10.1SDK and an.apkwith thex86_64SDK image, including the language packs. - Renames the files to end in
_all.<ext>and uploads them to the release.
The packages are architecture-independent (JavaScript, shell and JSON only), which is why one x86_64 build serves all routers.
Note: The workflow's
.configalso enables theidandthLuCI languages, for which the repository has no catalogs, so no packages are produced for them.
Versioning
- The version is
PKG_VERSIONplusPKG_RELEASEinluci-app-bandix/Makefile(for example0.12.12and5, released asv0.12.12-r5). - The minor version follows the backend: luci-app-bandix 0.12.x needs openwrt-bandix 0.12.x. Changes that need a new backend API belong in a new minor version of both projects.
- The built-in updater compares versions with
sort -Vafter strippingvfrom the tag, so keep tags in that format.
Release notes are on the GitHub releases page.
License
LuCI Bandix is licensed under the Apache License 2.0 (LICENSE, and PKG_LICENSE:=Apache-2.0 in the Makefile).