Add option to enable/disable I2P

This commit is contained in:
Taylor Helsper 2024-02-24 00:56:35 -06:00
parent a900c0f210
commit c3294271de
4 changed files with 47 additions and 2 deletions

View File

@ -1166,7 +1166,6 @@ systemctl enable docker_images
systemctl enable glances
systemctl enable webssh2
systemctl enable tor
systemctl enable i2pd
systemctl enable loop
systemctl enable pool
systemctl enable rotate_logs

View File

@ -97,6 +97,7 @@ def page_settings():
"upload_rate": upload_rate,
"electrs_tx_lookup_limit": get_electrs_index_lookup_limit(),
"btcrpcexplorer_token_enabled": is_btcrpcexplorer_token_enabled(),
"is_i2p_enabled": is_service_enabled("i2pd"),
"is_btc_ipv4_enabled": settings_file_exists("btc_ipv4_enabled"),
"is_btc_tor_enabled": settings_file_exists("btc_tor_enabled"),
"is_btc_i2p_enabled": settings_file_exists("btc_i2p_enabled"),
@ -850,6 +851,19 @@ def page_reset_tor_connections():
flash("Tor connections reset", category="message")
return redirect("/settings")
@mynode_settings.route("/settings/i2p")
def page_i2p():
check_logged_in()
enable = request.args.get('enable')
if enable == "1":
enable_service("i2pd")
else:
disable_service("i2pd")
flash("I2P Setting Saved", category="message")
return redirect(url_for(".page_settings"))
@mynode_settings.route("/settings/btcrpcexplorer_token")
def page_btcrpcexplorer_token():
check_logged_in()

View File

@ -666,6 +666,22 @@
}
});
$('#i2p_checkbox').change(function () {
$("#i2p").show();
});
$("#i2p").on("click", function() {
checked=$('#i2p_checkbox').is(":checked")
$('#loading_spinner_overlay').fadeIn();
if (checked)
{
window.location.href='/settings/i2p?enable=1'
}
else
{
window.location.href='/settings/i2p?enable=0'
}
});
$('#tor_repo_checkbox').change(function () {
$("#tor_repo").show();
});
@ -962,10 +978,14 @@
</label>
</td>
<td>
{% if is_i2p_enabled %}
<label class="switch">
<input type="checkbox" name="btc_i2p_checkbox" {% if is_btc_i2p_enabled %}checked{% endif %}>
<span class="slider round"></span>
</label>
{% else %}
disabled
{% endif %}
</td>
</tr>
<tr>
@ -992,6 +1012,19 @@
<input type="submit" id="btc_lnd_networks_save" class="ui-button ui-widget ui-corner-all" value="Save"/>
</form>
<div class="divider"></div>
<div class="settings_block_subheader">I2P</div>
A privacy network option, similar to Tor, can be be enabled. Enabling I2P will run the service in the background and it can be used as a network for Bitcoin.
<br/><br/>
<label class="switch">
<input type="checkbox" id="i2p_checkbox" {% if is_i2p_enabled %}checked{% endif %}>
<span class="slider round"></span>
</label>
<br/><br/>
<button id="i2p" style="display: none;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
</div>

View File

@ -1062,7 +1062,6 @@ systemctl enable redis-server
#systemctl enable btcrpcexplorer # DISABLED BY DEFAULT
systemctl enable rtl
systemctl enable tor
systemctl enable i2pd
systemctl enable invalid_block_check
systemctl enable usb_driver_check
systemctl enable docker_images