diff --git a/script-api.py b/script-api.py index 854db9f..41dbcb6 100755 --- a/script-api.py +++ b/script-api.py @@ -1303,20 +1303,15 @@ def render_index(): cards = [] - - for command_id, command in CONFIG["commands"].items(): - if not command.get( "web_enabled", False ): - continue - title = html.escape( command.get( "web_title", @@ -1325,7 +1320,6 @@ def render_index(): ) - description = html.escape( command.get( "description", @@ -1334,146 +1328,69 @@ def render_index(): ) - cards.append( f""" +
+
+ action="/web/run/{command_id}"> + -

{title}

+
+{title} +
+ + +
+{description} +
-

{description}

+
+ +
""" ) - if not cards: cards.append( - "

No commands configured.

" + """ +
+Keine Befehle verfügbar. +
+""" ) - return render_page( - "Raspberry Pi Script API", + "IR Steuerung", + """ +
+""" + + "\n".join(cards) - - ) - - - - - -def render_result( - command_id, - result -): - - - body = f""" - -

- -Back - -

- - -

-{html.escape(command_id)} -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OK -{html.escape(str(result.get("ok")))} -
Exit Code -{html.escape(str(result.get("exit_code")))} -
Duration -{html.escape(str(result.get("duration_ms")))} -ms -
Request ID -{html.escape(str(result.get("request_id")))} -
- - -

-stdout -

- - -
-{html.escape(result.get("stdout",""))}
-
- - - -

-stderr -

- - -
-{html.escape(result.get("stderr",""))}
-
- + + + """ +
""" - - return render_page( - "Command Result", - body ) - - - def render_page( title, body @@ -1488,6 +1405,7 @@ def render_page( + {html.escape(title)} @@ -1499,111 +1417,305 @@ content="width=device-width, initial-scale=1"> @@ -1623,13 +1735,12 @@ padding: + """ - - # ============================================================ # Main # ============================================================