mldonkey: Update description and minor updates

- Update description to simply and talk about multiple protocols supported.

- Don't diagnose on IPv6 as mldonkey does not listen there.

- Run yapf and isort.

- Minor styling fixes.

- Update functional tests to check for service running.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2019-01-25 14:27:25 -08:00
parent 548c6b98f3
commit 260dcd4d32
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
6 changed files with 35 additions and 28 deletions

View File

@ -25,6 +25,7 @@ import subprocess
from plinth import action_utils
def parse_arguments():
"""Return parsed command line arguments as dictionary."""
parser = argparse.ArgumentParser()
@ -40,9 +41,9 @@ def parse_arguments():
def subcommand_pre_install(_):
"""Preseed debconf values before packages are installed."""
subprocess.check_output(
['debconf-set-selections'],
input=b'mldonkey-server mldonkey-server/launch_at_startup boolean true')
subprocess.check_output([
'debconf-set-selections'
], input=b'mldonkey-server mldonkey-server/launch_at_startup boolean true')
def subcommand_enable(_):

View File

@ -4,7 +4,6 @@
# Redirect /mldonkey to /mldonkey/ as the MLdonkey server web interface does not
# work without a slash at the end.
<Location ~ ^/mldonkey$>
<IfModule mod_rewrite.c>
RewriteEngine On
@ -13,7 +12,6 @@
</IfModule>
</Location>
<Location /mldonkey/>
Include includes/freedombox-single-sign-on.conf
ProxyPass http://localhost:4080/

View File

@ -26,11 +26,13 @@ Background:
Scenario: Enable mldonkey application
Given the mldonkey application is disabled
When I enable the mldonkey application
Then the mldonkey service should be running
Then the mldonkey site should be available
Scenario: Disable mldonkey application
Given the mldonkey application is enabled
When I disable the mldonkey application
Then the mldonkey service should not be running
Then the mldonkey site should not be available
# Scenario: Upload an ed2k file to mldonkey

View File

@ -20,28 +20,31 @@ FreedomBox app for mldonkey.
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
from plinth import action_utils, actions, cfg, frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.modules.users import register_group
from plinth.utils import format_lazy
from .manifest import clients
version = 1
service = None
managed_services = ['mldonkey-server']
managed_packages = ['mldonkey-server']
name = _('MLDonkey')
short_description = _('Door to the eDonkey network')
short_description = _('Peer-to-peer File Sharing')
description = [
_('MLDonkey is a door to the eDonkey network, a decentralized network '
'used to exchange big files on the Internet.'),
_('MLDonkey is a peer-to-peer file sharing application used to exchange '
'large files. It can participate in multiple peer-to-peer networks '
'including eDonkey, Kademlia, Overnet, BitTorrent and DirectConnect.'),
format_lazy(
_('On {box_name}, downloaded files can be found in /var/lib/mldonkey/ '
'directory.'), box_name=cfg.box_name)
]
clients = clients
@ -50,13 +53,15 @@ reserved_usernames = ['mldonkey']
group = ('ed2k', _('Download files using eDonkey applications'))
service = None
manual_page = 'MLDonkey'
def init():
"""Intialize the MLDonkey module."""
"""Initialize the MLDonkey module."""
menu = main_menu.get('apps')
menu.add_urlname(name, 'mldonkey', 'mldonkey:index',
short_description)
menu.add_urlname(name, 'mldonkey', 'mldonkey:index', short_description)
register_group(group)
global service
@ -90,9 +95,9 @@ def setup(helper, old_version=None):
def add_shortcut():
"""Helper method to add a shortcut to the frontpage."""
frontpage.add_shortcut('mldonkey', name, short_description=short_description,
url='/mldonkey', login_required=True,
allowed_groups=[group[0]])
frontpage.add_shortcut(
'mldonkey', name, short_description=short_description,
url='/mldonkey/', login_required=True, allowed_groups=[group[0]])
def is_running():
@ -102,8 +107,8 @@ def is_running():
def is_enabled():
"""Return whether the module is enabled."""
return (action_utils.service_is_enabled('mldonkey-server') and
action_utils.webserver_is_enabled('mldonkey-freedombox'))
return (action_utils.service_is_enabled('mldonkey-server')
and action_utils.webserver_is_enabled('mldonkey-freedombox'))
def enable():
@ -123,7 +128,6 @@ def diagnose():
results = []
results.append(action_utils.diagnose_port_listening(4080, 'tcp4'))
results.append(action_utils.diagnose_port_listening(4080, 'tcp6'))
results.extend(
action_utils.diagnose_url_on_all('https://{host}/mldonkey/',
check_certificate=False))

View File

@ -14,6 +14,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Application manifest for mldonkey.
"""
from django.utils.translation import ugettext_lazy as _

View File

@ -20,16 +20,15 @@ URLs for the mldonkey module.
from django.conf.urls import url
from plinth.views import ServiceView
from plinth.modules import mldonkey
from plinth.views import ServiceView
urlpatterns = [
url(r'^apps/mldonkey/$',
ServiceView.as_view(
service_id=mldonkey.managed_services[0],
diagnostics_module_name='mldonkey',
description=mldonkey.description,
clients=mldonkey.clients,
show_status_block=True),
url(
r'^apps/mldonkey/$',
ServiceView.as_view(service_id=mldonkey.managed_services[0],
diagnostics_module_name='mldonkey',
description=mldonkey.description,
clients=mldonkey.clients, show_status_block=True),
name='index'),
]