You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
803 B
31 lines
803 B
#!/usr/bin/env lua
|
|
|
|
local fcgi = require"fcgi"
|
|
apps = {
|
|
yqtemplate = require"yqtemplate"
|
|
}
|
|
|
|
while fcgi.accept() do
|
|
app = fcgi.getenv("DOCUMENT_URI"):sub(6)
|
|
appfn = apps[app]
|
|
if appfn then
|
|
appfn.run(fcgi)
|
|
else
|
|
fcgi.print"Content-Type: text/html; charset=utf-8\r\n\r\n"
|
|
fcgi.print[[<!DOCTYPE html>
|
|
<html>
|
|
<head><title>Annwan's CGI scripts</title></head>
|
|
<body>]]
|
|
if app and app ~= "" then
|
|
fcgi.print("<p>No such application application: <b>" .. app .. "</b></p̬>\n")
|
|
end
|
|
fcgi.print("<p>Available applications:</p><ul>")
|
|
for n, x in pairs(apps) do
|
|
fcgi.print("<li><b><a href=/cgi/" .. n .. ">" .. n .. "</a></b> " .. x.desc .. "</li>")
|
|
end
|
|
fcgi.print[[
|
|
</ul>
|
|
</body>
|
|
</html>]]
|
|
end
|
|
end
|