export queries

This commit is contained in:
metamuffin 2024-11-13 21:33:22 +01:00
parent c24818388f
commit 56ee146ec9
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654

View file

@ -710,13 +710,46 @@ local function extract_username()
return username
end
local function r_export_log()
local log = io.open("log", "r")
if log == nil then
return function() return nil end
end
print("Status: 200")
print("Content-Type: text/csv")
print("")
for l in log:lines("l") do
print(l)
end
end
local function r_export_products()
local log = io.open("products", "r")
if log == nil then
return function() return nil end
end
print("Status: 200")
print("Content-Type: text/csv")
print("")
for l in log:lines("l") do
print(l)
end
end
if path == "/" then
if query.about then
return r_about()
elseif query.products then
return r_products()
if query.export then
return r_export_products()
else
return r_products()
end
elseif query.log then
return r_log()
if query.export then
return r_export_log()
else
return r_log()
end
elseif query.create_user then
return r_create_user()
elseif query.spus then