mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
privoxy: Use new setup mechanism
This commit is contained in:
parent
45a1bff51d
commit
b112c82889
@ -25,23 +25,50 @@ from plinth import actions
|
||||
from plinth import action_utils
|
||||
from plinth import cfg
|
||||
from plinth import service as service_module
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
|
||||
version = 1
|
||||
|
||||
is_essential = False
|
||||
|
||||
depends = ['apps']
|
||||
|
||||
title = _('Web Proxy (Privoxy)')
|
||||
|
||||
description = [
|
||||
_('Privoxy is a non-caching web proxy with advanced filtering '
|
||||
'capabilities for enhancing privacy, modifying web page data and '
|
||||
'HTTP headers, controlling access, and removing ads and other '
|
||||
'obnoxious Internet junk. '),
|
||||
|
||||
format_lazy(
|
||||
_('You can use Privoxy by modifying your browser proxy settings to '
|
||||
'your {box_name} hostname (or IP address) with port 8118. '
|
||||
'While using Privoxy, you can see its configuration details and '
|
||||
'documentation at '
|
||||
'<a href="http://config.privoxy.org">http://config.privoxy.org/</a> '
|
||||
'or <a href="http://p.p">http://p.p</a>.'), box_name=_(cfg.box_name))
|
||||
]
|
||||
|
||||
service = None
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the module."""
|
||||
menu = cfg.main_menu.get('apps:index')
|
||||
menu.add_urlname(_('Web Proxy (Privoxy)'), 'glyphicon-cloud-upload',
|
||||
'privoxy:index', 1000)
|
||||
menu.add_urlname(title, 'glyphicon-cloud-upload', 'privoxy:index', 1000)
|
||||
|
||||
global service
|
||||
service = service_module.Service(
|
||||
'privoxy', _('Privoxy Web Proxy'),
|
||||
is_external=False, enabled=is_enabled())
|
||||
'privoxy', title, is_external=False, enabled=is_enabled())
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.install(['privoxy'])
|
||||
helper.call('post', actions.superuser_run, 'privoxy', ['setup'])
|
||||
helper.call('post', service.notify_enabled, None, True)
|
||||
|
||||
|
||||
def is_enabled():
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "app.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
@ -21,29 +21,7 @@
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{% trans "Web Proxy (Privoxy)" %}</h2>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
Privoxy is a non-caching web proxy with advanced filtering
|
||||
capabilities for enhancing privacy, modifying web page data and
|
||||
HTTP headers, controlling access, and removing ads and other
|
||||
obnoxious Internet junk.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
You can use Privoxy by modifying your browser proxy settings to
|
||||
your {{ box_name }} hostname (or IP address) with port 8118.
|
||||
While using Privoxy, you can see its configuration details and
|
||||
documentation at
|
||||
<a href="http://config.privoxy.org">http://config.privoxy.org/</a>
|
||||
or <a href="http://p.p">http://p.p</a>.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% block configuration %}
|
||||
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
|
||||
@ -26,19 +26,11 @@ import logging
|
||||
|
||||
from .forms import PrivoxyForm
|
||||
from plinth import actions
|
||||
from plinth import package
|
||||
from plinth.modules import privoxy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def on_install():
|
||||
"""Notify that the service is now enabled."""
|
||||
actions.superuser_run('privoxy', ['setup'])
|
||||
privoxy.service.notify_enabled(None, True)
|
||||
|
||||
|
||||
@package.required(['privoxy'], on_install=on_install)
|
||||
def index(request):
|
||||
"""Serve configuration page."""
|
||||
status = get_status()
|
||||
@ -56,7 +48,8 @@ def index(request):
|
||||
form = PrivoxyForm(initial=status, prefix='privoxy')
|
||||
|
||||
return TemplateResponse(request, 'privoxy.html',
|
||||
{'title': _('Web Proxy (Privoxy)'),
|
||||
{'title': privoxy.title,
|
||||
'description': privoxy.description,
|
||||
'status': status,
|
||||
'form': form})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user