<%# Copyright (C) 2019-2023 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 str:match(".+%.(%w+)$") end http.prepare_content("text/html; charset=UTF-8") local theme_dir = resource .. "/background/" if not fs.access("/www" .. resource .. "/background/") then local theme_dir = media .. "/background/" end local bingUrl = "http://www.bing.com/" local dark_css = fs.readfile('/www/luci-static/kucat/css/dark.css') local bg_url = media.."/img/bg1.jpg" local bg_lock = bg_url local bar="/cgi-bin/luci/admin/" local mode = 'light' local home = "overview" local user = "admin" local setbar = "1" local bgqs = '1' local showword = sys.exec("cat /www/luci-static/kucat/img/logoword") local showurl = sys.exec("cat /www/luci-static/kucat/img/logourl") local ssr = "" local gohome = bar .. "status/" ..home local gouser = bar .. "system/" ..user local gossr = bar .. "services/" ..ssr local background = '0' local fontd = '1.2rem' local fontz = '0.92rem' local fontx = '0.875rem' local primary_rgbbody = '248,248,248' local primary_rgbm = '45,102,147' local primary_rgbm_ts = '0.8' local primary_rgbs = '132,188,218' local primary_rgbs_ts = '0.1' local primary_opacity = '0' local bkuse = '0' local bk_use='none' local bklock = '1' local dayword = '0' if fs.access('/etc/config/advancedplus') then primary_rgbbody = uci:get_first('advancedplus', 'basic', 'primary_rgbbody') primary_rgbm = uci:get_first('advancedplus', 'basic', 'primary_rgbm') primary_rgbm_ts = uci:get_first('advancedplus', 'basic', 'primary_rgbm_ts') primary_opacity = uci:get_first('advancedplus', 'basic', 'primary_opacity') primary_rgbs = uci:get_first('advancedplus', 'basic', 'primary_rgbs') primary_rgbs_ts = uci:get_first('advancedplus', 'basic', 'primary_rgbs_ts') mode = uci:get_first('advancedplus', 'basic', 'mode') setbar = uci:get_first('advancedplus', 'basic', 'setbar') home = uci:get_first('advancedplus', 'basic', 'gohome') user = uci:get_first('advancedplus', 'basic', 'gouser') ssr = uci:get_first('advancedplus', 'basic', 'gossr') gohome = bar .. "status/" .. home gouser = bar .. "system/" .. user gossr = bar .. "services/" .. ssr background = uci:get_first('advancedplus', 'basic', 'background') bkuse = uci:get_first('advancedplus', 'basic', 'bkuse') bklock = uci:get_first('advancedplus', 'basic', 'bklock') fontd = uci:get_first('advancedplus', 'basic', 'font_d') fontz = uci:get_first('advancedplus', 'basic', 'font_z') fontx = uci:get_first('advancedplus', 'basic', 'font_x') bgqs = uci:get_first('advancedplus', 'basic', 'bgqs') dayword = uci:get_first('advancedplus', 'basic', 'dayword') end local primary_ufilter = "saturate(150%) contrast(50%) blur(" .. primary_opacity .. "px)" if primary_opacity == '0' then primary_ufilter = 'none' end local bgqs_image = '-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent)' local bgqs_color = 'rgba(var(--primary-rgbm),var(--primary-rgbm-ts))' if bgqs == '1' then bgqs_image = 'none' end function downunsplashUrl() local check = 1 if fs.access('/tmp/kucatunsplash.tmp') then local localtime = sys.exec("a=$(date +%Y%m%d) && cat /tmp/kucatunsplash.tmp | grep $a") if localtime ~= '' then check = 0 end end if check == 1 or not fs.access('/www/luci-static/kucat/img/down2.jpg') then io.popen("(curl -k -L \"$(curl -s https://instant.unsplash.com | grep -oE '\"raw\":\".*?\",\"full\"'| grep -o 'https://.*,' | sed 's/\",//g' | awk -F '\"raw\"' '{printf $(NF)}' | sed 's/:\"//g')\&q=80\&w=1680\" -o /www/luci-static/kucat/img/down2.jpg >/dev/null 2>&1) &") sys.exec("date +%Y%m%d > /tmp/kucatunsplash.tmp") end if fs.access('/www/luci-static/kucat/img/down2.jpg') then bg_url = media .. "/img/down2.jpg" end end function downbingUrl() local check = 1 if fs.access('/tmp/kucatbing.tmp') then local localtime = sys.exec("cat /tmp/kucatbing.tmp | grep `date +%Y%m%d`") if localtime ~= '' then check = 0 end end if check == 1 or not fs.access('/www/luci-static/kucat/img/down3.jpg') then local dbing = sys.exec("curl -s 'http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=3&mkt=en-US'" ) if (dbing and dbing ~= '') then bUrl = bingUrl .. json.parse(dbing).images[1].url end sys.exec("curl -kLfsm 5 -o /www/luci-static/kucat/img/down3.jpg '%s'" %bUrl) sys.exec("date +%Y%m%d > /tmp/kucatbing.tmp") end if fs.access('/www/luci-static/kucat/img/down3.jpg') then bg_url = media .. "/img/down3.jpg" end end function downIcibaword() local check = 1 if fs.access('/tmp/kucaticibaword.tmp') then local localtime = sys.exec("cat /tmp/kucaticibaword.tmp | grep `date +%Y%m%d`") if localtime ~= '' then check = 0 end end if check == 1 or not fs.access('/tmp/showword.tmp') then local localword = sys.exec("a=`curl -kLfsm 5 https://v1.hitokoto.cn | awk -F 'hitokoto\":\"' '{print $2}'| awk -F '\"' '{print $1}' ` && printf $a ") if localword ~= '' then sys.exec("a=`curl -kLfsm 5 https://v1.hitokoto.cn | awk -F 'hitokoto\":\"' '{print $2}'| awk -F '\"' '{print $1}' ` && echo -e $a >/tmp/showword.tmp") sys.exec("date +%Y%m%d > /tmp/kucaticibaword.tmp") end end if fs.access('/tmp/showword.tmp') then localword = sys.exec("a=`cat /tmp/showword.tmp` && printf $a ") if localword ~= '' then showword = localword end end end function downbirdUrl() local check = 1 if fs.access('/tmp/kucatbird.tmp') then local localtime = sys.exec("cat /tmp/kucatbird.tmp | grep `date +%Y%m%d` ") if localtime ~= '' then check = 0 end end if check == 1 or not fs.access('/www/luci-static/kucat/img/down5.jpg') then math.randomseed(tostring(os.time()):reverse():sub(1,9)) local j = math.random(1, 9) local i = math.random(1, 400) local bUrl = "http://wp.birdpaper.com.cn/intf/search?content=4k&pageno=" .. i .. "&count=9" bUrl = sys.exec("curl -s '%s' | awk -F '\"count\":9' '{print $2}' | awk -F ',\"processTime\"' '{print $1}' | sed 's#,#{#' " %bUrl) if (bUrl and bUrl ~= '') then bUrl = "" .. json.parse(bUrl).list[j].url end io.popen("curl -kLfsm 3 -o /www/luci-static/kucat/img/down5.jpg '%s'" %bUrl ) sys.exec("date +%Y%m%d > /tmp/kucatbird.tmp") end if fs.access('/www/luci-static/kucat/img/down5.jpg') then bg_url = media .. "/img/down5.jpg" end end if ( background == "0" ) then math.randomseed(os.time()) 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)] bg_url = currentBg.url end elseif ( background == "2" ) then pcall(downunsplashUrl) elseif background == "3" then pcall(downbingUrl) elseif background == "4" then pcall(downbirdUrl) end if bklock == '1' then bg_lock = bg_url else 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 pcall(downIcibaword) end if bkuse == '1' then bk_use="url("..bg_lock..")" end %> <%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI - LuCI"> - LuCI"> <% if node and node.css then %> <% end -%> <% if css then %> <% end -%> node-<%= path %><% else %>node-main-login<% end %>" data-page="<%= pcdata(path) %>">
<%- 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 -%>