1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00
Ycarus (Yannick Chabanois) 2021-01-16 08:14:51 +01:00
parent 36351e8548
commit 027c4e7c49

View file

@ -36,14 +36,16 @@ function create_helper_text()
end
function get_provider_name(value)
for filename in fs.dir(providers_dir) do
local p_func = loadfile(providers_dir .. filename)
setfenv(p_func, { _ = i18n.translate })
local p = p_func()
value = value:gsub('[%p%c%s]', '')
p.url_match = p.resolver_url:gsub('[%p%c%s]', '')
if value:match(p.url_match) then
return p.label
if value ~= nil then
for filename in fs.dir(providers_dir) do
local p_func = loadfile(providers_dir .. filename)
setfenv(p_func, { _ = i18n.translate })
local p = p_func()
value = value:gsub('[%p%c%s]', '')
p.url_match = p.resolver_url:gsub('[%p%c%s]', '')
if value:match(p.url_match) then
return p.label
end
end
end
return translate("Unknown Provider")