Mercurial Hosting > luan
comparison src/luan/modules/http/tools/Shell.luan @ 1352:1604d7f36f3a
minor for nabble
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 10 Mar 2019 18:25:51 -0600 |
parents | d5739c101bd6 |
children | d9a5405a3102 |
comparison
equal
deleted
inserted
replaced
1351:21b153b4bcc4 | 1352:1604d7f36f3a |
---|---|
58 local function get_session(session_id) | 58 local function get_session(session_id) |
59 return Thread.global_callable("shell.session"..session_id,fns,timeout) | 59 return Thread.global_callable("shell.session"..session_id,fns,timeout) |
60 end | 60 end |
61 | 61 |
62 function Shell.respond() | 62 function Shell.respond() |
63 Io.stdout = Http.response.text_writer() | |
64 local cmd = Http.request.parameters.cmd | 63 local cmd = Http.request.parameters.cmd |
65 if cmd ~= nil then | 64 if cmd ~= nil then |
66 Http.response.headers["content-type"] = "application/javascript" | 65 Http.response.headers["content-type"] = "application/javascript" |
66 Io.stdout = Http.response.text_writer() | |
67 local session_id = Http.request.parameters.session or error() | 67 local session_id = Http.request.parameters.session or error() |
68 local session = get_session(session_id) | 68 local session = get_session(session_id) |
69 local rtn = pack( session.run(cmd) ) | 69 local rtn = pack( session.run(cmd) ) |
70 %> | 70 %> |
71 var pre = document.querySelector('pre'); | 71 var pre = document.querySelector('pre'); |
85 input.scrollIntoView(); | 85 input.scrollIntoView(); |
86 input.blur(); input.focus(); // because Chrome is retarded | 86 input.blur(); input.focus(); // because Chrome is retarded |
87 <% | 87 <% |
88 return | 88 return |
89 end | 89 end |
90 Io.stdout = Http.response.text_writer() | |
90 %> | 91 %> |
91 <!doctype html> | 92 <!doctype html> |
92 <html> | 93 <html> |
93 <head> | 94 <head> |
94 <title>Luan Shell</title> | 95 <title>Luan Shell</title> |