Fixed backup download

Renamed silly REST names to more meaningful ones
Fixed download icon to make it consistent with the rest of ntopng
This commit is contained in:
Luca Deri 2023-04-24 18:56:37 +02:00
parent 94d4f5c350
commit c856dd3b6f
4 changed files with 13 additions and 15 deletions

View file

@ -15,16 +15,16 @@ local backup_config = require("backup_config")
local download = _GET["download"]
local epoch = _GET["epoch"]
local succ, rsp = backup_config.export_backup(epoch)
local success, response = backup_config.export_backup(epoch)
if (not succ) then
if (not success) then
rest_utils.answer(rest_utils.consts.err.bad_content)
end
-- Download the file
if download then
sendHTTPContentTypeHeader('application/json', 'attachment; filename="configuration.json"')
print(rsp)
sendHTTPContentTypeHeader('application/json', 'attachment; filename="ntopng_backup_' .. epoch .. '.json"')
print(response)
else
rest_utils.answer(rest_utils.consts.success.ok, rsp)
end