% -- LuCI by libc0607 (libc0607@gmail.com) -- 华工路由群:262939451 local sys = require "luci.sys" local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() local ntm = require "luci.model.network".init() local scutclient_version = luci.sys.exec("opkg list-installed scutclient | cut -d ' ' -f 3") local scutclient_status = {} scutclient_status.enable = uci:get_first("scutclient", "option", "enable") scutclient_status.username = uci:get_first("scutclient", "scutclient", "username") scutclient_status.password = uci:get_first("scutclient", "scutclient", "password") scutclient_status.hostname = uci:get_first("scutclient", "drcom", "hostname") scutclient_status.version = uci:get_first("scutclient", "drcom", "version") scutclient_status.hash = uci:get_first("scutclient", "drcom", "hash") scutclient_status.server_auth_ip = uci:get_first("scutclient", "drcom", "server_auth_ip") local mode_links = {} mode_links.base = luci.dispatcher.build_url("admin/scutclient/status") mode_links.redial = mode_links.base.."?redial=1" mode_links.logoff = mode_links.base.."?logoff=1" mode_links.move_tag = mode_links.base .."?move_tag=1" local stat, wan_nets = pcall(ntm.get_wan_networks, ntm) local wan, wandev if stat then if #wan_nets > 0 then wan = wan_nets[1] wandev = wan:get_interface() end else wan = ntm:get_wannet() wandev = ntm:get_wandev() end function page_moved() return (uci:get_first("scutclient", "luci", "mainorder", 10) == 10) end function get_client_status(exec_name) return (os.execute("pidof scutclient > /dev/null 2>/dev/null") == 0) end function get_wifi_switch() return (string.sub(luci.sys.exec("wifi status|grep up|head -n 1|awk {'print $2'}"), 1, 4) == "true") and true or false end %> <%+header%>