mirror of
https://github.com/honmashironeko/ProxyCat.git
synced 2026-10-24 16:44:26 +00:00
Update
This commit is contained in:
1 parent
56d86644c1
commit
bbd010b497
2 files changed
+26
-14
No files matched your search
+23
-9
@@ -1,17 +1,31 @@
|
||||
from modules.modules import get_message, load_config
|
||||
import requests
|
||||
|
||||
first_run_flag = True
|
||||
|
||||
def newip():
|
||||
global first_run_flag
|
||||
config = load_config()
|
||||
language = config.get('language', 'cn')
|
||||
print(get_message('getting_new_proxy', language))
|
||||
url = config.get('getip_url', '')
|
||||
if not url:
|
||||
raise ValueError(get_message('proxy_file_not_found', language, 'getip_url'))
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
newip = "socks5://" + response.text.split("\r\n")[0]
|
||||
print(get_message('new_proxy_is', language, newip))
|
||||
return newip
|
||||
try:
|
||||
if first_run_flag:
|
||||
appKey = ""
|
||||
anquanma = ""
|
||||
whitelist_url = f"https://sch.shanchendaili.com/api.html?action=addWhiteList&appKey={appKey}&anquanma={anquanma}"
|
||||
requests.get(whitelist_url).raise_for_status()
|
||||
first_run_flag = False
|
||||
|
||||
url = config.get('getip_url', '')
|
||||
if not url:
|
||||
raise ValueError('getip_url')
|
||||
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
return "socks5://" + response.text.split("\r\n")[0]
|
||||
|
||||
except Exception as e:
|
||||
error_msg = 'whitelist_error' if first_run_flag else 'proxy_file_not_found'
|
||||
print(get_message(error_msg, language, str(e)))
|
||||
raise
|
||||
|
||||
|
||||
+3
-5
@@ -73,8 +73,7 @@ MESSAGES = {
|
||||
'consecutive_failures': '检测到连续代理失败: {}',
|
||||
'invalid_proxy': '当前代理无效: {}',
|
||||
'proxy_switched': '已从代理 {} 切换到 {}',
|
||||
'consecutive_failures': '检测到连续代理失败: {}',
|
||||
'invalid_proxy': '当前代理无效: {}'
|
||||
'whitelist_error': '添加白名单失败: {}'
|
||||
},
|
||||
'en': {
|
||||
'getting_new_proxy': 'Getting new proxy IP',
|
||||
@@ -146,8 +145,7 @@ MESSAGES = {
|
||||
'consecutive_failures': 'Consecutive proxy failures detected for {}',
|
||||
'invalid_proxy': 'Current proxy is invalid: {}',
|
||||
'proxy_switched': 'Switched from proxy {} to {}',
|
||||
'consecutive_failures': 'Consecutive proxy failures detected for {}',
|
||||
'invalid_proxy': 'Current proxy is invalid: {}'
|
||||
'whitelist_error': 'Failed to add whitelist: {}'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +342,7 @@ async def check_for_updates(language='cn'):
|
||||
match = re.search(r'<p>(ProxyCat-V\d+\.\d+\.\d+)</p>', content)
|
||||
if match:
|
||||
latest_version = match.group(1)
|
||||
CURRENT_VERSION = "ProxyCat-V1.9.3"
|
||||
CURRENT_VERSION = "ProxyCat-V1.9.4"
|
||||
if version.parse(latest_version.split('-V')[1]) > version.parse(CURRENT_VERSION.split('-V')[1]):
|
||||
print(f"{Fore.YELLOW}{get_message('new_version_found', language)} 当前版本: {CURRENT_VERSION}, 最新版本: {latest_version}")
|
||||
print(f"{Fore.YELLOW}{get_message('visit_quark', language)}")
|
||||
|
||||
Reference in new issue
Block a user