(self)
| 179 | return False |
| 180 | |
| 181 | def run(self): |
| 182 | signal.signal(signal.SIGINT, self.cleanup) |
| 183 | signal.signal(signal.SIGTERM, self.cleanup) |
| 184 | |
| 185 | print("TermNet Launcher") |
| 186 | print("=" * 20) |
| 187 | |
| 188 | while True: |
| 189 | print("\nSelect frontend:") |
| 190 | print("1) Web UI (opens browser after password setup)") |
| 191 | print("2) Terminal UI") |
| 192 | choice = input("Enter choice (1 or 2): ").strip() |
| 193 | if choice in ["1", "2"]: |
| 194 | break |
| 195 | print("Invalid choice. Please try again.") |
| 196 | |
| 197 | # Free ports before launching |
| 198 | self.free_ports() |
| 199 | |
| 200 | if not self.start_backend(): |
| 201 | print("Failed to start backend. Exiting.") |
| 202 | return |
| 203 | |
| 204 | time.sleep(2) |
| 205 | self.start_extensions() |
| 206 | time.sleep(1) |
| 207 | |
| 208 | if choice == "1": |
| 209 | if not self.start_web_ui(): |
| 210 | self.cleanup() |
| 211 | return |
| 212 | print("Please set a password:") |
| 213 | try: |
| 214 | self.ui_process.wait() |
| 215 | except KeyboardInterrupt: |
| 216 | self.cleanup() |
| 217 | else: |
| 218 | if not self.start_terminal_ui(): |
| 219 | self.cleanup() |
| 220 | return |
| 221 | |
| 222 | self.cleanup() |
| 223 | |
| 224 | |
| 225 | if __name__ == "__main__": |
no test coverage detected