From 3ac71aaa091542369b70ec7bd87f95a212b91469 Mon Sep 17 00:00:00 2001 From: bilt Date: Fri, 1 Aug 2025 08:07:42 +0800 Subject: [PATCH] frp params --- main.py | 21 +++++++++++++-------- script.sh | 6 +++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 6a5d61300..195994dfe 100644 --- a/main.py +++ b/main.py @@ -144,18 +144,23 @@ def trigger_vercel_deploy(): except requests.exceptions.RequestException as req_err: print(f"An error occurred: {req_err}") +import subprocess + +def start_frp(): + # !cat /kaggle/working/frpc.toml + # subprocess.Popen(["sed", "-i", f"s/8188/{port}/g", "/kaggle/working/frpc.toml"],shell=False) + subprocess.run(['chmod', '+x', '/kaggle/working/frpc'], check=True) + time.sleep(3) + subprocess.Popen(['/kaggle/working/frpc', '-c', '/kaggle/working/frpc.toml']) + print(f'frp已经启动') if __name__ == "__main__": - - # 向 Notion 数据库插入记录:目前使用的frp服务商 + start_frp() + # frp_remote_port_idx: 3, 4, 5, 6.... if args.frp_remote_port_idx is not None: - if str(args.frp_remote_port_idx) == "5": - notion.add_record_to_notion_database(f"http://111.170.148.226:21665/") - if str(args.frp_remote_port_idx) == "6": - notion.add_record_to_notion_database(f"http://111.170.148.226:21666/") + notion.add_record_to_notion_database(f"http://111.170.148.226:2166{args.frp_remote_port_idx}/") else: - notion.add_record_to_notion_database("http://111.170.148.226:21663/") - notion.add_record_to_notion_database("http://111.170.148.226:21664/") + print("frp_remote_port_idx is None, no records will be added to notion database") print("disable_trigger_vercel_deploy: ", args.disable_trigger_vercel_deploy) if args.disable_trigger_vercel_deploy is None: diff --git a/script.sh b/script.sh index a45b7c273..54bea5a7c 100644 --- a/script.sh +++ b/script.sh @@ -112,7 +112,7 @@ cd /kaggle/ComfyUI REMOTE_PORT="$1" -# 传入参数1,2... 这样便于扩展,如果以后用了其他的frp,也好调整。 +# 传入参数3,4,5,... 这样便于扩展,如果以后用了其他的frp,也好调整。 # frp execution binary only. 这里放frpc执行文件,如果版本有变也好改。配置文件模版,也在项目中, 模版文件名为template_frpc wget -O /kaggle/working/frp_0.54.0_linux_amd64.tar.gz https://github.com/fatedier/frp/releases/download/v0.54.0/frp_0.54.0_linux_amd64.tar.gz @@ -123,9 +123,9 @@ cp -p /kaggle/ComfyUI/template_frpc /kaggle/working/frpc.toml # 1, 2 主要是为了兼容之前的comfyUI notebook(不想一个一个的去修改了) FRP_CONFIG_FILE="/kaggle/working/frpc.toml" CHOICE="$1" -if [ "$CHOICE" -eq 1 ]; then +if [ "$CHOICE" -eq 3 ]; then TARGET_REMOTE_PORT="21663" -elif [ "$CHOICE" -eq 2 ]; then +elif [ "$CHOICE" -eq 4 ]; then TARGET_REMOTE_PORT="21664" elif [ "$CHOICE" -eq 5 ]; then