Update main.py
Browse files
main.py
CHANGED
|
@@ -110,7 +110,27 @@ remote_port = 8188
|
|
| 110 |
except Exception as e:
|
| 111 |
print(f"创建 frpc.toml 配置文件时出错: {e}")
|
| 112 |
|
|
|
|
|
|
|
|
|
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
# 启动 start_jupyterlab.py 的线程函数
|
| 115 |
def start_jupyterlab_process():
|
| 116 |
jupyter_script = os.path.join(REPO_PATH, "start_jupyterlab.py")
|
|
@@ -179,6 +199,7 @@ def start_gradio():
|
|
| 179 |
# 主函数
|
| 180 |
def main():
|
| 181 |
clone_repository()
|
|
|
|
| 182 |
|
| 183 |
# 创建 frp 配置文件(如果不存在)
|
| 184 |
create_frpc_toml()
|
|
|
|
| 110 |
except Exception as e:
|
| 111 |
print(f"创建 frpc.toml 配置文件时出错: {e}")
|
| 112 |
|
| 113 |
+
def install_frp():
|
| 114 |
+
frp_tar_path = os.path.join(REPO_PATH, "frp_0.61.0_linux_amd64.tar.gz")
|
| 115 |
+
frp_install_path = os.path.join(REPO_PATH, "frp_0.61.0_linux_amd64")
|
| 116 |
|
| 117 |
+
if os.path.exists(frp_install_path):
|
| 118 |
+
print(f"frp 已安装: {frp_install_path}")
|
| 119 |
+
return True
|
| 120 |
+
|
| 121 |
+
if not os.path.exists(frp_tar_path):
|
| 122 |
+
print(f"未找到 frp 安装包: {frp_tar_path}")
|
| 123 |
+
return False
|
| 124 |
+
|
| 125 |
+
try:
|
| 126 |
+
print(f"正在解压 frp 安装包到 {REPO_PATH}...")
|
| 127 |
+
subprocess.run(["tar", "-xvzf", frp_tar_path, "-C", REPO_PATH], check=True)
|
| 128 |
+
print("frp 安装成功!")
|
| 129 |
+
return True
|
| 130 |
+
except subprocess.CalledProcessError as e:
|
| 131 |
+
print(f"解压 frp 时出错: {e}")
|
| 132 |
+
return False
|
| 133 |
+
|
| 134 |
# 启动 start_jupyterlab.py 的线程函数
|
| 135 |
def start_jupyterlab_process():
|
| 136 |
jupyter_script = os.path.join(REPO_PATH, "start_jupyterlab.py")
|
|
|
|
| 199 |
# 主函数
|
| 200 |
def main():
|
| 201 |
clone_repository()
|
| 202 |
+
install_frp()
|
| 203 |
|
| 204 |
# 创建 frp 配置文件(如果不存在)
|
| 205 |
create_frpc_toml()
|