mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
pagekite: Use new setup mechanism
This commit is contained in:
parent
166ff9b5bf
commit
5e094934b0
@ -21,19 +21,59 @@ Plinth module to configure PageKite
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from plinth import cfg
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
from . import utils
|
||||
|
||||
__all__ = ['init']
|
||||
version = 1
|
||||
|
||||
depends = ['apps', 'names']
|
||||
|
||||
title = _('Public Visibility (PageKite)')
|
||||
|
||||
description = [
|
||||
format_lazy(
|
||||
_('PageKite is a system for exposing {box_name} services when '
|
||||
'you don\'t have a direct connection to the Internet. You only '
|
||||
'need this if your {box_name} services are unreachable from '
|
||||
'the rest of the Internet. This includes the following '
|
||||
'situations:'), box_name=_(cfg.box_name)),
|
||||
|
||||
format_lazy(
|
||||
_('{box_name} is behind a restricted firewall.'),
|
||||
box_name=_(cfg.box_name)),
|
||||
|
||||
format_lazy(
|
||||
_('{box_name} is connected to a (wireless) router which you '
|
||||
'don\'t control.'), box_name=_(cfg.box_name)),
|
||||
|
||||
_('Your ISP does not provide you an external IP address and '
|
||||
'instead provides Internet connection through NAT.'),
|
||||
|
||||
_('Your ISP does not provide you a static IP address and your IP '
|
||||
'address changes evertime you connect to Internet.'),
|
||||
|
||||
_('Your ISP limits incoming connections.'),
|
||||
|
||||
format_lazy(
|
||||
_('PageKite works around NAT, firewalls and IP-address limitations '
|
||||
'by using a combination of tunnels and reverse proxies. You can '
|
||||
'use any pagekite service provider, for example '
|
||||
'<a href="https://pagekite.net">pagekite.net</a>. In future it '
|
||||
'might be possible to use your buddy\'s {box_name} for this.'),
|
||||
box_name=_(cfg.box_name))
|
||||
]
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the PageKite module"""
|
||||
menu = cfg.main_menu.get('apps:index')
|
||||
menu.add_urlname(_('Public Visibility (PageKite)'),
|
||||
'glyphicon-flag', 'pagekite:index', 800)
|
||||
menu.add_urlname(title, 'glyphicon-flag', 'pagekite:index', 800)
|
||||
|
||||
# Register kite name with Name Services module.
|
||||
utils.update_names_module(initial_registration=True)
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.install(['pagekite'])
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "app.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
@ -20,58 +20,7 @@
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
PageKite is a system for exposing {{ box_name }} services when
|
||||
you don't have a direct connection to the Internet. You only
|
||||
need this if your {{ box_name }} services are unreachable from
|
||||
the rest of the Internet. This includes the following
|
||||
situations:
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
{% blocktrans trimmed %}
|
||||
{{ box_name }} is behind a restricted firewall.
|
||||
{% endblocktrans %}
|
||||
</li>
|
||||
|
||||
<li>
|
||||
{% blocktrans trimmed %}
|
||||
{{ box_name }} is connected to a (wireless) router which you
|
||||
don't control.
|
||||
{% endblocktrans %}
|
||||
</li>
|
||||
|
||||
<li>
|
||||
{% blocktrans trimmed %}
|
||||
Your ISP does not provide you an external IP address and
|
||||
instead provides Internet connection through NAT.
|
||||
{% endblocktrans %}
|
||||
</li>
|
||||
|
||||
<li>
|
||||
{% blocktrans trimmed %}
|
||||
Your ISP does not provide you a static IP address and your IP
|
||||
address changes evertime you connect to Internet.
|
||||
{% endblocktrans %}
|
||||
</li>
|
||||
|
||||
<li>{% trans "Your ISP limits incoming connections." %}</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
PageKite works around NAT, firewalls and IP-address limitations
|
||||
by using a combination of tunnels and reverse proxies. You can
|
||||
use any pagekite service provider, for example
|
||||
<a href="https://pagekite.net">pagekite.net</a>. In future it
|
||||
might be possible to use your buddy's {{ box_name }} for this.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% block configuration %}
|
||||
|
||||
<p>
|
||||
<a class="btn btn-primary btn-md" href="{% url 'pagekite:configure' %}">
|
||||
|
||||
@ -18,18 +18,16 @@
|
||||
from django.core.urlresolvers import reverse, reverse_lazy
|
||||
from django.http.response import HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import View, TemplateView
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
from plinth import package
|
||||
from . import utils
|
||||
from .forms import ConfigurationForm, StandardServiceForm, \
|
||||
AddCustomServiceForm, DeleteCustomServiceForm
|
||||
from plinth.modules import pagekite
|
||||
|
||||
|
||||
required_packages = ('pagekite',)
|
||||
subsubmenu = [{'url': reverse_lazy('pagekite:index'),
|
||||
'text': _('About PageKite')},
|
||||
{'url': reverse_lazy('pagekite:configure'),
|
||||
@ -43,7 +41,8 @@ subsubmenu = [{'url': reverse_lazy('pagekite:index'),
|
||||
def index(request):
|
||||
"""Serve introduction page"""
|
||||
return TemplateResponse(request, 'pagekite_introduction.html',
|
||||
{'title': _('Public Visibility (PageKite)'),
|
||||
{'title': pagekite.title,
|
||||
'description': pagekite.description,
|
||||
'subsubmenu': subsubmenu})
|
||||
|
||||
|
||||
@ -59,7 +58,6 @@ class ContextMixin(object):
|
||||
context['subsubmenu'] = subsubmenu
|
||||
return context
|
||||
|
||||
@method_decorator(package.required(required_packages))
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(ContextMixin, self).dispatch(*args, **kwargs)
|
||||
|
||||
@ -81,8 +79,9 @@ class CustomServiceView(ContextMixin, TemplateView):
|
||||
unused, custom_services = utils.get_pagekite_services()
|
||||
for service in custom_services:
|
||||
service['form'] = AddCustomServiceForm(initial=service)
|
||||
context['custom_services'] = [utils.prepare_service_for_display(service)
|
||||
for service in custom_services]
|
||||
context['custom_services'] = [
|
||||
utils.prepare_service_for_display(service)
|
||||
for service in custom_services]
|
||||
context.update(utils.get_kite_details())
|
||||
return context
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user