(self)
| 13545 | return {"status": "error", "message": f"Errore avvio GHunt login: {e}"} |
| 13546 | |
| 13547 | def ghunt_smart_start(self): |
| 13548 | script_dir = Path(__file__).resolve().parent |
| 13549 | ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command() |
| 13550 | local_py = (script_dir / "GHunt" / "main.py") |
| 13551 | if not ghunt_cmd and local_py.exists(): |
| 13552 | ghunt_cmd = [str(sys.executable), str(local_py)] |
| 13553 | ghunt_cwd = str(script_dir / "GHunt") |
| 13554 | |
| 13555 | if not ghunt_cmd: |
| 13556 | install_result = self._install_ghunt_runtime() |
| 13557 | if not install_result.get("ok"): |
| 13558 | return { |
| 13559 | "status": "need_install", |
| 13560 | "action": "install", |
| 13561 | "message": install_result.get("message") or "ghunt non trovato.", |
| 13562 | "install": install_result |
| 13563 | } |
| 13564 | |
| 13565 | ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command() |
| 13566 | if not ghunt_cmd and local_py.exists(): |
| 13567 | ghunt_cmd = [str(sys.executable), str(local_py)] |
| 13568 | ghunt_cwd = str(script_dir / "GHunt") |
| 13569 | if not ghunt_cmd: |
| 13570 | return { |
| 13571 | "status": "error", |
| 13572 | "action": "install", |
| 13573 | "message": "Installazione avviata, ma il comando GHunt non è ancora disponibile nel PATH. Riprova tra 2-3 secondi.", |
| 13574 | "install": install_result |
| 13575 | } |
| 13576 | |
| 13577 | launch_info = self._run_ghunt_login_command(ghunt_cmd, Path(ghunt_cwd), os.environ.copy()) |
| 13578 | return { |
| 13579 | "status": "ok", |
| 13580 | "action": "login_started", |
| 13581 | "message": "Installazione avviata in terminale. Login avviato automaticamente.", |
| 13582 | "install": install_result, |
| 13583 | "launch": launch_info |
| 13584 | } |
| 13585 | |
| 13586 | run_env = os.environ.copy() |
| 13587 | run_env["PYTHONIOENCODING"] = "utf-8" |
| 13588 | run_env["PYTHONUTF8"] = "1" |
| 13589 | run_env["LC_ALL"] = "C.UTF-8" |
| 13590 | run_env["LANG"] = "C.UTF-8" |
| 13591 | run_dir = Path(ghunt_cwd) if ghunt_cwd else script_dir |
| 13592 | launch_info = self._run_ghunt_login_command(ghunt_cmd, run_dir, run_env) |
| 13593 | return { |
| 13594 | "status": "ok", |
| 13595 | "action": "login_started", |
| 13596 | "message": "Login GHunt avviato.", |
| 13597 | "launch": launch_info |
| 13598 | } |
| 13599 | |
| 13600 | def ghunt_login_status(self): |
| 13601 | try: |
no test coverage detected