fixed default network

This commit is contained in:
2026-06-29 10:34:02 +03:00
parent cdb731d837
commit 980608a279
12 changed files with 108 additions and 3 deletions
+41 -2
View File
@@ -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)'