17 lines
551 B
Python
17 lines
551 B
Python
#!/usr/bin/env python3
|
|
"""Check registered Flask routes in dashboard"""
|
|
import sys
|
|
sys.path.insert(0, "/opt/dashboard")
|
|
# Read the app.py source and exec it, but stop before app.run
|
|
src = open("/opt/dashboard/app.py").read()
|
|
# Find app.run and cut before it
|
|
idx = src.find("app.run(")
|
|
if idx > 0:
|
|
exec(compile(src[:idx], "app.py", "exec"))
|
|
else:
|
|
exec(compile(src, "app.py", "exec"))
|
|
|
|
for rule in sorted(app.url_map.iter_rules(), key=lambda r: str(r)):
|
|
if "tts" in str(rule) or "proxy" in str(rule):
|
|
print(f"{rule.methods} {rule}")
|