mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
openvpn: Use new setup mechanism
This commit is contained in:
parent
335eeccee9
commit
b916d95a0b
@ -25,23 +25,42 @@ from plinth import actions
|
|||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
from plinth import service as service_module
|
from plinth import service as service_module
|
||||||
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
|
|
||||||
|
version = 1
|
||||||
|
|
||||||
depends = ['apps']
|
depends = ['apps']
|
||||||
|
|
||||||
|
title = _('Virtual Private Network (OpenVPN)')
|
||||||
|
|
||||||
|
description = [
|
||||||
|
format_lazy(
|
||||||
|
_('Virtual Private Network (VPN) is a technique for securely '
|
||||||
|
'connecting two devices in order to access resources of a '
|
||||||
|
'private network. While you are away from home, you can connect '
|
||||||
|
'to your {box_name} in order to join your home network and '
|
||||||
|
'access private/internal services provided by {box_name}. '
|
||||||
|
'You can also access the rest of the Internet via {box_name} '
|
||||||
|
'for added security and anonymity.'), box_name=_(cfg.box_name))
|
||||||
|
]
|
||||||
|
|
||||||
service = None
|
service = None
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Intialize the OpenVPN module."""
|
"""Intialize the OpenVPN module."""
|
||||||
menu = cfg.main_menu.get('apps:index')
|
menu = cfg.main_menu.get('apps:index')
|
||||||
menu.add_urlname(_('Virtual Private Network (OpenVPN)'), 'glyphicon-lock',
|
menu.add_urlname(title, 'glyphicon-lock', 'openvpn:index', 850)
|
||||||
'openvpn:index', 850)
|
|
||||||
|
|
||||||
global service
|
global service
|
||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
'openvpn', _('OpenVPN'), ['openvpn'],
|
'openvpn', title, ['openvpn'], is_external=True, enabled=is_enabled())
|
||||||
is_external=True, enabled=is_enabled())
|
|
||||||
|
|
||||||
|
def setup(helper, old_version=None):
|
||||||
|
"""Install and configure the module."""
|
||||||
|
helper.install(['openvpn', 'easy-rsa'])
|
||||||
|
|
||||||
|
|
||||||
def is_enabled():
|
def is_enabled():
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "app.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
@ -30,21 +30,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block configuration %}
|
||||||
|
|
||||||
<h2>{% trans "Virtual Private Network (OpenVPN)" %}</h2>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
{% blocktrans trimmed %}
|
|
||||||
Virtual Private Network (VPN) is a technique for securely
|
|
||||||
connecting two devices in order to access resources of a
|
|
||||||
private network. While you are away from home, you can connect
|
|
||||||
to your {{ box_name }} in order to join your home network and
|
|
||||||
access private/internal services provided by {{ box_name }}.
|
|
||||||
You can also access the rest of the Internet via {{ box_name }}
|
|
||||||
for added security and anonymity.
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{% if status.is_setup %}
|
{% if status.is_setup %}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,6 @@ import logging
|
|||||||
|
|
||||||
from .forms import OpenVpnForm
|
from .forms import OpenVpnForm
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import package
|
|
||||||
from plinth.modules import openvpn
|
from plinth.modules import openvpn
|
||||||
from plinth.modules.config import config
|
from plinth.modules.config import config
|
||||||
|
|
||||||
@ -38,7 +37,6 @@ logger = logging.getLogger(__name__)
|
|||||||
setup_process = None
|
setup_process = None
|
||||||
|
|
||||||
|
|
||||||
@package.required(['openvpn', 'easy-rsa'])
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve configuration page."""
|
"""Serve configuration page."""
|
||||||
status = get_status()
|
status = get_status()
|
||||||
@ -59,7 +57,8 @@ def index(request):
|
|||||||
form = OpenVpnForm(initial=status, prefix='openvpn')
|
form = OpenVpnForm(initial=status, prefix='openvpn')
|
||||||
|
|
||||||
return TemplateResponse(request, 'openvpn.html',
|
return TemplateResponse(request, 'openvpn.html',
|
||||||
{'title': _('Virtual Private Network (OpenVPN)'),
|
{'title': openvpn.title,
|
||||||
|
'description': openvpn.description,
|
||||||
'status': status,
|
'status': status,
|
||||||
'form': form})
|
'form': form})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user