Update StackMonkey.ps1

This commit is contained in:
2025-06-23 01:33:27 -04:00
parent 728cdc23dc
commit 0589ecfc6f

View File

@@ -133,7 +133,7 @@ $Global:DattoWebhookUrl = 'https://automate.svstools.ca/webhook/svsmspkit'
} }
# 2) call the existing cmdlet from your module # 2) call the existing cmdlet from your module
# (make sure youve 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 ` Install-DattoRMM `
-ApiUrl $creds.ApiUrl ` -ApiUrl $creds.ApiUrl `
-ApiKey $creds.ApiKey ` -ApiKey $creds.ApiKey `
@@ -291,25 +291,6 @@ function Respond-JSON {
$Context.Response.OutputStream.Close() $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 #region Install-DattoRMM-Helper
function Install-DattoRMM-Helper { function Install-DattoRMM-Helper {
@@ -415,21 +396,6 @@ function Handle-FetchSites {
# 1) Read incoming JSON (using block auto-disposes the reader) # 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) $reader = [IO.StreamReader]::new($Context.Request.InputStream)
try { try {
$raw = $reader.ReadToEnd() $raw = $reader.ReadToEnd()