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.

26 lines
812 B

  1. local etlua = require "etlua"
  2. local utils = require "utils"
  3. local yqtemplateform = utils.readfile("yqform.etlua")
  4. local form = etlua.compile(yqtemplateform)
  5. return {
  6. desc = "Creates Yokoka’s quest-style personal status page",
  7. run = function(fcgi)
  8. fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n")
  9. local data = ""
  10. if fcgi.getenv("REQUEST_METHOD") == "POST" then
  11. local content_type = fcgi.getenv("CONTENT_TYPE")
  12. local boundary = content_type:match("; boundary=(.*)$")
  13. local post_data = fcgi.post()
  14. data = "Content type:" .. content_type .. "\n Boundary: "..boundary.."\n"
  15. local args = {}
  16. for w in string.gmatch(post_data, "(.-)"..boundary) do
  17. args[#args+1] = w
  18. end
  19. data = table.concat(args, "\n\n")
  20. end
  21. fcgi.print(form{data = data})
  22. end
  23. }