mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
disable proxy support if 127.0.0.1 is not bypassed
There doesn't appear to be an easy way to tell WebEngine to ignore the proxy for 127.0.0.1, so if the user has not bypassed the proxy for local addresses, completely disable it. This may break remote image and script references, but should at least allow the app to load without intervention.
This commit is contained in:
parent
63661713df
commit
7d62b186f8
1 changed files with 11 additions and 0 deletions
|
@ -305,6 +305,17 @@ def _run(argv=None, exec=True):
|
|||
if isMac:
|
||||
app.setAttribute(Qt.AA_DontShowIconsInMenus)
|
||||
|
||||
# proxy configured?
|
||||
from urllib.request import proxy_bypass, getproxies
|
||||
if 'http' in getproxies():
|
||||
# if it's not set up to bypass localhost, we'll
|
||||
# need to disable proxies in the webviews
|
||||
if not proxy_bypass("127.0.0.1"):
|
||||
print("webview proxy use disabled")
|
||||
proxy = QNetworkProxy()
|
||||
proxy.setType(QNetworkProxy.NoProxy)
|
||||
QNetworkProxy.setApplicationProxy(proxy)
|
||||
|
||||
# we must have a usable temp dir
|
||||
try:
|
||||
tempfile.gettempdir()
|
||||
|
|
Loading…
Reference in a new issue