mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 18:28:18 +03:00
parent
6b3da26af8
commit
7b73d3fb5c
3 changed files with 117 additions and 1 deletions
|
@ -193,6 +193,16 @@ void AppController::preferencesAction()
|
|||
data[u"max_uploads"_s] = session->maxUploads();
|
||||
data[u"max_uploads_per_torrent"_s] = session->maxUploadsPerTorrent();
|
||||
|
||||
// I2P
|
||||
data[u"i2p_enabled"_s] = session->isI2PEnabled();
|
||||
data[u"i2p_address"_s] = session->I2PAddress();
|
||||
data[u"i2p_port"_s] = session->I2PPort();
|
||||
data[u"i2p_mixed_mode"_s] = session->I2PMixedMode();
|
||||
data[u"i2p_inbound_quantity"_s] = session->I2PInboundQuantity();
|
||||
data[u"i2p_outbound_quantity"_s] = session->I2POutboundQuantity();
|
||||
data[u"i2p_inbound_length"_s] = session->I2PInboundLength();
|
||||
data[u"i2p_outbound_length"_s] = session->I2POutboundLength();
|
||||
|
||||
// Proxy Server
|
||||
const auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
|
||||
|
@ -628,6 +638,24 @@ void AppController::setPreferencesAction()
|
|||
if (hasKey(u"max_uploads_per_torrent"_s))
|
||||
session->setMaxUploadsPerTorrent(it.value().toInt());
|
||||
|
||||
// I2P
|
||||
if (hasKey(u"i2p_enabled"_s))
|
||||
session->setI2PEnabled(it.value().toBool());
|
||||
if (hasKey(u"i2p_address"_s))
|
||||
session->setI2PAddress(it.value().toString());
|
||||
if (hasKey(u"i2p_port"_s))
|
||||
session->setI2PPort(it.value().toInt());
|
||||
if (hasKey(u"i2p_mixed_mode"_s))
|
||||
session->setI2PMixedMode(it.value().toBool());
|
||||
if (hasKey(u"i2p_inbound_quantity"_s))
|
||||
session->setI2PInboundQuantity(it.value().toInt());
|
||||
if (hasKey(u"i2p_outbound_quantity"_s))
|
||||
session->setI2POutboundQuantity(it.value().toInt());
|
||||
if (hasKey(u"i2p_inbound_length"_s))
|
||||
session->setI2PInboundLength(it.value().toInt());
|
||||
if (hasKey(u"i2p_outbound_length"_s))
|
||||
session->setI2POutboundLength(it.value().toInt());
|
||||
|
||||
// Proxy Server
|
||||
auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "base/utils/version.h"
|
||||
#include "api/isessionmanager.h"
|
||||
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 9, 2};
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 9, 3};
|
||||
|
||||
class APIController;
|
||||
class AuthController;
|
||||
|
|
|
@ -349,6 +349,33 @@
|
|||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="settings">
|
||||
<legend>
|
||||
<input type="checkbox" id="i2pEnabledCheckbox" onclick="qBittorrent.Preferences.updateI2PSettingsEnabled();" />
|
||||
<label for="i2pEnabledCheckbox">QBT_TR(I2P (Experimental) (requires libtorrent >= 2.0))QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="i2pAddress">QBT_TR(Host:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="i2pAddress" />
|
||||
</td>
|
||||
<td>
|
||||
<label for="i2pPort">QBT_TR(Port:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" id="i2pPort" min="0" max="65535" onchange="qBittorrent.Preferences.numberInputLimiter(this);" style="width: 5em;" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="i2pMixedMode" title="QBT_TR(If "mixed mode" is enabled, I2P torrents are allowed to also get peers from other sources than the tracker, and connect to regular IPs, not providing any anonymization. This may be useful if the user is not interested in the anonymization of I2P, but still wants to be able to connect to I2P peers.)QBT_TR[CONTEXT=OptionsDialog]" />
|
||||
<label for="i2pMixedMode">QBT_TR(Mixed mode)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="settings">
|
||||
<legend>QBT_TR(Proxy Server)QBT_TR[CONTEXT=OptionsDialog]</legend>
|
||||
<table>
|
||||
|
@ -1420,6 +1447,38 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<input type="text" id="requestQueueSize" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="i2pInboundQuantity">QBT_TR(I2P inbound quantity (requires libtorrent >= 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#i2p_inbound_quantity" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="i2pInboundQuantity" type="number" min="1" max="16" onchange="qBittorrent.Preferences.numberInputLimiter(this);" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="i2pOutboundQuantity">QBT_TR(I2P outbound quantity (requires libtorrent >= 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#i2p_outbound_quantity" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="i2pOutboundQuantity" type="number" min="1" max="16" onchange="qBittorrent.Preferences.numberInputLimiter(this);" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="i2pInboundLength">QBT_TR(I2P inbound length (requires libtorrent >= 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#i2p_inbound_length" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="i2pInboundLength" type="number" min="0" max="7" onchange="qBittorrent.Preferences.numberInputLimiter(this);" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="i2pOutboundLength">QBT_TR(I2P outbound length (requires libtorrent >= 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#i2p_outbound_length" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="i2pOutboundLength" type="number" min="0" max="7" onchange="qBittorrent.Preferences.numberInputLimiter(this);" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@ -1455,6 +1514,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
updateMaxConnecPerTorrentEnabled: updateMaxConnecPerTorrentEnabled,
|
||||
updateMaxUploadsEnabled: updateMaxUploadsEnabled,
|
||||
updateMaxUploadsPerTorrentEnabled: updateMaxUploadsPerTorrentEnabled,
|
||||
updateI2PSettingsEnabled: updateI2PSettingsEnabled,
|
||||
updatePeerProxySettings: updatePeerProxySettings,
|
||||
updatePeerProxyAuthSettings: updatePeerProxyAuthSettings,
|
||||
updateFilterSettings: updateFilterSettings,
|
||||
|
@ -1644,6 +1704,13 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
$('max_uploads_per_torrent_value').setProperty('disabled', !isMaxUploadsPerTorrentEnabled);
|
||||
};
|
||||
|
||||
const updateI2PSettingsEnabled = function() {
|
||||
const isI2PEnabled = $('i2pEnabledCheckbox').getProperty('checked');
|
||||
$('i2pAddress').setProperty('disabled', !isI2PEnabled);
|
||||
$('i2pPort').setProperty('disabled', !isI2PEnabled);
|
||||
$('i2pMixedMode').setProperty('disabled', !isI2PEnabled);
|
||||
};
|
||||
|
||||
const updatePeerProxySettings = function() {
|
||||
const proxyType = $('peer_proxy_type_select').getProperty('value');
|
||||
const isProxyDisabled = (proxyType === "None");
|
||||
|
@ -2023,6 +2090,13 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
}
|
||||
updateMaxUploadsPerTorrentEnabled();
|
||||
|
||||
// I2P
|
||||
$('i2pEnabledCheckbox').setProperty('checked', pref.i2p_enabled);
|
||||
$('i2pAddress').setProperty('value', pref.i2p_address);
|
||||
$('i2pPort').setProperty('value', pref.i2p_port);
|
||||
$('i2pMixedMode').setProperty('checked', pref.i2p_mixed_mode);
|
||||
updateI2PSettingsEnabled();
|
||||
|
||||
// Proxy Server
|
||||
$('peer_proxy_type_select').setProperty('value', pref.proxy_type);
|
||||
$('peer_proxy_host_text').setProperty('value', pref.proxy_ip);
|
||||
|
@ -2241,6 +2315,10 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
$('peerTurnoverCutoff').setProperty('value', pref.peer_turnover_cutoff);
|
||||
$('peerTurnoverInterval').setProperty('value', pref.peer_turnover_interval);
|
||||
$('requestQueueSize').setProperty('value', pref.request_queue_size);
|
||||
$('i2pInboundQuantity').setProperty('value', pref.i2p_inbound_quantity);
|
||||
$('i2pOutboundQuantity').setProperty('value', pref.i2p_outbound_quantity);
|
||||
$('i2pInboundLength').setProperty('value', pref.i2p_inbound_length);
|
||||
$('i2pOutboundLength').setProperty('value', pref.i2p_outbound_length);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
|
@ -2360,6 +2438,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
}
|
||||
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
||||
|
||||
// I2P
|
||||
settings.set('i2p_enabled', $('i2pEnabledCheckbox').getProperty('checked'));
|
||||
settings.set('i2p_address', $('i2pAddress').getProperty('value'));
|
||||
settings.set('i2p_port', $('i2pPort').getProperty('value').toInt());
|
||||
settings.set('i2p_mixed_mode', $('i2pMixedMode').getProperty('checked'));
|
||||
|
||||
// Proxy Server
|
||||
settings.set('proxy_type', $('peer_proxy_type_select').getProperty('value'));
|
||||
settings.set('proxy_ip', $('peer_proxy_host_text').getProperty('value'));
|
||||
|
@ -2673,6 +2757,10 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
settings.set('peer_turnover_cutoff', $('peerTurnoverCutoff').getProperty('value'));
|
||||
settings.set('peer_turnover_interval', $('peerTurnoverInterval').getProperty('value'));
|
||||
settings.set('request_queue_size', $('requestQueueSize').getProperty('value'));
|
||||
settings.set('i2p_inbound_quantity', $('i2pInboundQuantity').getProperty('value'));
|
||||
settings.set('i2p_outbound_quantity', $('i2pOutboundQuantity').getProperty('value'));
|
||||
settings.set('i2p_inbound_length', $('i2pInboundLength').getProperty('value'));
|
||||
settings.set('i2p_outbound_length', $('i2pOutboundLength').getProperty('value'));
|
||||
|
||||
// Send it to qBT
|
||||
const json_str = JSON.encode(settings);
|
||||
|
|
Loading…
Reference in a new issue