mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
Add support for anonymous mode
This mode was added in libtorrent v0.16 and should be used in addition to a SOCKS5 proxy.
This commit is contained in:
@@ -249,6 +249,10 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
pref.setLSDEnabled(m["lsd"].toBool());
|
||||
if(m.contains("encryption"))
|
||||
pref.setEncryptionSetting(m["encryption"].toInt());
|
||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||
if(m.contains("anonymous_mode"))
|
||||
pref.enableAnonymousMode(m["anonymous_mode"].toBool());
|
||||
#endif
|
||||
// Proxy
|
||||
if(m.contains("proxy_type"))
|
||||
pref.setProxyType(m["proxy_type"].toInt());
|
||||
@@ -362,6 +366,9 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["pex"] = pref.isPeXEnabled();
|
||||
data["lsd"] = pref.isLSDEnabled();
|
||||
data["encryption"] = pref.getEncryptionSetting();
|
||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||
data["anonymous_mode"] = pref.isAnonymousModeEnabled();
|
||||
#endif
|
||||
// Proxy
|
||||
data["proxy_type"] = pref.getProxyType();
|
||||
data["proxy_ip"] = pref.getProxyIp();
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<option value="1">_(Require encryption)</option>
|
||||
<option value="2">_(Disable encryption)</option>
|
||||
</select><br/>
|
||||
<input type="checkbox" id="anonymous_mode_checkbox" onClick="toggleAnonymousMode()"/> _(Enable anonymous mode) (<a href="http://sourceforge.net/apps/mediawiki/qbittorrent/index.php?title=Anonymous_mode">More information</a>)<br/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -312,6 +313,23 @@
|
||||
<script type="text/javascript">
|
||||
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
|
||||
|
||||
toggleAnonymousMode = function() {
|
||||
if($('anonymous_mode_checkbox').getProperty('checked')) {
|
||||
$('dht_checkbox').setProperty('disabled', true);
|
||||
$('DHTPortDiffThanBT_checkbox').setProperty('disabled', true);
|
||||
$('dht_checkbox').setProperty('checked', false);
|
||||
$('lsd_checkbox').setProperty('disabled', true);
|
||||
$('lsd_checkbox').setProperty('checked', false);
|
||||
$('upnp_checkbox').setProperty('disabled', true);
|
||||
$('upnp_checkbox').setProperty('checked', false);
|
||||
} else {
|
||||
$('dht_checkbox').setProperty('disabled', false);
|
||||
$('DHTPortDiffThanBT_checkbox').setProperty('disabled', false);
|
||||
$('lsd_checkbox').setProperty('disabled', false);
|
||||
$('upnp_checkbox').setProperty('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
updateDlLimitEnabled = function() {
|
||||
if($('dl_limit_checkbox').getProperty('checked')) {
|
||||
$('dl_limit_value').setProperty('disabled', false);
|
||||
@@ -619,6 +637,11 @@ loadPreferences = function() {
|
||||
$('lsd_checkbox').setProperty('checked', pref.lsd);
|
||||
var encryption = pref.encryption.toInt();
|
||||
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
|
||||
if($defined(pref.anonymous_mode)) {
|
||||
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
|
||||
} else {
|
||||
$('enable_utp_checkbox').addClass('invisible');
|
||||
}
|
||||
// Downloads
|
||||
$("savepath_text").setProperty('value', pref.save_path);
|
||||
$('temppath_checkbox').setProperty('checked', pref.temp_path_enabled);
|
||||
@@ -797,6 +820,9 @@ applyPreferences = function() {
|
||||
settings.set('pex', $('pex_checkbox').getProperty('checked'));
|
||||
settings.set('lsd', $('lsd_checkbox').getProperty('checked'));
|
||||
settings.set('encryption', $('encryption_select').getSelected()[0].getProperty('value'));
|
||||
if(!$('anonymous_mode_checkbox').hasClass('invisible')) {
|
||||
settings.set('anonymous_mode', $('anonymous_mode_checkbox').getProperty('checked'));
|
||||
}
|
||||
|
||||
// Downloads
|
||||
settings.set('save_path', $('savepath_text').getProperty('value'));
|
||||
|
||||
Reference in New Issue
Block a user