<%+header%> <% local http = require("luci.http") local core = require("substore.core") local node = require("substore.node") local util = require("substore.util") local ctx = luci.dispatcher.context or {} local q = ctx.query or {} local id = http.formvalue("id") or q.id or "" local meta = id ~= "" and core.get(id) or nil local nodes = id ~= "" and core.read_nodes(id) or {} local proto = http.formvalue("proto") or q.proto or "" local keyword = http.formvalue("keyword") or q.keyword or "" local group = http.formvalue("group") or q.group or "" local sort_by = http.formvalue("sort") or q.sort or "name" local sort_desc = http.formvalue("desc") == "1" or q.desc == "1" -- id 会进入 " 的值会在 HTML 词法阶段就闭合 -- script 元素(与 JS 字符串上下文无关),剩下的部分被当作 HTML 执行。 -- 把**全部** "<" 转成 <:在 JS/JSON 字符串里这就是 "<",而 HTML 词法 -- 阶段再也看不到 "<",于是 " 不再结束脚本块,整页被吞进脚本)两个 -- 坑一并堵上。只转 " <% -- §18:控制器把失败原因放在 ?err= 上带回来,这里渲染成可见的提示。 -- pcdata 转义:err 可能包含用户提交的内容,不能直接当 HTML 输出。 local flash_err = http.formvalue("err") if flash_err and flash_err ~= "" then %>
<%:Operation failed%>: <%=luci.util.pcdata(flash_err)%>
<% end %>

<%:Nodes%> — <%=luci.util.pcdata(meta and meta.name or "")%>

<%:Back%>
<% for _, n in ipairs(nodes) do %> " data-port="<%=luci.util.pcdata(tostring(n.port or ""))%>"> <% end %> <% if #nodes == 0 then %> <% end %>
<%:Name%> <%:Group%> <%:Type%> <%:Server%> <%:Port%> <%:Latency%> <%:Actions%>
<%=luci.util.pcdata(n.name or "")%> " data-idx="<%=n.__idx%>" onchange="substore_set_group(this)"/> <%=luci.util.pcdata(n.proto or "")%> <%=luci.util.pcdata(n.server or "")%> <%=luci.util.pcdata(tostring(n.port or ""))%> - <%:Edit%>
<% if sort_desc then %><% end %>
<%:No nodes found.%>
<%+footer%>