diff --git a/plugins/geenforce/seed_display_scope.py b/plugins/geenforce/seed_display_scope.py index d6edb3b..fe05f94 100644 --- a/plugins/geenforce/seed_display_scope.py +++ b/plugins/geenforce/seed_display_scope.py @@ -218,54 +218,21 @@ try {{ ForEach-Object {{ Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue; Write-Host "killed old-URL kiosk Edge pid $($_.ProcessId)" }} }} catch {{}} -# WHY a launcher, not a direct Edge shortcut: at auto-login the shortcut fires -# before the network is up, so Edge --kiosk navigates to nothing and sits on a -# blank WHITE page with no retry. This VBS waits (hidden, no console flash - -# wscript has no window) until the kiosk URL actually responds, THEN launches -# Edge fullscreen, so the first paint is the real page. Gives up after ~3 min -# and launches anyway so a display is never left dark. -$launcherDir = Join-Path $env:ProgramData 'ShopDB' -if (-not (Test-Path $launcherDir)) {{ New-Item -ItemType Directory -Path $launcherDir -Force | Out-Null }} -$launcherPath = Join-Path $launcherDir 'Start-ShopdbKiosk.vbs' -$vbsTemplate = @' -Option Explicit -Dim kioskUrl, edgePath, i, reachable, http, shell -kioskUrl = "__URL__" -edgePath = "__EDGE__" -reachable = False -For i = 1 To 60 - On Error Resume Next - Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0") - http.SetTimeouts 5000, 5000, 5000, 5000 - http.Open "GET", kioskUrl, False - http.Send - If Err.Number = 0 Then - If http.Status >= 200 And http.Status < 400 Then reachable = True - End If - On Error GoTo 0 - If reachable Then Exit For - WScript.Sleep 3000 -Next -Set shell = CreateObject("WScript.Shell") -Dim q -q = Chr(34) -shell.Run q & edgePath & q & " --kiosk " & q & kioskUrl & q & " --edge-kiosk-type=fullscreen", 1, False -'@ -$vbs = $vbsTemplate.Replace('__URL__', $kioskUrl).Replace('__EDGE__', $edge) -Set-Content -LiteralPath $launcherPath -Value $vbs -Encoding ASCII +# remove a stale VBS launcher from an earlier build (kiosk now uses a direct +# Edge shortcut again). Harmless if absent. +$staleVbs = Join-Path (Join-Path $env:ProgramData 'ShopDB') 'Start-ShopdbKiosk.vbs' +if (Test-Path -LiteralPath $staleVbs) {{ Remove-Item -LiteralPath $staleVbs -Force -ErrorAction SilentlyContinue }} -# Startup shortcut launches the VBS via wscript (windowless), which waits then -# opens Edge. TargetPath is wscript, not Edge, so the connectivity wait runs. -$wscript = Join-Path $env:WINDIR 'System32\\wscript.exe' +$edgeArgs = "--kiosk `"$kioskUrl`" --edge-kiosk-type=fullscreen" $lnkPath = Join-Path $startup 'ShopDB Kiosk.lnk' $lnk = $shell.CreateShortcut($lnkPath) -$lnk.TargetPath = $wscript -$lnk.Arguments = '"' + $launcherPath + '"' -$lnk.WorkingDirectory = $launcherDir -$lnk.WindowStyle = 7 +$lnk.TargetPath = $edge +$lnk.Arguments = $edgeArgs +$lnk.WorkingDirectory = Split-Path -Parent $edge +$lnk.WindowStyle = 3 $lnk.Description = "ShopDB kiosk display: $kioskUrl" $lnk.Save() -Write-Host "display-type '$displayType' -> kiosk Startup launcher (waits for $kioskUrl)" +Write-Host "display-type '$displayType' -> kiosk Startup shortcut for $kioskUrl" """