mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
transmission: Run from behind Apache
- Introduce Apache configuration for plinth. - Remove Transmission service file for firewalld. - Enable transmission on install. - Enable/disable Apache configuration on Transmission on enable/disable. - Remove IP address whilelisting as 127.0.0.1 is the default setting and is sufficient for Apache to reverse proxy. - Update UI URL.
This commit is contained in:
1 parent
f94d0d5414
commit
69adf1cfc5
8 files changed
+31
-32
No files matched your search
@@ -42,5 +42,5 @@ def init():
|
||||
|
||||
global service
|
||||
service = service_module.Service(
|
||||
'transmission-rpcplinth', _('Transmission BitTorrent'),
|
||||
'transmission', _('Transmission BitTorrent'), ['http', 'https'],
|
||||
is_external=True, enabled=enabled)
|
||||
@@ -20,16 +20,7 @@ Plinth module for configuring Transmission.
|
||||
"""
|
||||
|
||||
from django import forms
|
||||
from django.core.validators import RegexValidator
|
||||
from gettext import gettext as _
|
||||
import re
|
||||
|
||||
|
||||
ipv4_wildcard_re = r'(25[0-5]|2[0-4]\d|[0-1]?\d?\d)' \
|
||||
r'(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d|\*)){3}'
|
||||
|
||||
multiple_ips_re = re.compile(r'^({ipv4})(\s*,\s*{ipv4})*$'.format(ipv4=ipv4_wildcard_re))
|
||||
ip_validator = RegexValidator(multiple_ips_re)
|
||||
|
||||
|
||||
class TransmissionForm(forms.Form): # pylint: disable=W0232
|
||||
@@ -53,10 +44,3 @@ default directory, ensure that the new directory exists and is writable by \
|
||||
help_text=_('Password to login to the web interface. Current \
|
||||
password is shown in a hashed format. To set a new password, enter the \
|
||||
password in plain text.'))
|
||||
|
||||
rpc_whitelist = forms.CharField(
|
||||
label=_('IP addresses to allow'),
|
||||
validators=[ip_validator],
|
||||
help_text=_('A comma separated list of IP addresses that will be \
|
||||
allowed to connect to the web interface. IP addresses may use wild cards, \
|
||||
such as 192.168.*.* .'))
|
||||
@@ -28,9 +28,7 @@
|
||||
daemon handles Bitorrent file sharing. Note that BitTorrent is not
|
||||
anonymous.</p>
|
||||
|
||||
<p>Access the web interface at
|
||||
<a href="http://{{ status.hostname }}:{{ status.rpc_port }}">
|
||||
http://{{ status.hostname }}:{{ status.rpc_port }}</a>
|
||||
<p>Access the web interface at <a href="/transmission">/transmission</a></p>
|
||||
|
||||
<h3>Status</h3>
|
||||
|
||||
|
||||
@@ -37,8 +37,13 @@ logger = logging.getLogger(__name__)
|
||||
TRANSMISSION_CONFIG = '/etc/transmission-daemon/settings.json'
|
||||
|
||||
|
||||
def on_install():
|
||||
"""Enable transmission as soon as it is installed."""
|
||||
actions.superuser_run('transmission', ['enable'])
|
||||
|
||||
|
||||
@login_required
|
||||
@package.required(['transmission-daemon'])
|
||||
@package.required(['transmission-daemon'], on_install=on_install)
|
||||
def index(request):
|
||||
"""Serve configuration page."""
|
||||
status = get_status()
|
||||
@@ -92,13 +97,11 @@ def _apply_changes(request, old_status, new_status):
|
||||
|
||||
if old_status['download_dir'] != new_status['download_dir'] or \
|
||||
old_status['rpc_username'] != new_status['rpc_username'] or \
|
||||
old_status['rpc_password'] != new_status['rpc_password'] or \
|
||||
old_status['rpc_whitelist'] != new_status['rpc_whitelist']:
|
||||
old_status['rpc_password'] != new_status['rpc_password']:
|
||||
new_configuration = {
|
||||
'download-dir': new_status['download_dir'],
|
||||
'rpc-username': new_status['rpc_username'],
|
||||
'rpc-password': new_status['rpc_password'],
|
||||
'rpc-whitelist': new_status['rpc_whitelist']
|
||||
}
|
||||
|
||||
actions.superuser_run('transmission', ['merge-configuration',
|
||||
|
||||
Reference in new issue
Block a user