From ced83335a5a338cb9c24956b96da526465d94df8 Mon Sep 17 00:00:00 2001 From: ficus Date: Sat, 15 Sep 2012 22:50:14 +0200 Subject: refactor to distributable format --- templates/base.html | 75 ------------------------------------------ templates/home.html | 71 ---------------------------------------- templates/lan.html | 32 ------------------ templates/lib.html | 84 ------------------------------------------------ templates/logs.html | 9 ------ templates/processes.html | 28 ---------------- templates/reboot.html | 22 ------------- templates/tor.html | 19 ----------- templates/wan.html | 35 -------------------- templates/wifi.html | 38 ---------------------- 10 files changed, 413 deletions(-) delete mode 100644 templates/base.html delete mode 100644 templates/home.html delete mode 100644 templates/lan.html delete mode 100644 templates/lib.html delete mode 100644 templates/logs.html delete mode 100644 templates/processes.html delete mode 100644 templates/reboot.html delete mode 100644 templates/tor.html delete mode 100644 templates/wan.html delete mode 100644 templates/wifi.html (limited to 'templates') diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 4c15c73..0000000 --- a/templates/base.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - torouter configuration interface - - - - - - - -
-
-
- -
-
- {% if messages %} - {{ mesages }} - {% for category, message in messages %} -
- - {% if category == "warning" %}Warning:{% endif %} - {% if category == "error" %}Error:{% endif %} - {% if category == "info" %}Note:{% endif %} - {{ message }} -
- {% endfor %} - {% endif %} -{% block body %}{% endblock %} -
-
-
-
-

© torouter, copyleft 2012

-
-
- - - diff --git a/templates/home.html b/templates/home.html deleted file mode 100644 index fa2ed2b..0000000 --- a/templates/home.html +++ /dev/null @@ -1,71 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - - -
-
-

System

- - - - -
Host Name - {{ status.system.hostname }} -
Current Time - {{ status.system.current_time }} -
System Uptime - {{ status.system.uptime }} -
-
-
-

Resources

-
    -
  • - CPU Load{{status.resources.cpu_load}} / {{status.resources.cpu_cores}} cores -
    -
    -
    -
  • -
  • RAM Usage{{status.resources.ram_used}} / {{status.resources.ram_avail}} -
    -
    -
    -
  • -
  • Primary Disk Space{{status.resources.disk_used}} / {{status.resources.disk_avail}} -
    -
    -
    -
  • -
-
-
-
-
-

WAN

- {{ lib.ifstatus(status.wan) }} -
-
-

LAN

- {{ lib.ifstatus(status.lan) }} -
-
-
-
-

WiFi

- {{ lib.ifstatus(status.wifi) }} -
-
-

Tor

- - -
Status - - {{ status.tor.state }} - -
-
-
- -{% endblock %} diff --git a/templates/lan.html b/templates/lan.html deleted file mode 100644 index 09bcf0a..0000000 --- a/templates/lan.html +++ /dev/null @@ -1,32 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - -
-Local Ethernet Configuration - -{% if not status.lan %} -Could not find the local ethernet hardware device! -{% else %} - -{{ lib.formcheckbox(form, formerr, 'ipv4enable', 'Enable this interface', 'true') }} - -Address Configuration -{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }} -{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.0.0') }} -{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }} - -DHCP Configuration -{{ lib.forminput(form, formerr, 'dhcpbase', 'DHCP Range Base', '192.168.1.100') }} -{{ lib.forminput(form, formerr, 'dhcptop', 'DHCP Range Top', '192.168.1.200') }} -{{ lib.forminput(form, formerr, 'dhcptime', 'Lease Time', '12h') }} - -
- - -
-
-{% endif %} - -{% endblock %} diff --git a/templates/lib.html b/templates/lib.html deleted file mode 100644 index 6ac5e12..0000000 --- a/templates/lib.html +++ /dev/null @@ -1,84 +0,0 @@ - - -{% macro ifstatus(ifstatus) -%} -{% if not ifstatus %} - -Network hardware not detected at all! - -{% else %} - - - - - - - - - - -
Interface Name - {{ ifstatus.ifname }} -
Status - - {{ ifstatus.state }} - -
MAC Address - {{ ifstatus.mac }} -
IPv4 Addresses - - {% for addr in ifstatus.ipv4addrs %} - {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})
- {% endfor %}
-
IPv6 Addresses - - {% for addr in ifstatus.ipv6addrs %} - {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})
- {% endfor %}
- {% if ifstatus.radio_state %} -
Radio State - {{ ifstatus.radio_state }} -
SSID - {{ ifstatus.ssid }} -
Frequency - {{ ifstatus.freq }} -
Signal Strength - {{ ifstatus.signal_dbm }} - {% endif %} -
-{% endif %} -{%- endmacro %} - - -{% macro logbox(name, contents) -%} -

{{name}}

-{% if contents == None %} -Access to {{name}} was denied, or file did not exist. -{% else %} -
-
-{{ contents }}
-
-
-{% endif%} -{%- endmacro %} - - -{% macro forminput(form, formerr, name, title, placeholder) -%} -
- -
- - {% if formerr[name] %} - {{ formerr[name] }} - {% endif %} -
-
-{%- endmacro %} - -{% macro formcheckbox(form, formerr, name, title, value) -%} - -{% endmacro %} diff --git a/templates/logs.html b/templates/logs.html deleted file mode 100644 index c5ea52a..0000000 --- a/templates/logs.html +++ /dev/null @@ -1,9 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - -{{ lib.logbox("dmesg", logs.dmesg) }} -{{ lib.logbox("auth.log", logs.authlog) }} -{{ lib.logbox("syslog", logs.syslog) }} - -{% endblock %} diff --git a/templates/processes.html b/templates/processes.html deleted file mode 100644 index 2e35162..0000000 --- a/templates/processes.html +++ /dev/null @@ -1,28 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} -

System Running Process List

- - - -
User - PID - %CPU - %MEM - Status - Started - Time - Command -{% for proc in process_list %} -
{{ proc.user }} - {{ proc.pid}} - {{ proc.perc_cpu }} - {{ proc.perc_mem }} - {{ proc.status_code }} - {{ proc.started }} - {{ proc.time }} -
{{ proc.command }}
-{% endfor %} -
- -{% endblock %} diff --git a/templates/reboot.html b/templates/reboot.html deleted file mode 100644 index b9f0c54..0000000 --- a/templates/reboot.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "base.html" %} -{% block body %} -

System Reboot

- -{% if status == 'rebooting' %} - -Rebooting! This interface will stop working in a few seconds, check back in a -minute or two... - -{% else %} -
-Are you sure you'd like to restart? This could have reprecussions! -
- - -
-{% endif %} - -{% endblock %} diff --git a/templates/tor.html b/templates/tor.html deleted file mode 100644 index a1f30dc..0000000 --- a/templates/tor.html +++ /dev/null @@ -1,19 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - -
-Tor Network Configuration - -{{ lib.formcheckbox(form, formerr, 'torenable', 'Enable Tor daemon', 'true') }} -{{ lib.formcheckbox(form, formerr, 'torrelayenable', 'Enable Tor Relay', 'true') }} -{{ lib.formcheckbox(form, formerr, 'torbridgeenable', 'Enable Tor Bridge', 'true') }} - -
- - -
-
- -{% endblock %} diff --git a/templates/wan.html b/templates/wan.html deleted file mode 100644 index 2da2733..0000000 --- a/templates/wan.html +++ /dev/null @@ -1,35 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - -
-Upstream Ethernet Configuration - - - - - -{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }} -{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.255.0') }} -{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }} - - - -
- - -
-
- - -{% endblock %} diff --git a/templates/wifi.html b/templates/wifi.html deleted file mode 100644 index 3e41788..0000000 --- a/templates/wifi.html +++ /dev/null @@ -1,38 +0,0 @@ -{% import "lib.html" as lib %} -{% extends "base.html" %} -{% block body %} - -
-WiFi Configuration - -{% if not status.wifi %} -Could not find the WiFi hardware device! -{% else %} - -{{ lib.formcheckbox(form, formerr, 'wifienable', 'Enable the radio', 'true') }} -{{ lib.formcheckbox(form, formerr, 'torifylanenable', 'Transparently "Tor-ify" this network interface', 'true') }} - -Radio -{{ lib.forminput(form, formerr, 'wifissid', 'SSID name', 'internet') }} -{{ lib.forminput(form, formerr, 'wifipower', 'Transmit Power', 'high, low') }} -{{ lib.forminput(form, formerr, 'wifichannel', 'Channel', '11') }} - -Network Address -{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }} -{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.0.0') }} -{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }} - -DHCP Server -{{ lib.forminput(form, formerr, 'dhcpbase', 'DHCP Range Base', '192.168.1.100') }} -{{ lib.forminput(form, formerr, 'dhcptop', 'DHCP Range Top', '192.168.1.200') }} -{{ lib.forminput(form, formerr, 'dhcptime', 'Lease Time', '12h') }} - -
- - -
-
-{% endif %} - -{% endblock %} -- cgit v1.2.3