Update testTaskGate.ps1
This commit is contained in:
@@ -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 {
|
||||
# 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"
|
||||
}
|
||||
) -join "`n"
|
||||
|
||||
# Build JS tasks array
|
||||
$tasksJs = $Global:Tasks | ForEach-Object {
|
||||
$tasksJs = (
|
||||
$Global:Tasks | ForEach-Object {
|
||||
"{ id: '$($_.Id)', handler: '/$($_.Name)' }"
|
||||
} -join ",`n "
|
||||
}
|
||||
) -join ",`n "
|
||||
|
||||
$html = @"
|
||||
<!DOCTYPE html>
|
||||
|
||||
Reference in New Issue
Block a user