Update StackMonkey.ps1
This commit is contained in:
@@ -1855,28 +1855,28 @@ function Install-DattoRMM {
|
||||
|
||||
#>
|
||||
|
||||
'UI' {
|
||||
'UI' {
|
||||
$url = "http://localhost:$Port/"
|
||||
Write-LogHybrid "Starting ScriptMonkey UI on $url" Info Startup
|
||||
|
||||
# Resolve Edge path explicitly (works in both 32/64-bit installs)
|
||||
# Resolve Edge path explicitly (x86 first, then 64-bit, then PATH)
|
||||
$edgeCandidates = @(
|
||||
"${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe",
|
||||
"$env:ProgramFiles\Microsoft\Edge\Application\msedge.exe
|
||||
"$env:ProgramFiles\Microsoft\Edge\Application\msedge.exe"
|
||||
)
|
||||
$edgePath = ($edgeCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1)
|
||||
$edgePath = $edgeCandidates | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1
|
||||
if (-not $edgePath) {
|
||||
$cmd = Get-Command -Name 'msedge.exe' -ErrorAction SilentlyContinue
|
||||
if ($cmd) { $edgePath = $cmd.Path }
|
||||
}
|
||||
|
||||
# Launch Edge (app mode) in a background job so Start-Server can block
|
||||
# Launch Edge (app mode) in a background job so Start-Server can block
|
||||
Start-Job -Name 'OpenScriptMonkeyUI' -ScriptBlock {
|
||||
param($u, $edge)
|
||||
param([string]$u, [string]$edge)
|
||||
Start-Sleep -Milliseconds 400
|
||||
try {
|
||||
if ($edge -and (Test-Path $edge)) {
|
||||
Start-Process -FilePath $edge -ArgumentList @('--new-window',"--app=$u")
|
||||
Start-Process -FilePath $edge -ArgumentList @('--new-window', "--app=$u")
|
||||
} else {
|
||||
Start-Process -FilePath $u # fallback to default browser
|
||||
}
|
||||
@@ -1886,6 +1886,8 @@ function Install-DattoRMM {
|
||||
# Now start the blocking listener loop
|
||||
Start-Server
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user