mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Removed merge errors in user_scripts.lua
This commit is contained in:
commit
51956c4167
5 changed files with 93 additions and 21 deletions
|
|
@ -159,6 +159,26 @@ local available_subdirs = {
|
|||
return not not flow.getFlowInfoField():find(val)
|
||||
end
|
||||
}
|
||||
l7_cat = {
|
||||
lint = http_lint.validateCategory,
|
||||
match = function(context, val)
|
||||
-- If val is the application name, then it is converted to application id
|
||||
if not tonumber(val) then val = interface.getnDPICategoryId(val) end
|
||||
-- For integers represented as strings
|
||||
val = tonumber(val)
|
||||
-- Check for equality on either the master or application ids
|
||||
return flow.getnDPICategoryId() == val
|
||||
end
|
||||
},
|
||||
dns_last_query = {
|
||||
lint = http_lint.validateSingleWord,
|
||||
match = function(context, val)
|
||||
-- Check for equality on either the master or application ids
|
||||
return flow.getDnsQuery() == val
|
||||
end
|
||||
},
|
||||
|
||||
-- info = http_lint.validateUnquoted,
|
||||
},
|
||||
},
|
||||
-- No pools for flows
|
||||
|
|
@ -1240,6 +1260,7 @@ function user_scripts.updateScriptConfig(confid, script_key, subdir, new_config,
|
|||
|
||||
if not filter_conf["filter"]["current_filters"] then
|
||||
filter_conf["filter"]["current_filters"] = {}
|
||||
filter_conf["filter"]["current_filters"] = (user_scripts.getDefaultFilters(interface.getId(), subdir, script_key))["current_filters"] or {}
|
||||
end
|
||||
|
||||
if table.len(additional_filters) == 0 then
|
||||
|
|
@ -1871,4 +1892,20 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function user_scripts.getDefaultFilters(ifid, subdir, script_key)
|
||||
|
||||
local script_type = user_scripts.getScriptType(subdir)
|
||||
local script = user_scripts.loadModule(ifid, script_type, subdir, script_key)
|
||||
local filters = {}
|
||||
filters["current_filters"] = {}
|
||||
|
||||
if script["filter"] and script["filter"]["default_filters"] then
|
||||
filters["current_filters"] = script["filter"]["default_filters"]
|
||||
end
|
||||
|
||||
return filters
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
return(user_scripts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue