mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2025-01-31 02:51:42 +00:00
export queries
This commit is contained in:
parent
c24818388f
commit
56ee146ec9
1 changed files with 35 additions and 2 deletions
|
@ -710,13 +710,46 @@ local function extract_username()
|
||||||
return username
|
return username
|
||||||
end
|
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 path == "/" then
|
||||||
if query.about then
|
if query.about then
|
||||||
return r_about()
|
return r_about()
|
||||||
elseif query.products then
|
elseif query.products then
|
||||||
|
if query.export then
|
||||||
|
return r_export_products()
|
||||||
|
else
|
||||||
return r_products()
|
return r_products()
|
||||||
|
end
|
||||||
elseif query.log then
|
elseif query.log then
|
||||||
|
if query.export then
|
||||||
|
return r_export_log()
|
||||||
|
else
|
||||||
return r_log()
|
return r_log()
|
||||||
|
end
|
||||||
elseif query.create_user then
|
elseif query.create_user then
|
||||||
return r_create_user()
|
return r_create_user()
|
||||||
elseif query.spus then
|
elseif query.spus then
|
||||||
|
|
Loading…
Add table
Reference in a new issue