See: https://protonvpn.com/support/port-forwarding
These systemd configs will watch for changes to /run/user/$UID/Proton/VPN/forwarded_port as described in the support article.
When a change is detected it will trigger the service to update the qbittorrent config via the api.
If your qBittorrent api requires a password you will need to modifiy the curl command.
This assume user level systemd.
At minimum you need the proton-qbit-port-sync.path and proton-qbit-port-sync.service.
protonvpn.conf only applies if you are using the protonvpn flatpak.
.config/systemd/user/proton-qbit-port-sync.path.config/systemd/user/proton-qbit-port-sync.service.config/user-tmpfiles.d/protonvpn.conf
systemctl --user daemon-reload
systemctl --user enable proton-qbit-port-sync.pathIf you are using flatpak you should also add the protonvpn.conf to ensure the run directory always exists.
systemd-tmpfiles can be used to apply the change immediately.
The flatpak config needs to be updated to allow it to access /run/user/$UID/Proton/VPN/forwarded_port.
systemd-tmpfiles --user --create
flatpak override --user --filesystem=/run/user/$(id -u)/Proton/VPN com.protonvpn.wwwsystemctl --user status proton-qbit-port-sync.path
systemctl --user status proton-qbit-port-sync.service
journalctl -xe --user-unit proton-qbit-port-sync.service