diff --git a/Start-QBTGluetunPortMgr.ps1 b/Start-QBTGluetunPortMgr.ps1 index e224105..d594e95 100644 --- a/Start-QBTGluetunPortMgr.ps1 +++ b/Start-QBTGluetunPortMgr.ps1 @@ -5,6 +5,9 @@ [string] $qbtUser = $ENV:QBTUSER [string] $qbtPassword = $ENV:QBTPASSWORD [string] $notificationWebhookURL = $ENV:NOTIFICATIONWEBHOOKURL +[string] $discordWebhookURL = $ENV:DISCORDWEBHOOKURL +[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL +[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG while ($true) { @@ -33,8 +36,9 @@ while ($true) { $qbtPortChangeBody = 'json={"listen_port":' + $gluetunForwardedPort + '}' $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 = @{ "Content-Type"="application/json" } @@ -44,6 +48,19 @@ while ($true) $json = $body | ConvertTo-Json 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..." Start-Sleep ($schedule * 60) diff --git a/docker-compose.yaml b/docker-compose.yaml index f68a329..e12fdce 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,6 +10,9 @@ services: - QBTPORT=8787 # qbittorrent port - QBTUSER=admin # qbittorrent webUI username - QBTPASSWORD=adminpass # qbittorrent webUI password - - NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/ # discord notification wehook URL + #- NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/ # DEPRECATED discord notification wehook URL + #- DISCORDWEBHOOKURL=https://discord.com/api/webhooks/ # discord notification wehook URL + #- APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url + #- APPRISEWEBHOOKTAG=all # apprise notification tag volumes: - C:/Docker/qbittorrent/gluetun/tmp:/tmp # REQUIRED: Path to where the 'forwarded_port' file from gluetun is stored \ No newline at end of file