<%# 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 %>