def main(): # change path to launcher global __file__ __file__ = os.path.abspath(__file__) if os.path.islink(__file__): __file__ = getattr(os, 'readlink', lambda x: x)(__file__) os.chdir(os.path.dirname(os.path.abspath(__file__))) current_version = update_from_github.current_version() xlog.info("start XX-Net %s", current_version) web_control.confirm_xxnet_exit() setup_win_python.check_setup() last_run_version = config.get(["modules", "launcher", "last_run_version"], "0.0.0") if last_run_version != current_version: import post_update post_update.run(last_run_version) config.set(["modules", "launcher", "last_run_version"], current_version) config.save() allow_remote = 0 if len(sys.argv) > 1: for s in sys.argv[1:]: xlog.info("command args:%s", s) if s == "-allow_remote": allow_remote = 1 module_init.xargs["allow_remote"] = 1 module_init.start_all_auto() web_control.start(allow_remote) if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1: host_port = config.get(["modules", "launcher", "control_port"], 8085) import webbrowser webbrowser.open("http://127.0.0.1:%s/" % host_port) update.start() update_from_github.delete_to_save_disk() if config.get(["modules", "launcher", "show_systray"], 1): sys_tray.serve_forever() else: while True: time.sleep(100) module_init.stop_all() sys.exit()
def main(): # change path to launcher global __file__ __file__ = os.path.abspath(__file__) if os.path.islink(__file__): __file__ = getattr(os, 'readlink', lambda x: x)(__file__) os.chdir(os.path.dirname(os.path.abspath(__file__))) current_version = update_from_github.current_version() xlog.info("start XX-Net %s", current_version) web_control.confirm_xxnet_exit() setup_win_python.check_setup() last_run_version = config.get(["modules", "launcher", "last_run_version"], "0.0.0") if last_run_version != current_version: import post_update post_update.run(last_run_version) config.set(["modules", "launcher", "last_run_version"], current_version) config.save() allow_remote = 0 if len(sys.argv) > 1: for s in sys.argv[1:]: xlog.info("command args:%s", s) if s == "-allow_remote": allow_remote = 1 module_init.xargs["allow_remote"] = 1 module_init.start_all_auto() web_control.start(allow_remote) if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1: host_port = config.get(["modules", "launcher", "control_port"], 8085) import webbrowser webbrowser.open("http://127.0.0.1:%s/" % host_port) update.start() update_from_github.delete_to_save_disk() if config.get(["modules", "launcher", "show_systray"], 1): sys_tray.serve_forever() else: while True: time.sleep(100) module_init.stop_all() sys.exit()