%#
Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI and Argon Template
luci-theme-argon
Copyright 2020 Jerryk
Have a bug? Please create an issue here on GitHub!
https://github.com/jerrykuku/luci-theme-argon/issues
luci-theme-bootstrap:
Copyright 2008 Steven Barth
Copyright 2008-2016 Jo-Philipp Wich
Copyright 2012 David Menting
MUI:
https://github.com/muicss/mui
Argon Theme
https://demos.creative-tim.com/argon-dashboard/index.html
Licensed to the public under the Apache License 2.0
-%>
<%+themes/argon/out_header_login%>
<%
local util = require "luci.util"
local boardinfo = util.ubus("system", "board")
local fs = require "nixio.fs"
local nutil = require "nixio.util"
function glob(...)
local iter, code, msg = fs.glob(...)
if iter then
return nutil.consume(iter)
else
return nil, code, msg
end
end
function getExtension(str)
return str:match(".+%.(%w+)$")
end
local bgcount = 0
local currentBg = {}
local bgs,attr = {}
local theme_dir = media .. "/background/"
for i, f in ipairs(glob("/www" .. theme_dir .. "*")) do
attr = fs.stat(f)
if attr then
local ext = getExtension(fs.basename(f))
if ext == "jpg" or ext == "png" or ext == "gif" or ext == "mp4" then
local bg = {}
bg.type = ext
bg.url = theme_dir .. fs.basename(f)
table.insert(bgs,bg)
bgcount = bgcount + 1
end
end
end
if bgcount > 0 then
currentBg = bgs[math.random(1,bgcount)]
end
%>
<% if (bgcount > 0 and currentBg.type == "mp4") then %>
<% else
local bg_url = media .. "/img/bg1.jpg"
local bing = "123"
if (bgcount == 0 ) then
local sys = require "luci.sys"
local json = require "luci.jsonc"
local remote_bg_url="http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"
--bing = sys.httpget(remote_bg_url)
bing = sys.exec("wget --timeout=0.5 -qO- '%s'" %remote_bg_url)
if (bing and bing ~= '') then
bg_url = "https://www.bing.com" .. json.parse(bing).images[1].url
end
elseif (bgcount > 0 and currentBg["type"] ~= "mp4") then
bg_url = currentBg.url
end
%>
<% end %>
<%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %>
<%
local uci = require "luci.model.uci".cursor()
local fs = require "nixio.fs"
local https_key = uci:get("uhttpd", "main", "key")
local https_port = uci:get("uhttpd", "main", "listen_https")
if type(https_port) == "table" then
https_port = https_port[1]
end
if https_port and fs.access(https_key) then
https_port = https_port:match("(%d+)$")
%>
<% end %>
<%+themes/argon/out_footer_login%>