frp params

This commit is contained in:
bilt 2025-08-01 08:07:42 +08:00
parent fee1fd8963
commit 3ac71aaa09
2 changed files with 16 additions and 11 deletions

21
main.py
View File

@ -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:

View File

@ -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