diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
index eb7a5c201..792a62ca9 100644
--- a/debian/source/lintian-overrides
+++ b/debian/source/lintian-overrides
@@ -8,5 +8,4 @@ very-long-line-length-in-source-file * [doc/manual/*.raw.wiki:*]
very-long-line-length-in-source-file * [plinth/modules/deluge/tests/data/sample.torrent:*]
very-long-line-length-in-source-file * [plinth/modules/transmission/tests/data/sample.torrent:*]
very-long-line-length-in-source-file * [doc/visual_design/FreedomBox-Logo.7z:*]
-very-long-line-length-in-source-file * [plinth/modules/i2p/tests/data/router.config:*]
very-long-line-length-in-source-file * [COPYING.md:*]
diff --git a/plinth/modules/help/tests/test_views.py b/plinth/modules/help/tests/test_views.py
index 6f4b7e620..56e73602a 100644
--- a/plinth/modules/help/tests/test_views.py
+++ b/plinth/modules/help/tests/test_views.py
@@ -172,12 +172,12 @@ MANUAL_PAGES = ('Apache_userdir', 'APU', 'Backups', 'BananaPro', 'BeagleBone',
'DateTime', 'Debian', 'Deluge', 'Developer', 'Diagnostics',
'Download', 'DynamicDNS', 'ejabberd', 'Firewall',
'freedombox-manual', 'GettingHelp', 'GitWeb', 'Hardware',
- 'I2P', 'Ikiwiki', 'Infinoted', 'Introduction', 'JSXC',
- 'LetsEncrypt', 'Maker', 'MatrixSynapse', 'MediaWiki',
- 'Minetest', 'MiniDLNA', 'Mumble', 'NameServices', 'Networks',
- 'OpenVPN', 'OrangePiZero', 'PageKite', 'pcDuino3',
- 'Performance', 'PineA64+', 'PioneerEdition', 'Plinth', 'Power',
- 'Privoxy', 'Quassel', 'QuickStart', 'Radicale', 'RaspberryPi2',
+ 'Ikiwiki', 'Infinoted', 'Introduction', 'JSXC', 'LetsEncrypt',
+ 'Maker', 'MatrixSynapse', 'MediaWiki', 'Minetest', 'MiniDLNA',
+ 'Mumble', 'NameServices', 'Networks', 'OpenVPN',
+ 'OrangePiZero', 'PageKite', 'pcDuino3', 'Performance',
+ 'PineA64+', 'PioneerEdition', 'Plinth', 'Power', 'Privoxy',
+ 'Quassel', 'QuickStart', 'Radicale', 'RaspberryPi2',
'RaspberryPi3B+', 'RaspberryPi3B', 'RaspberryPi4B',
'ReleaseNotes', 'Rock64', 'RockPro64', 'Roundcube', 'Samba',
'Searx', 'SecureShell', 'Security', 'ServiceDiscovery',
diff --git a/plinth/modules/i2p/__init__.py b/plinth/modules/i2p/__init__.py
deleted file mode 100644
index 4116357f3..000000000
--- a/plinth/modules/i2p/__init__.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
-"""FreedomBox app to configure I2P."""
-
-from django.utils.translation import gettext_lazy as _
-
-from plinth import app as app_module
-from plinth import frontpage, menu
-from plinth.config import DropinConfigs
-from plinth.daemon import Daemon
-from plinth.modules.apache.components import Webserver
-from plinth.modules.backups.components import BackupRestore
-from plinth.modules.firewall.components import (Firewall,
- FirewallLocalProtection)
-from plinth.modules.i2p.resources import FAVORITES
-from plinth.modules.users.components import UsersAndGroups
-from plinth.package import Packages
-
-from . import manifest, privileged
-
-_description = [
- _('The Invisible Internet Project is an anonymous network layer intended '
- 'to protect communication from censorship and surveillance. I2P '
- 'provides anonymity by sending encrypted traffic through a '
- 'volunteer-run network distributed around the world.'),
- _('Find more information about I2P on their project '
- 'homepage.'),
- _('The first visit to the provided web interface will initiate the '
- 'configuration process.')
-]
-
-tunnels_to_manage = {
- 'I2P HTTP Proxy': 'i2p-http-proxy-freedombox',
- 'I2P HTTPS Proxy': 'i2p-https-proxy-freedombox',
- 'Irc2P': 'i2p-irc-freedombox'
-}
-
-
-class I2PApp(app_module.App):
- """FreedomBox app for I2P."""
-
- app_id = 'i2p'
-
- _version = 3
-
- def __init__(self) -> None:
- """Create components for the app."""
- super().__init__()
-
- groups = {'i2p': _('Manage I2P application')}
-
- info = app_module.Info(app_id=self.app_id, version=self._version,
- name=_('I2P'), icon_filename='i2p',
- short_description=_('Anonymity Network'),
- description=_description, manual_page='I2P',
- clients=manifest.clients, tags=manifest.tags)
- self.add(info)
-
- menu_item = menu.Menu('menu-i2p', info.name, info.short_description,
- info.icon_filename, 'i2p:index',
- parent_url_name='apps')
- self.add(menu_item)
-
- shortcut = frontpage.Shortcut('shortcut-i2p', info.name,
- short_description=info.short_description,
- icon=info.icon_filename, url='/i2p/',
- clients=info.clients,
- login_required=True,
- allowed_groups=list(groups))
- self.add(shortcut)
-
- packages = Packages('packages-i2p', ['i2p'])
- self.add(packages)
-
- dropin_configs = DropinConfigs('dropin-configs-i2p', [
- '/etc/apache2/conf-available/i2p-freedombox.conf',
- ])
- self.add(dropin_configs)
-
- firewall = Firewall('firewall-i2p-web', info.name,
- ports=['http', 'https'], is_external=True)
- self.add(firewall)
-
- firewall = Firewall('firewall-i2p-proxies', _('I2P Proxy'),
- ports=tunnels_to_manage.values(),
- is_external=False)
- self.add(firewall)
-
- firewall_local_protection = FirewallLocalProtection(
- 'firewall-local-protection-i2p', ['7657'])
- self.add(firewall_local_protection)
-
- webserver = Webserver('webserver-i2p', 'i2p-freedombox',
- urls=['https://{host}/i2p/'])
- self.add(webserver)
-
- daemon = Daemon('daemon-i2p', 'i2p', listen_ports=[(7657, 'tcp6')])
- self.add(daemon)
-
- users_and_groups = UsersAndGroups('users-and-groups-i2p',
- groups=groups)
- self.add(users_and_groups)
-
- backup_restore = BackupRestore('backup-restore-i2p', **manifest.backup)
- self.add(backup_restore)
-
- def setup(self, old_version):
- """Install and configure the app."""
- super().setup(old_version)
-
- if not old_version:
- self.disable()
- # Add favorites to the configuration
- for fav in FAVORITES:
- privileged.add_favorite(fav['name'], fav['url'],
- fav.get('description'),
- fav.get('icon'))
-
- # Tunnels to all interfaces
- for tunnel in tunnels_to_manage:
- privileged.set_tunnel_property(tunnel, 'interface', '0.0.0.0')
-
- self.enable()
diff --git a/plinth/modules/i2p/data/usr/lib/firewalld/services/i2p-http-proxy-freedombox.xml b/plinth/modules/i2p/data/usr/lib/firewalld/services/i2p-http-proxy-freedombox.xml
deleted file mode 100644
index 7b6cdd383..000000000
--- a/plinth/modules/i2p/data/usr/lib/firewalld/services/i2p-http-proxy-freedombox.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
{{ line|safe }}
- {% endfor %} - - - -{{ line|safe }}
- {% endfor %} - - -{% endblock %} diff --git a/plinth/modules/i2p/tests/__init__.py b/plinth/modules/i2p/tests/__init__.py deleted file mode 100644 index 2aec89107..000000000 --- a/plinth/modules/i2p/tests/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Common parts for all I2P tests. -""" - -from pathlib import Path - -DATA_DIR = Path(__file__).parent / 'data' diff --git a/plinth/modules/i2p/tests/data/i2ptunnel.config b/plinth/modules/i2p/tests/data/i2ptunnel.config deleted file mode 100644 index 467980059..000000000 --- a/plinth/modules/i2p/tests/data/i2ptunnel.config +++ /dev/null @@ -1,192 +0,0 @@ -# NOTE: This I2P config file must use UTF-8 encoding -tunnel.0.description=HTTP proxy for browsing eepsites and the web -tunnel.0.interface=127.0.0.1 -tunnel.0.listenPort=4444 -tunnel.0.name=I2P HTTP Proxy -tunnel.0.option.i2cp.closeIdleTime=1800000 -tunnel.0.option.i2cp.closeOnIdle=false -tunnel.0.option.i2cp.delayOpen=false -tunnel.0.option.i2cp.destination.sigType=EdDSA_SHA512_Ed25519 -tunnel.0.option.i2cp.newDestOnResume=false -tunnel.0.option.i2cp.reduceIdleTime=900000 -tunnel.0.option.i2cp.reduceOnIdle=true -tunnel.0.option.i2cp.reduceQuantity=1 -tunnel.0.option.i2p.streaming.connectDelay=1000 -tunnel.0.option.i2ptunnel.httpclient.SSLOutproxies=false.i2p -tunnel.0.option.i2ptunnel.httpclient.allowInternalSSL=true -tunnel.0.option.i2ptunnel.httpclient.jumpServers=http://stats.i2p/cgi-bin/jump.cgi?a=,http://no.i2p/jump/,http://i2pjump.i2p/jump/ -tunnel.0.option.i2ptunnel.httpclient.sendAccept=false -tunnel.0.option.i2ptunnel.httpclient.sendReferer=false -tunnel.0.option.i2ptunnel.httpclient.sendUserAgent=false -tunnel.0.option.i2ptunnel.useLocalOutproxy=false -tunnel.0.option.inbound.backupQuantity=0 -tunnel.0.option.inbound.length=3 -tunnel.0.option.inbound.lengthVariance=0 -tunnel.0.option.inbound.nickname=shared clients -tunnel.0.option.inbound.quantity=2 -tunnel.0.option.outbound.backupQuantity=0 -tunnel.0.option.outbound.length=3 -tunnel.0.option.outbound.lengthVariance=0 -tunnel.0.option.outbound.nickname=shared clients -tunnel.0.option.outbound.priority=10 -tunnel.0.option.outbound.quantity=2 -tunnel.0.option.outproxyAuth=false -tunnel.0.option.persistentClientKey=false -tunnel.0.option.sslManuallySet=true -tunnel.0.option.useSSL=false -tunnel.0.proxyList=false.i2p -tunnel.0.sharedClient=true -tunnel.0.startOnLoad=true -tunnel.0.type=httpclient -tunnel.1.description=IRC tunnel to access the Irc2P network -tunnel.1.i2cpHost=127.0.0.1 -tunnel.1.i2cpPort=7654 -tunnel.1.interface=127.0.0.1 -tunnel.1.listenPort=6668 -tunnel.1.name=Irc2P -tunnel.1.option.crypto.lowTagThreshold=14 -tunnel.1.option.crypto.tagsToSend=20 -tunnel.1.option.i2cp.closeIdleTime=1200000 -tunnel.1.option.i2cp.closeOnIdle=true -tunnel.1.option.i2cp.delayOpen=true -tunnel.1.option.i2cp.destination.sigType=ECDSA_SHA256_P256 -tunnel.1.option.i2cp.newDestOnResume=false -tunnel.1.option.i2cp.reduceIdleTime=600000 -tunnel.1.option.i2cp.reduceOnIdle=true -tunnel.1.option.i2cp.reduceQuantity=1 -tunnel.1.option.i2p.streaming.connectDelay=1000 -tunnel.1.option.i2p.streaming.maxWindowSize=16 -tunnel.1.option.inbound.length=3 -tunnel.1.option.inbound.lengthVariance=0 -tunnel.1.option.inbound.nickname=Irc2P -tunnel.1.option.outbound.length=3 -tunnel.1.option.outbound.lengthVariance=0 -tunnel.1.option.outbound.nickname=Irc2P -tunnel.1.option.outbound.priority=15 -tunnel.1.sharedClient=false -tunnel.1.startOnLoad=true -tunnel.1.targetDestination=irc.00.i2p:6667,irc.postman.i2p:6667,irc.echelon.i2p:6667 -tunnel.1.type=ircclient -tunnel.2.description=I2P Monotone Server -tunnel.2.i2cpHost=127.0.0.1 -tunnel.2.i2cpPort=7654 -tunnel.2.interface=127.0.0.1 -tunnel.2.listenPort=8998 -tunnel.2.name=mtn.i2p-projekt.i2p -tunnel.2.option.i2cp.destination.sigType=EdDSA_SHA512_Ed25519 -tunnel.2.option.i2cp.reduceIdleTime=900000 -tunnel.2.option.i2cp.reduceOnIdle=true -tunnel.2.option.i2cp.reduceQuantity=1 -tunnel.2.option.inbound.backupQuantity=0 -tunnel.2.option.inbound.length=3 -tunnel.2.option.inbound.lengthVariance=0 -tunnel.2.option.inbound.nickname=shared clients -tunnel.2.option.inbound.quantity=2 -tunnel.2.option.outbound.backupQuantity=0 -tunnel.2.option.outbound.length=3 -tunnel.2.option.outbound.lengthVariance=0 -tunnel.2.option.outbound.nickname=shared clients -tunnel.2.option.outbound.quantity=2 -tunnel.2.sharedClient=true -tunnel.2.startOnLoad=false -tunnel.2.targetDestination=mtn.i2p-projekt.i2p:4691 -tunnel.2.type=client -tunnel.3.description=My eepsite -tunnel.3.i2cpHost=127.0.0.1 -tunnel.3.i2cpPort=7654 -tunnel.3.name=I2P webserver -tunnel.3.option.i2cp.destination.sigType=7 -tunnel.3.option.i2p.streaming.limitAction=http -tunnel.3.option.i2p.streaming.maxConcurrentStreams=20 -tunnel.3.option.i2p.streaming.maxConnsPerDay=100 -tunnel.3.option.i2p.streaming.maxConnsPerHour=40 -tunnel.3.option.i2p.streaming.maxConnsPerMinute=10 -tunnel.3.option.i2p.streaming.maxTotalConnsPerMinute=25 -tunnel.3.option.inbound.length=3 -tunnel.3.option.inbound.lengthVariance=0 -tunnel.3.option.inbound.nickname=eepsite -tunnel.3.option.maxPosts=3 -tunnel.3.option.maxTotalPosts=10 -tunnel.3.option.outbound.length=3 -tunnel.3.option.outbound.lengthVariance=0 -tunnel.3.option.outbound.nickname=eepsite -tunnel.3.option.shouldBundleReplyInfo=false -tunnel.3.privKeyFile=eepsite/eepPriv.dat -tunnel.3.spoofedHost=mysite.i2p -tunnel.3.startOnLoad=false -tunnel.3.targetHost=127.0.0.1 -tunnel.3.targetPort=7658 -tunnel.3.type=httpserver -tunnel.4.description=smtp server -tunnel.4.i2cpHost=127.0.0.1 -tunnel.4.i2cpPort=7654 -tunnel.4.interface=127.0.0.1 -tunnel.4.listenPort=7659 -tunnel.4.name=smtp.postman.i2p -tunnel.4.option.i2cp.destination.sigType=EdDSA_SHA512_Ed25519 -tunnel.4.option.i2cp.reduceIdleTime=900000 -tunnel.4.option.i2cp.reduceOnIdle=true -tunnel.4.option.i2cp.reduceQuantity=1 -tunnel.4.option.inbound.backupQuantity=0 -tunnel.4.option.inbound.length=3 -tunnel.4.option.inbound.lengthVariance=0 -tunnel.4.option.inbound.nickname=shared clients -tunnel.4.option.inbound.quantity=2 -tunnel.4.option.outbound.backupQuantity=0 -tunnel.4.option.outbound.length=3 -tunnel.4.option.outbound.lengthVariance=0 -tunnel.4.option.outbound.nickname=shared clients -tunnel.4.option.outbound.quantity=2 -tunnel.4.sharedClient=true -tunnel.4.startOnLoad=true -tunnel.4.targetDestination=smtp.postman.i2p:25 -tunnel.4.type=client -tunnel.5.description=pop3 server -tunnel.5.i2cpHost=127.0.0.1 -tunnel.5.i2cpPort=7654 -tunnel.5.interface=127.0.0.1 -tunnel.5.listenPort=7660 -tunnel.5.name=pop3.postman.i2p -tunnel.5.option.i2cp.destination.sigType=EdDSA_SHA512_Ed25519 -tunnel.5.option.i2cp.reduceIdleTime=900000 -tunnel.5.option.i2cp.reduceOnIdle=true -tunnel.5.option.i2cp.reduceQuantity=1 -tunnel.5.option.i2p.streaming.connectDelay=1000 -tunnel.5.option.inbound.backupQuantity=0 -tunnel.5.option.inbound.length=3 -tunnel.5.option.inbound.lengthVariance=0 -tunnel.5.option.inbound.nickname=shared clients -tunnel.5.option.inbound.quantity=2 -tunnel.5.option.outbound.backupQuantity=0 -tunnel.5.option.outbound.length=3 -tunnel.5.option.outbound.lengthVariance=0 -tunnel.5.option.outbound.nickname=shared clients -tunnel.5.option.outbound.quantity=2 -tunnel.5.sharedClient=true -tunnel.5.startOnLoad=true -tunnel.5.targetDestination=pop.postman.i2p:110 -tunnel.5.type=client -tunnel.6.description=HTTPS proxy for browsing eepsites and the web -tunnel.6.i2cpHost=127.0.0.1 -tunnel.6.i2cpPort=7654 -tunnel.6.interface=127.0.0.1 -tunnel.6.listenPort=4445 -tunnel.6.name=I2P HTTPS Proxy -tunnel.6.option.i2cp.reduceIdleTime=900000 -tunnel.6.option.i2cp.reduceOnIdle=true -tunnel.6.option.i2cp.reduceQuantity=1 -tunnel.6.option.i2p.streaming.connectDelay=1000 -tunnel.6.option.inbound.backupQuantity=0 -tunnel.6.option.inbound.length=3 -tunnel.6.option.inbound.lengthVariance=0 -tunnel.6.option.inbound.nickname=shared clients -tunnel.6.option.inbound.quantity=2 -tunnel.6.option.outbound.backupQuantity=0 -tunnel.6.option.outbound.length=3 -tunnel.6.option.outbound.lengthVariance=0 -tunnel.6.option.outbound.nickname=shared clients -tunnel.6.option.outbound.quantity=2 -tunnel.6.proxyList=outproxy-tor.meeh.i2p -tunnel.6.sharedClient=true -tunnel.6.startOnLoad=true -tunnel.6.type=connectclient diff --git a/plinth/modules/i2p/tests/data/router.config b/plinth/modules/i2p/tests/data/router.config deleted file mode 100644 index 8661f7f28..000000000 --- a/plinth/modules/i2p/tests/data/router.config +++ /dev/null @@ -1,23 +0,0 @@ -# NOTE: This I2P config file must use UTF-8 encoding -i2np.lastIPChange=1555091394049 -i2np.ntcp2.iv=i3yLM2tPW6QH5h4YYZ8EWQ== -i2np.ntcp2.sp=j1K18jMDa5SPH23R2cHMJ-dUyPdo~uooZp6Uz06qP0k= -i2np.udp.internalPort=18778 -i2np.udp.port=18778 -jbigi.lastProcessor=Haswell Celeron/Pentium w/ AVX model 60/64 -router.blocklistVersion=1523108115000 -router.firstInstalled=1555091372597 -router.firstVersion=0.9.38 -router.inboundPool.randomKey=c1BGKzCBpxYfsH0AiEMIS39zYWzyBuWO9lYTqeA91dk= -router.outboundPool.randomKey=Of0jkHuGeUAHr~NoIAQbY930fbYacb4NyX3CjbVKKFI= -router.passwordManager.migrated=true -router.previousVersion=0.9.38 -router.startup.jetty9.migrated=true -router.updateDisabled=true -router.updateLastInstalled=1555091372597 -routerconsole.country= -routerconsole.favorites=anoncoin.i2p,The Anoncoin project,http://anoncoin.i2p/,/themes/console/images/anoncoin_32.png,Dev Builds,Development builds of I2P,http://bobthebuilder.i2p/,/themes/console/images/script_gear.png,Dev Forum,Development forum,http://zzz.i2p/,/themes/console/images/group_gear.png,echelon.i2p,I2P Applications,http://echelon.i2p/,/themes/console/images/box_open.png,exchanged.i2p,Anonymous cryptocurrency exchange,http://exchanged.i2p/,/themes/console/images/exchanged.png,I2P Bug Reports,Bug tracker,http://trac.i2p2.i2p/report/1,/themes/console/images/bug.png,I2P FAQ,Frequently Asked Questions,http://i2p-projekt.i2p/faq,/themes/console/images/question.png,I2P Forum,Community forum,http://i2pforum.i2p/,/themes/console/images/group.png,I2P Plugins,Add-on directory,http://i2pwiki.i2p/index.php?title=Plugins,/themes/console/images/info/plugin_link.png,I2P Technical Docs,Technical documentation,http://i2p-projekt.i2p/how,/themes/console/images/education.png,I2P Wiki,Anonymous wiki - share the knowledge,http://i2pwiki.i2p/,/themes/console/images/i2pwiki_logo.png,Planet I2P,I2P News,http://planet.i2p/,/themes/console/images/world.png,PrivateBin,Encrypted I2P Pastebin,http://paste.crypthost.i2p/,/themes/console/images/paste_plain.png,Project Website,I2P home page,http://i2p-projekt.i2p/,/themes/console/images/info_rhombus.png,stats.i2p,I2P Network Statistics,http://stats.i2p/cgi-bin/dashboard.cgi,/themes/console/images/chart_line.png,The Tin Hat,Privacy guides and tutorials,http://secure.thetinhat.i2p/,/themes/console/images/thetinhat.png,Trac Wiki,,http://trac.i2p2.i2p/,/themes/console/images/billiard_marker.png, -routerconsole.lang=en -routerconsole.newsLastChecked=1555093599462 -routerconsole.newsLastUpdated=1553195540000 -routerconsole.welcomeWizardComplete=true diff --git a/plinth/modules/i2p/tests/test_functional.py b/plinth/modules/i2p/tests/test_functional.py deleted file mode 100644 index d71a5f7ef..000000000 --- a/plinth/modules/i2p/tests/test_functional.py +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Functional, browser based tests for i2p app. -""" - -import pytest - -from plinth.tests.functional import BaseAppTests - -pytestmark = [pytest.mark.apps, pytest.mark.i2p] - - -class TestI2pApp(BaseAppTests): - app_name = 'i2p' - has_service = True - has_web = True - diagnostics_delay = 1 diff --git a/plinth/modules/i2p/tests/test_helpers.py b/plinth/modules/i2p/tests/test_helpers.py deleted file mode 100644 index 848621ed1..000000000 --- a/plinth/modules/i2p/tests/test_helpers.py +++ /dev/null @@ -1,61 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Unit tests for helpers of I2P application. -""" - -from pathlib import Path - -import pytest - -from plinth.modules.i2p.helpers import TunnelEditor - -DATA_DIR = Path(__file__).parent / 'data' -TUNNEL_CONF_PATH = DATA_DIR / 'i2ptunnel.config' -TUNNEL_HTTP_NAME = 'I2P HTTP Proxy' - - -@pytest.fixture(name='editor') -def fixture_editor(): - """Setup editor for each test.""" - return TunnelEditor(str(TUNNEL_CONF_PATH)) - - -def test_reading_conf(editor): - """Test reading configuration file.""" - editor.read_conf() - assert len(editor.lines) > 1 - - -def test_setting_idx(editor): - """Test setting index for editing a tunnel.""" - editor.read_conf() - assert editor.idx is None - editor.set_tunnel_idx(TUNNEL_HTTP_NAME) - assert editor.idx == 0 - - -def test_setting_tunnel_props(editor): - """Test setting a tunnel property.""" - editor.read_conf() - editor.set_tunnel_idx('I2P HTTP Proxy') - interface = '0.0.0.0' - editor.set_tunnel_prop('interface', interface) - assert editor['interface'] == interface - - -def test_getting_nonexistent_props(editor): - """Test getting nonexistent property.""" - editor.read_conf() - editor.idx = 0 - with pytest.raises(KeyError): - _ = editor['blabla'] # noqa - - -def test_setting_new_props(editor): - """Test setting new properties.""" - editor.read_conf() - editor.idx = 0 - value = 'lol' - prop = 'blablabla' - editor[prop] = value - assert editor[prop] == value diff --git a/plinth/modules/i2p/tests/test_router_editor.py b/plinth/modules/i2p/tests/test_router_editor.py deleted file mode 100644 index 2f9ae883e..000000000 --- a/plinth/modules/i2p/tests/test_router_editor.py +++ /dev/null @@ -1,73 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Test I2P router configuration editing helper. -""" - -import pytest - -from plinth.modules.i2p.helpers import RouterEditor -from plinth.modules.i2p.tests import DATA_DIR - -ROUTER_CONF_PATH = str(DATA_DIR / 'router.config') - - -@pytest.fixture(name='editor') -def fixture_editor(): - """Return editor instance object for each test.""" - return RouterEditor(ROUTER_CONF_PATH) - - -def test_count_favorites(editor): - """Test counting favorites.""" - editor.read_conf() - favorites = editor.get_favorites() - assert len(favorites.keys()) == 17 - - -def test_add_normal_favorite(editor): - """Test adding a normal favorite.""" - editor.read_conf() - name = 'Somewhere' - url = 'http://somewhere-again.i2p' - description = "Just somewhere else" - editor.add_favorite(name, url, description) - - favorites = editor.get_favorites() - assert url in favorites - favorite = favorites[url] - assert favorite['name'] == name - assert favorite['description'] == description - - assert len(favorites) == 18 - - -def test_add_favorite_with_comma(editor): - """Test adding a favorite with common in its name.""" - editor.read_conf() - name = 'Name,with,comma' - expected_name = name.replace(',', '.') - url = 'http://url-without-comma.i2p' - description = "Another,comma,to,play,with" - expected_description = description.replace(',', '.') - - editor.add_favorite(name, url, description) - - favorites = editor.get_favorites() - assert url in favorites - favorite = favorites[url] - assert favorite['name'] == expected_name - assert favorite['description'] == expected_description - - assert len(favorites) == 18 - - -def test_add_fav_to_empty_config(editor): - """Test adding favorite to empty configuration.""" - editor.conf_filename = '/tmp/inexistent.conf' - editor.read_conf() - assert not editor.get_favorites() - - name = 'Test Favorite' - url = 'http://test-fav.i2p' - editor.add_favorite(name, url) - assert len(editor.get_favorites()) == 1 diff --git a/plinth/modules/i2p/urls.py b/plinth/modules/i2p/urls.py deleted file mode 100644 index e43f0f28e..000000000 --- a/plinth/modules/i2p/urls.py +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -URLs for the I2P module. -""" - -from django.urls import re_path - -from plinth.modules.i2p import views - -urlpatterns = [ - re_path(r'^apps/i2p/$', views.I2PAppView.as_view(), name='index') -] diff --git a/plinth/modules/i2p/views.py b/plinth/modules/i2p/views.py deleted file mode 100644 index c09806ed7..000000000 --- a/plinth/modules/i2p/views.py +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Views for I2P application. -""" - -from django.utils.translation import gettext_lazy as _ - -from plinth.views import AppView - - -class I2PAppView(AppView): - """Serve configuration page.""" - app_id = 'i2p' - template_name = 'i2p.html' - proxies_description = [ - _('I2P lets you browse the Internet and hidden services (eepsites) ' - 'anonymously. For this, your browser, preferably the Tor Browser, ' - 'needs to be configured with a proxy.'), - _('By default HTTP, HTTPS and IRC proxies are available. Additional ' - 'proxies and tunnels may be configured using the tunnel ' - 'configuration interface.'), - ] - torrents_description = [ - _('I2P provides an application to download files anonymously in a ' - 'peer-to-peer network. Download files by adding torrents or ' - 'create a new torrent to share a file.'), - ] - - def get_context_data(self, **kwargs): - """Return the context data for rendering the template view.""" - context = super().get_context_data(**kwargs) - context['proxies_description'] = self.proxies_description - context['torrents_description'] = self.torrents_description - - return context