Added haste module with New-Haste cmdlet

This commit is contained in:
lksz 2021-05-08 17:48:32 -04:00
parent 877f9adb4e
commit 92bd7ba69f
2 changed files with 30 additions and 0 deletions

24
hastebin/New-Haste.ps1 Normal file
View File

@ -0,0 +1,24 @@
[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
}

6
hastebin/_.package.json Normal file
View File

@ -0,0 +1,6 @@
{
"package": {
"Condition": [],
"Name": "hastebin"
}
}