<%# Copyright (C) 2019-2024 The Sirpdboy Team luci-theme-material: Copyright 2015 Lutty Yang luci-theme-bootstrap: Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2012 David Menting MUI: https://github.com/muicss/mui Licensed to the public under the Apache License 2.0 -%> <% local ver = require "luci.version" local sys = require "luci.sys" local util = require "luci.util" local http = require "luci.http" local disp = require "luci.dispatcher" local json = require "luci.jsonc" local fs = require "nixio.fs" local nutil = require "nixio.util" local uci = require 'luci.model.uci'.cursor() local urlencode = luci.http.protocol and luci.http.protocol.urlencode or luci.util.urlencode local boardinfo = util.ubus("system", "board") or { } local node = disp.context.dispatched local path = table.concat(disp.context.path, "-") 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 urlencode(str:match(".+%.(%w+)$")) end http.prepare_content("text/html; charset=UTF-8") local dark_css = fs.readfile('/www/luci-static/kucat/css/dark.css') local bar='/cgi-bin/luci/admin/' local bk_use='background: rgba(var(--primary-rgbbody),1)' local loginbk_use = 'background: linear-gradient(0deg, rgba(var(--primary-rgbm), 1) 0%, rgba(var(--primary-rgbbody), 1) 100%);display: block;' if fs.access('/etc/config/advancedplus') then kucat = 'advancedplus' elseif fs.access('/etc/config/kucat') then kucat = 'kucat' end if (kucat and kucat ~= '') then local config = uci:get_all(kucat, "@basic[0]") primary_rgbbody,primary_rgbm,primary_rgbm_ts,primary_opacity,primary_rgbs,primary_rgbs_ts,mode = config.primary_rgbbody,config.primary_rgbm,config.primary_rgbm_ts,config.primary_opacity,config.primary_rgbs,config.primary_rgbs_ts,config.mode gohome,gouser,gossr = bar .. "status/" .. config.gohome,bar .. "system/" .. config.gouser,bar .. "services/" .. config.gossr background,bkuse,bklock,fontd,fontz,fontx = config.background,config.bkuse,config.bklock,config.font_d,config.font_z,config.font_x bgqs,setbar,dayword = config.bgqs,config.setbar,config.dayword else primary_rgbbody,primary_rgbm,primary_rgbm_ts,primary_opacity,primary_rgbs,primary_rgbs_ts,mode = '248,248,248','45,102,147','0.8','0','132,188,218','0.1','light' gohome,gouser,gossr = bar .. "status/" ,bar .. "system/" ,bar .. "services/" background,bkuse,bklock,fontd,fontz,fontx = '0','0','1','1.2rem' ,'0.92rem' ,'0.875rem' bgqs,setbar,dayword = '1','1','0' end local ufilter = string.format("blur(%dpx)", tonumber(primary_opacity)) if primary_opacity == '0' then ufilter = 'none' end local bgqs_image = '-webkit-linear-gradient(135deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent)' if bgqs == '1' then bgqs_image = 'none' end local bg_url = media..'/img/bg1.jpg' if background == '0' then math.randomseed(os.time()) local theme_dir = resource .. '/background/' if not fs.access('/www' .. resource .. '/background/') then local theme_dir = media .. '/background/' end local bgcount = 0 local currentBg = {} local bgs,attr = {} 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" 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)] picurl = currentBg.url end else picurl = sys.exec("/usr/libexec/kucat/kucat_wallpaper") end if (picurl and picurl ~= '') then bg_url = picurl end local bg_lock = bg_url if bklock == '0' then math.randomseed(os.time()) local bk_dir = media .. "/bg/" local bkcount = 0 local currentbk = {} local bgs,attr = {} for i, f in ipairs(glob("/www" .. bk_dir .. "*")) do attr = fs.stat(f) if attr then local ext = getExtension(fs.basename(f)) if ext == "jpg" or ext == "png" or ext == "gif" then local bg = {} bg.type = ext bg.url = bk_dir .. fs.basename(f) table.insert(bgs,bg) bkcount = bkcount + 1 end end end if bkcount > 0 then currentbk = bgs[math.random(1,bkcount)] bg_lock = currentbk.url end end if dayword == '1' then showword = sys.exec("/usr/libexec/kucat/kucat_word") end if bkuse == '1' then bk_use="background-image:url("..bg_lock..")" loginbk_use = "background-image:url(" .. bg_url .. ")" end -%> <%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI - LuCI"> - LuCI"> <% if node and node.css then %> <% end -%> node-<%= path %><% else %>node-main-login<% end %>" data-page="<%= pcdata(path) %>" style="<%=bk_use%>; " <% if mode ~= 'auto' then %> data-theme = "<%= mode %>" <% end -%> > <% if mode == 'auto' 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.%>

<%- end -%>