Software / code / prosody
Comparison
plugins/mod_admin_shell.lua @ 13771:5f26164c738f
Merge 13.0->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 13 Mar 2025 11:41:32 +0000 |
| parent | 13770:a28349b8a387 |
| child | 13796:c8e534b4f2e2 |
comparison
equal
deleted
inserted
replaced
| 13766:b11242656300 | 13771:5f26164c738f |
|---|---|
| 90 end | 90 end |
| 91 | 91 |
| 92 -- Seed with default sections and their description text | 92 -- Seed with default sections and their description text |
| 93 help_topic "console" "Help regarding the console itself" [[ | 93 help_topic "console" "Help regarding the console itself" [[ |
| 94 Hey! Welcome to Prosody's admin console. | 94 Hey! Welcome to Prosody's admin console. |
| 95 First thing, if you're ever wondering how to get out, simply type 'quit'. | 95 If you're ever wondering how to get out, simply type 'quit' (ctrl+d should also |
| 96 Secondly, note that we don't support the full telnet protocol yet (it's coming) | 96 work). |
| 97 so you may have trouble using the arrow keys, etc. depending on your system. | |
| 98 | |
| 99 For now we offer a couple of handy shortcuts: | |
| 100 !! - Repeat the last command | |
| 101 !old!new! - repeat the last command, but with 'old' replaced by 'new' | |
| 102 | 97 |
| 103 For those well-versed in Prosody's internals, or taking instruction from those who are, | 98 For those well-versed in Prosody's internals, or taking instruction from those who are, |
| 104 you can prefix a command with > to escape the console sandbox, and access everything in | 99 you can prefix a command with > to escape the console sandbox, and access everything in |
| 105 the running server. Great fun, but be careful not to break anything :) | 100 the running server. Great fun, but be careful not to break anything :) |
| 106 ]]; | 101 ]]; |
| 345 session.width = (tonumber(event.stanza.attr.width) or default_width)-margin; | 340 session.width = (tonumber(event.stanza.attr.width) or default_width)-margin; |
| 346 | 341 |
| 347 local line = event.stanza:get_text(); | 342 local line = event.stanza:get_text(); |
| 348 local useglobalenv; | 343 local useglobalenv; |
| 349 | 344 |
| 345 session.repl = event.stanza.attr.repl ~= "0"; | |
| 346 | |
| 350 local result = st.stanza("repl-result"); | 347 local result = st.stanza("repl-result"); |
| 351 | 348 |
| 352 if line:match("^>") then | 349 if line:match("^>") then |
| 353 line = line:gsub("^>", ""); | 350 line = line:gsub("^>", ""); |
| 354 useglobalenv = true; | 351 useglobalenv = true; |
| 423 result.attr.type = "error"; | 420 result.attr.type = "error"; |
| 424 result:text("Sorry, I couldn't understand that... "..err); | 421 result:text("Sorry, I couldn't understand that... "..err); |
| 425 event.origin.send(result); | 422 event.origin.send(result); |
| 426 return; | 423 return; |
| 427 end | 424 end |
| 428 end | |
| 429 | |
| 430 if not source then | |
| 431 session.repl = true; | |
| 432 end | 425 end |
| 433 | 426 |
| 434 taskok, message = chunk(flags); | 427 taskok, message = chunk(flags); |
| 435 | 428 |
| 436 if promise.is_promise(taskok) then | 429 if promise.is_promise(taskok) then |