From 0d55599e02947a66677f36a06b8cb6b3593a3c7a Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Mon, 12 Feb 2018 00:56:05 -0500 Subject: [PATCH] Add "Use proxy only for torrents" option to webui --- src/webui/api/appcontroller.cpp | 3 +++ src/webui/www/private/preferences_content.html | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 2b3035c61..26122ebcd 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -134,6 +134,7 @@ void AppController::preferencesAction() data["proxy_peer_connections"] = session->isProxyPeerConnectionsEnabled(); data["force_proxy"] = session->isForceProxyEnabled(); + data["proxy_torrents_only"] = proxyManager->isProxyOnlyForTorrents(); // IP Filtering data["ip_filter_enabled"] = session->isIPFilteringEnabled(); @@ -344,6 +345,8 @@ void AppController::setPreferencesAction() session->setProxyPeerConnectionsEnabled(m["proxy_peer_connections"].toBool()); if (m.contains("force_proxy")) session->setForceProxyEnabled(m["force_proxy"].toBool()); + if (m.contains("proxy_torrents_only")) + proxyManager->setProxyOnlyForTorrents(m["proxy_torrents_only"].toBool()); // IP Filtering if (m.contains("ip_filter_enabled")) diff --git a/src/webui/www/private/preferences_content.html b/src/webui/www/private/preferences_content.html index 7290bb5bf..0af671376 100644 --- a/src/webui/www/private/preferences_content.html +++ b/src/webui/www/private/preferences_content.html @@ -165,6 +165,10 @@ +
+ + +
@@ -648,6 +652,7 @@ updatePeerProxySettings = function() { $('peer_proxy_port_value').setProperty('disabled', false); $('use_peer_proxy_checkbox').setProperty('disabled', false); $('force_proxy_checkbox').setProperty('disabled', false); + $('proxy_only_for_torrents_checkbox').setProperty('disabled', false); if($('peer_proxy_type_select').getProperty('value') != "socks5") { $('peer_proxy_auth_checkbox').setProperty('checked', false); $('peer_proxy_auth_checkbox').setProperty('disabled', true); @@ -660,6 +665,7 @@ updatePeerProxySettings = function() { $('peer_proxy_port_value').setProperty('disabled', true); $('use_peer_proxy_checkbox').setProperty('disabled', true); $('force_proxy_checkbox').setProperty('disabled', true); + $('proxy_only_for_torrents_checkbox').setProperty('disabled', true); $('peer_proxy_auth_checkbox').setProperty('disabled', true); $('peer_proxy_auth_checkbox').setProperty('checked', false); updatePeerProxyAuthSettings(); @@ -956,6 +962,7 @@ loadPreferences = function() { $('peer_proxy_port_value').setProperty('value', pref.proxy_port); $('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections); $('force_proxy_checkbox').setProperty('checked', pref.force_proxy); + $('proxy_only_for_torrents_checkbox').setProperty('checked', pref.proxy_torrents_only); $('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled); updatePeerProxyAuthSettings(); $('peer_proxy_username_text').setProperty('value', pref.proxy_username); @@ -1203,6 +1210,7 @@ applyPreferences = function() { settings.set('proxy_port', $('peer_proxy_port_value').getProperty('value').toInt()); settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked')); settings.set('force_proxy', $('force_proxy_checkbox').getProperty('checked')); + settings.set('proxy_torrents_only', $('proxy_only_for_torrents_checkbox').getProperty('checked')); settings.set('proxy_username', $('peer_proxy_username_text').getProperty('value')); settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value'));