add init_paths to handle sys.path setup for importing shared modules like paths.py

This commit is contained in:
Whispering Wind
2025-04-24 20:23:31 +03:30
committed by GitHub
parent ff194d0098
commit 748d0bf2bd
6 changed files with 40 additions and 16 deletions

View File

@ -4,12 +4,14 @@ import re
import json
import sys
SHOW_URI_SCRIPT = "/etc/hysteria/core/scripts/hysteria2/show_user_uri.py"
from init_paths import *
from paths import *
DEFAULT_ARGS = ["-a", "-n", "-s"]
def run_show_uri(username):
try:
cmd = ["python3", SHOW_URI_SCRIPT, "-u", username] + DEFAULT_ARGS
cmd = ["python3", CLI_PATH, "show-user-uri", "-u", username] + DEFAULT_ARGS
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
output = result.stdout
if "Invalid username" in output: