2018-04-07 20:13:33 +00:00
< %+header%>
2018-06-22 08:50:17 +00:00
< script type = "text/javascript" src = "<%=resource%>/cbi.js?v=git-18.170.32705-0f524f1" data-strings = "{"path":{"resource":"\/luci-static\/resources","browser":"\/cgi-bin\/luci\/admin\/filebrowser"},"label":{"choose":"-- Choisir --","custom":"-- autre --"}}" > < / script >
2018-04-07 20:13:33 +00:00
< %
local uci = require("luci.model.uci").cursor()
local hosts = uci:get_list("dhcp", uci:get_first("dhcp","dnsmasq"), "ipset")
2018-05-15 15:20:49 +00:00
local ips = uci:get_list("omr-bypass", "ips", "ip")
2018-06-22 08:50:17 +00:00
local dpi = uci:get_list("omr-bypass", "dpi", "proto")
local tmpfile = os.tmpname()
local dpi_available_proto = luci.util.execi("cat /proc/net/xt_ndpi/proto | awk '{print $3}' | sort -u | head -n -1")
2018-04-07 20:13:33 +00:00
%>
< % if stderr and #stderr > 0 then %>< pre class = "error" > < %=pcdata(stderr)%>< / pre > < % end %>
< form class = "inline" method = "post" action = "<%=url('admin/services/omr-bypass/add')%>" >
< div class = "cbi-map" >
< h2 name = "content" > < %:Bypass%>< / h2 >
< fieldset class = "cbi-section" id = "hosts" >
2018-06-14 13:38:31 +00:00
< div class = "cbi-section-descr" > < %:Set domains name, ips or networks you want to bypass.%>< / div >
2018-04-07 20:13:33 +00:00
< div class = "cbi-value cbi-value-last" id = "cbi-omr-tracker-hosts" data-depends = "[]" data-index = "<%=table.getn(hosts)%>" >
2018-05-15 15:20:49 +00:00
< label class = "cbi-value-title" for = "cbid.omr-tracker.hosts" > < %:Domain, IP or network%>< / label >
2018-04-07 20:13:33 +00:00
< div class = "cbi-value-field" >
< div data-prefix = "cbid.omr-bypass.hosts" data-browser-path = "" data-dynlist = "[[],[],null,false]" data-placeholder = "google.com" >
< %
local j = 1
for _ , host in pairs(hosts) do
j = j+1
for hst in string.gmatch(host,"([^/]*)/") do
if hst ~= "" then
%>
2018-06-22 08:50:17 +00:00
< input class = "cbi-input-text" value = "<%=hst%>" data-update = "change" type = "text" id = "cbid.omr-bypass.hosts.<%=j%>" name = "cbid.omr-bypass.hosts" placeholder = "google.com" / >
< br / >
< div class = "cbi-value-description" >
< span class = "cbi-value-helpicon" > < img src = "/luci-static/resources/cbi/help.gif" alt = "help" / > < / span >
< %:You need to use OpenMPTCProuter as DNS server when you want to bypass a domain%>
< / div >
2018-04-07 20:13:33 +00:00
< %
end
end
end
2018-05-15 15:20:49 +00:00
for _ , ip in pairs(ips) do
j = j+1
%>
< input class = "cbi-input-text" value = "<%=ip%>" data-update = "change" type = "text" id = "cbid.omr-bypass.hosts.<%=j%>" name = "cbid.omr-bypass.hosts" placeholder = "google.com" / > < br / >
< %
end
2018-04-07 20:13:33 +00:00
if j == 1 then
%>
2018-06-22 08:50:17 +00:00
< input class = "cbi-input-text" value = "" data-update = "change" type = "text" id = "cbid.omr-bypass.hosts.1" name = "cbid.omr-bypass.hosts" placeholder = "google.com" / >
< br / >
< div class = "cbi-value-description" >
< span class = "cbi-value-helpicon" > < img src = "/luci-static/resources/cbi/help.gif" alt = "help" / > < / span >
< %:You need to use OpenMPTCProuter as DNS server when you want to bypass a domain%>
< / div >
2018-04-07 20:13:33 +00:00
< %
end
%>
< / div >
< / div >
< / div >
< / fieldset >
2018-06-22 08:50:17 +00:00
< fieldset class = "cbi-section" id = "dpi" >
< div class = "cbi-section-descr" > < %:Set protocols you want to bypass.%>< / div >
< div class = "cbi-value cbi-value-last" id = "cbi-omr-tracker-dpi" data-depends = "[]" data-index = "<%=table.getn(dpi)%>" >
< label class = "cbi-value-title" for = "cbid.omr-tracker.dpi" > < %:Protocol%>< / label >
< div class = "cbi-value-field" >
< %
local allprt="" " "
for prt in dpi_available_proto do
allprt=allprt .. "," " .. prt .. "" "
end
%>
< div data-prefix = "cbid.omr-bypass.dpi" data-browser-path = "" data-dynlist = "[[<%=allprt%>],[<%=allprt%>],null,false]" >
< %
local k = 1
for _ , proto in pairs(dpi) do
k = k+1
%>
< input class = "cbi-input-text" id = "cbid.omr-bypass.dpi.<%=k%>" name = "cbid.omr-bypass.dpi" data-update = "change" value = "<%=proto%>" / > < br / >
< %
end
if k == 1 then
%>
< input class = "cbi-input-text" id = "cbid.omr-bypass.dpi.<%=k%>" name = "cbid.omr-bypass.dpi" data-update = "change" / > < br / >
< %
end
%>
< / div >
< / div >
< / div >
< / fieldset >
2018-04-07 20:13:33 +00:00
< / div >
< div class = "cbi-page-actions" >
< input type = "hidden" name = "token" value = "<%=token%>" / >
< button class = "btn" type = "submit" > Submit< / button >
< / div >
< / form >
< script type = "text/javascript" > cbi _init ( ) ; < / script >
< %+footer%>