From bb4a0df747092bdc0fac0baa0658bf1d314a9de8 Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Wed, 17 Aug 2011 18:03:43 +0200 Subject: Move source into src dir --- packages/torouter-web/__init__.py | 0 packages/torouter-web/config.py | 15 --- packages/torouter-web/runui.py | 35 ------ packages/torouter-web/src/__init__.py | 0 packages/torouter-web/src/config.py | 15 +++ packages/torouter-web/src/runui.py | 35 ++++++ packages/torouter-web/src/static/main.css | 37 ++++++ packages/torouter-web/src/tui/__init__.py | 0 .../torouter-web/src/tui/controllers/__init__.py | 0 packages/torouter-web/src/tui/controllers/main.py | 26 +++++ .../torouter-web/src/tui/controllers/network.py | 129 +++++++++++++++++++++ .../torouter-web/src/tui/controllers/old/main.py | 11 ++ .../torouter-web/src/tui/controllers/old/status.py | 9 ++ .../torouter-web/src/tui/controllers/old/wizard.py | 81 +++++++++++++ packages/torouter-web/src/tui/controllers/tor.py | 29 +++++ .../torouter-web/src/tui/models/router_config.py | 19 +++ packages/torouter-web/src/tui/utils/__init__.py | 0 .../torouter-web/src/tui/utils/configuration.py | 85 ++++++++++++++ packages/torouter-web/src/tui/utils/parsing.py | 83 +++++++++++++ packages/torouter-web/src/tui/utils/session.py | 26 +++++ packages/torouter-web/src/tui/views/base.html | 30 +++++ packages/torouter-web/src/tui/views/firewall.html | 7 ++ packages/torouter-web/src/tui/views/index.html | 1 + packages/torouter-web/src/tui/views/login.html | 7 ++ packages/torouter-web/src/tui/views/logout.html | 1 + packages/torouter-web/src/tui/views/main.html | 1 + packages/torouter-web/src/tui/views/saved.html | 8 ++ packages/torouter-web/src/tui/views/status.html | 3 + packages/torouter-web/src/tui/views/torconfig.html | 1 + packages/torouter-web/src/tui/views/torstatus.html | 1 + packages/torouter-web/src/tui/views/wired.html | 7 ++ packages/torouter-web/src/tui/views/wireless.html | 8 ++ packages/torouter-web/src/tui/views/wizard.html | 12 ++ packages/torouter-web/src/view.py | 11 ++ packages/torouter-web/static/main.css | 37 ------ packages/torouter-web/tui/__init__.py | 0 packages/torouter-web/tui/controllers/__init__.py | 0 packages/torouter-web/tui/controllers/main.py | 26 ----- packages/torouter-web/tui/controllers/network.py | 129 --------------------- packages/torouter-web/tui/controllers/old/main.py | 11 -- .../torouter-web/tui/controllers/old/status.py | 9 -- .../torouter-web/tui/controllers/old/wizard.py | 81 ------------- packages/torouter-web/tui/controllers/tor.py | 29 ----- packages/torouter-web/tui/models/router_config.py | 19 --- packages/torouter-web/tui/utils/__init__.py | 0 packages/torouter-web/tui/utils/configuration.py | 85 -------------- packages/torouter-web/tui/utils/parsing.py | 83 ------------- packages/torouter-web/tui/utils/session.py | 26 ----- packages/torouter-web/tui/views/base.html | 30 ----- packages/torouter-web/tui/views/firewall.html | 7 -- packages/torouter-web/tui/views/index.html | 1 - packages/torouter-web/tui/views/login.html | 7 -- packages/torouter-web/tui/views/logout.html | 1 - packages/torouter-web/tui/views/main.html | 1 - packages/torouter-web/tui/views/saved.html | 8 -- packages/torouter-web/tui/views/status.html | 3 - packages/torouter-web/tui/views/torconfig.html | 1 - packages/torouter-web/tui/views/torstatus.html | 1 - packages/torouter-web/tui/views/wired.html | 7 -- packages/torouter-web/tui/views/wireless.html | 8 -- packages/torouter-web/tui/views/wizard.html | 12 -- packages/torouter-web/view.py | 11 -- 62 files changed, 683 insertions(+), 683 deletions(-) delete mode 100644 packages/torouter-web/__init__.py delete mode 100644 packages/torouter-web/config.py delete mode 100644 packages/torouter-web/runui.py create mode 100644 packages/torouter-web/src/__init__.py create mode 100644 packages/torouter-web/src/config.py create mode 100644 packages/torouter-web/src/runui.py create mode 100644 packages/torouter-web/src/static/main.css create mode 100644 packages/torouter-web/src/tui/__init__.py create mode 100644 packages/torouter-web/src/tui/controllers/__init__.py create mode 100644 packages/torouter-web/src/tui/controllers/main.py create mode 100644 packages/torouter-web/src/tui/controllers/network.py create mode 100644 packages/torouter-web/src/tui/controllers/old/main.py create mode 100644 packages/torouter-web/src/tui/controllers/old/status.py create mode 100644 packages/torouter-web/src/tui/controllers/old/wizard.py create mode 100644 packages/torouter-web/src/tui/controllers/tor.py create mode 100644 packages/torouter-web/src/tui/models/router_config.py create mode 100644 packages/torouter-web/src/tui/utils/__init__.py create mode 100644 packages/torouter-web/src/tui/utils/configuration.py create mode 100644 packages/torouter-web/src/tui/utils/parsing.py create mode 100644 packages/torouter-web/src/tui/utils/session.py create mode 100644 packages/torouter-web/src/tui/views/base.html create mode 100644 packages/torouter-web/src/tui/views/firewall.html create mode 100644 packages/torouter-web/src/tui/views/index.html create mode 100644 packages/torouter-web/src/tui/views/login.html create mode 100644 packages/torouter-web/src/tui/views/logout.html create mode 100644 packages/torouter-web/src/tui/views/main.html create mode 100644 packages/torouter-web/src/tui/views/saved.html create mode 100644 packages/torouter-web/src/tui/views/status.html create mode 100644 packages/torouter-web/src/tui/views/torconfig.html create mode 100644 packages/torouter-web/src/tui/views/torstatus.html create mode 100644 packages/torouter-web/src/tui/views/wired.html create mode 100644 packages/torouter-web/src/tui/views/wireless.html create mode 100644 packages/torouter-web/src/tui/views/wizard.html create mode 100644 packages/torouter-web/src/view.py delete mode 100644 packages/torouter-web/static/main.css delete mode 100644 packages/torouter-web/tui/__init__.py delete mode 100644 packages/torouter-web/tui/controllers/__init__.py delete mode 100644 packages/torouter-web/tui/controllers/main.py delete mode 100644 packages/torouter-web/tui/controllers/network.py delete mode 100644 packages/torouter-web/tui/controllers/old/main.py delete mode 100644 packages/torouter-web/tui/controllers/old/status.py delete mode 100644 packages/torouter-web/tui/controllers/old/wizard.py delete mode 100644 packages/torouter-web/tui/controllers/tor.py delete mode 100644 packages/torouter-web/tui/models/router_config.py delete mode 100644 packages/torouter-web/tui/utils/__init__.py delete mode 100644 packages/torouter-web/tui/utils/configuration.py delete mode 100644 packages/torouter-web/tui/utils/parsing.py delete mode 100644 packages/torouter-web/tui/utils/session.py delete mode 100644 packages/torouter-web/tui/views/base.html delete mode 100644 packages/torouter-web/tui/views/firewall.html delete mode 100644 packages/torouter-web/tui/views/index.html delete mode 100644 packages/torouter-web/tui/views/login.html delete mode 100644 packages/torouter-web/tui/views/logout.html delete mode 100644 packages/torouter-web/tui/views/main.html delete mode 100644 packages/torouter-web/tui/views/saved.html delete mode 100644 packages/torouter-web/tui/views/status.html delete mode 100644 packages/torouter-web/tui/views/torconfig.html delete mode 100644 packages/torouter-web/tui/views/torstatus.html delete mode 100644 packages/torouter-web/tui/views/wired.html delete mode 100644 packages/torouter-web/tui/views/wireless.html delete mode 100644 packages/torouter-web/tui/views/wizard.html delete mode 100644 packages/torouter-web/view.py diff --git a/packages/torouter-web/__init__.py b/packages/torouter-web/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/packages/torouter-web/config.py b/packages/torouter-web/config.py deleted file mode 100644 index 8fd716d..0000000 --- a/packages/torouter-web/config.py +++ /dev/null @@ -1,15 +0,0 @@ -# tui, Tor web UI -# by Arturo Filasto' -# - -import web, os - -cache = False - -globals = {} - -# Add your own (username, password) pair -authinfo = ("test", "test") - -interfaces_file = os.getcwd() + "/../torouter-prep/configs/interfaces" - diff --git a/packages/torouter-web/runui.py b/packages/torouter-web/runui.py deleted file mode 100644 index 3d2dfc8..0000000 --- a/packages/torouter-web/runui.py +++ /dev/null @@ -1,35 +0,0 @@ -# tui - Tor web UI -# by Arturo Filasto' -# - -import web -import config -import tui.controllers - -from tui.utils import session -from view import render - - -# This is the main structure of URLs -urls = ( - '/', 'tui.controllers.main.index', -# '/config/(tor|router)', 'tui.controllers.main.config', - '/network', 'tui.controllers.network.main', - '/network/firewall', 'tui.controllers.network.firewall', - '/network/wireless', 'tui.controllers.network.wireless', - '/network/wired', 'tui.controllers.network.wired', - '/network/status', 'tui.controllers.network.status', - '/tor', 'tui.controllers.tor.status', - '/tor/config', 'tui.controllers.tor.config', - '/logout', 'tui.controllers.main.logout' - ) -# '/wizard/([0-9a-f]{1,2})?', 'tui.controllers.wizard.step', -# '/status', 'tui.controllers.status') - -if __name__ == "__main__": - app = web.application(urls, globals()) - # Add session management to the app - session.add_session_to_app(app) - app.internalerror = web.debugerror - app.run() - diff --git a/packages/torouter-web/src/__init__.py b/packages/torouter-web/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/torouter-web/src/config.py b/packages/torouter-web/src/config.py new file mode 100644 index 0000000..8fd716d --- /dev/null +++ b/packages/torouter-web/src/config.py @@ -0,0 +1,15 @@ +# tui, Tor web UI +# by Arturo Filasto' +# + +import web, os + +cache = False + +globals = {} + +# Add your own (username, password) pair +authinfo = ("test", "test") + +interfaces_file = os.getcwd() + "/../torouter-prep/configs/interfaces" + diff --git a/packages/torouter-web/src/runui.py b/packages/torouter-web/src/runui.py new file mode 100644 index 0000000..3d2dfc8 --- /dev/null +++ b/packages/torouter-web/src/runui.py @@ -0,0 +1,35 @@ +# tui - Tor web UI +# by Arturo Filasto' +# + +import web +import config +import tui.controllers + +from tui.utils import session +from view import render + + +# This is the main structure of URLs +urls = ( + '/', 'tui.controllers.main.index', +# '/config/(tor|router)', 'tui.controllers.main.config', + '/network', 'tui.controllers.network.main', + '/network/firewall', 'tui.controllers.network.firewall', + '/network/wireless', 'tui.controllers.network.wireless', + '/network/wired', 'tui.controllers.network.wired', + '/network/status', 'tui.controllers.network.status', + '/tor', 'tui.controllers.tor.status', + '/tor/config', 'tui.controllers.tor.config', + '/logout', 'tui.controllers.main.logout' + ) +# '/wizard/([0-9a-f]{1,2})?', 'tui.controllers.wizard.step', +# '/status', 'tui.controllers.status') + +if __name__ == "__main__": + app = web.application(urls, globals()) + # Add session management to the app + session.add_session_to_app(app) + app.internalerror = web.debugerror + app.run() + diff --git a/packages/torouter-web/src/static/main.css b/packages/torouter-web/src/static/main.css new file mode 100644 index 0000000..5626e92 --- /dev/null +++ b/packages/torouter-web/src/static/main.css @@ -0,0 +1,37 @@ + +/* Clear all */ +body { margin: 0;border: 0;padding: 0; } + +div.wrapper { + min-height: 300px; + width: 800px; + margin: 0 auto; +} + +div.footer { + text-align: center; + background-color: #333; + color: white; + padding-top: 20px; + padding-bottom: 20px; +} + +div.header { + color: white; +} + +div.header ul { + list-style: none; + height: 20px; +} + +div.header ul li { + font-size: 20px; + float: left; + padding: 5px 10px; +} + +div.header ul#submenu li { + font-size: 15px; +} + diff --git a/packages/torouter-web/src/tui/__init__.py b/packages/torouter-web/src/tui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/torouter-web/src/tui/controllers/__init__.py b/packages/torouter-web/src/tui/controllers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/torouter-web/src/tui/controllers/main.py b/packages/torouter-web/src/tui/controllers/main.py new file mode 100644 index 0000000..060caa6 --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/main.py @@ -0,0 +1,26 @@ +import web +import view, config +from view import render +from tui.utils import session + +""" +The main page for network configuration +""" +class index: + def GET(self): + if session.is_logged() > 0: + return render.base(render.index()) + else: + return render.base(render.login()) + + def POST(self): + if session.check_login(web.input()) == 0: + return render.base(render.index()) + else: + return render.base(render.login()) + +class logout: + def GET(self): + session.logout() + return render.base(render.logout()) + diff --git a/packages/torouter-web/src/tui/controllers/network.py b/packages/torouter-web/src/tui/controllers/network.py new file mode 100644 index 0000000..d189d0c --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/network.py @@ -0,0 +1,129 @@ +import web +import view, config +from view import render +from tui.utils import session,configuration,parsing + +""" +This function is used to generate the network +submenus. +""" +def menu(n): + a = [] + for i in range(0,5): + if i == n: + a.append("sel") + else: + a.append("") + print a + return """ +""" % tuple(a) + +""" +The main page for network configuration +""" +class main: + # XXX do all the backend stuff + def update_config(self, data): + return True + + def GET(self): + if session.is_logged() > 0: + return render.base(render.main(),menu(0)) + else: + return render.base(render.login()) + + def POST(self): + if session.is_logged() > 0: + self.update_config(web.input()) + return render.base(render.main(),menu(0)) + else: + return render.base(render.login()) + +""" +The firewall configuration page +""" +class firewall: + # XXX do all the backend stuff + def update_config(self, data): + return True + + def GET(self): + if session.is_logged() > 0: + return render.base(render.firewall(configuration.get_form("firewall")),menu(0)) + else: + return render.base(render.login()) + + def POST(self): + if session.is_logged() > 0: + self.update_config(web.input()) + return render.base(render.firewall(),menu(1)) + else: + return render.base(render.login()) + + + +""" +Wireless network configuration page +""" +class wireless: + # XXX do all the backend stuff + def update_config(self, data): + return True + + def GET(self): + if session.is_logged() > 0: + return render.base(render.wireless(configuration.get_form("wireless")),menu(2)) + else: + return render.base(render.login()) + + def POST(self): + if session.is_logged() > 0: + self.update_config(web.input()) + print web.input() + return render.base(render.saved(web.input()),menu(2)) + else: + return render.base(render.login()) + +""" +Wired network configuration page +""" +class wired: + # XXX do all the backend stuff + def update_config(self, data): + return True + + def GET(self): + if session.is_logged() > 0: + return render.base(render.wired(configuration.get_form("wired")),menu(3)) + else: + return render.base(render.login()) + + def POST(self): + if session.is_logged() > 0: + self.update_config(web.input()) + return render.base(render.wired(),menu(3)) + else: + return render.base(render.login()) + +""" +General status page, displays a bit more detail than main +""" +class status: + def GET(self): + itfc = parsing.interfaces(config.interfaces_file) + itfc.parse() + network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1) + return render.base(render.status(network),menu(4)) + + def POST(self): + itfc = parsing.interfaces(config.interfaces_file) + itfc.parse() + network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1) + return render.base(render.status(),menu(4)) + diff --git a/packages/torouter-web/src/tui/controllers/old/main.py b/packages/torouter-web/src/tui/controllers/old/main.py new file mode 100644 index 0000000..9127e72 --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/old/main.py @@ -0,0 +1,11 @@ +import web + + +class index: + def GET(self): + return "index" + +class config: + def GET(self): + return "config" + diff --git a/packages/torouter-web/src/tui/controllers/old/status.py b/packages/torouter-web/src/tui/controllers/old/status.py new file mode 100644 index 0000000..05f0bf8 --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/old/status.py @@ -0,0 +1,9 @@ +import web +import config + +from config import views +from web import form + +class status: + def GET(): + print "status" diff --git a/packages/torouter-web/src/tui/controllers/old/wizard.py b/packages/torouter-web/src/tui/controllers/old/wizard.py new file mode 100644 index 0000000..7b82df2 --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/old/wizard.py @@ -0,0 +1,81 @@ +import web + +from web import form +from config import view + +class step: + cur_step = 1 + next_step = 2 + wiztext = [] + wizform = [] + + wiztext.append("Tor Configuration") + wizform.append(form.Form( + form.Textbox('Nickname', + form.notnull, description="Relay Nickname"), + form.Textbox('RelayBandwidthRate', + form.notnull, description="Relay Bandwidth Rate"), + form.Textbox('RelayBandwidthBurst', + form.notnull, description="Relay Bandwidth Burst"), + form.Textbox('ContactInfo', + form.notnull, description="Contact Info"), + form.Textbox('ExitPolicy', + form.notnull, description="Exit Policy"), + form.Button('Next Step') + )) + + wiztext.append("Wireless setup") + wizform.append(form.Form( + form.Textbox('essid', + form.notnull, description="Wireless ESSID"), + form.Textbox('mac', + form.notnull, description="MAC address"), + form.Textbox('whatever', + form.notnull, description="Wireless ESSID"), + form.Button('Next Step') + )) + + wiztext.append("") + wizform.append(form.Form( + form.Textbox('essid', + form.notnull, description="Wireless ESSID"), + form.Textbox('mac', + form.notnull, description="MAC address"), + form.Textbox('whatever', + form.notnull, description="Wireless ESSID"), + form.Button('Next Step') + )) + + wiztext.append("") + wizform.append(form.Form( + form.Textbox('essid', + form.notnull, description="Wireless ESSID"), + form.Textbox('mac', + form.notnull, description="MAC address"), + form.Textbox('whatever', + form.notnull, description="Wireless ESSID"), + form.Button('Next Step') + )) + + def GET(self, step): + if step: + self.cur_step = int(step) + self.next_step = int(step) + 1 + else: + self.cur_step = 1 + self.next_step = 2 + if len(self.wizform) < int(self.cur_step): + return "Done!" + return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step) + + def POST(self, step): + x = web.input() + self.cur_step = int(step) + self.next_step = int(step) + 1 + if len(self.wizform) < int(self.cur_step): + return "Done!" + return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step) + + + + diff --git a/packages/torouter-web/src/tui/controllers/tor.py b/packages/torouter-web/src/tui/controllers/tor.py new file mode 100644 index 0000000..d07cb71 --- /dev/null +++ b/packages/torouter-web/src/tui/controllers/tor.py @@ -0,0 +1,29 @@ +import web +import view, config +from view import render +from tui.utils import session + +""" +The main Tor status page +""" +class status: + def GET(self): + return render.base(render.torstatus()) + + def POST(self): + return render.base(render.torstatus()) + +""" +Tor configuration page +""" +class config: + def update_config(self, data): + return True + + def GET(self): + return render.base(render.torconfig()) + + def POST(self): + self.update_config(web.input()) + return render.base(render.torconfig()) + diff --git a/packages/torouter-web/src/tui/models/router_config.py b/packages/torouter-web/src/tui/models/router_config.py new file mode 100644 index 0000000..e83f9aa --- /dev/null +++ b/packages/torouter-web/src/tui/models/router_config.py @@ -0,0 +1,19 @@ +import web +from config import db + +def new_config(conf): + db.insert('router_config', + essid=conf['essid'], + field1=conf['field1'], + field2=conf['field2'] + ) + + +def write_config(): + db.update('router_config', + essid=conf['essid'], + field1=conf['field1'], + field2=conf['field2'] + ) + + diff --git a/packages/torouter-web/src/tui/utils/__init__.py b/packages/torouter-web/src/tui/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/torouter-web/src/tui/utils/configuration.py b/packages/torouter-web/src/tui/utils/configuration.py new file mode 100644 index 0000000..88bbc05 --- /dev/null +++ b/packages/torouter-web/src/tui/utils/configuration.py @@ -0,0 +1,85 @@ +import web +import config + +def get(name): + conf = {} + # XXX The content of these functions are just + # skeletons + if name == "wireless": + conf['essid'] = "Torouter" + conf['encryption'] = "WPA2" + conf['key'] = "ljdasjkbcuBH12389Ba" + return conf + elif name == "firewall": + conf['el1'] = "Element 1" + conf['el2'] = "Element 2" + conf['el3'] = "Element 3" + return conf + elif name == "wired": + conf['el1'] = "Element 1" + conf['el2'] = "Element 2" + conf['el3'] = "Element 3" + return conf + elif name == "tor": + conf['el1'] = "Element 1" + conf['el2'] = "Element 2" + conf['el3'] = "Element 3" + return conf + +def write(name, data): + if name == "wireless": + return True + elif name == "firewall": + return True + elif name == "wired": + return True + elif name == "tor": + return True + +def get_form(name): + # Also these are just skeletons + if name == "wireless": + c = get(name) + return web.form.Form( + web.form.Textbox(name='essid', + description='Wireless ESSID', value=c['essid']), + web.form.Dropdown(name='enctype', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], + description='Wireless encryption scheme', value=c['encryption']), + web.form.Password(name='key', + description='key', value=c['key']), + web.form.Button('save') + ) + elif name == "firewall": + c = get(name) + return web.form.Form( + web.form.Textbox(name='el1', + description='The first element', value=c['el2']), + web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], + description='The second selement', value=c['el2']), + web.form.Password(name='el3', + description='The third element', value=c['el3']), + web.form.Button('save') + ) + elif name == "wired": + c = get(name) + return web.form.Form( + web.form.Textbox(name='el1', + description='The first element', value=c['el2']), + web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], + description='The second selement', value=c['el2']), + web.form.Password(name='el3', + description='The third element', value=c['el3']), + web.form.Button('save') + ) + elif name == "tor": + c = get(name) + return web.form.Form( + web.form.Textbox(name='el1', + description='The first element', value=c['el2']), + web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], + description='The second selement', value=c['el2']), + web.form.Password(name='el3', + description='The third element', value=c['el3']), + web.form.Button('save') + ) + diff --git a/packages/torouter-web/src/tui/utils/parsing.py b/packages/torouter-web/src/tui/utils/parsing.py new file mode 100644 index 0000000..e9ccc83 --- /dev/null +++ b/packages/torouter-web/src/tui/utils/parsing.py @@ -0,0 +1,83 @@ +# These functions are for parsing /etc/network/interface +# files, they will be used inside torouter to visualize +# and edit configuration +import os + +class interfaces: + def __init__(self,filename): + self.fp = open(filename, "r") + self.wifi = {} + self.eth1 = {} + self.eth0 = {} + + def parse_line(self, line, iface): + name = line.split(" ")[0] + values = " ".join(line.split(" ")[1:]).rstrip() + if iface == "uap0": + if self.wifi.has_key(name): + if type(self.wifi[name]) is list: + self.wifi[name].append(values) + else: + self.wifi[name] = [self.wifi[name],values] + else: + self.wifi.update({name : values}) + elif iface == "eth1": + if self.eth1.has_key(name): + if type(self.eth1[name]) is list: + self.eth1[name].append(values) + else: + self.eth1[name] = [self.eth1[name],values] + else: + self.eth1.update({name : values}) + elif iface == "eth0": + if self.eth0.has_key(name): + if type(self.eth0[name]) is list: + self.eth0[name].append(values) + else: + self.eth0[name] = [self.eth0[name],values] + else: + self.eth0.update({name : values}) + + def parse(self): + iface = None + for line in self.fp.readlines(): + line = line.lstrip() + if line.startswith("#") or line == "": + continue + if line.startswith("iface"): + iface = line.split(" ")[1] + if iface: + self.parse_line(line, iface) + + def html_output(self, data): + output = "

Interface %s

\n" % data['iface'].split(" ")[0] + output += "\n" % data['iface'].split(" ")[0] + + for item in data.items(): + if item[0] != "iface": + if type(item[1]) is list: + for i in item[1]: + output += "\n" % (item[0], i) + else: + output += "\n" % (item[0],item[1]) + output += "
%s%s
%s%s
" + print output + return output + + def output(self, data): + print "iface %s" % data['iface'] + for item in data.items(): + if item[0] != "iface": + if type(item[1]) is list: + for i in item[1]: + print "%s %s" % (item[0], i) + else: + print "%s %s" % (item[0],item[1]) + +#interfaces_file = os.getcwd() + "/../../../torouter-prep/configs/interfaces" +#itfc = interfaces(interfaces_file) +#itfc.parse() +#itfc.html_output(itfc.wifi) +#itfc.html_output(itfc.eth1) +#itfc.html_output(itfc.eth0) + diff --git a/packages/torouter-web/src/tui/utils/session.py b/packages/torouter-web/src/tui/utils/session.py new file mode 100644 index 0000000..a554dad --- /dev/null +++ b/packages/torouter-web/src/tui/utils/session.py @@ -0,0 +1,26 @@ +import web +import config + +# The main session class + +def add_session_to_app(app): + + if web.config.get("_session") is None: + store = web.session.DiskStore('sessions') + session = web.session.Session(app, store, initializer={'login': 0, 'privilege': 0}) + web.config._session = session + else: + session = web.config._session + +def is_logged(): + return web.config._session.login + +def check_login(data): + if (data.user == config.authinfo[0]) and (data.password == config.authinfo[1]): + web.config._session.login = 1 + return 0 + return 1 + +def logout(): + web.config._session.kill() + diff --git a/packages/torouter-web/src/tui/views/base.html b/packages/torouter-web/src/tui/views/base.html new file mode 100644 index 0000000..bce4110 --- /dev/null +++ b/packages/torouter-web/src/tui/views/base.html @@ -0,0 +1,30 @@ +$def with (page,submenu=None) + + + + + + TUI - Tor Web User Interface + + + +
+ + $:submenu +
+ +
+$:page +
+ + + + + diff --git a/packages/torouter-web/src/tui/views/firewall.html b/packages/torouter-web/src/tui/views/firewall.html new file mode 100644 index 0000000..30f5a9b --- /dev/null +++ b/packages/torouter-web/src/tui/views/firewall.html @@ -0,0 +1,7 @@ +$def with (form) + +

Firewall configuration page

+ +
+$:form.render() +
diff --git a/packages/torouter-web/src/tui/views/index.html b/packages/torouter-web/src/tui/views/index.html new file mode 100644 index 0000000..3907d84 --- /dev/null +++ b/packages/torouter-web/src/tui/views/index.html @@ -0,0 +1 @@ +The main index diff --git a/packages/torouter-web/src/tui/views/login.html b/packages/torouter-web/src/tui/views/login.html new file mode 100644 index 0000000..1377078 --- /dev/null +++ b/packages/torouter-web/src/tui/views/login.html @@ -0,0 +1,7 @@ +Login is required +
+ Login: + Password: + +
+ diff --git a/packages/torouter-web/src/tui/views/logout.html b/packages/torouter-web/src/tui/views/logout.html new file mode 100644 index 0000000..f027ed4 --- /dev/null +++ b/packages/torouter-web/src/tui/views/logout.html @@ -0,0 +1 @@ +Successfully logged out! diff --git a/packages/torouter-web/src/tui/views/main.html b/packages/torouter-web/src/tui/views/main.html new file mode 100644 index 0000000..dc503e7 --- /dev/null +++ b/packages/torouter-web/src/tui/views/main.html @@ -0,0 +1 @@ +the main page diff --git a/packages/torouter-web/src/tui/views/saved.html b/packages/torouter-web/src/tui/views/saved.html new file mode 100644 index 0000000..ba14488 --- /dev/null +++ b/packages/torouter-web/src/tui/views/saved.html @@ -0,0 +1,8 @@ +$def with (content) + +
    + +$for i in content.items(): +
  • $i[0]: $i[1]
  • + +
diff --git a/packages/torouter-web/src/tui/views/status.html b/packages/torouter-web/src/tui/views/status.html new file mode 100644 index 0000000..bfe2fcd --- /dev/null +++ b/packages/torouter-web/src/tui/views/status.html @@ -0,0 +1,3 @@ +$def with (content) + +$:content diff --git a/packages/torouter-web/src/tui/views/torconfig.html b/packages/torouter-web/src/tui/views/torconfig.html new file mode 100644 index 0000000..26bd228 --- /dev/null +++ b/packages/torouter-web/src/tui/views/torconfig.html @@ -0,0 +1 @@ +The main Tor config page diff --git a/packages/torouter-web/src/tui/views/torstatus.html b/packages/torouter-web/src/tui/views/torstatus.html new file mode 100644 index 0000000..ed83531 --- /dev/null +++ b/packages/torouter-web/src/tui/views/torstatus.html @@ -0,0 +1 @@ +The main Tor status page diff --git a/packages/torouter-web/src/tui/views/wired.html b/packages/torouter-web/src/tui/views/wired.html new file mode 100644 index 0000000..3676f63 --- /dev/null +++ b/packages/torouter-web/src/tui/views/wired.html @@ -0,0 +1,7 @@ +$def with (form) + +

Wired configuration page

+ +
+$:form.render() +
diff --git a/packages/torouter-web/src/tui/views/wireless.html b/packages/torouter-web/src/tui/views/wireless.html new file mode 100644 index 0000000..48242bc --- /dev/null +++ b/packages/torouter-web/src/tui/views/wireless.html @@ -0,0 +1,8 @@ +$def with (form) + +

Wireless configuration page

+ +
+$:form.render() +
+ diff --git a/packages/torouter-web/src/tui/views/wizard.html b/packages/torouter-web/src/tui/views/wizard.html new file mode 100644 index 0000000..0890507 --- /dev/null +++ b/packages/torouter-web/src/tui/views/wizard.html @@ -0,0 +1,12 @@ +$def with (wiz_form, text, step, next_step) + +

Step number $step

+ +$text + +
+$:wiz_form.render() + +
+ + diff --git a/packages/torouter-web/src/view.py b/packages/torouter-web/src/view.py new file mode 100644 index 0000000..f4c9b39 --- /dev/null +++ b/packages/torouter-web/src/view.py @@ -0,0 +1,11 @@ +import web +import config + +t_globals = dict( + datestr=web.datestr, + ) + +# create the render object +render = web.template.render('tui/views', cache=config.cache, globals=t_globals) +render._keywords['globals']['render'] = render + diff --git a/packages/torouter-web/static/main.css b/packages/torouter-web/static/main.css deleted file mode 100644 index 5626e92..0000000 --- a/packages/torouter-web/static/main.css +++ /dev/null @@ -1,37 +0,0 @@ - -/* Clear all */ -body { margin: 0;border: 0;padding: 0; } - -div.wrapper { - min-height: 300px; - width: 800px; - margin: 0 auto; -} - -div.footer { - text-align: center; - background-color: #333; - color: white; - padding-top: 20px; - padding-bottom: 20px; -} - -div.header { - color: white; -} - -div.header ul { - list-style: none; - height: 20px; -} - -div.header ul li { - font-size: 20px; - float: left; - padding: 5px 10px; -} - -div.header ul#submenu li { - font-size: 15px; -} - diff --git a/packages/torouter-web/tui/__init__.py b/packages/torouter-web/tui/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/packages/torouter-web/tui/controllers/__init__.py b/packages/torouter-web/tui/controllers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/packages/torouter-web/tui/controllers/main.py b/packages/torouter-web/tui/controllers/main.py deleted file mode 100644 index 060caa6..0000000 --- a/packages/torouter-web/tui/controllers/main.py +++ /dev/null @@ -1,26 +0,0 @@ -import web -import view, config -from view import render -from tui.utils import session - -""" -The main page for network configuration -""" -class index: - def GET(self): - if session.is_logged() > 0: - return render.base(render.index()) - else: - return render.base(render.login()) - - def POST(self): - if session.check_login(web.input()) == 0: - return render.base(render.index()) - else: - return render.base(render.login()) - -class logout: - def GET(self): - session.logout() - return render.base(render.logout()) - diff --git a/packages/torouter-web/tui/controllers/network.py b/packages/torouter-web/tui/controllers/network.py deleted file mode 100644 index d189d0c..0000000 --- a/packages/torouter-web/tui/controllers/network.py +++ /dev/null @@ -1,129 +0,0 @@ -import web -import view, config -from view import render -from tui.utils import session,configuration,parsing - -""" -This function is used to generate the network -submenus. -""" -def menu(n): - a = [] - for i in range(0,5): - if i == n: - a.append("sel") - else: - a.append("") - print a - return """ -""" % tuple(a) - -""" -The main page for network configuration -""" -class main: - # XXX do all the backend stuff - def update_config(self, data): - return True - - def GET(self): - if session.is_logged() > 0: - return render.base(render.main(),menu(0)) - else: - return render.base(render.login()) - - def POST(self): - if session.is_logged() > 0: - self.update_config(web.input()) - return render.base(render.main(),menu(0)) - else: - return render.base(render.login()) - -""" -The firewall configuration page -""" -class firewall: - # XXX do all the backend stuff - def update_config(self, data): - return True - - def GET(self): - if session.is_logged() > 0: - return render.base(render.firewall(configuration.get_form("firewall")),menu(0)) - else: - return render.base(render.login()) - - def POST(self): - if session.is_logged() > 0: - self.update_config(web.input()) - return render.base(render.firewall(),menu(1)) - else: - return render.base(render.login()) - - - -""" -Wireless network configuration page -""" -class wireless: - # XXX do all the backend stuff - def update_config(self, data): - return True - - def GET(self): - if session.is_logged() > 0: - return render.base(render.wireless(configuration.get_form("wireless")),menu(2)) - else: - return render.base(render.login()) - - def POST(self): - if session.is_logged() > 0: - self.update_config(web.input()) - print web.input() - return render.base(render.saved(web.input()),menu(2)) - else: - return render.base(render.login()) - -""" -Wired network configuration page -""" -class wired: - # XXX do all the backend stuff - def update_config(self, data): - return True - - def GET(self): - if session.is_logged() > 0: - return render.base(render.wired(configuration.get_form("wired")),menu(3)) - else: - return render.base(render.login()) - - def POST(self): - if session.is_logged() > 0: - self.update_config(web.input()) - return render.base(render.wired(),menu(3)) - else: - return render.base(render.login()) - -""" -General status page, displays a bit more detail than main -""" -class status: - def GET(self): - itfc = parsing.interfaces(config.interfaces_file) - itfc.parse() - network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1) - return render.base(render.status(network),menu(4)) - - def POST(self): - itfc = parsing.interfaces(config.interfaces_file) - itfc.parse() - network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1) - return render.base(render.status(),menu(4)) - diff --git a/packages/torouter-web/tui/controllers/old/main.py b/packages/torouter-web/tui/controllers/old/main.py deleted file mode 100644 index 9127e72..0000000 --- a/packages/torouter-web/tui/controllers/old/main.py +++ /dev/null @@ -1,11 +0,0 @@ -import web - - -class index: - def GET(self): - return "index" - -class config: - def GET(self): - return "config" - diff --git a/packages/torouter-web/tui/controllers/old/status.py b/packages/torouter-web/tui/controllers/old/status.py deleted file mode 100644 index 05f0bf8..0000000 --- a/packages/torouter-web/tui/controllers/old/status.py +++ /dev/null @@ -1,9 +0,0 @@ -import web -import config - -from config import views -from web import form - -class status: - def GET(): - print "status" diff --git a/packages/torouter-web/tui/controllers/old/wizard.py b/packages/torouter-web/tui/controllers/old/wizard.py deleted file mode 100644 index 7b82df2..0000000 --- a/packages/torouter-web/tui/controllers/old/wizard.py +++ /dev/null @@ -1,81 +0,0 @@ -import web - -from web import form -from config import view - -class step: - cur_step = 1 - next_step = 2 - wiztext = [] - wizform = [] - - wiztext.append("Tor Configuration") - wizform.append(form.Form( - form.Textbox('Nickname', - form.notnull, description="Relay Nickname"), - form.Textbox('RelayBandwidthRate', - form.notnull, description="Relay Bandwidth Rate"), - form.Textbox('RelayBandwidthBurst', - form.notnull, description="Relay Bandwidth Burst"), - form.Textbox('ContactInfo', - form.notnull, description="Contact Info"), - form.Textbox('ExitPolicy', - form.notnull, description="Exit Policy"), - form.Button('Next Step') - )) - - wiztext.append("Wireless setup") - wizform.append(form.Form( - form.Textbox('essid', - form.notnull, description="Wireless ESSID"), - form.Textbox('mac', - form.notnull, description="MAC address"), - form.Textbox('whatever', - form.notnull, description="Wireless ESSID"), - form.Button('Next Step') - )) - - wiztext.append("") - wizform.append(form.Form( - form.Textbox('essid', - form.notnull, description="Wireless ESSID"), - form.Textbox('mac', - form.notnull, description="MAC address"), - form.Textbox('whatever', - form.notnull, description="Wireless ESSID"), - form.Button('Next Step') - )) - - wiztext.append("") - wizform.append(form.Form( - form.Textbox('essid', - form.notnull, description="Wireless ESSID"), - form.Textbox('mac', - form.notnull, description="MAC address"), - form.Textbox('whatever', - form.notnull, description="Wireless ESSID"), - form.Button('Next Step') - )) - - def GET(self, step): - if step: - self.cur_step = int(step) - self.next_step = int(step) + 1 - else: - self.cur_step = 1 - self.next_step = 2 - if len(self.wizform) < int(self.cur_step): - return "Done!" - return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step) - - def POST(self, step): - x = web.input() - self.cur_step = int(step) - self.next_step = int(step) + 1 - if len(self.wizform) < int(self.cur_step): - return "Done!" - return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step) - - - - diff --git a/packages/torouter-web/tui/controllers/tor.py b/packages/torouter-web/tui/controllers/tor.py deleted file mode 100644 index d07cb71..0000000 --- a/packages/torouter-web/tui/controllers/tor.py +++ /dev/null @@ -1,29 +0,0 @@ -import web -import view, config -from view import render -from tui.utils import session - -""" -The main Tor status page -""" -class status: - def GET(self): - return render.base(render.torstatus()) - - def POST(self): - return render.base(render.torstatus()) - -""" -Tor configuration page -""" -class config: - def update_config(self, data): - return True - - def GET(self): - return render.base(render.torconfig()) - - def POST(self): - self.update_config(web.input()) - return render.base(render.torconfig()) - diff --git a/packages/torouter-web/tui/models/router_config.py b/packages/torouter-web/tui/models/router_config.py deleted file mode 100644 index e83f9aa..0000000 --- a/packages/torouter-web/tui/models/router_config.py +++ /dev/null @@ -1,19 +0,0 @@ -import web -from config import db - -def new_config(conf): - db.insert('router_config', - essid=conf['essid'], - field1=conf['field1'], - field2=conf['field2'] - ) - - -def write_config(): - db.update('router_config', - essid=conf['essid'], - field1=conf['field1'], - field2=conf['field2'] - ) - - diff --git a/packages/torouter-web/tui/utils/__init__.py b/packages/torouter-web/tui/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/packages/torouter-web/tui/utils/configuration.py b/packages/torouter-web/tui/utils/configuration.py deleted file mode 100644 index 88bbc05..0000000 --- a/packages/torouter-web/tui/utils/configuration.py +++ /dev/null @@ -1,85 +0,0 @@ -import web -import config - -def get(name): - conf = {} - # XXX The content of these functions are just - # skeletons - if name == "wireless": - conf['essid'] = "Torouter" - conf['encryption'] = "WPA2" - conf['key'] = "ljdasjkbcuBH12389Ba" - return conf - elif name == "firewall": - conf['el1'] = "Element 1" - conf['el2'] = "Element 2" - conf['el3'] = "Element 3" - return conf - elif name == "wired": - conf['el1'] = "Element 1" - conf['el2'] = "Element 2" - conf['el3'] = "Element 3" - return conf - elif name == "tor": - conf['el1'] = "Element 1" - conf['el2'] = "Element 2" - conf['el3'] = "Element 3" - return conf - -def write(name, data): - if name == "wireless": - return True - elif name == "firewall": - return True - elif name == "wired": - return True - elif name == "tor": - return True - -def get_form(name): - # Also these are just skeletons - if name == "wireless": - c = get(name) - return web.form.Form( - web.form.Textbox(name='essid', - description='Wireless ESSID', value=c['essid']), - web.form.Dropdown(name='enctype', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], - description='Wireless encryption scheme', value=c['encryption']), - web.form.Password(name='key', - description='key', value=c['key']), - web.form.Button('save') - ) - elif name == "firewall": - c = get(name) - return web.form.Form( - web.form.Textbox(name='el1', - description='The first element', value=c['el2']), - web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], - description='The second selement', value=c['el2']), - web.form.Password(name='el3', - description='The third element', value=c['el3']), - web.form.Button('save') - ) - elif name == "wired": - c = get(name) - return web.form.Form( - web.form.Textbox(name='el1', - description='The first element', value=c['el2']), - web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], - description='The second selement', value=c['el2']), - web.form.Password(name='el3', - description='The third element', value=c['el3']), - web.form.Button('save') - ) - elif name == "tor": - c = get(name) - return web.form.Form( - web.form.Textbox(name='el1', - description='The first element', value=c['el2']), - web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'], - description='The second selement', value=c['el2']), - web.form.Password(name='el3', - description='The third element', value=c['el3']), - web.form.Button('save') - ) - diff --git a/packages/torouter-web/tui/utils/parsing.py b/packages/torouter-web/tui/utils/parsing.py deleted file mode 100644 index e9ccc83..0000000 --- a/packages/torouter-web/tui/utils/parsing.py +++ /dev/null @@ -1,83 +0,0 @@ -# These functions are for parsing /etc/network/interface -# files, they will be used inside torouter to visualize -# and edit configuration -import os - -class interfaces: - def __init__(self,filename): - self.fp = open(filename, "r") - self.wifi = {} - self.eth1 = {} - self.eth0 = {} - - def parse_line(self, line, iface): - name = line.split(" ")[0] - values = " ".join(line.split(" ")[1:]).rstrip() - if iface == "uap0": - if self.wifi.has_key(name): - if type(self.wifi[name]) is list: - self.wifi[name].append(values) - else: - self.wifi[name] = [self.wifi[name],values] - else: - self.wifi.update({name : values}) - elif iface == "eth1": - if self.eth1.has_key(name): - if type(self.eth1[name]) is list: - self.eth1[name].append(values) - else: - self.eth1[name] = [self.eth1[name],values] - else: - self.eth1.update({name : values}) - elif iface == "eth0": - if self.eth0.has_key(name): - if type(self.eth0[name]) is list: - self.eth0[name].append(values) - else: - self.eth0[name] = [self.eth0[name],values] - else: - self.eth0.update({name : values}) - - def parse(self): - iface = None - for line in self.fp.readlines(): - line = line.lstrip() - if line.startswith("#") or line == "": - continue - if line.startswith("iface"): - iface = line.split(" ")[1] - if iface: - self.parse_line(line, iface) - - def html_output(self, data): - output = "

Interface %s

\n" % data['iface'].split(" ")[0] - output += "\n" % data['iface'].split(" ")[0] - - for item in data.items(): - if item[0] != "iface": - if type(item[1]) is list: - for i in item[1]: - output += "\n" % (item[0], i) - else: - output += "\n" % (item[0],item[1]) - output += "
%s%s
%s%s
" - print output - return output - - def output(self, data): - print "iface %s" % data['iface'] - for item in data.items(): - if item[0] != "iface": - if type(item[1]) is list: - for i in item[1]: - print "%s %s" % (item[0], i) - else: - print "%s %s" % (item[0],item[1]) - -#interfaces_file = os.getcwd() + "/../../../torouter-prep/configs/interfaces" -#itfc = interfaces(interfaces_file) -#itfc.parse() -#itfc.html_output(itfc.wifi) -#itfc.html_output(itfc.eth1) -#itfc.html_output(itfc.eth0) - diff --git a/packages/torouter-web/tui/utils/session.py b/packages/torouter-web/tui/utils/session.py deleted file mode 100644 index a554dad..0000000 --- a/packages/torouter-web/tui/utils/session.py +++ /dev/null @@ -1,26 +0,0 @@ -import web -import config - -# The main session class - -def add_session_to_app(app): - - if web.config.get("_session") is None: - store = web.session.DiskStore('sessions') - session = web.session.Session(app, store, initializer={'login': 0, 'privilege': 0}) - web.config._session = session - else: - session = web.config._session - -def is_logged(): - return web.config._session.login - -def check_login(data): - if (data.user == config.authinfo[0]) and (data.password == config.authinfo[1]): - web.config._session.login = 1 - return 0 - return 1 - -def logout(): - web.config._session.kill() - diff --git a/packages/torouter-web/tui/views/base.html b/packages/torouter-web/tui/views/base.html deleted file mode 100644 index bce4110..0000000 --- a/packages/torouter-web/tui/views/base.html +++ /dev/null @@ -1,30 +0,0 @@ -$def with (page,submenu=None) - - - - - - TUI - Tor Web User Interface - - - -
- - $:submenu -
- -
-$:page -
- - - - - diff --git a/packages/torouter-web/tui/views/firewall.html b/packages/torouter-web/tui/views/firewall.html deleted file mode 100644 index 30f5a9b..0000000 --- a/packages/torouter-web/tui/views/firewall.html +++ /dev/null @@ -1,7 +0,0 @@ -$def with (form) - -

Firewall configuration page

- -
-$:form.render() -
diff --git a/packages/torouter-web/tui/views/index.html b/packages/torouter-web/tui/views/index.html deleted file mode 100644 index 3907d84..0000000 --- a/packages/torouter-web/tui/views/index.html +++ /dev/null @@ -1 +0,0 @@ -The main index diff --git a/packages/torouter-web/tui/views/login.html b/packages/torouter-web/tui/views/login.html deleted file mode 100644 index 1377078..0000000 --- a/packages/torouter-web/tui/views/login.html +++ /dev/null @@ -1,7 +0,0 @@ -Login is required -
- Login: - Password: - -
- diff --git a/packages/torouter-web/tui/views/logout.html b/packages/torouter-web/tui/views/logout.html deleted file mode 100644 index f027ed4..0000000 --- a/packages/torouter-web/tui/views/logout.html +++ /dev/null @@ -1 +0,0 @@ -Successfully logged out! diff --git a/packages/torouter-web/tui/views/main.html b/packages/torouter-web/tui/views/main.html deleted file mode 100644 index dc503e7..0000000 --- a/packages/torouter-web/tui/views/main.html +++ /dev/null @@ -1 +0,0 @@ -the main page diff --git a/packages/torouter-web/tui/views/saved.html b/packages/torouter-web/tui/views/saved.html deleted file mode 100644 index ba14488..0000000 --- a/packages/torouter-web/tui/views/saved.html +++ /dev/null @@ -1,8 +0,0 @@ -$def with (content) - -
    - -$for i in content.items(): -
  • $i[0]: $i[1]
  • - -
diff --git a/packages/torouter-web/tui/views/status.html b/packages/torouter-web/tui/views/status.html deleted file mode 100644 index bfe2fcd..0000000 --- a/packages/torouter-web/tui/views/status.html +++ /dev/null @@ -1,3 +0,0 @@ -$def with (content) - -$:content diff --git a/packages/torouter-web/tui/views/torconfig.html b/packages/torouter-web/tui/views/torconfig.html deleted file mode 100644 index 26bd228..0000000 --- a/packages/torouter-web/tui/views/torconfig.html +++ /dev/null @@ -1 +0,0 @@ -The main Tor config page diff --git a/packages/torouter-web/tui/views/torstatus.html b/packages/torouter-web/tui/views/torstatus.html deleted file mode 100644 index ed83531..0000000 --- a/packages/torouter-web/tui/views/torstatus.html +++ /dev/null @@ -1 +0,0 @@ -The main Tor status page diff --git a/packages/torouter-web/tui/views/wired.html b/packages/torouter-web/tui/views/wired.html deleted file mode 100644 index 3676f63..0000000 --- a/packages/torouter-web/tui/views/wired.html +++ /dev/null @@ -1,7 +0,0 @@ -$def with (form) - -

Wired configuration page

- -
-$:form.render() -
diff --git a/packages/torouter-web/tui/views/wireless.html b/packages/torouter-web/tui/views/wireless.html deleted file mode 100644 index 48242bc..0000000 --- a/packages/torouter-web/tui/views/wireless.html +++ /dev/null @@ -1,8 +0,0 @@ -$def with (form) - -

Wireless configuration page

- -
-$:form.render() -
- diff --git a/packages/torouter-web/tui/views/wizard.html b/packages/torouter-web/tui/views/wizard.html deleted file mode 100644 index 0890507..0000000 --- a/packages/torouter-web/tui/views/wizard.html +++ /dev/null @@ -1,12 +0,0 @@ -$def with (wiz_form, text, step, next_step) - -

Step number $step

- -$text - -
-$:wiz_form.render() - -
- - diff --git a/packages/torouter-web/view.py b/packages/torouter-web/view.py deleted file mode 100644 index f4c9b39..0000000 --- a/packages/torouter-web/view.py +++ /dev/null @@ -1,11 +0,0 @@ -import web -import config - -t_globals = dict( - datestr=web.datestr, - ) - -# create the render object -render = web.template.render('tui/views', cache=config.cache, globals=t_globals) -render._keywords['globals']['render'] = render - -- cgit v1.2.3 From 4a148848c44279733c27de4e5a8f600ac5f2531e Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Wed, 17 Aug 2011 19:02:12 +0200 Subject: add basic setup.py for install target --- packages/torouter-web/setup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/torouter-web/setup.py diff --git a/packages/torouter-web/setup.py b/packages/torouter-web/setup.py new file mode 100644 index 0000000..d73e65f --- /dev/null +++ b/packages/torouter-web/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +from distutils.core import setup + +setup(name='torouter-tui', + packages=['tui'], + package_dir = {'tui': 'src/tui/'}, + package_data = {'tui': ['src/static']}, + version='0.1', + description='Torouter Web UI', + author='Arturo Filasto', + author_email='hellais@torproject.org', + url='https://www.torproject.org/', + scripts=['src/runui.py', 'src/view.py', 'src/config.py']) + -- cgit v1.2.3 From 702600566d00c495c418631cd64ee99839fea5a0 Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Wed, 17 Aug 2011 19:16:53 +0200 Subject: add basic install target with static files --- packages/torouter-web/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/torouter-web/setup.py b/packages/torouter-web/setup.py index d73e65f..7629b6b 100644 --- a/packages/torouter-web/setup.py +++ b/packages/torouter-web/setup.py @@ -4,7 +4,9 @@ from distutils.core import setup setup(name='torouter-tui', packages=['tui'], package_dir = {'tui': 'src/tui/'}, - package_data = {'tui': ['src/static']}, + package_data = {'tui': ['src/tui/']}, + data_files = [('/usr/share/torouter-tui/static', + ['src/static/main.css'])], version='0.1', description='Torouter Web UI', author='Arturo Filasto', -- cgit v1.2.3