Skip to content

Commit 9fc4349

Browse files
committed
fix: bug fix
1 parent 6e25863 commit 9fc4349

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

app/lib/common/login_helper/main.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CommonLoginHelper(interRoot):
1414
def __init__(self):
1515
self.lang = self.INS.i18n.get_bundle("app.common.loginHelper", func=True)
1616
self.requests = requests.Session()
17-
self.requests.mount("https://", CustomAdapter())
17+
# self.requests.mount("https://", CustomAdapter())
1818
self.token_getter = TokenGetter(lang=self.lang, requests=self.requests)
1919
self.proxy = ""
2020
self.auth_token_url = ""
@@ -152,19 +152,19 @@ def _get(cls, url, proxy="", silent=False):
152152
return True
153153

154154

155-
class CustomAdapter(requests.adapters.HTTPAdapter):
156-
"""
157-
防止在请求 Cloudflare 时可能的 SSL 相关错误。
158-
Thanks to @github/grawity.
159-
"""
155+
# class CustomAdapter(requests.adapters.HTTPAdapter):
156+
# """
157+
# 防止在请求 Cloudflare 时可能的 SSL 相关错误。
158+
# Thanks to @github/grawity.
159+
# """
160160

161-
def init_poolmanager(self, *args, **kwargs):
162-
# When urllib3 hand-rolls a SSLContext, it sets 'options |= OP_NO_TICKET'
163-
# and CloudFlare really does not like this. We cannot control this behavior
164-
# in urllib3, but we can just pass our own standard context instead.
165-
import ssl
161+
# def init_poolmanager(self, *args, **kwargs):
162+
# # When urllib3 hand-rolls a SSLContext, it sets 'options |= OP_NO_TICKET'
163+
# # and CloudFlare really does not like this. We cannot control this behavior
164+
# # in urllib3, but we can just pass our own standard context instead.
165+
# import ssl
166166

167-
ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
168-
ctx.load_default_certs()
169-
ctx.set_alpn_protocols(["http/1.1"])
170-
return super().init_poolmanager(*args, **kwargs, ssl_context=ctx)
167+
# ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
168+
# ctx.load_default_certs()
169+
# ctx.set_alpn_protocols(["http/1.1"])
170+
# return super().init_poolmanager(*args, **kwargs, ssl_context=ctx)

app/lib/core/biu.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __pre_check(self):
7575
self.STATIC.localMsger.red(self.lang("config.hint_port_is_in_use"))
7676
input(self.lang("common.press_to_exit"))
7777
sys.exit(0)
78-
# 检测 cache 大小
78+
# 检测 Cache 大小
7979
cache_path = self.getENV("rootPath") + "usr/cache/search/"
8080
size_cache = self.STATIC.file.get_dir_size_mib(cache_path)
8181
if size_cache > float(self.sets["biu"]["search"]["maxCacheSizeMiB"]):
@@ -125,14 +125,13 @@ def __check_out_network(self):
125125
self.STATIC.localMsger.msg(self.lang("network.hint_in_check"))
126126
try:
127127
if self.proxy != "":
128-
requests.get("https://pixiv.net/", proxies={"https": self.proxy}, timeout=3)
128+
requests.head("https://pixiv.net/", proxies={"https": self.proxy}, timeout=3)
129129
else:
130-
requests.get("https://pixiv.net/", timeout=3)
130+
requests.head("https://pixiv.net/", timeout=3)
131131
except:
132132
self.STATIC.localMsger.red(self.lang("network.fail_pixiv_and_use_bypass"))
133133
self.api_route = "bypassSNI"
134134
self.proxy = ""
135-
time.sleep(5)
136135

137136
def __login(self, refresh_token=None, silent=False):
138137
"""

main.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
from altfe.interface.root import classRoot
1111

1212
# Fix SSL socket connection issues in some systems
13-
import ssl
13+
# import ssl
1414

15-
create_default_context_orig = ssl.create_default_context
15+
# create_default_context_orig = ssl.create_default_context
1616

1717

18-
def cdc(*args, **kwargs):
19-
kwargs["purpose"] = ssl.Purpose.SERVER_AUTH
20-
return create_default_context_orig(*args[1:], **kwargs)
18+
# def cdc(*args, **kwargs):
19+
# kwargs["purpose"] = ssl.Purpose.SERVER_AUTH
20+
# return create_default_context_orig(*args[1:], **kwargs)
2121

2222

23-
ssl.create_default_context = cdc
23+
# ssl.create_default_context = cdc
2424
# Fix End
2525

2626
rootPath = os.path.split(os.path.realpath(sys.argv[0]))[0] + "/"

0 commit comments

Comments
 (0)