Browse Source

[Dispatch] Converted dispatch to HTML

main
Annwan 4 months ago
parent
commit
f53294bcdc
  1. 18
      main.lua

18
main.lua

@ -11,11 +11,21 @@ while fcgi.accept() do
if appfn then if appfn then
appfn.run(fcgi) appfn.run(fcgi)
else else
fcgi.print"Content-Type: text/plain; charset=utf-8\r\n\r\n"
fcgi.print("No such application application: `" .. app .. "'\n")
fcgi.print("Available applications:\n")
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 for n, x in pairs(apps) do
fcgi.print(" - " .. n .. ": " .. x.desc .. "\n")
fcgi.print("<li><b><a href=/cgi/" .. n .. ">" .. n .. "</a></b> " .. x.desc .. "</li>")
end end
fastcgi.print[[
</ul>
</body>
</html>]]
end end
end end
Loading…
Cancel
Save