mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Remove Router stubs
This commit is contained in:
parent
de250e5e63
commit
57487ab2d3
@ -38,10 +38,10 @@ class PageKite(PagePlugin):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
PagePlugin.__init__(self, *args, **kwargs)
|
PagePlugin.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
self.register_page("router.setup.pagekite")
|
self.register_page("router.pagekite")
|
||||||
cfg.html_root.router.setup.menu.add_item(
|
cfg.html_root.router.menu.add_item(
|
||||||
_("Public Visibility (PageKite)"), "icon-flag",
|
_("Public Visibility (PageKite)"), "icon-flag",
|
||||||
"/router/setup/pagekite", 50)
|
"/router/pagekite", 50)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -51,7 +51,7 @@ class PageKite(PagePlugin):
|
|||||||
del kwargs # Unused
|
del kwargs # Unused
|
||||||
|
|
||||||
menu = {'title': _('PageKite'),
|
menu = {'title': _('PageKite'),
|
||||||
'items': [{'url': '/router/setup/pagekite/configure',
|
'items': [{'url': '/router/pagekite/configure',
|
||||||
'text': _('Configure PageKite')}]}
|
'text': _('Configure PageKite')}]}
|
||||||
sidebar_right = util.render_template(template='menu_block', menu=menu)
|
sidebar_right = util.render_template(template='menu_block', menu=menu)
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class Configure(PagePlugin): # pylint: disable-msg=C0103
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
PagePlugin.__init__(self, *args, **kwargs)
|
PagePlugin.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
self.register_page("router.setup.pagekite.configure")
|
self.register_page("router.pagekite.configure")
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@require()
|
@require()
|
||||||
|
|||||||
@ -18,11 +18,6 @@ class Router(PagePlugin):
|
|||||||
|
|
||||||
self.menu = cfg.main_menu.add_item('Router', 'icon-retweet', '/router',
|
self.menu = cfg.main_menu.add_item('Router', 'icon-retweet', '/router',
|
||||||
10)
|
10)
|
||||||
self.menu.add_item('Wireless', 'icon-signal', '/router/wireless', 12)
|
|
||||||
self.menu.add_item('Firewall', 'icon-fire', '/router/firewall', 18)
|
|
||||||
self.menu.add_item('Hotspot and Mesh', 'icon-map-marker',
|
|
||||||
'/router/hotspot')
|
|
||||||
self.menu.add_item('Info', 'icon-list-alt', '/router/info', 100)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -31,120 +26,4 @@ class Router(PagePlugin):
|
|||||||
reflect that we've moved down into the submenu hierarchy.
|
reflect that we've moved down into the submenu hierarchy.
|
||||||
Otherwise, it's hard to know which menu portion to make active
|
Otherwise, it's hard to know which menu portion to make active
|
||||||
or expand or contract."""
|
or expand or contract."""
|
||||||
raise cherrypy.HTTPRedirect(cfg.server_dir + '/router/setup')
|
raise cherrypy.HTTPRedirect(cfg.server_dir + '/router/pagekite')
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def wireless():
|
|
||||||
"""Serve the wireless page"""
|
|
||||||
return util.render_template(title="Wireless",
|
|
||||||
main="<p>wireless setup: essid, etc.</p>")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def firewall():
|
|
||||||
"""Serve the firewall page"""
|
|
||||||
return util.render_template(title="Firewall",
|
|
||||||
main="<p>Iptables twiddling.</p>")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def hotspot():
|
|
||||||
"""Serve the hotspot page"""
|
|
||||||
return util.render_template(title="Hotspot and Mesh",
|
|
||||||
main="<p>connection sharing setup.</p>")
|
|
||||||
|
|
||||||
|
|
||||||
class WANForm(forms.Form): # pylint: disable-msg=W0232
|
|
||||||
"""WAN setup form"""
|
|
||||||
connection_type = forms.ChoiceField(
|
|
||||||
label=_('Connection Type'),
|
|
||||||
choices=[('dhcp', _('DHCP')), ('static_ip', _('Static IP'))])
|
|
||||||
|
|
||||||
wan_ip = forms.IPAddressField(label=_('WAN IP Address'), required=False)
|
|
||||||
|
|
||||||
subnet_mask = forms.IPAddressField(label=_('Subnet Mask'), required=False)
|
|
||||||
|
|
||||||
dns_1 = forms.IPAddressField(label=_('Static DNS 1'), required=False)
|
|
||||||
|
|
||||||
dns_2 = forms.IPAddressField(label=_('Static DNS 2'), required=False)
|
|
||||||
|
|
||||||
dns_3 = forms.IPAddressField(label=_('Static DNS 3'), required=False)
|
|
||||||
|
|
||||||
|
|
||||||
class Setup(PagePlugin):
|
|
||||||
"""Router setup page"""
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
PagePlugin.__init__(self, args, kwargs)
|
|
||||||
|
|
||||||
self.register_page('router.setup')
|
|
||||||
|
|
||||||
self.menu = cfg.html_root.router.menu.add_item(
|
|
||||||
'General Setup', 'icon-cog', '/router/setup', 10)
|
|
||||||
self.menu.add_item('Dynamic DNS', 'icon-flag', '/router/setup/ddns',
|
|
||||||
20)
|
|
||||||
self.menu.add_item('MAC Address Clone', 'icon-barcode',
|
|
||||||
'/router/setup/mac_address', 30)
|
|
||||||
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def index(self, **kwargs):
|
|
||||||
"""Return the setup page"""
|
|
||||||
status = self.get_status()
|
|
||||||
|
|
||||||
form = None
|
|
||||||
messages = []
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
form = WANForm(kwargs, prefix='router')
|
|
||||||
# pylint: disable-msg=E1101
|
|
||||||
if form.is_valid():
|
|
||||||
self._apply_changes(status, form.cleaned_data, messages)
|
|
||||||
status = self.get_status()
|
|
||||||
form = WANForm(initial=status, prefix='router')
|
|
||||||
else:
|
|
||||||
form = WANForm(initial=status, prefix='router')
|
|
||||||
|
|
||||||
return util.render_template(template='router_setup',
|
|
||||||
title=_('General Router Setup'),
|
|
||||||
form=form, messages=messages)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def ddns():
|
|
||||||
"""Return the DDNS page"""
|
|
||||||
return util.render_template(title="Dynamic DNS",
|
|
||||||
main="<p>Masquerade setup</p>")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def mac_address():
|
|
||||||
"""Return the MAC address page"""
|
|
||||||
return util.render_template(
|
|
||||||
title="MAC Address Cloning",
|
|
||||||
main="<p>Your router can pretend to have a different MAC address \
|
|
||||||
on any interface.</p>")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_status():
|
|
||||||
"""Return the current status"""
|
|
||||||
store = util.filedict_con(cfg.store_file, 'router')
|
|
||||||
return {'connection_type': store.get('connection_type', 'dhcp')}
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _apply_changes(old_status, new_status, messages):
|
|
||||||
"""Apply the changes"""
|
|
||||||
print 'Apply changes - %s, %s', old_status, new_status
|
|
||||||
if old_status['connection_type'] == new_status['connection_type']:
|
|
||||||
return
|
|
||||||
|
|
||||||
store = util.filedict_con(cfg.store_file, 'router')
|
|
||||||
store['connection_type'] = new_status['connection_type']
|
|
||||||
|
|
||||||
messages.append(('success', _('Connection type set')))
|
|
||||||
messages.append(('info', _('IP address settings unimplemented')))
|
|
||||||
|
|||||||
@ -1,117 +0,0 @@
|
|||||||
{% extends "login_nav.html" %}
|
|
||||||
{% comment %}
|
|
||||||
#
|
|
||||||
# This file is part of Plinth.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block main_block %}
|
|
||||||
|
|
||||||
{% if cfg.users.expert %}
|
|
||||||
|
|
||||||
<h3>WAN Connection</h3>
|
|
||||||
|
|
||||||
{% include 'messages.html' %}
|
|
||||||
|
|
||||||
<form class="form" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.connection_type %}
|
|
||||||
|
|
||||||
<div id="static_ip_form"
|
|
||||||
style='display:
|
|
||||||
{% if form.connection_type.value = 'static_ip' %} block
|
|
||||||
{% else %} none {% endif %};'>
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.wan_ip %}
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.subnet_mask %}
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.dns_1 %}
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.dns_2 %}
|
|
||||||
{% include 'bootstrapform/field.html' with field=form.dns_3 %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="submit" class="btn-primary" value="Set WAN"/>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
<p>In basic mode, you don't need to do any router setup before you
|
|
||||||
can go online. Just plug your {{ cfg.product_name }} in to your
|
|
||||||
cable or DSL modem and the router will try to get you on the
|
|
||||||
internet using DHCP.</p>
|
|
||||||
|
|
||||||
<p>If that fails, you might need to resort to the expert options.
|
|
||||||
Enable expert mode in the "{{ cfg.product_name }} / System /
|
|
||||||
Configure" menu.</p>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block sidebar_right_block %}
|
|
||||||
|
|
||||||
<div class="well sidebar-nav">
|
|
||||||
|
|
||||||
<h3>Introduction</h3>
|
|
||||||
|
|
||||||
<p>Your {{ cfg.box_name }} is a replacement for your wireless
|
|
||||||
router. By default, it should do everything your usual router
|
|
||||||
does. With the addition of some extra modules, its abilities
|
|
||||||
can rival those of high-end routers costing hundreds of
|
|
||||||
dollars.</p>
|
|
||||||
|
|
||||||
{% if cfg.users.expert %}
|
|
||||||
|
|
||||||
<h3>WAN Connection Type</h3>
|
|
||||||
|
|
||||||
<h3>DHCP</h3>
|
|
||||||
|
|
||||||
<p>DHCP allows your router to automatically connect with the
|
|
||||||
upstream network. If you are unsure what option to choose,
|
|
||||||
stick with DHCP. It is usually correct.</p>
|
|
||||||
|
|
||||||
<h3>Static IP</h3>
|
|
||||||
|
|
||||||
<p>If you want to setup your connection manually, you can enter
|
|
||||||
static IP information. This option is for those who know what
|
|
||||||
they're doing. As such, it is only available in expert
|
|
||||||
mode.</p>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_block %}
|
|
||||||
{{ js|safe }}
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function($) {
|
|
||||||
function hideshow_static() {
|
|
||||||
var value = $('#id_router-connection_type').val();
|
|
||||||
var show_or_hide = (value == 'static_ip');
|
|
||||||
$('#static_ip_form').toggle(show_or_hide);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#id_router-connection_type').change(hideshow_static);
|
|
||||||
hideshow_static();
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user