Cleanup Locale system, remove legacy Locale API, add command help handling, misc

This commit is contained in:
2024-08-07 02:27:17 +02:00
parent 6a1a21027c
commit c9895a4bed
37 changed files with 314 additions and 297 deletions

4
ModWinDog/System/System.py Normal file → Executable file
View File

@ -15,7 +15,7 @@ from re import compile as re_compile
def cExec(context:EventContext, data:InputMessageData) -> None:
if not (len(data.command.tokens) >= 2 and data.command.tokens[1].lower() in ExecAllowed):
return SendMessage(context, {"Text": choice(Locale.__('eval'))})
return SendMessage(context, {"Text": "This feature is not implemented [Security Issue]."})
command = data.command.tokens[1].lower()
output = subprocess.run(
("sh", "-c", f"export PATH=$PATH:/usr/games; {command}"),
@ -26,6 +26,6 @@ def cExec(context:EventContext, data:InputMessageData) -> None:
text_plain=text, text_html=f"<pre>{html_escape(text)}</pre>"))
RegisterModule(name="System", endpoints=[
SafeNamespace(names=["exec"], handler=cExec),
SafeNamespace(names=["exec"], handler=cExec, body=True),
])