diff --git a/build_arm/ButtonTask b/build_arm/ButtonTask index 6a043a4..2b97d0a 100644 Binary files a/build_arm/ButtonTask and b/build_arm/ButtonTask differ diff --git a/winDeployScripts/README-deploy.md b/winDeployScripts/README-deploy.md index 540b82f..ce5833c 100644 --- a/winDeployScripts/README-deploy.md +++ b/winDeployScripts/README-deploy.md @@ -61,6 +61,11 @@ device-install.sh, все скрипты уже в LF). Бинарник по у Перед сборкой обновите `.\software\`: свежий `ButtonTask` (arm64) и актуальный `webconfig\` из репозитория (OTA не трогает `/opt/buttontask/scripts/` — всё должно попасть в бандл сразу). +PNG/JPG/SVG/GIF из `.\software\` и `.\software\icons\` попадут в +`/opt/buttontask/icons/`. Дефолтный конфиг уже содержит кнопку +`Вызов клининга` с иконкой `cleaner1Crop.png`. +Сеть: отредактируйте `.\software\config\network.json` перед сборкой +(по умолчанию `eth0` static `192.168.1.60/24`). --- diff --git a/winDeployScripts/buttontask-deploy-2.5.tgz b/winDeployScripts/buttontask-deploy-2.5.tgz index 21f2ebc..67c439e 100644 Binary files a/winDeployScripts/buttontask-deploy-2.5.tgz and b/winDeployScripts/buttontask-deploy-2.5.tgz differ diff --git a/winDeployScripts/device-install.sh b/winDeployScripts/device-install.sh index c38f5ae..d1170f2 100644 --- a/winDeployScripts/device-install.sh +++ b/winDeployScripts/device-install.sh @@ -63,6 +63,24 @@ else warn "config.json нет ни на устройстве, ни в бандле — приложение создаст дефолтный при старте" fi +# network — не перезатираем существующий +if [ -f "$ROOT/config/network.json" ]; then + log "network.json уже есть — оставляю как есть" +elif [ -f "$BUNDLE_DIR/config/network.json" ]; then + cp -a "$BUNDLE_DIR/config/network.json" "$ROOT/config/" + log "network.json установлен" +else + warn "network.json нет в бандле — eth0 останется на DHCP" +fi + +# default/shared icons — не удаляем пользовательские иконки, только докладываем новые +if ls "$BUNDLE_DIR"/icons/* >/dev/null 2>&1; then + cp -an "$BUNDLE_DIR"/icons/. "$ROOT/icons/" + log "иконки установлены" +else + warn "иконок в бандле нет" +fi + # --------------------------------------------------------------------------- # 4. Привилегированные хелперы + sudoers # --------------------------------------------------------------------------- @@ -148,5 +166,14 @@ systemctl enable buttontask buttontask-web buttontask-network >/dev/null 2>&1 || systemctl enable buttontask buttontask-web >/dev/null 2>&1 || \ die "не удалось включить сервисы (проверьте имена юнитов)" +# применить сеть сразу (не ждать ребута), если есть сохранённый профиль +if [ -f "$ROOT/config/network.json" ] && [ -x "$ROOT/scripts/bt-netconfig-boot" ]; then + if "$ROOT/scripts/bt-netconfig-boot"; then + log "сеть применена из network.json" + else + warn "не удалось применить network.json — проверьте nmcli и кабель" + fi +fi + log "версия $VER развёрнута" echo "INSTALL-OK" diff --git a/winDeployScripts/make-adb-bundle.ps1 b/winDeployScripts/make-adb-bundle.ps1 index e8b5af6..9bee3cf 100644 --- a/winDeployScripts/make-adb-bundle.ps1 +++ b/winDeployScripts/make-adb-bundle.ps1 @@ -56,7 +56,7 @@ foreach ($s in $needScripts) { $stage = Join-Path $Here "stage-$Version" if (Test-Path $stage) { Remove-Item -Recurse -Force $stage } -foreach ($d in 'app', 'debs', 'scripts', 'config', 'systemd') { +foreach ($d in 'app', 'debs', 'scripts', 'config', 'icons', 'systemd') { New-Item -ItemType Directory -Force -Path (Join-Path $stage $d) | Out-Null } @@ -94,12 +94,51 @@ else { "background": { "type": "gradient", "color1": "#00007b", "color2": "#7b007b", "animated": true, "imagePath": "" }, "feedback": { "okColor": "#00cc44", "errorColor": "#cc2200", "okWidth": 6, "errorWidth": 6, "glowRadius": 20 }, "settings": { "darkMode": true, "password": "admin", "kioskMode": false, "iconsDir": "/opt/buttontask/icons", "webPort": 8080 }, - "buttons": [] + "buttons": [ + { + "id": "cleaning-call", + "label": "Вызов клининга", + "iconPath": "cleaner1Crop.png", + "action": { "type": "http_get", "url": "http://192.168.1.55", "headers": {}, "body": "" }, + "feedback": { "successText": "Вызов отправлен", "errorText": "Ошибка", "pendingText": "...", "fadeMs": 5000 }, + "trigger": { "mode": "hold", "holdMs": 800 }, + "color": "#7b007b" + } + ] } '@ Write-Bytes (Join-Path $stage 'config\config.json') ($default -replace "`r`n", "`n") } +$netCfg = Join-Path $SoftwareDir 'config\network.json' +if (Test-Path $netCfg) { + Copy-Item $netCfg (Join-Path $stage 'config\network.json') + Log "network.json: $netCfg" +} +else { + Warn 'network.json не найден в .\software\config\ — сеть останется на DHCP' +} + +$iconExts = '.png', '.jpg', '.jpeg', '.bmp', '.svg', '.gif' +$iconSources = @() +$iconSources += Get-ChildItem $SoftwareDir -File -ErrorAction SilentlyContinue | + Where-Object { $iconExts -contains $_.Extension.ToLowerInvariant() } +$iconsDir = Join-Path $SoftwareDir 'icons' +if (Test-Path $iconsDir) { + $iconSources += Get-ChildItem $iconsDir -File -ErrorAction SilentlyContinue | + Where-Object { $iconExts -contains $_.Extension.ToLowerInvariant() } +} +$iconSources = @($iconSources | Sort-Object FullName -Unique) +foreach ($ic in $iconSources) { + Copy-Item $ic.FullName (Join-Path $stage "icons\$($ic.Name)") +} +if ($iconSources.Count -gt 0) { + Log "иконок в бандле: $($iconSources.Count)" +} +else { + Warn "иконки в .\software или .\software\icons не найдены" +} + if ($MasterPassword) { Write-Bytes (Join-Path $stage 'config\.master') $MasterPassword Log 'мастер-пароль записан в бандл (config/.master)' diff --git a/winDeployScripts/software/ButtonTask b/winDeployScripts/software/ButtonTask index e45812b..2b97d0a 100644 Binary files a/winDeployScripts/software/ButtonTask and b/winDeployScripts/software/ButtonTask differ diff --git a/winDeployScripts/software/cleaner1Crop.png b/winDeployScripts/software/cleaner1Crop.png new file mode 100644 index 0000000..cbf1fdf Binary files /dev/null and b/winDeployScripts/software/cleaner1Crop.png differ diff --git a/winDeployScripts/software/config/config.json b/winDeployScripts/software/config/config.json index 1ac713f..d0b90bc 100644 --- a/winDeployScripts/software/config/config.json +++ b/winDeployScripts/software/config/config.json @@ -28,6 +28,27 @@ "webPort": 8080 }, "buttons": [ - + { + "id": "cleaning-call", + "label": "Вызов клининга", + "iconPath": "cleaner1Crop.png", + "action": { + "type": "http_get", + "url": "http://192.168.1.55", + "headers": {}, + "body": "" + }, + "feedback": { + "successText": "Вызов отправлен", + "errorText": "Ошибка", + "pendingText": "...", + "fadeMs": 5000 + }, + "trigger": { + "mode": "hold", + "holdMs": 800 + }, + "color": "#7b007b" + } ] } \ No newline at end of file diff --git a/winDeployScripts/software/config/network.json b/winDeployScripts/software/config/network.json new file mode 100644 index 0000000..9f8e91c --- /dev/null +++ b/winDeployScripts/software/config/network.json @@ -0,0 +1,8 @@ +{ + "iface": "eth0", + "mode": "static", + "address": "192.168.1.60", + "prefix": 24, + "gateway": "192.168.1.1", + "dns": "192.168.1.1" +} diff --git a/winDeployScripts/software/webconfig/api.py b/winDeployScripts/software/webconfig/api.py index 07b0e18..b6ead44 100644 --- a/winDeployScripts/software/webconfig/api.py +++ b/winDeployScripts/software/webconfig/api.py @@ -55,6 +55,7 @@ def api_add_button(): "feedback": { "successText": data.get("successText", ""), "errorText": data.get("errorText", "Ошибка"), + "pendingText": data.get("pendingText", "..."), "fadeMs": int(data.get("fadeMs", 5000)), }, "trigger": { @@ -87,6 +88,7 @@ def api_update_button(bid): feedback = b.setdefault("feedback", {}) feedback["successText"] = data.get("successText", feedback.get("successText", "")) feedback["errorText"] = data.get("errorText", feedback.get("errorText", "Ошибка")) + feedback["pendingText"] = data.get("pendingText", feedback.get("pendingText", "...")) feedback["fadeMs"] = int(data.get("fadeMs", feedback.get("fadeMs", 5000))) trigger = b.setdefault("trigger", {}) if "triggerMode" in data: diff --git a/winDeployScripts/software/webconfig/static/app.js b/winDeployScripts/software/webconfig/static/app.js index 331e6d4..0260170 100644 --- a/winDeployScripts/software/webconfig/static/app.js +++ b/winDeployScripts/software/webconfig/static/app.js @@ -177,6 +177,7 @@ function openDialogFor(btn) { $("#b-url").value = btn?.action?.url || ""; $("#b-success").value = btn?.feedback?.successText || ""; $("#b-error").value = btn?.feedback?.errorText || "Ошибка"; + $("#b-pending").value = btn?.feedback?.pendingText ?? "..."; $("#b-color").value = btn?.color || "#7b007b"; $("#b-trigger-mode").value = btn?.trigger?.mode || "hold"; $("#b-hold").value = btn?.trigger?.holdMs || 800; @@ -218,6 +219,7 @@ form?.addEventListener("submit", async (e) => { url: $("#b-url").value, successText: $("#b-success").value, errorText: $("#b-error").value, + pendingText: $("#b-pending").value || "...", color: $("#b-color").value, triggerMode: $("#b-trigger-mode").value, holdMs: parseInt($("#b-hold").value, 10), diff --git a/winDeployScripts/software/webconfig/templates/index.html b/winDeployScripts/software/webconfig/templates/index.html index 859becd..84ab87c 100644 --- a/winDeployScripts/software/webconfig/templates/index.html +++ b/winDeployScripts/software/webconfig/templates/index.html @@ -369,6 +369,7 @@ +