fix(core): 信任系统证书,并添加网络代理地址配置项 #50

This commit is contained in:
DLmaster361
2025-07-13 22:50:04 +08:00
parent 4efbafc174
commit d539c0f808
9 changed files with 104 additions and 13 deletions

View File

@@ -199,7 +199,16 @@ class Notification(QObject):
params = {"title": title, "desp": content, **options}
headers = {"Content-Type": "application/json;charset=utf-8"}
response = requests.post(url, json=params, headers=headers, timeout=10)
response = requests.post(
url,
json=params,
headers=headers,
timeout=10,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
)
result = response.json()
if result.get("code") == 0:
@@ -244,6 +253,10 @@ class Notification(QObject):
url=webhook_url,
json=data,
timeout=10,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
)
info = response.json()
break
@@ -307,7 +320,7 @@ class Notification(QObject):
image_base64 = ImageUtils.get_base64_from_file(str(image_path))
image_md5 = ImageUtils.calculate_md5_from_file(str(image_path))
except Exception as e:
logger.error(f"图片编码或MD5计算失败{e}")
logger.exception(f"图片编码或MD5计算失败{e}")
self.push_info_bar.emit(
"error",
"企业微信群机器人通知推送异常",
@@ -327,6 +340,10 @@ class Notification(QObject):
url=webhook_url,
json=data,
timeout=10,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
)
info = response.json()
break

View File

@@ -40,6 +40,8 @@ import hashlib
import requests
from urllib import parse
from app.core import Config
def skland_sign_in(token) -> dict:
"""森空岛签到"""
@@ -137,7 +139,13 @@ def skland_sign_in(token) -> dict:
# 通过grant code换cred和sign_token
def get_cred(grant):
rsp = requests.post(
cred_code_url, json={"code": grant, "kind": 1}, headers=header_login
cred_code_url,
json={"code": grant, "kind": 1},
headers=header_login,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
).json()
if rsp["code"] != 0:
raise Exception(f'获得cred失败{rsp.get("messgae")}')
@@ -151,6 +159,10 @@ def skland_sign_in(token) -> dict:
grant_code_url,
json={"appCode": app_code, "token": token, "type": 0},
headers=header_login,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
).json()
if rsp["status"] != 0:
raise Exception(
@@ -172,6 +184,10 @@ def skland_sign_in(token) -> dict:
headers=get_sign_header(
binding_url, "get", None, copy_header(cred), sign_token
),
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
).json()
if rsp["code"] != 0:
logger.error(f"森空岛服务 | 请求角色列表出现问题:{rsp['message']}")
@@ -209,6 +225,10 @@ def skland_sign_in(token) -> dict:
sign_url, "post", body, copy_header(cred), sign_token
),
json=body,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
).json()
if rsp["code"] != 0: