added backlight and fixed outbound

This commit is contained in:
2026-07-21 09:17:48 +03:00
parent ff2b8a250e
commit 5392273794
37 changed files with 1560 additions and 76 deletions
+27 -12
View File
@@ -113,13 +113,11 @@ sudo cp config/config.json /opt/buttontask/config/
# privileged helpers (root-owned) + sudoers whitelist
sudo install -m 0755 webconfig/scripts/bt-netconfig webconfig/scripts/bt-update \
webconfig/scripts/bt-service webconfig/scripts/bt-set-master \
webconfig/scripts/bt-settime webconfig/scripts/bt-reboot \
webconfig/scripts/bt-access webconfig/scripts/bt-brightness \
/opt/buttontask/scripts/
sudo /opt/buttontask/scripts/bt-set-master 'your-emergency-password'
sudo tee /etc/sudoers.d/buttontask > /dev/null << 'EOF'
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-netconfig
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-update
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-service
EOF
sudo install -m 0440 webconfig/scripts/buttontask.sudoers /etc/sudoers.d/buttontask
sudo chmod 0440 /etc/sudoers.d/buttontask
sudo visudo -cf /etc/sudoers.d/buttontask
@@ -168,11 +166,8 @@ If the device was installed from an older guide, apply these fixes:
```sh
# 1. sudoers (fixes "sudo: a password is required" in web network config)
sudo tee /etc/sudoers.d/buttontask > /dev/null << 'EOF'
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-netconfig
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-update
buttontask ALL=(root) NOPASSWD: /opt/buttontask/scripts/bt-service
EOF
sudo install -m 0440 /opt/buttontask/current/webconfig/scripts/buttontask.sudoers \
/etc/sudoers.d/buttontask
sudo chmod 0440 /etc/sudoers.d/buttontask
sudo visudo -cf /etc/sudoers.d/buttontask
@@ -247,13 +242,33 @@ Build a package and upload it from the web UI → tab **Обновление**:
```
On upload, `bt-update` (detached, root) extracts the package into
`versions/<ver>`, flips the `current` symlink, restarts both services, then runs
a health-check: the web `/healthz` must answer, the Qt UI heartbeat
`versions/<ver>`, syncs `webconfig/scripts/bt-*` and sudoers into
`/opt/buttontask/scripts/` and `/etc/sudoers.d/`, flips the `current` symlink,
restarts both services, then runs a health-check: the web `/healthz` must answer, the Qt UI heartbeat
(`run/qt.alive`) must be fresh, and the `buttontask` unit must be active within
`BUTTONTASK_HEALTH_TIMEOUT` (default 30s). If any check fails it automatically
switches `current` back to the previous version and restarts. Progress is shown
live and is also readable in the app's **Обновление** page.
## LCD brightness
Web UI → **Система** → «Яркость экрана», or the on-device settings menu.
Uses `/sys/class/backlight/` via the privileged helper `bt-brightness`
(percent 0100, stored in `settings.brightness`, restored when web/Qt start).
OTA packages sync `bt-*` helpers and sudoers via `bt-update`. On devices that
still run an older `bt-update` (before helper sync), run once after the first
OTA that includes this feature:
```sh
sudo install -m0755 /opt/buttontask/current/webconfig/scripts/bt-* \
/opt/buttontask/scripts/
sudo install -m0440 /opt/buttontask/current/webconfig/scripts/buttontask.sudoers \
/etc/sudoers.d/buttontask
sudo visudo -cf /etc/sudoers.d/buttontask
sudo -u buttontask sudo -n /opt/buttontask/scripts/bt-brightness status
```
## JSON config schema
```jsonc