mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
deluge: Minor fixes and styling
- Updated comments - Start the daemon before enabling Apache configuration. - Warn the user about editing the Apache configuration for Deluge. - Other minor updates.
This commit is contained in:
parent
6a57dc78f3
commit
a6fa7abbad
@ -18,7 +18,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Configuration helper for BitTorrent web client
|
Configuration helper for BitTorrent web client.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@ -30,6 +30,12 @@ SITE_CONF = '/etc/apache2/conf-available/deluge-web.conf'
|
|||||||
SITE_ENABLED = '/etc/apache2/conf-enabled/deluge-web.conf'
|
SITE_ENABLED = '/etc/apache2/conf-enabled/deluge-web.conf'
|
||||||
|
|
||||||
APACHE_CONF = '''
|
APACHE_CONF = '''
|
||||||
|
##
|
||||||
|
## On all sites, provide Deluge on a default path: /deluge
|
||||||
|
##
|
||||||
|
## This file is managed and overwritten by Plinth. If you wish to edit
|
||||||
|
## it, disable Deluge in Plinth, remove this file and manage it manually.
|
||||||
|
##
|
||||||
<Location /deluge>
|
<Location /deluge>
|
||||||
ProxyPass http://localhost:8112
|
ProxyPass http://localhost:8112
|
||||||
</Location>
|
</Location>
|
||||||
@ -77,11 +83,11 @@ def subcommand_enable(_):
|
|||||||
if not os.path.isfile(SITE_CONF):
|
if not os.path.isfile(SITE_CONF):
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
|
subcommand_start(_)
|
||||||
|
|
||||||
subprocess.check_call(['a2enconf', 'deluge-web'])
|
subprocess.check_call(['a2enconf', 'deluge-web'])
|
||||||
subprocess.check_call(['service', 'apache2', 'reload'])
|
subprocess.check_call(['service', 'apache2', 'reload'])
|
||||||
|
|
||||||
subcommand_start(_)
|
|
||||||
|
|
||||||
|
|
||||||
def subcommand_disable(_):
|
def subcommand_disable(_):
|
||||||
"""Disable deluge-web site and stop deluge-web."""
|
"""Disable deluge-web site and stop deluge-web."""
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Plinth module to configure a Deluge web client
|
Plinth module to configure a Deluge web client.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
@ -28,7 +28,7 @@ depends = ['plinth.modules.apps']
|
|||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the BitTorrent module."""
|
"""Initialize the Deluge module."""
|
||||||
menu = cfg.main_menu.get('apps:index')
|
menu = cfg.main_menu.get('apps:index')
|
||||||
menu.add_urlname(_('BitTorrent (Deluge)'), 'glyphicon-magnet',
|
menu.add_urlname(_('BitTorrent (Deluge)'), 'glyphicon-magnet',
|
||||||
'deluge:index', 60)
|
'deluge:index', 60)
|
||||||
|
|||||||
@ -26,5 +26,5 @@ from gettext import gettext as _
|
|||||||
class DelugeForm(forms.Form):
|
class DelugeForm(forms.Form):
|
||||||
"""Deluge configuration form."""
|
"""Deluge configuration form."""
|
||||||
enabled = forms.BooleanField(
|
enabled = forms.BooleanField(
|
||||||
label=_('Enable Deluge web client'),
|
label=_('Enable Deluge'),
|
||||||
required=False)
|
required=False)
|
||||||
|
|||||||
@ -49,19 +49,19 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% if status.is_running %}
|
{% if status.is_running %}
|
||||||
|
|
||||||
<span class="running-status active"></span> deluge-web is running
|
<span class="running-status active"></span> deluge-web is running
|
||||||
<form class="form" method="post" action="{% url 'deluge:stop' %}">
|
<form class="form" method="post" action="{% url 'deluge:stop' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary" value="Stop deluge-web"/>
|
||||||
value="Stop deluge-web »"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<span class="running-status inactive"></span> deluge-web is not running
|
<span class="running-status inactive"></span> deluge-web is not running
|
||||||
<form class="form" method="post" action="{% url 'deluge:start' %}">
|
<form class="form" method="post" action="{% url 'deluge:start' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary" value="Start deluge-web"/>
|
||||||
value="Start deluge-web »"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ def get_status():
|
|||||||
enabled = (output.strip() == 'yes')
|
enabled = (output.strip() == 'yes')
|
||||||
|
|
||||||
output = actions.run('deluge', ['is-running'])
|
output = actions.run('deluge', ['is-running'])
|
||||||
is_running = ('yes' in output.strip())
|
is_running = (output.strip() == 'yes')
|
||||||
|
|
||||||
status = {'enabled': enabled,
|
status = {'enabled': enabled,
|
||||||
'is_running': is_running}
|
'is_running': is_running}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user