mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 22:43:56 +08:00
🍓 Sync 2026-10-01 00:51:52
This commit is contained in:
1 parent
57dc97412f
commit
d45a1cb4ad
60 files changed
+2630
-1193
No files matched your search
@@ -135,7 +135,7 @@ return view.extend({
|
||||
ipv6: uci.get('network', 'wan6', 'auto') === '0' ? '0' : '1',
|
||||
https: uci.get('wizard', 'default', 'https') || '0',
|
||||
cookie_p: uci.get('wizard', 'default', 'persistent_cookies') || '1',
|
||||
landing_page: uci.get('wizard', 'default', 'landing_page') || 'default',
|
||||
landing_page: uci.get('wizard', 'default', 'landing_page') || 'auto',
|
||||
autoupgrade_fm: uci.get('wizard', 'default', 'autoupgrade_fm') || '0',
|
||||
coremark: uci.get('wizard', 'default', 'coremark') || '0',
|
||||
wifi_ssid: baseSsid || (this.hasWireless ? 'Kwrt' : ''),
|
||||
@@ -195,7 +195,7 @@ return view.extend({
|
||||
{ tab: 'firmware', type: form.Flag, id: 'cookie_p', title: _('Persistent Cookie Session'), desc: _('Maintain persistent login sessions in the web browser.') },
|
||||
{ tab: 'firmware', type: form.Flag, id: 'https', title: _('Enforce HTTPS Access'), desc: _('Automatically redirect HTTP requests to secure HTTPS.') },
|
||||
{ tab: 'firmware', type: form.ListValue, id: 'landing_page', title: _('Landing Dashboard Mode'),
|
||||
choices: { 'default': _('Default'), 'dashboard': _('Dashboard'), routerdog: _('RouterDog'), nas: _('NAS'), 'next-nas': _('Next-NAS'), router: _('Router') } }
|
||||
choices: { 'auto': _('Auto'), 'overview': _('Overview'), 'istoreos': _('iStoreOS'), 'dashboard': _('Dashboard'), routerdog: _('RouterDog'), nas: _('NAS'), 'next-nas': _('Next-NAS'), router: _('Router') } }
|
||||
];
|
||||
|
||||
// 无线配置根据设备硬件动态追加
|
||||
|
||||
@@ -1,40 +1,67 @@
|
||||
module("luci.controller.wizard", package.seeall)
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
local http = require "luci.http"
|
||||
|
||||
function index()
|
||||
entry({"admin", "index"}, call("landing_page"), _("Home") , 0).dependent = false
|
||||
entry({"admin", "index"}, call("landing_page"), _("Home"), 0).dependent = false
|
||||
|
||||
-- 2. 核心:直接改写 admin 根节点的调度目标
|
||||
-- 这样当用户访问 /admin、登录后跳转或访问根目录时,无需经过 firstchild(),直接执行 landing_page()
|
||||
-- 直接改写 admin 根节点的调度目标
|
||||
local admin = node("admin")
|
||||
if admin then
|
||||
admin.target = call("landing_page")
|
||||
end
|
||||
end
|
||||
|
||||
local function check_wifi(uci)
|
||||
local has_wifi = false
|
||||
pcall(function()
|
||||
uci:foreach("wireless", "wifi-device", function(s)
|
||||
has_wifi = true
|
||||
return false -- 检测到任意 wifi-device 即终止遍历
|
||||
end)
|
||||
end)
|
||||
return has_wifi
|
||||
end
|
||||
|
||||
local function is_running(proc)
|
||||
return luci.sys.call(string.format("pgrep %s >/dev/null", proc)) == 0
|
||||
end
|
||||
|
||||
function landing_page()
|
||||
local landing_page = uci:get("wizard", "default", "landing_page")
|
||||
if (landing_page == "default") then
|
||||
http.redirect(luci.dispatcher.build_url("admin","status","overview"))
|
||||
elseif (landing_page == "dashboard") then
|
||||
http.redirect(luci.dispatcher.build_url("admin","status","dashboard"))
|
||||
elseif (luci.sys.call("pgrep routergo >/dev/null") == 0 and landing_page == "routerdog") then
|
||||
http.redirect(luci.dispatcher.build_url("admin","routerdog"));
|
||||
elseif luci.sys.call("pgrep quickstart >/dev/null") == 0 then
|
||||
if landing_page == "nas" then
|
||||
http.redirect(luci.dispatcher.build_url("admin","istorex","nas"));
|
||||
elseif landing_page == "next-nas" then
|
||||
http.redirect(luci.dispatcher.build_url("admin","istorex","next-nas"));
|
||||
elseif landing_page == "router" then
|
||||
http.redirect(luci.dispatcher.build_url("admin","istorex","router"));
|
||||
else
|
||||
http.redirect(luci.dispatcher.build_url("admin","quickstart"));
|
||||
end
|
||||
else
|
||||
http.redirect(luci.dispatcher.build_url("admin", "status", "overview"))
|
||||
local uci = luci.model.uci.cursor()
|
||||
local page = uci:get("wizard", "default", "landing_page")
|
||||
local target = {"admin", "status", "overview"}
|
||||
|
||||
-- 1. 默认/自动模式
|
||||
if not page or page == "auto" then
|
||||
if is_running("quickstart") then
|
||||
target = {"admin", "quickstart"}
|
||||
elseif check_wifi(uci) then
|
||||
target = {"admin", "status", "dashboard"}
|
||||
end
|
||||
|
||||
-- 2. 常规指定页面
|
||||
elseif page == "overview" then
|
||||
target = {"admin", "status", "overview"}
|
||||
elseif page == "dashboard" then
|
||||
target = {"admin", "status", "dashboard"}
|
||||
|
||||
-- 3. Routerdog 模式(优先比对字符串,命中再检测进程)
|
||||
elseif page == "routerdog" and is_running("routergo") then
|
||||
target = {"admin", "routerdog"}
|
||||
|
||||
-- 4. iStoreOS / iStoreX 增强页面(仅在 quickstart 运行时有效)
|
||||
elseif is_running("quickstart") then
|
||||
local istore_routes = {
|
||||
istoreos = {"admin", "quickstart"},
|
||||
nas = {"admin", "istorex", "nas"},
|
||||
["next-nas"] = {"admin", "istorex", "next-nas"},
|
||||
router = {"admin", "istorex", "router"}
|
||||
}
|
||||
if istore_routes[page] then
|
||||
target = istore_routes[page]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
http.redirect(luci.dispatcher.build_url(unpack(target)))
|
||||
end
|
||||
Reference in new issue
Block a user