<%# Copyright 2008 Steven Barth Copyright 2008-2016 Jo-Philipp Wich Copyright 2012 David Menting Licensed to the public under the Apache License 2.0. -%> <% local sys = require "luci.sys" local util = require "luci.util" local http = require "luci.http" local disp = require "luci.dispatcher" local boardinfo = util.ubus("system", "board") local node = disp.context.dispatched -- send as HTML5 http.prepare_content("text/html") -- Get current and latest OMR version local current_omr_version = luci.model.uci.cursor():get("openmptcprouter","settings","version") or "" local latest_omr_version = luci.model.uci.cursor():get("openmptcprouter","latest_versions","omr") or "" -- Numeric per dotted component of the release part ("0.64.10" of -- "0.64.10-6.18"): a string compare put 0.64.10 before 0.64.9. local function omr_version_newer(cur, new) local a, b = {}, {} for n in (cur:match("^v?([%d%.]+)") or ""):gmatch("%d+") do a[#a + 1] = tonumber(n) end for n in (new:match("^v?([%d%.]+)") or ""):gmatch("%d+") do b[#b + 1] = tonumber(n) end if #a == 0 or #b == 0 then return false end for i = 1, math.max(#a, #b) do local x, y = a[i] or 0, b[i] or 0 if x ~= y then return y > x end end return false end -%> <%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI <% if node and node.css then %> <% end -%> <% if css then %> <% end -%> ">
<%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>

<%:No password set!%>

<%:There is no password set on this router. Please configure a root password to protect the web interface.%>

<% if disp.lookup("admin/system/admin") then %> <% end %>
<%- end -%> <%- if omr_version_newer(current_omr_version, latest_omr_version) then -%>

<%=translatef("You have OpenMPTCProuter version %s and version %s is now available",pcdata(current_omr_version),pcdata(latest_omr_version))%>

<%- end -%>