05-sep: [parental] preparar API ASUSWRT
This commit is contained in:
@@ -115,6 +115,30 @@ def reservas():
|
||||
return f"<pre>{html.escape(output)}</pre>"
|
||||
|
||||
|
||||
def control_parental():
|
||||
try:
|
||||
from asus_api_control import parental_status
|
||||
return f"<pre>{html.escape(parental_status())}</pre>"
|
||||
except RuntimeError as exc:
|
||||
return f"<pre>{html.escape(str(exc))}</pre>"
|
||||
except Exception:
|
||||
pass
|
||||
keys = (
|
||||
"yadns_enable_x",
|
||||
"yadns_mode",
|
||||
"yadns_clientlist",
|
||||
"bwdpi_enable",
|
||||
"bwdpi_rulelist",
|
||||
"keyword_rulelist",
|
||||
"url_rulelist",
|
||||
"time_zone",
|
||||
)
|
||||
lines = []
|
||||
for key in keys:
|
||||
lines.append(f"{key}={_run(f'nvram get {key}')}")
|
||||
return f"<pre>{html.escape(chr(10).join(lines))}</pre>"
|
||||
|
||||
|
||||
def reiniciar():
|
||||
return _run("reboot")
|
||||
|
||||
@@ -128,5 +152,6 @@ if __name__ == "__main__":
|
||||
"inventario": inventario,
|
||||
"reservar": reservar_dhcp,
|
||||
"reservas": reservas,
|
||||
"parental": control_parental,
|
||||
}
|
||||
print(actions.get(action, estado)())
|
||||
|
||||
Reference in New Issue
Block a user