Add separate script for logging in
This commit is contained in:
parent
bc77426b16
commit
225bd943f4
3 changed files with 25 additions and 18 deletions
scripts/Common/Software/docker/services/jellyfin
|
@ -8,7 +8,7 @@ fi
|
|||
export DBUS_SESSION_BUS_ADDRESS=`dbus-daemon --fork --config-file=/usr/share/dbus-1/session.conf --print-address`
|
||||
mkdir -p ~/.config
|
||||
ln -s /data/proton ~/.config/protonvpn
|
||||
|
||||
pvpn-login || exit $?
|
||||
pvpn-cli || true
|
||||
ip link show protonwire0 >/dev/null 2>&1 || exit
|
||||
exec "$@"
|
||||
|
|
|
@ -10,23 +10,6 @@ from protonvpn_nm_lib.api import FeatureEnum
|
|||
from protonvpn_nm_lib.core.servers.list import LogicalServer
|
||||
|
||||
cli = CLIWrapper()
|
||||
|
||||
if not cli.protonvpn.get_session().is_valid:
|
||||
print("You are not logged in.", file=sys.stderr)
|
||||
|
||||
if (sys.__stdin__ != None) and sys.__stdin__.isatty():
|
||||
print("Please log in to ProtonVPN", file=sys.stderr)
|
||||
print("Username: " + environ["PVPN_USERNAME"], file=sys.stderr)
|
||||
result = subprocess.run(["protonvpn-cli", "login", environ["PVPN_USERNAME"]])
|
||||
|
||||
if result.returncode != 0:
|
||||
exit(result.returncode)
|
||||
else:
|
||||
exit(0)
|
||||
else:
|
||||
print("Please run this container interactively in order to log in.", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
parser = ArgumentParser()
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
from os import environ
|
||||
import sys
|
||||
from protonvpn_cli.cli_dialog import subprocess
|
||||
from protonvpn_cli.cli_wrapper import CLIWrapper
|
||||
|
||||
cli = CLIWrapper()
|
||||
|
||||
if not cli.protonvpn.get_session().is_valid:
|
||||
print("You are not logged in.", file=sys.stderr)
|
||||
|
||||
if (sys.__stdin__ != None) and sys.__stdin__.isatty():
|
||||
username = environ["PVPN_USERNAME"]
|
||||
print("Please log in to ProtonVPN", file=sys.stderr)
|
||||
print("Username: " + username, file=sys.stderr, flush=True)
|
||||
result = subprocess.run(["protonvpn-cli", "login", username])
|
||||
|
||||
if result.returncode != 0:
|
||||
exit(result.returncode)
|
||||
else:
|
||||
exit(0)
|
||||
else:
|
||||
print("Please run this container interactively in order to log in.", file=sys.stderr, flush=True)
|
||||
exit(1)
|
Loading…
Reference in a new issue