From f4fa09a759dcc75fcf777067ca03e8f223e75547 Mon Sep 17 00:00:00 2001 From: Bing_Yanchi Date: Thu, 4 Nov 2021 23:46:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lae-tunnel.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lae-tunnel.py b/lae-tunnel.py index 548b5e6..b830a41 100644 --- a/lae-tunnel.py +++ b/lae-tunnel.py @@ -130,8 +130,6 @@ def printTunnel(is_arg): # 下载配置文件 def get_config(id): - if (args.latest and os.path.exists(frpc_config.format(id=id))): return True - result = sendrequest(get_config_url + str(id) + "?api_token={}".format(token), True) if (result == "error"): return False @@ -155,18 +153,24 @@ def runTunnel(tunnels): for tunnel_id in tunnels: if (tunnel_id in tunnel): - # 下载配置文件 - if (get_config(tunnel_id)): - # 启动程序 - command = frpc_command.format(file=frpc_config.format(id=tunnel_id)) - - th_frpGo = Thread(target=runCmd, args=(command,)) - th_frpGo.setDaemon(True) - th_frpGo.start() - + if (args.latest and os.path.exists(frpc_config.format(id=id))): success += 1 else: - print(language['warn'] + language['tunnel_get_config_warn'].format(id=tunnel_id)) + # 下载配置文件 + if (get_config(tunnel_id)): + success += 1 + # 间隔 + time.sleep(0.3) + else: + print(language['warn'] + language['tunnel_get_config_warn'].format(id=tunnel_id)) + continue + + # 启动程序 + command = frpc_command.format(file=frpc_config.format(id=tunnel_id)) + + th_frpGo = Thread(target=runCmd, args=(command,)) + th_frpGo.setDaemon(True) + th_frpGo.start() if (success == 0): return False else: return True