From 45f948b225746bd8360fca9655aa9652b5119f40 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 6 May 2022 20:45:01 +0200 Subject: [PATCH] Update run --- qbittorrent/rootfs/etc/services.d/nginx/run | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/qbittorrent/rootfs/etc/services.d/nginx/run b/qbittorrent/rootfs/etc/services.d/nginx/run index e60f44e7b..7c43dbccf 100644 --- a/qbittorrent/rootfs/etc/services.d/nginx/run +++ b/qbittorrent/rootfs/etc/services.d/nginx/run @@ -14,16 +14,20 @@ if [ -f /currentip ]; then else curl -s ipecho.net/plain --interface tun0 > /vpnip fi - - # Compare ip + + # Verify ip has changed if [[ "$(cat /vpnip)" = "$(cat /currentip)" ]]; then bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode" bashio::exit.nok - else - bashio::log.info "VPN is up and running with ip $(curl -s ipecho.net/plain)" - rm /vpnip - rm /currentip fi + + # Get ip location + COUNTRY=$"(curl -s https://ipinfo.io/"$(cat /vpnip)" | grep country -i -m 1 | cut -d ':' -f 2 |xargs | awk 'gsub(/,$/,x)' || true)" + + # Inform by message + bashio::log.info "VPN is up and running with ip $(curl -s ipecho.net/plain), based in country : $COUNTRY" + rm /vpnip + rm /currentip fi