update 2026-08-20 20:36:19

This commit is contained in:
action
2026-08-20 20:36:20 +08:00
parent 2ac8f487f6
commit d0d547405b
10 changed files with 65 additions and 8 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 547 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 659 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

@@ -1,13 +1,14 @@
module("luci.controller.linkeasefull", package.seeall)
function index()
entry({"admin", "services", "linkeasefull_status"}, call("linkeasefull_status"))
entry({"admin", "services", "linkeasefull", "auth"}, call("linkeasefull_auth")).leaf = true
if not nixio.fs.access("/etc/config/linkeasefull") then
return
end
entry({"admin", "services", "linkeasefull"}, cbi("linkeasefull"), _("LinkEase Full"), 21).dependent = true
entry({"admin", "services", "linkeasefull_status"}, call("linkeasefull_status"))
entry({"admin", "services", "linkeasefull", "auth"}, call("linkeasefull_auth")).leaf = true
end
local function uhttpd_has_apps_proxy_prefix()
@@ -62,11 +63,39 @@ local function valid_apps_return(value)
if not value or value == "" then
return false
end
if value == "/apps" then
return true
local function valid_path(path)
if path == "/apps" then
return true
end
local prefix = path:sub(1, 6)
return prefix == "/apps/" or prefix == "/apps?" or prefix == "/apps#"
end
local prefix = value:sub(1, 6)
return prefix == "/apps/" or prefix == "/apps?" or prefix == "/apps#"
if value:sub(1, 1) == "/" then
return valid_path(value)
end
local scheme, authority, path = value:match("^(https?://)([^/]+)(/.*)$")
if not scheme or not authority or not valid_path(path) then
return false
end
local http = require "luci.http"
local uci = require "luci.model.uci".cursor()
local request_host = http.getenv("HTTP_HOST") or ""
local lan_host = uci:get("network", "lan", "ipaddr") or ""
local allowed_authorities = {
request_host,
request_host .. ":19290",
lan_host,
lan_host .. ":19290"
}
for _, host in ipairs(allowed_authorities) do
if host ~= "" and authority == host then
return true
end
end
return false
end
local function valid_cookie_value(value)
@@ -45,6 +45,22 @@ local function storage_mounts()
return mounts
end
local function ensure_linkease_config(uci)
if not fs.access("/etc/config/linkease") then
fs.writefile("/etc/config/linkease", "")
end
uci:load("linkease")
local section = uci:get_first("linkease", "linkease")
if not section then
section = uci:add("linkease", "linkease")
uci:set("linkease", section, "enabled", "0")
uci:set("linkease", section, "port", "8897")
uci:set("linkease", section, "allowPublic", "0")
uci:commit("linkease")
end
return section
end
m = Map("linkeasefull", translate("LinkEase Full"), translate("LinkEase Full uses fixed entries at port 19290 /apps/ and legacy port 8897."))
m:section(SimpleSection).template = "linkeasefull_status"
@@ -55,10 +71,11 @@ s.anonymous = true
s:option(Flag, "enabled", translate("Enable")).rmempty = false
local data = s:option(ListValue, "data_root_parent", translate("Storage path"), translate("Choose a mounted persistent disk. /tmp is not allowed."))
local data = s:option(ListValue, "_local_home", translate("Storage path"), translate("Choose a mounted persistent disk. /tmp is not allowed."))
data.rmempty = false
local current = m.uci:get_first("linkeasefull", "linkeasefull", "data_root_parent") or ""
ensure_linkease_config(m.uci)
local current = m.uci:get_first("linkease", "linkease", "local_home") or ""
local has_current = false
for _, mount in ipairs(storage_mounts()) do
data:value(mount.path, mount.label)
@@ -83,4 +100,15 @@ function data.validate(self, value)
return value
end
function data.cfgvalue(self, section)
m.uci:load("linkease")
return m.uci:get_first("linkease", "linkease", "local_home") or ""
end
function data.write(self, section, value)
local linkease_section = ensure_linkease_config(m.uci)
m.uci:set("linkease", linkease_section, "local_home", value)
m.uci:commit("linkease")
end
return m