Skip to content

Commit

Permalink
fix(main.py): 修复download.py调用报错的原因
Browse files Browse the repository at this point in the history
TypeError: check_file_exists() missing 1 required positional argument: 'file_path'
Signed-off-by: YanMo <xiajiaruimail@qq.com>
  • Loading branch information
ltzXiaoYanMo committed May 31, 2024
1 parent 84e66a8 commit 3cd73d2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
9 changes: 8 additions & 1 deletion download.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from tqdm import tqdm

import asyncio
import io
import platform
import aiohttp
Expand Down Expand Up @@ -43,7 +44,7 @@ async def download_frp(url, file_name):
print(f"文件 {file_name} 下载完成。")


def check_file_exists(file_path):
async def check_file_exists(file_path):
return os.path.exists(file_path)


Expand Down Expand Up @@ -98,3 +99,9 @@ async def main():
]
file_name = "frp_LoCyanFrp-0.51.3_windows_amd64.zip"
await download_frp(url_list, file_name)
await unzip_file(file_name)
await check_frp_exists()


if __name__ == "__main__":
asyncio.run(main())
42 changes: 23 additions & 19 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import urllib3
import requests
import download
import asyncio

from launch import *

Expand All @@ -21,28 +22,31 @@ def __init__(self):
# 关闭urllib3不验证SSL产生的报错
urllib3.disable_warnings()

# 检查更新
version = "version_1.0.1"
async def async_init(self):
# 检查更新
version = "version_1.0.1"

check_update_url = f"https://api.ymbit.cn/public/check_update/{version}.html"
check_update = requests.get(check_update_url, verify=False)
check_update_url = (
f"https://api.ymbit.cn/public/check_update/{version}.html"
)
check_update = requests.get(check_update_url, verify=False)

if check_update.status_code == 200:
download.check_file_exists()
elif check_update.status_code == 404:
print("目前 LoCyanPyLauncher 非最新版本,请前往 GitHub 更新。")
else:
print("检查更新失败,请检查网络连接。")
sys.exit(1)
if check_update.status_code == 200:
await download.check_frp_exists()
elif check_update.status_code == 404:
print("目前 LoCyanPyLauncher 非最新版本,请前往 GitHub 更新。")
else:
print("检查更新失败,请检查网络连接。")
sys.exit(1)

print("欢迎使用LoCyan Frp Application")
result = self.r.get("https://api.locyanfrp.cn/App", verify=False)
result = result.json()
contents = result["contents"]
print("------------------------------------------------")
print("公告:")
print(contents)
print("------------------------------------------------")
print("欢迎使用LoCyan Frp Application")
result = self.r.get("https://api.locyanfrp.cn/App", verify=False)
result = result.json()
contents = result["contents"]
print("------------------------------------------------")
print("公告:")
print(contents)
print("------------------------------------------------")

def get_user_info(
self, node: str, code: str
Expand Down

0 comments on commit 3cd73d2

Please sign in to comment.