pwd part 2

This commit is contained in:
2025-12-17 19:26:35 -05:00
parent 99bacdd7b4
commit b73aae2d87

View File

@@ -1928,15 +1928,17 @@ function Get-SamyClientListFromServer {
[Parameter(Mandatory)] [Parameter(Mandatory)]
[string]$Uri, [string]$Uri,
[Parameter(Mandatory)] [Parameter(Mandatory=$false)]
[string]$Password [AllowEmptyString()]
[string]$Password = ""
) )
try { try {
Write-LogHybrid "Calling client list service at $Uri" Info Printers -LogToEvent Write-LogHybrid "Calling client list service at $Uri" Info Printers -LogToEvent
$headers = @{ $headers = @{}
SAMYPW = $Password if (-not [string]::IsNullOrEmpty($Password)) {
$headers.SAMYPW = $Password
} }
$resp = Invoke-RestMethod -Uri $Uri ` $resp = Invoke-RestMethod -Uri $Uri `
@@ -1990,11 +1992,8 @@ function Invoke-GetPrinters {
} }
$password = $body.password $password = $body.password
if (-not $password) { if ($null -eq $password) { $password = "" } # allow blank
$Context.Response.StatusCode = 400
Send-Text $Context 'Password is required.'
return
}
$uri = 'https://bananas.svstools.ca/getprinters' $uri = 'https://bananas.svstools.ca/getprinters'
Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent