summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEvgeny Sorokin <me@ch1p.io>2024-04-03 01:26:41 +0300
committerEvgeny Sorokin <me@ch1p.io>2024-04-03 01:26:41 +0300
commit8314dc42dc21185f556b4bb257ce198378d30d71 (patch)
treeab11a973c920f99063f55a58ed2affc397fd8945 /bin
parent63ff5dd151ca6a21dbae8a654d81cf60f2f6f0cc (diff)
web_kbn: relative paths
Diffstat (limited to 'bin')
-rwxr-xr-xbin/web_kbn.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/web_kbn.py b/bin/web_kbn.py
index 9629598..0439c94 100755
--- a/bin/web_kbn.py
+++ b/bin/web_kbn.py
@@ -248,7 +248,7 @@ async def render(req: web.Request,
@routes.get('/')
async def index0(req: web.Request):
- raise web.HTTPFound('/main.cgi')
+ raise web.HTTPFound('main.cgi')
@routes.get('/main.cgi')
@@ -256,7 +256,7 @@ async def index(req: web.Request):
tabs = ['zones', 'list']
tab = req.query.get('tab', None)
if tab and (tab not in tabs or tab == tabs[0]):
- raise web.HTTPFound('/main.cgi')
+ raise web.HTTPFound('main.cgi')
if tab is None:
tab = tabs[0]
@@ -284,7 +284,7 @@ async def modems(req: web.Request):
context=dict(modems=ModemsConfig()))
-@routes.get('/modems/info.ajx')
+@routes.get('/modems_info.ajx')
async def modems_ajx(req: web.Request):
mc = ModemsConfig()
modem = req.query.get('id', None)
@@ -303,7 +303,7 @@ async def modems_ajx(req: web.Request):
return http.ajax_ok({'html': html})
-@routes.get('/modems/verbose.cgi')
+@routes.get('/modems_verbose.cgi')
async def modems_verbose(req: web.Request):
modem = req.query.get('id', None)
if modem not in ModemsConfig().keys():
@@ -356,7 +356,7 @@ async def sms_post(req: web.Request):
phone = fd.get('phone', None)
text = fd.get('text', None)
- return_url = f'/sms.cgi?id={modem}&outbox={int(is_outbox)}'
+ return_url = f'sms.cgi?id={modem}&outbox={int(is_outbox)}'
phone = re.sub('\s+', '', phone)
if len(phone) > 4:
@@ -383,7 +383,7 @@ async def inverter(req: web.Request):
cl = get_inverter_client()
cl.exec('set-output-source-priority',
arguments=(val.upper(),))
- raise web.HTTPFound('/inverter.cgi')
+ raise web.HTTPFound('inverter.cgi')
status, rated, html = await asyncio.get_event_loop().run_in_executor(None, get_inverter_data)
return await render(req, 'inverter',
@@ -408,7 +408,7 @@ async def pump(req: web.Request):
action = req.query.get('set', None)
if action in ('on', 'off'):
getattr(cl, action)()
- raise web.HTTPFound('/pump.cgi')
+ raise web.HTTPFound('pump.cgi')
status = cl.status()
return await render(req, 'pump',
@@ -468,7 +468,7 @@ async def cams(req: web.Request):
))
-@routes.get('/routing/main.cgi')
+@routes.get('/routing_main.cgi')
async def routing_main(req: web.Request):
upstream = get_current_upstream()
@@ -479,7 +479,7 @@ async def routing_main(req: web.Request):
modem = mc[set_upstream_to]
new_upstream = str(modem['gateway_ip'] if 'gateway_ip' in modem else modem['ip'])
openwrt.set_upstream(new_upstream)
- raise web.HTTPFound('/routing/main.cgi')
+ raise web.HTTPFound('routing_main.cgi')
context = dict(
upstream=upstream,
@@ -489,7 +489,7 @@ async def routing_main(req: web.Request):
return await render(req, 'routing_main', title=lang('routing'), context=context)
-@routes.get('/routing/rules.cgi')
+@routes.get('/routing_rules.cgi')
async def routing_rules(req: web.Request):
mc = ModemsConfig()
@@ -520,7 +520,7 @@ async def routing_rules(req: web.Request):
if not validate_ipv4(ip_without_mask):
raise ValueError(f'invalid ip \'{ip}\'')
- base_url = '/routing/rules.cgi'
+ base_url = 'routing_rules.cgi'
if action in ('add', 'del'):
try:
validate_input()
@@ -544,7 +544,7 @@ async def routing_rules(req: web.Request):
context=context)
-@routes.get('/routing/dhcp.cgi')
+@routes.get('/routing_dhcp.cgi')
async def routing_dhcp(req: web.Request):
leases = openwrt.get_dhcp_leases()
return await render(req, 'routing_dhcp',