fixed theo error
This commit is contained in:
23
samy.ps1
23
samy.ps1
@@ -2248,11 +2248,26 @@ function Install-DattoRMM {
|
||||
}
|
||||
|
||||
# ---- Task invocation ----
|
||||
$task = $Global:SamyTasks | Where-Object Name -EQ $path
|
||||
if ($task) {
|
||||
$task = $Global:SamyTasks | Where-Object Name -EQ $path $task = $Global:SamyTasks | Where-Object Name -EQ $path
|
||||
if ($task) { if ($task) {
|
||||
& $task.HandlerFn $Context
|
||||
return
|
||||
}
|
||||
return $fn = $task.HandlerFn
|
||||
} $cmd = Get-Command $fn -ErrorAction SilentlyContinue
|
||||
if (-not $cmd) {
|
||||
$Context.Response.StatusCode = 500
|
||||
Send-Text $Context "Handler not found: $fn"
|
||||
return
|
||||
}
|
||||
# If the handler declares a Context parameter, pass it by name.
|
||||
# Otherwise, call it with no args (prevents HttpListenerContext getting bound to -Mode).
|
||||
if ($cmd.Parameters.ContainsKey('Context')) {
|
||||
& $fn -Context $Context
|
||||
}
|
||||
else {
|
||||
& $fn
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# ---- 404 ----
|
||||
$Context.Response.StatusCode = 404
|
||||
|
||||
Reference in New Issue
Block a user