From 23b4d33b3b15d3fe210944532e93f2b2fff6f3e9 Mon Sep 17 00:00:00 2001 From: LoveIsGrief Date: Sat, 2 Mar 2019 16:35:10 +0100 Subject: [PATCH] i2p: django: Add description for the configuration shortcuts Tunnels have a better description now. I2P snark will need a better description and introduction freedombox-team/plinth#1428 Request: I2P support Reviewed-by: Sunil Mohan Adapa --- TODO.md | 2 +- plinth/modules/i2p/templates/i2p_frame.html | 22 ++++++++++++++++---- plinth/modules/i2p/urls.py | 8 ++----- plinth/modules/i2p/views.py | 23 +++++++++++++++++++-- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/TODO.md b/TODO.md index dbdb665a7..f814521e0 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,7 @@ # I2P - [ ] functional tests - - [ ] improve i2p_frames to add a description above the frame + - [x] improve i2p_frames to add a description above the frame - [ ] configure HTTP/S proxy from freedombox interface + disabled + local interfaces diff --git a/plinth/modules/i2p/templates/i2p_frame.html b/plinth/modules/i2p/templates/i2p_frame.html index 4c08b6be7..8c3c4a6d0 100644 --- a/plinth/modules/i2p/templates/i2p_frame.html +++ b/plinth/modules/i2p/templates/i2p_frame.html @@ -1,13 +1,27 @@ {% extends "base.html" %} {% block page_head %} {% endblock %} {% block content %} - +
+
+ {% for line in description %} +

{{ line|safe }}

+ {% endfor %} + +
+ + +
{% endblock %} diff --git a/plinth/modules/i2p/urls.py b/plinth/modules/i2p/urls.py index 0fcd68b48..fa5f0e8e1 100644 --- a/plinth/modules/i2p/urls.py +++ b/plinth/modules/i2p/urls.py @@ -24,11 +24,7 @@ from plinth.modules.i2p import views urlpatterns = [ url(r'^apps/i2p/$', views.I2PServiceView.as_view(), name='index'), - url(r'^apps/i2p/frame/tunnels/?$', views.create_i2p_frame_view( - "I2P Proxies and Tunnels", "i2ptunnel" - ), name='frame_tunnels'), - url(r'^apps/i2p/frame/torrent/?$', views.create_i2p_frame_view( - "Anonymous torrents", "i2psnark" - ), name='frame_torrent'), + url(r'^apps/i2p/frame/tunnels/?$', views.i2p_frame_tunnels, name='frame_tunnels'), + url(r'^apps/i2p/frame/torrent/?$', views.i2p_frame_torrent, name='frame_torrent'), ] diff --git a/plinth/modules/i2p/views.py b/plinth/modules/i2p/views.py index 9bc7fd84f..b818c6970 100644 --- a/plinth/modules/i2p/views.py +++ b/plinth/modules/i2p/views.py @@ -49,7 +49,7 @@ class I2PServiceView(ServiceView): return context -def create_i2p_frame_view(title, rel_path): +def _create_i2p_frame_view(title, rel_path, description): """ Creates a view with an iframe to the given path @@ -69,7 +69,26 @@ def create_i2p_frame_view(title, rel_path): request, 'i2p_frame.html', { 'title': _(title), 'subsubmenu': subsubmenu, - 'path': path + 'path': path, + 'description': description }) return i2p_frame_view + + +i2p_frame_tunnels = _create_i2p_frame_view( + "I2P Proxies and Tunnels", "i2ptunnel", [ + _('I2P has the concept of tunnels. These enter an exit the network and are configured and (de)activated here.'), + _('HTTP/S SOCKS5 proxies are entry tunnels, so they are configured here.'), + _('In order to allow usage by other members of your network, ' + 'select the proxy then the interface you want your proxies to be bound to and save the settings.' + 'The interface is in the "Reachable by" dropdown list.'), + _('You can find the IP addresses of your interfaces/connections here'), + ] +) +i2p_frame_torrent = _create_i2p_frame_view( + "Anonymous torrents", "i2psnark", [ + _('Track the progress of your anonymous torrent downlaods here.'), + _('You can find torrents on the Postman Tracker'), + ] +)