Support the http_proxy environment variable
Overrides General.proxy setting if set
This commit is contained in:
parent
f6f0a0c1ee
commit
6febaeeb1b
|
@ -61,6 +61,9 @@ and this project adheres to
|
|||
- Add command-line arguments parsing and a `--start-in-tray` option, see
|
||||
`mirage --help`
|
||||
|
||||
- Support for HTTP and SOCKS5 proxies, can be set in config file or using the
|
||||
`http_proxy` environment variable
|
||||
|
||||
- Hovering on stability percentages in the sign-in page's homeserver list
|
||||
now shows more detailed tooltips about the server's recent downtimes
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import asyncio
|
|||
import html
|
||||
import io
|
||||
import logging as log
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import textwrap
|
||||
|
@ -167,7 +168,8 @@ class MatrixClient(nio.AsyncClient):
|
|||
store = Path(backend.appdirs.user_data_dir) / "encryption"
|
||||
store.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
proxy = backend.settings.General.proxy
|
||||
proxy: Optional[str]
|
||||
proxy = os.environ.get("http_proxy", backend.settings.General.proxy)
|
||||
host = re.sub(r":\d+$", "", urlparse(homeserver).netloc)
|
||||
|
||||
if host in ("127.0.0.1", "localhost", "::1"):
|
||||
|
|
|
@ -21,6 +21,7 @@ QtObject {
|
|||
MIRAGE_CONFIG_DIR Override the default configuration folder
|
||||
MIRAGE_DATA_DIR Override the default application data folder
|
||||
MIRAGE_CACHE_DIR Override the default cache and downloads folder
|
||||
http_proxy Override the General.proxy setting, see settings.py
|
||||
`
|
||||
|
||||
readonly property bool ready: {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <QObject>
|
||||
#include <QUuid>
|
||||
#include <QNetworkProxy>
|
||||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
|
@ -92,6 +92,8 @@ public slots:
|
|||
}
|
||||
|
||||
void setProxy(QUrl url) const {
|
||||
const QUrl envProxy = QUrl(qEnvironmentVariable("http_proxy"));
|
||||
if (! envProxy.isEmpty()) url = envProxy;
|
||||
if (url.isEmpty()) return;
|
||||
|
||||
const QString scheme = url.scheme();
|
||||
|
|
Loading…
Reference in New Issue
Block a user