(self)
| 58 | self.simulated_os_for_camoufox = "linux" |
| 59 | |
| 60 | def run(self): |
| 61 | is_internal_call = self.args.internal_launch_mode is not None |
| 62 | |
| 63 | if is_internal_call: |
| 64 | if self.args.internal_launch_mode: |
| 65 | run_internal_camoufox(self.args, launch_server, DefaultAddons) |
| 66 | return |
| 67 | |
| 68 | log_level_str = os.environ.get("SERVER_LOG_LEVEL", "INFO").upper() |
| 69 | log_level = getattr(logging, log_level_str, logging.INFO) |
| 70 | setup_launcher_logging(log_level=log_level) |
| 71 | logger.info("[System] Launcher started") |
| 72 | ensure_auth_dirs_exist() |
| 73 | check_dependencies(launch_server is not None, DefaultAddons is not None) |
| 74 | |
| 75 | # Automatically check and rebuild frontend if needed |
| 76 | from launcher.frontend_build import ensure_frontend_built |
| 77 | |
| 78 | ensure_frontend_built(skip_build=self.args.skip_frontend_build) |
| 79 | |
| 80 | self._determine_launch_mode() |
| 81 | |
| 82 | if not DIRECT_LAUNCH: |
| 83 | self._handle_auth_file_selection() |
| 84 | self._check_xvfb() |
| 85 | self._check_server_port() |
| 86 | |
| 87 | logger.debug("[Init] Step 3: Preparing and starting Camoufox...") |
| 88 | self._resolve_auth_file_path() |
| 89 | |
| 90 | current_system_for_camoufox = platform.system() |
| 91 | if current_system_for_camoufox == "Linux": |
| 92 | self.simulated_os_for_camoufox = "linux" |
| 93 | elif current_system_for_camoufox == "Windows": |
| 94 | self.simulated_os_for_camoufox = "windows" |
| 95 | elif current_system_for_camoufox == "Darwin": |
| 96 | self.simulated_os_for_camoufox = "macos" |
| 97 | else: |
| 98 | logger.warning( |
| 99 | f"Unrecognized system '{current_system_for_camoufox}'. Defaulting Camoufox OS simulation to: {self.simulated_os_for_camoufox}" |
| 100 | ) |
| 101 | |
| 102 | mode_str = self.final_launch_mode.replace("_", " ").capitalize() |
| 103 | auth_name = ( |
| 104 | os.path.basename(self.effective_active_auth_json_path) |
| 105 | if self.effective_active_auth_json_path |
| 106 | else "None" |
| 107 | ) |
| 108 | logger.info( |
| 109 | f"[System] Configuration ready | Port: {self.args.server_port} | Mode: {mode_str} | Auth: {auth_name}" |
| 110 | ) |
| 111 | |
| 112 | captured_ws_endpoint = self.camoufox_manager.start( |
| 113 | self.final_launch_mode, |
| 114 | self.effective_active_auth_json_path, |
| 115 | self.simulated_os_for_camoufox, |
| 116 | self.args, |
| 117 | ) |
no test coverage detected