mirror of
https://github.com/masterking32/MasterHttpRelayVPN.git
synced 2026-05-17 21:24:37 +03:00
Add one-click launcher and interactive setup wizard
- setup.py: prompts only for the values the user must choose, generates a random auth_key, writes config.json (backs up any existing one). - start.bat / start.sh: create a local venv, install deps (with PyPI mirror fallback), run the wizard if config.json is missing, then launch main.py. - main.py: when config.json is missing on an interactive TTY, offer to run the wizard instead of just exiting. - README: new "Quick Start" section up top; manual steps kept below. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -103,8 +103,31 @@ def main():
|
||||
config = json.load(f)
|
||||
except FileNotFoundError:
|
||||
print(f"Config not found: {config_path}")
|
||||
print("Copy config.example.json to config.json and fill in your values.")
|
||||
sys.exit(1)
|
||||
# Offer the interactive wizard if it's available and we're on a TTY.
|
||||
wizard = os.path.join(os.path.dirname(os.path.abspath(__file__)), "setup.py")
|
||||
if os.path.exists(wizard) and sys.stdin.isatty():
|
||||
try:
|
||||
answer = input("Run the interactive setup wizard now? [Y/n]: ").strip().lower()
|
||||
except EOFError:
|
||||
answer = "n"
|
||||
if answer in ("", "y", "yes"):
|
||||
import subprocess
|
||||
rc = subprocess.call([sys.executable, wizard])
|
||||
if rc != 0:
|
||||
sys.exit(rc)
|
||||
try:
|
||||
with open(config_path) as f:
|
||||
config = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Could not load config after setup: {e}")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("Copy config.example.json to config.json and fill in your values,")
|
||||
print("or run: python setup.py")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("Run: python setup.py (or copy config.example.json to config.json)")
|
||||
sys.exit(1)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Invalid JSON in config: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user