updated to have apprise as a notification option
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
[string] $qbtUser = $ENV:QBTUSER
|
[string] $qbtUser = $ENV:QBTUSER
|
||||||
[string] $qbtPassword = $ENV:QBTPASSWORD
|
[string] $qbtPassword = $ENV:QBTPASSWORD
|
||||||
[string] $notificationWebhookURL = $ENV:NOTIFICATIONWEBHOOKURL
|
[string] $notificationWebhookURL = $ENV:NOTIFICATIONWEBHOOKURL
|
||||||
|
[string] $discordWebhookURL = $ENV:DISCORDWEBHOOKURL
|
||||||
|
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
|
||||||
|
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
|
||||||
|
|
||||||
while ($true)
|
while ($true)
|
||||||
{
|
{
|
||||||
@@ -33,8 +36,9 @@ while ($true)
|
|||||||
{
|
{
|
||||||
$qbtPortChangeBody = 'json={"listen_port":' + $gluetunForwardedPort + '}'
|
$qbtPortChangeBody = 'json={"listen_port":' + $gluetunForwardedPort + '}'
|
||||||
$qbtPortChangeResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/setPreferences" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtPortChangeBody
|
$qbtPortChangeResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/setPreferences" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtPortChangeBody
|
||||||
if ($notificationWebhookURL)
|
if ($notificationWebhookURL -or $discordWebhookURL)
|
||||||
{
|
{
|
||||||
|
if ($discordWebhookURL) { $notificationWebhookURL = $discordWebhookURL }
|
||||||
$headers = @{
|
$headers = @{
|
||||||
"Content-Type"="application/json"
|
"Content-Type"="application/json"
|
||||||
}
|
}
|
||||||
@@ -44,6 +48,19 @@ while ($true)
|
|||||||
$json = $body | ConvertTo-Json
|
$json = $body | ConvertTo-Json
|
||||||
Invoke-WebRequest -URI $notificationWebhookURL -Method post -Body $json -Headers $headers
|
Invoke-WebRequest -URI $notificationWebhookURL -Method post -Body $json -Headers $headers
|
||||||
}
|
}
|
||||||
|
elseif ($appriseWebhookURL)
|
||||||
|
{
|
||||||
|
$headers = @{
|
||||||
|
"Content-Type"="application/json"
|
||||||
|
}
|
||||||
|
$body = @{
|
||||||
|
title="QBitTorrent Port Manager"
|
||||||
|
body="QBitTorrent Listening Port updated to $gluetunForwardedPort"
|
||||||
|
tags="$appriseWebhookTag"
|
||||||
|
}
|
||||||
|
$json = $body | ConvertTo-Json
|
||||||
|
Invoke-WebRequest -URI $appriseWebhookURL -Method post -Body $json -Headers $headers
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Write-Host "Sleeping for $schedule minutes..."
|
Write-Host "Sleeping for $schedule minutes..."
|
||||||
Start-Sleep ($schedule * 60)
|
Start-Sleep ($schedule * 60)
|
||||||
|
|||||||
+4
-1
@@ -10,6 +10,9 @@ services:
|
|||||||
- QBTPORT=8787 # qbittorrent port
|
- QBTPORT=8787 # qbittorrent port
|
||||||
- QBTUSER=admin # qbittorrent webUI username
|
- QBTUSER=admin # qbittorrent webUI username
|
||||||
- QBTPASSWORD=adminpass # qbittorrent webUI password
|
- QBTPASSWORD=adminpass # qbittorrent webUI password
|
||||||
- NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # discord notification wehook URL
|
#- NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # DEPRECATED discord notification wehook URL
|
||||||
|
#- DISCORDWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # discord notification wehook URL
|
||||||
|
#- APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url
|
||||||
|
#- APPRISEWEBHOOKTAG=all # apprise notification tag
|
||||||
volumes:
|
volumes:
|
||||||
- C:/Docker/qbittorrent/gluetun/tmp:/tmp # REQUIRED: Path to where the 'forwarded_port' file from gluetun is stored
|
- C:/Docker/qbittorrent/gluetun/tmp:/tmp # REQUIRED: Path to where the 'forwarded_port' file from gluetun is stored
|
||||||
Reference in New Issue
Block a user