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.
65 lines
1.9 KiB
65 lines
1.9 KiB
local etlua = require "etlua"
|
|
local utils = require "utils"
|
|
|
|
local yqtemplateform = utils.readfile("yqform.etlua")
|
|
|
|
local form = etlua.compile(yqtemplateform)
|
|
--- @type [table]
|
|
local classes = {
|
|
{ n = "Beast", f = "c01.beast.png" },
|
|
{ n = "Swordsman", f = "c02.swordsman.png" },
|
|
{ n = "Spirit Bird", f = "c03.spirit-bird.png" },
|
|
{ n = "Twin Blades", f = "c04.twin-blades.png" },
|
|
{ n = "Healer", f = "c05.healer.png" },
|
|
{ n = "Summoner", f = "c06.summoner.png" },
|
|
{ n = "Tamer", f = "c07.tamer.png" },
|
|
{ n = "Pugilist", f = "c08.pugilist.png" },
|
|
{ n = "Mounted Fighter", f = "c09.mounted-fighter.png" },
|
|
{ n = "Fruit Animal", f = "c10.fruit-animal.png" },
|
|
{ n = "Spellcaster", f = "c11.spellcaster.png" }
|
|
}
|
|
|
|
return {
|
|
desc = "Creates Yokoka’s quest-style personal status page",
|
|
run = function(fcgi)
|
|
fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n")
|
|
local data = ""
|
|
local args = nil
|
|
if fcgi.getenv("REQUEST_METHOD") == "POST" then
|
|
args = {}
|
|
local content_type = fcgi.getenv("CONTENT_TYPE")
|
|
local boundary = content_type:match("; boundary=(.*)$")
|
|
local post_data = fcgi.post()
|
|
data = "Content type:" .. content_type .. "\n Boundary: " .. boundary .. "\n"
|
|
|
|
for w in string.gmatch(post_data, "(.-)" .. boundary) do
|
|
local name, dtype, value = utils.parse_form_entry(w)
|
|
args[name] = { t = dtype, v = value }
|
|
end
|
|
for k, v in pairs(args) do
|
|
data = data .. k .. ": "
|
|
if v.t then
|
|
data = data .. "[FILE:" .. v.t .. "]\n"
|
|
else
|
|
data = data .. v.v .. "\n"
|
|
end
|
|
end
|
|
end
|
|
fcgi.print(
|
|
form {
|
|
encoder = require "base64".encode,
|
|
readfile = utils.readfile,
|
|
args = args,
|
|
classes = classes
|
|
elements = {
|
|
"Fire", "Water", "Earth", "Air",
|
|
"Wood", "Electricity", "Metals", "Dreams",
|
|
"Light", "Darkness", "Sun", "Moon",
|
|
"Smoke", "Ice", "Crystal", "Sound",
|
|
"Poison", "Lightning", "Weapons", "Fortune",
|
|
"Healing", "Curses", "Day", "Night"
|
|
}
|
|
}
|
|
)
|
|
end
|
|
}
|