export balances

This commit is contained in:
metamuffin 2024-11-13 23:44:48 +01:00
parent e155282234
commit a429216639
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654

View file

@ -766,6 +766,14 @@ local function r_export_products()
print(l)
end
end
local function r_export_balances()
print("Status: 200")
print("Content-Type: text/csv")
print("")
for user, balance in pairs(balances()) do
print(string.format("%s,%d", user, balance))
end
end
if path == "/" then
if query.about then
@ -787,7 +795,11 @@ if path == "/" then
elseif query.spus then
return r_users(true)
elseif query.users then
if query.export then
return r_export_balances()
else
return r_users(false)
end
else
return r_users(false)
end