mirror of
https://github.com/github/awesome-copilot.git
synced 2026-08-22 17:06:51 +00:00
address review: sanitize tagc, fix customize doc, harden serve-board.ps1
- Sanitize tagc to [A-Za-z0-9_-] before class-attribute interpolation, so a custom class name cannot break out of the attribute and inject markup/handlers (template + sample). - customize.md now points at .tagedit.<name> (the class the renderer actually applies). - serve-board.ps1: fail when the port is already in use, capture and report the server PID (with a stop command), and verify the process did not exit before opening the URL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 07e720ee-ca02-419e-9adb-300738b6fc76
This commit is contained in:
@@ -7,8 +7,17 @@ param(
|
||||
)
|
||||
$full = Join-Path $Dir $File
|
||||
if (-not (Test-Path $full)) { Write-Error "Board not found: $full"; exit 1 }
|
||||
Start-Process -FilePath "python" -ArgumentList @("-m","http.server","$Port","--bind","127.0.0.1","--directory","`"$Dir`"") -WindowStyle Hidden
|
||||
try {
|
||||
if (Get-NetTCPConnection -State Listen -LocalPort $Port -ErrorAction SilentlyContinue) {
|
||||
Write-Error "Port $Port is already in use — choose another with -Port or stop the existing server."; exit 1
|
||||
}
|
||||
} catch { } # Get-NetTCPConnection may be unavailable on some platforms; skip the pre-check there.
|
||||
$proc = Start-Process -FilePath "python" -ArgumentList @("-m","http.server","$Port","--bind","127.0.0.1","--directory","`"$Dir`"") -WindowStyle Hidden -PassThru
|
||||
Start-Sleep -Seconds 2
|
||||
if ($proc.HasExited) {
|
||||
Write-Error "The server exited on startup (code $($proc.ExitCode)) — is Python installed and the port free?"; exit 1
|
||||
}
|
||||
$url = "http://localhost:$Port/$File"
|
||||
Write-Host "Focus board: $url"
|
||||
Write-Host "Server PID $($proc.Id) — stop it with: Stop-Process -Id $($proc.Id)"
|
||||
Start-Process $url # opens in default browser; in a Copilot-app session, open a browser canvas to this URL instead
|
||||
|
||||
Reference in New Issue
Block a user