luci-app-passwall2: sync upstream

This commit is contained in:
actions 2024-03-30 03:30:05 +08:00
parent b1cbfa1c81
commit 3da2d267bd
3 changed files with 21 additions and 11 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2 PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.28-4 PKG_VERSION:=1.28-5
PKG_RELEASE:= PKG_RELEASE:=
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \

View File

@ -114,20 +114,25 @@ local api = require "luci.passwall2.api"
} }
return ret; return ret;
}, },
query: function (param, src, default_value, tval = "1", fval = "0") { query: function (param, src, default_value) {
var ret = "&" + param + "=";
var obj = this.get(src); var obj = this.get(src);
if (obj) { if (obj) {
var ret = "&" + param + "=";
if (obj.type === "checkbox") { if (obj.type === "checkbox") {
return ret + (obj.checked === true ? tval : fval); return ret + (obj.checked === true ? "1" : "0");
} else { } else {
var result = encodeURIComponent(obj.value); var result = encodeURIComponent(obj.value);
if ((result == null || result.trim() == "") && default_value) if (result == null || result.trim() == "") {
result = default_value; if (default_value) {
return ret + result; return ret + default_value;
}
return "";
} else {
return ret + result;
}
} }
} }
return "" return "";
} }
} }
opt.base = "cbid." + urlname + "." + sid; opt.base = "cbid." + urlname + "." + sid;

View File

@ -594,7 +594,9 @@ local function processData(szType, content, add_mode, add_from)
local params = {} local params = {}
for _, v in pairs(split(query[2], '&')) do for _, v in pairs(split(query[2], '&')) do
local t = split(v, '=') local t = split(v, '=')
params[string.lower(t[1])] = UrlDecode(t[2]) if #t > 1 then
params[string.lower(t[1])] = UrlDecode(t[2])
end
end end
-- [2001:4860:4860::8888]:443 -- [2001:4860:4860::8888]:443
-- 8.8.8.8:443 -- 8.8.8.8:443
@ -838,7 +840,9 @@ local function processData(szType, content, add_mode, add_from)
local params = {} local params = {}
for _, v in pairs(split(query[2], '&')) do for _, v in pairs(split(query[2], '&')) do
local t = split(v, '=') local t = split(v, '=')
params[string.lower(t[1])] = UrlDecode(t[2]) if #t > 1 then
params[string.lower(t[1])] = UrlDecode(t[2])
end
end end
-- [2001:4860:4860::8888]:443 -- [2001:4860:4860::8888]:443
-- 8.8.8.8:443 -- 8.8.8.8:443
@ -1186,7 +1190,8 @@ local function parse_link(raw, add_mode, add_from)
tinsert(node_list, result) tinsert(node_list, result)
end end
end end
end, function () end, function (err)
--log(err)
log(v, "解析错误,跳过此节点。") log(v, "解析错误,跳过此节点。")
end end
) )