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