mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Dead code
This commit is contained in:
parent
925301d20a
commit
9f1c6dd846
2 changed files with 0 additions and 82 deletions
|
|
@ -1,36 +0,0 @@
|
|||
--
|
||||
-- (C) 2013-22 - ntop.org
|
||||
--
|
||||
|
||||
--
|
||||
-- JSON POST example
|
||||
--
|
||||
-- curl -X POST -H "Content-Type: application/json" -d @req.json http://localhost:3000/lua/jsontest.lua
|
||||
--
|
||||
-- Put in req.json a valid JSON
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "lua_utils"
|
||||
json = require("dkjson")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
-- print(_POST["JSON"])
|
||||
|
||||
local info, pos, err = json.decode(_POST["JSON"], 1, nil)
|
||||
|
||||
print(info.responseId.."\n")
|
||||
|
||||
|
||||
rsp = {}
|
||||
rsp.info = "sdasdasdas"
|
||||
rsp.req = {}
|
||||
rsp.req.luca = "deri"
|
||||
|
||||
local js = json.encode(rsp)
|
||||
|
||||
print(js.."\n")
|
||||
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
--
|
||||
-- (C) 2020 - ntop.org
|
||||
--
|
||||
|
||||
--
|
||||
-- This is the main widget entrypoint that renders all widgets
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require ("lua_utils")
|
||||
|
||||
local dkjson = require("dkjson")
|
||||
local datasources_utils = require("datasources_utils")
|
||||
local widgets_utils = require("widgets_utils")
|
||||
|
||||
local function reportError(msg)
|
||||
print(dkjson.encode({ success = false, message = msg }))
|
||||
end
|
||||
|
||||
-- ###############################################
|
||||
|
||||
local json = _GET["JSON"]
|
||||
|
||||
local widget_data = {}
|
||||
|
||||
if (json ~= nil) then
|
||||
widget_data = dkjson.decode(json)
|
||||
end
|
||||
|
||||
sendHTTPContentTypeHeader('application/json')
|
||||
|
||||
if (widget_data.widget_key == nil) then
|
||||
reportError("Missing widget_key parameter")
|
||||
return
|
||||
end
|
||||
|
||||
local widget = widgets_utils.get_widget(widget_data.widget_key)
|
||||
if (widget == nil) then
|
||||
reportError("The requested widget was not found")
|
||||
return
|
||||
end
|
||||
|
||||
widget.type = widget_data.widget_type or widget.type
|
||||
-- Generate the widget response
|
||||
print(widgets_utils.generate_response(widget, widget_data))
|
||||
Loading…
Add table
Add a link
Reference in a new issue