<%# Argonne is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI and Argonne Template luci-theme-argonne Copyright 2021 kenzo Have a bug? Please create an issue here on GitHub! https://github.com/jerrykuku/luci-theme-argonne/issues luci-theme-bootstrap: Copyright 2008 Steven Barth Copyright 2008-2016 Jo-Philipp Wich Copyright 2012 David Menting MUI: https://github.com/muicss/mui Agron Theme https://demos.creative-tim.com/argonne-dashboard/index.html Licensed to the public under the Apache License 2.0 -%> <%+header_login%> <% local util = require "luci.util" local boardinfo = util.ubus("system", "board") local fs = require "nixio.fs" local nutil = require "nixio.util" local uci = require 'luci.model.uci'.cursor() local theme_dir = media .. "/background/" 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 function fetchMedia(path) local bgArr = {} local numBg = 0 for i, f in ipairs(glob(path)) 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(bgArr,bg) numBg = numBg + 1 end end end return bgArr,numBg end local bgcount = 0 local currentBg = {} local bgs = {} local theme_dir = media .. "/background/" local bing_background = fs.access('/etc/config/argonne') and uci:get_first('argonne', 'global', 'bing_background') or "0" bgs,bgcount=fetchMedia("/www" .. theme_dir .. "*") %>