Add click to connect to ProtonVPN script
This commit is contained in:
parent
828ed1993d
commit
2f87cadf82
1 changed files with 9 additions and 2 deletions
|
@ -6,13 +6,20 @@ Author: flyingscorpio
|
|||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from protonvpn_cli import utils as pvpn_utils # type: ignore
|
||||
|
||||
|
||||
if os.environ.get("BLOCK_BUTTON") is not None:
|
||||
# print("Connecting...")
|
||||
vpn_command = subprocess.run(
|
||||
"sudo protonvpn c -f", check=True, shell=True
|
||||
)
|
||||
|
||||
IP_ADDR = pvpn_utils.get_ip_info()[0]
|
||||
|
||||
if not pvpn_utils.is_connected():
|
||||
OUTPUT = os.environ['LABEL_OFF']
|
||||
OUTPUT = os.environ["LABEL_OFF"]
|
||||
OUTPUT += " {}".format(IP_ADDR)
|
||||
|
||||
else:
|
||||
|
@ -21,7 +28,7 @@ else:
|
|||
CODE = pvpn_utils.get_server_value(SERVER, "ExitCountry", ALL_SERVERS)
|
||||
COUNTRY = pvpn_utils.get_country_name(CODE)
|
||||
CITY = pvpn_utils.get_server_value(SERVER, "City", ALL_SERVERS)
|
||||
OUTPUT = os.environ['LABEL_ON']
|
||||
OUTPUT = os.environ["LABEL_ON"]
|
||||
OUTPUT += " {} - {}, {}".format(IP_ADDR, CITY, COUNTRY)
|
||||
|
||||
print(OUTPUT)
|
||||
|
|
Loading…
Add table
Reference in a new issue