From 5bc4330e1cfc14ece3bae11f35490fd8cf671ee0 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 2 Mar 2025 14:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DHDDolby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/site.py | 27 +++++++++++++++++++++++++++ version.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/chain/site.py b/app/chain/site.py index e099dfbc..13d854a4 100644 --- a/app/chain/site.py +++ b/app/chain/site.py @@ -52,6 +52,7 @@ class SiteChain(ChainBase): "1ptba.com": self.__indexphp_test, "star-space.net": self.__indexphp_test, "yemapt.org": self.__yema_test, + "hddolby.com": self.__hddolby_test, } def refresh_userdata(self, site: dict = None) -> Optional[SiteUserData]: @@ -251,6 +252,32 @@ class SiteChain(ChainBase): site.url = f"{site.url}index.php" return self.__test(site) + @staticmethod + def __hddolby_test(site: Site) -> Tuple[bool, str]: + """ + 判断站点是否已经登陆:hddolby + """ + url = f"{site.url}api/v1/user/data" + headers = { + "Content-Type": "application/json", + "Accept": "application/json, text/plain, */*", + "x-api-key": site.apikey, + } + res = RequestUtils( + headers=headers, + proxies=settings.PROXY if site.proxy else None, + timeout=site.timeout or 15 + ).get_res(url=url) + if res is None: + return False, "无法打开网站!" + if res.status_code == 200: + user_info = res.json() + if user_info and user_info.get("status") == 0: + return True, "连接成功" + return False, "APIKEY已过期" + else: + return False, f"错误:{res.status_code} {res.reason}" + @staticmethod def __parse_favicon(url: str, cookie: str, ua: str) -> Tuple[str, Optional[str]]: """ diff --git a/version.py b/version.py index ec15d326..e1923e62 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ -APP_VERSION = 'v2.3.3' +APP_VERSION = 'v2.3.3-1' FRONTEND_VERSION = 'v2.3.3'