Mercurial Hosting > luan
comparison src/luan/modules/http/tools/Shell_mod.luan @ 1088:bae2d0c2576c
change module naming convention
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 26 Dec 2016 22:29:36 -0700 |
parents | e2eb55d86bb2 |
children | 21d157b153fe |
comparison
equal
deleted
inserted
replaced
1087:4aab4dd3ac9c | 1088:bae2d0c2576c |
---|---|
6 local Io = require "luan:Io.luan" | 6 local Io = require "luan:Io.luan" |
7 local print = Io.print or error() | 7 local print = Io.print or error() |
8 local Http = require "luan:http/Http.luan" | 8 local Http = require "luan:http/Http.luan" |
9 | 9 |
10 | 10 |
11 local M = {} | 11 local Shell_mod = {} |
12 | 12 |
13 local history = {} | 13 local history = {} |
14 M.env = {} | 14 Shell_mod.env = {} |
15 | 15 |
16 function M.respond() | 16 function Shell_mod.respond() |
17 if Http.request.parameter.clear ~= nil then | 17 if Http.request.parameter.clear ~= nil then |
18 Http.clear_session() | 18 Http.clear_session() |
19 Http.response.send_redirect(Http.request.path) -- reload page | 19 Http.response.send_redirect(Http.request.path) -- reload page |
20 return | 20 return |
21 else | 21 else |
31 try { | 31 try { |
32 function() | 32 function() |
33 local line | 33 local line |
34 try { | 34 try { |
35 function() | 35 function() |
36 line = load("return "..cmd,"<web_shell>",M.env) | 36 line = load("return "..cmd,"<web_shell>",Shell_mod.env) |
37 end | 37 end |
38 catch = function(e) | 38 catch = function(e) |
39 line = load(cmd,"<web_shell>",M.env) | 39 line = load(cmd,"<web_shell>",Shell_mod.env) |
40 end | 40 end |
41 } | 41 } |
42 print( line() ) | 42 print( line() ) |
43 end | 43 end |
44 catch = function(e) | 44 catch = function(e) |
101 </body> | 101 </body> |
102 </html> | 102 </html> |
103 <% | 103 <% |
104 end | 104 end |
105 | 105 |
106 Http.per_session(M.respond) | 106 Http.per_session(Shell_mod.respond) |
107 | 107 |
108 return M | 108 return Shell_mod |