Skip to content

Commit

Permalink
Add option to enable/disable I2P
Browse files Browse the repository at this point in the history
  • Loading branch information
tehelsper committed Feb 24, 2024
1 parent a900c0f commit c329427
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
1 change: 0 additions & 1 deletion rootfs/standard/usr/bin/mynode_post_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions rootfs/standard/var/www/mynode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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()
Expand Down
33 changes: 33 additions & 0 deletions rootfs/standard/var/www/mynode/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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>
Expand All @@ -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>


Expand Down
1 change: 0 additions & 1 deletion setup/setup_device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c329427

Please sign in to comment.