mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
openvpn: Fix i18n and minor refactoring
- Remove hard coded link
This commit is contained in:
parent
3e8caab08a
commit
7465aafe89
@ -18,7 +18,8 @@
|
|||||||
"""
|
"""
|
||||||
Plinth module to configure OpenVPN server.
|
Plinth module to configure OpenVPN server.
|
||||||
"""
|
"""
|
||||||
from django.urls import reverse_lazy
|
|
||||||
|
from django.urls import resolve, reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
@ -65,31 +66,29 @@ def init():
|
|||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
managed_services[0], title, ports=['openvpn'], is_external=True)
|
managed_services[0], title, ports=['openvpn'], is_external=True)
|
||||||
|
|
||||||
if is_enabled() and is_setup():
|
if service.is_enabled() and is_setup():
|
||||||
add_shortcut()
|
add_shortcut()
|
||||||
|
|
||||||
|
|
||||||
def is_enabled():
|
|
||||||
return action_utils.service_is_enabled('openvpn')
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
|
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
global service
|
global service
|
||||||
if service is None:
|
if service is None:
|
||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
managed_services[0], title, ports=['openvpn'], is_external=True)
|
managed_services[0], title, ports=['openvpn'], is_external=True)
|
||||||
add_shortcut()
|
|
||||||
|
helper.call('post', add_shortcut)
|
||||||
|
|
||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
|
"""Add shortcut in frontpage."""
|
||||||
|
download_profile = \
|
||||||
|
format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">'
|
||||||
|
'Download Profile</a>'),
|
||||||
|
link=reverse_lazy('openvpn:profile'))
|
||||||
frontpage.add_shortcut('openvpn', title,
|
frontpage.add_shortcut('openvpn', title,
|
||||||
details=description + [
|
details=description + [download_profile],
|
||||||
'<a class="btn btn-primary btn-sm"'
|
|
||||||
'href="/plinth/apps/openvpn/profile">Download Profile</a>'
|
|
||||||
],
|
|
||||||
configure_url=reverse_lazy('openvpn:index'),
|
configure_url=reverse_lazy('openvpn:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user