mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Reworked blacklists page
This commit is contained in:
parent
cd425b384d
commit
0fecdee1e4
19 changed files with 829 additions and 21 deletions
39
scripts/lua/rest/v2/edit/system/edit_blacklist.lua
Normal file
39
scripts/lua/rest/v2/edit/system/edit_blacklist.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
--
|
||||
-- (C) 2013-24 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "ntop_utils"
|
||||
require "http_lint"
|
||||
local rest_utils = require "rest_utils"
|
||||
local lists_utils = require "lists_utils"
|
||||
|
||||
local enabled = _POST["list_enabled"]
|
||||
local list_name = _POST["list_name"]
|
||||
local category = tonumber(_POST["category"])
|
||||
local url = _POST["url"]
|
||||
local list_update = tonumber(_POST["list_update"])
|
||||
|
||||
if enabled == "on" then
|
||||
enabled = true
|
||||
else
|
||||
enabled = false
|
||||
end
|
||||
if isEmptyString(enabled) or isEmptyString(list_name) or isEmptyString(category) or isEmptyString(url) or
|
||||
isEmptyString(list_update) then
|
||||
rest_utils.answer(rest_utils.consts.err.bad_content)
|
||||
return
|
||||
end
|
||||
|
||||
url = string.gsub(url, "http:__", "http://")
|
||||
url = string.gsub(url, "https:__", "https://")
|
||||
|
||||
lists_utils.editList(list_name, {
|
||||
enabled = enabled,
|
||||
category = nil,
|
||||
url = url,
|
||||
update_interval = list_update
|
||||
})
|
||||
|
||||
rest_utils.answer(rest_utils.consts.success.ok)
|
||||
Loading…
Add table
Add a link
Reference in a new issue