ptlsp站点测试问题修复
This commit is contained in:
parent
e0e76bf3fe
commit
3bfc87f1cc
@ -49,6 +49,7 @@ class SiteChain(ChainBase):
|
|||||||
"zhuque.in": self.__zhuque_test,
|
"zhuque.in": self.__zhuque_test,
|
||||||
"m-team.io": self.__mteam_test,
|
"m-team.io": self.__mteam_test,
|
||||||
"m-team.cc": self.__mteam_test,
|
"m-team.cc": self.__mteam_test,
|
||||||
|
"ptlsp.com": self.__ptlsp_test,
|
||||||
}
|
}
|
||||||
|
|
||||||
def is_special_site(self, domain: str) -> bool:
|
def is_special_site(self, domain: str) -> bool:
|
||||||
@ -123,6 +124,14 @@ class SiteChain(ChainBase):
|
|||||||
return True, f"连接成功,但更新状态失败"
|
return True, f"连接成功,但更新状态失败"
|
||||||
return False, "Cookie已失效"
|
return False, "Cookie已失效"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __ptlsp_test(site: Site) -> Tuple[bool, str]:
|
||||||
|
"""
|
||||||
|
判断站点是否已经登陆:ptlsp
|
||||||
|
"""
|
||||||
|
site.url = f"{site.url}index.php"
|
||||||
|
return __test(site)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __parse_favicon(url: str, cookie: str, ua: str) -> Tuple[str, Optional[str]]:
|
def __parse_favicon(url: str, cookie: str, ua: str) -> Tuple[str, Optional[str]]:
|
||||||
"""
|
"""
|
||||||
@ -347,6 +356,15 @@ class SiteChain(ChainBase):
|
|||||||
return self.special_site_test[domain](site_info)
|
return self.special_site_test[domain](site_info)
|
||||||
|
|
||||||
# 通用站点测试
|
# 通用站点测试
|
||||||
|
self.__test(site_info)
|
||||||
|
except Exception as e:
|
||||||
|
return False, f"{str(e)}!"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __test(site_info: Site) -> Tuple[bool, str]:
|
||||||
|
"""
|
||||||
|
通用站点测试
|
||||||
|
"""
|
||||||
site_url = site_info.url
|
site_url = site_info.url
|
||||||
site_cookie = site_info.cookie
|
site_cookie = site_info.cookie
|
||||||
ua = site_info.ua or settings.USER_AGENT
|
ua = site_info.ua or settings.USER_AGENT
|
||||||
@ -386,8 +404,6 @@ class SiteChain(ChainBase):
|
|||||||
return False, f"状态码:{res.status_code}!"
|
return False, f"状态码:{res.status_code}!"
|
||||||
else:
|
else:
|
||||||
return False, f"无法打开网站!"
|
return False, f"无法打开网站!"
|
||||||
except Exception as e:
|
|
||||||
return False, f"{str(e)}!"
|
|
||||||
return True, "连接成功"
|
return True, "连接成功"
|
||||||
|
|
||||||
def remote_list(self, channel: MessageChannel, userid: Union[str, int] = None):
|
def remote_list(self, channel: MessageChannel, userid: Union[str, int] = None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user