| Conditions | 6 |
| Total Lines | 12 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 16 | def get_latest_ver() -> str: |
||
| 17 | url = "https://ghproxy.com/https://raw.githubusercontent.com/Oreomeow/checkinpanel/master/utils_ver.py" |
||
| 18 | if time.localtime().tm_hour < 8 or time.localtime().tm_hour > 12: |
||
| 19 | return "不在 8-12 点内,跳过版本检查。" |
||
| 20 | try: |
||
| 21 | r = requests.get(url=url, timeout=3) |
||
| 22 | except Exception as e: |
||
| 23 | ver_msg = f"获取最新版本失败,错误信息如下:\n{e}" |
||
| 24 | else: |
||
| 25 | latest_ver = ver_re.findall(r.text)[0] if ver_re.findall(r.text) else "无效版本" |
||
| 26 | ver_msg = f"最新版本:{latest_ver}" |
||
| 27 | return ver_msg |
||
| 28 | |||
| 32 |