mirror of https://github.com/aredn/aredn.git
Allow user to force certain macs to be accepted
This commit is contained in:
parent
c57d384ca6
commit
28f25cf951
|
@ -64,7 +64,8 @@ function get_config()
|
|||
min_quality = tonumber(c:get("aredn", "@lqm[0]", "min_quality")),
|
||||
margin_quality = tonumber(c:get("aredn", "@lqm[0]", "margin_quality")),
|
||||
ping_penalty = tonumber(c:get("aredn", "@lqm[0]", "ping_penalty")),
|
||||
user_blocks = c:get("aredn", "@lqm[0]", "user_blocks") or ""
|
||||
user_blocks = c:get("aredn", "@lqm[0]", "user_blocks") or "",
|
||||
user_allows = c:get("aredn", "@lqm[0]", "user_allows") or ""
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -87,7 +88,9 @@ function is_pending(track)
|
|||
end
|
||||
|
||||
function should_block(track)
|
||||
if is_pending(track) then
|
||||
if track.user_allow then
|
||||
return false
|
||||
elseif is_pending(track) then
|
||||
return track.blocks.dtd or track.blocks.user
|
||||
else
|
||||
return track.blocks.dtd or track.blocks.signal or track.blocks.distance or track.blocks.user or track.blocks.dup or track.blocks.quality
|
||||
|
@ -635,6 +638,16 @@ function lqm()
|
|||
track.blocks.quality = false
|
||||
end
|
||||
end
|
||||
|
||||
-- Always allow if user requested it
|
||||
track.user_allow = false;
|
||||
for val in string.gmatch(config.user_allows, "([^,]+)")
|
||||
do
|
||||
if val:gsub("%s+", ""):gsub("-", ":"):upper() == track.mac then
|
||||
track.user_allow = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Eliminate link pairs, where we might have links to multiple radios at the same site
|
||||
|
|
|
@ -335,7 +335,15 @@ local settings = {
|
|||
desc = "Comma separated list of blocked MACs",
|
||||
default = "",
|
||||
condition = "lqm_enabled()"
|
||||
}
|
||||
},
|
||||
{
|
||||
category = "Link Quality",
|
||||
key = "aredn.@lqm[0].user_allows",
|
||||
type = "string",
|
||||
desc = "Comma separated list of always allowed MACs",
|
||||
default = "",
|
||||
condition = "lqm_enabled()"
|
||||
}
|
||||
}
|
||||
|
||||
local msgs = {}
|
||||
|
|
|
@ -177,7 +177,8 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"lqm=1") then
|
|||
min_quality = tonumber(ctx:get("aredn", "@lqm[0]", "min_quality")),
|
||||
margin_quality = tonumber(ctx:get("aredn", "@lqm[0]", "margin_quality")),
|
||||
ping_penalty = tonumber(ctx:get("aredn", "@lqm[0]", "ping_penalty")),
|
||||
user_blocks = ctx:get("aredn", "@lqm[0]", "user_blocks") or {}
|
||||
user_blocks = ctx:get("aredn", "@lqm[0]", "user_blocks"),
|
||||
user_allows = ctx:get("aredn", "@lqm[0]", "user_allows")
|
||||
}
|
||||
lqm.info = {}
|
||||
if nixio.fs.stat("/tmp/lqm.info") then
|
||||
|
|
Loading…
Reference in New Issue