MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / run

Method run

launcher/runner.py:60–123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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 )

Callers 5

rebuild_frontendFunction · 0.45
kill_process_interactiveFunction · 0.45
_run_gsettings_commandFunction · 0.45
_start_serverMethod · 0.45
cleanupMethod · 0.45

Calls 15

_check_xvfbMethod · 0.95
_check_server_portMethod · 0.95
_setup_helper_modeMethod · 0.95
_start_serverMethod · 0.95
run_internal_camoufoxFunction · 0.90
setup_launcher_loggingFunction · 0.90
ensure_auth_dirs_existFunction · 0.90
check_dependenciesFunction · 0.90

Tested by

no test coverage detected