mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 14:57:52 +00:00
Update proxy settings in Web UI
This commit is contained in:
parent
b48b9479d2
commit
b59dded2a4
@ -282,6 +282,7 @@ void QBtSession::configureSession() {
|
||||
const unsigned short old_listenPort = getListenPort();
|
||||
const unsigned short new_listenPort = pref.getSessionPort();
|
||||
if(old_listenPort != new_listenPort) {
|
||||
qDebug("Session port changes in program preferences: %d -> %d", old_listenPort, new_listenPort);
|
||||
setListeningPort(new_listenPort);
|
||||
addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg(QString::number(new_listenPort)));
|
||||
}
|
||||
@ -1849,6 +1850,7 @@ void QBtSession::setAppendqBExtension(bool append) {
|
||||
// Set the ports range in which is chosen the port the Bittorrent
|
||||
// session will listen to
|
||||
void QBtSession::setListeningPort(int port) {
|
||||
qDebug() << Q_FUNC_INFO << port;
|
||||
Preferences pref;
|
||||
std::pair<int,int> ports(port, port);
|
||||
#if LIBTORRENT_VERSION_MINOR > 15
|
||||
|
@ -234,6 +234,8 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
pref.setProxyIp(m["proxy_ip"].toString());
|
||||
if(m.contains("proxy_port"))
|
||||
pref.setProxyPort(m["proxy_port"].toUInt());
|
||||
if(m.contains("proxy_peer_connections"))
|
||||
pref.setProxyPeerConnections(m["proxy_peer_connections"].toBool());
|
||||
if(m.contains("proxy_auth_enabled"))
|
||||
pref.setProxyAuthEnabled(m["proxy_auth_enabled"].toBool());
|
||||
if(m.contains("proxy_username"))
|
||||
@ -305,6 +307,7 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["proxy_type"] = pref.getProxyType();
|
||||
data["proxy_ip"] = pref.getProxyIp();
|
||||
data["proxy_port"] = pref.getProxyPort();
|
||||
data["proxy_peer_connections"] = pref.proxyPeerConnections();
|
||||
data["proxy_auth_enabled"] = pref.isProxyAuthEnabled();
|
||||
data["proxy_username"] = pref.getProxyUsername();
|
||||
data["proxy_password"] = pref.getProxyPassword();
|
||||
|
@ -182,7 +182,8 @@
|
||||
<option value="http">_(HTTP)</option>
|
||||
</select>
|
||||
_(Host:) <input type="text" id="peer_proxy_host_text" />
|
||||
_(Port:) <input type="text" id="peer_proxy_port_value" style="width: 4em;"/><br/><br/>
|
||||
_(Port:) <input type="text" id="peer_proxy_port_value" style="width: 4em;"/><br/>
|
||||
<input type="checkbox" id="use_peer_proxy_checkbox" /> _(Use proxy for peer connections)<br/><br/>
|
||||
<input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();" /> _(Authentication)<br/>
|
||||
<table>
|
||||
<tr><td style="padding-left: 10px;">_(Username:)</td><td><input type="text" id="peer_proxy_username_text" /></td></tr>
|
||||
@ -404,6 +405,7 @@
|
||||
}
|
||||
var proxy_ip = $('peer_proxy_host_text').get('value');
|
||||
var proxy_port = $('peer_proxy_port_value').get('value');
|
||||
var proxy_peer_connections = $defined($('use_peer_proxy_checkbox').get('checked')) && $('use_peer_proxy_checkbox').get('checked');
|
||||
var proxy_username = $('peer_proxy_username_text').get('value');
|
||||
var proxy_password = $('peer_proxy_password_text').get('value');
|
||||
// Web UI
|
||||
@ -469,6 +471,7 @@
|
||||
dict.set('proxy_type', proxy_type);
|
||||
dict.set('proxy_ip', proxy_ip);
|
||||
dict.set('proxy_port', proxy_port);
|
||||
dict.set('proxy_peer_connections', proxy_peer_connections);
|
||||
dict.set('proxy_auth_enabled', proxy_auth_enabled);
|
||||
dict.set('proxy_username', proxy_username);
|
||||
dict.set('proxy_password', proxy_password);
|
||||
@ -610,6 +613,7 @@ updatePeerProxySettings = function() {
|
||||
if($('peer_proxy_type_select').get('value') != "none") {
|
||||
$('peer_proxy_host_text').removeProperty('disabled');
|
||||
$('peer_proxy_port_value').removeProperty('disabled');
|
||||
$('use_peer_proxy_checkbox').removeProperty('disabled');
|
||||
if($('peer_proxy_type_select').get('value') != "socks5") {
|
||||
$('peer_proxy_auth_checkbox').removeProperty('checked');
|
||||
$('peer_proxy_auth_checkbox').set('disabled', 'true');
|
||||
@ -620,6 +624,7 @@ updatePeerProxySettings = function() {
|
||||
} else {
|
||||
$('peer_proxy_host_text').set('disabled', 'true');
|
||||
$('peer_proxy_port_value').set('disabled', 'true');
|
||||
$('use_peer_proxy_checkbox').set('disabled', 'true');
|
||||
$('peer_proxy_auth_checkbox').set('disabled', 'true');
|
||||
$('peer_proxy_auth_checkbox').removeProperty('checked');
|
||||
updatePeerProxyAuthSettings();
|
||||
@ -876,6 +881,11 @@ loadPreferences = function() {
|
||||
updatePeerProxySettings();
|
||||
$('peer_proxy_host_text').set('value', pref.proxy_ip);
|
||||
$('peer_proxy_port_value').set('value', pref.proxy_port);
|
||||
if(pref.proxy_peer_connections) {
|
||||
$('use_peer_proxy_checkbox').set('checked', 'checked');
|
||||
} else {
|
||||
$('use_peer_proxy_checkbox').removeProperty('checked');
|
||||
}
|
||||
if(pref.proxy_auth_enabled) {
|
||||
$('peer_proxy_auth_checkbox').set('checked', 'checked');
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user