diff --git a/StackMonkey.ps1 b/StackMonkey.ps1 index 21663e7..b6d5c56 100644 --- a/StackMonkey.ps1 +++ b/StackMonkey.ps1 @@ -133,7 +133,7 @@ $Global:DattoWebhookUrl = 'https://automate.svstools.ca/webhook/svsmspkit' } # 2) call the existing cmdlet from your module - # (make sure you’ve already done Import-Module SVSMSP or the module that contains it) + # (make sure you've already done Import-Module SVSMSP or the module that contains it) Install-DattoRMM ` -ApiUrl $creds.ApiUrl ` -ApiKey $creds.ApiKey ` @@ -291,25 +291,6 @@ function Respond-JSON { $Context.Response.OutputStream.Close() } -<# -#region Get-DattoApiCreds -function Get-DattoApiCredentials { - param ([string]$Password) - $headers = @{ "SVSMSPKit" = $Password } - try { - $response = Invoke-RestMethod -Uri $Global:DattoWebhookUrl -Headers $headers -Method GET - return @{ - ApiUrl = $response.ApiUrl - ApiKey = $response.ApiKey - ApiSecretKey = $response.ApiSecretKey - } - } catch { - Write-LogHybrid "Failed to fetch API credentials: $($_.Exception.Message)" "Error" "DattoAuth" - return $null - } -} -#endregion -#> #region Install-DattoRMM-Helper function Install-DattoRMM-Helper { @@ -414,22 +395,7 @@ function Handle-FetchSites { param($Context) # 1) Read incoming JSON (using block auto-disposes the reader) - - - <# powershell v7 - using ($reader = [IO.StreamReader]::new($Context.Request.InputStream)) { - $raw = $reader.ReadToEnd() - } - try { - $pw = (ConvertFrom-Json $raw).password - if (-not $pw) { throw "Missing `password` field" } - } catch { - Write-LogHybrid "Invalid JSON in /getpw payload: $($_.Exception.Message)" "Error" "FetchSites" - returnRespondEmpty $Context 400 - return - } - #> - + $reader = [IO.StreamReader]::new($Context.Request.InputStream) try { $raw = $reader.ReadToEnd()