Update testTaskGate.ps1

This commit is contained in:
2025-05-21 17:26:48 -04:00
parent ef55468b90
commit e2f2a72a72

View File

@@ -39,7 +39,8 @@ function Install-CyberQP {
}
# Utility for sending plain-text HTTP responses
function Respond-Text { param($Context, $Text)
function Respond-Text {
param($Context, $Text)
$buffer = [Text.Encoding]::UTF8.GetBytes($Text)
$Context.Response.ContentType = 'text/plain'
$Context.Response.ContentLength64 = $buffer.Length
@@ -50,15 +51,19 @@ function Respond-Text { param($Context, $Text)
#region UI Generation
function Get-UIHtml {
# Build checkbox HTML
$checkboxes = $Global:Tasks | ForEach-Object {
"<label><input type=`"checkbox`" id=`"$($_.Id)`" name=`"$($_.Name)`"> $($_.Label)</label>"
} -join "`n"
# Build checkbox HTML (wrap pipeline in parentheses so -join applies to result array)
$checkboxes = (
$Global:Tasks | ForEach-Object {
"<label><input type=`"checkbox`" id=`"$($_.Id)`" name=`"$($_.Name)`"> $($_.Label)</label>"
}
) -join "`n"
# Build JS tasks array
$tasksJs = $Global:Tasks | ForEach-Object {
"{ id: '$($_.Id)', handler: '/$($_.Name)' }"
} -join ",`n "
$tasksJs = (
$Global:Tasks | ForEach-Object {
"{ id: '$($_.Id)', handler: '/$($_.Name)' }"
}
) -join ",`n "
$html = @"
<!DOCTYPE html>