aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/controllers/tor.py
blob: af8678c62f09bff706f81d47e74eb36a733f4687 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import web
import view, config
from view import render
from tui.utils import session, parsing

"""
The main Tor status page
"""
class status:
  def GET(self):
    trc = parsing.torrc(config.torrc_file)
    trc.parse()
    output = trc.html_output()
    return render.base(render.torstatus(output,config.torrc_file))

  def POST(self):
    trc = parsing.torrc(config.torrc_file)
    trc.parse()
    output = trc.html_output()
    return render.base(render.torstatus(output,config.torrc_file))

"""
Tor configuration page
"""
class torrc:
  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())