applications/olsr: change config file download on olsr overview page to use seperate v4 and v6 config files
This commit is contained in:
parent
0382c12140
commit
fe3e14a716
1 changed files with 24 additions and 17 deletions
|
@ -6,7 +6,9 @@
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4")
|
|
||||||
|
has_ipv4_conf = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion")
|
||||||
|
has_ipv6_conf = luci.model.uci.cursor():get_first("olsrd6", "olsrd", "IpVersion")
|
||||||
|
|
||||||
function write_conf(conf, file)
|
function write_conf(conf, file)
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
|
@ -19,23 +21,23 @@ end
|
||||||
|
|
||||||
conf = luci.http.formvalue()
|
conf = luci.http.formvalue()
|
||||||
|
|
||||||
if conf.openwrt then
|
if conf.openwrt_v4 then
|
||||||
write_conf("/etc/config/olsrd", "olsrd")
|
write_conf("/etc/config/olsrd", "olsrd")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if conf.openwrt_v6 then
|
||||||
|
write_conf("/etc/config/olsrd6", "olsrd6")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if conf.conf_v4 then
|
if conf.conf_v4 then
|
||||||
write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4")
|
write_conf("/var/etc/olsrd.conf", "olsrd.conf")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if conf.conf_v6 then
|
if conf.conf_v6 then
|
||||||
write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6")
|
write_conf("/var/etc/olsrd6.conf", "olsrd6.conf")
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
if conf.conf then
|
|
||||||
write_conf("/var/etc/olsrd.conf", "olsrd.conf")
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -200,12 +202,17 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { },
|
||||||
<span id="version">-<span>
|
<span id="version">-<span>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td width="33%"><%:Download Config%></td><td>
|
<tr><td width="33%"><%:Download Config%></td><td>
|
||||||
<a href="<%=REQUEST_URI%>?openwrt">OpenWrt</a>,
|
<% if has_ipv4_conf then %>
|
||||||
<% if ipv == "6and4" then %>
|
<a href="<%=REQUEST_URI%>?openwrt_v4">OpenWrt (IPv4)</a>,
|
||||||
<a href="<%=REQUEST_URI%>?conf_v4">OLSRD IPv4</a>,
|
<% end %>
|
||||||
<a href="<%=REQUEST_URI%>?conf_v6">OLSRD IPv6</a>
|
<% if has_ipv6_conf then %>
|
||||||
<% else %>
|
<a href="<%=REQUEST_URI%>?openwrt_v6">OpenWrt (IPv6)</a>,
|
||||||
<a href="<%=REQUEST_URI%>?conf">OLSRD</a>
|
<% end %>
|
||||||
|
<% if has_ipv4_conf then %>
|
||||||
|
<a href="<%=REQUEST_URI%>?conf_v4">OLSRD (IPv4)</a>,
|
||||||
|
<% end %>
|
||||||
|
<% if has_ipv6_conf then %>
|
||||||
|
<a href="<%=REQUEST_URI%>?conf_v6">OLSRD (IPv6)</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue