PowerShell_Scripts/hastebin/New-Haste.ps1

25 lines
490 B
PowerShell

[CmdletBinding()]param(
[Parameter(ValueFromPipeline,Mandatory,Position=1)]
$InputObject
)
begin {
$data = @()
}
process {
$data += $InputObject
}
end {
if( -not $HastebinBase ) { $HastebinBase = "https://h.lksz.me" }
$URI = "$HastebinBase/documents"
$Body = ($dataArray | Out-String).TrimEnd()
$Response = Invoke-RestMethod -Method Post -Body $Body -Uri $URI
$key = $Response.key
$hasteAddress = "$HastebinBase/$key"
return $hasteAddress
}