update 2025-11-12 00:31:00

This commit is contained in:
kenzok8
2025-11-12 00:31:00 +08:00
parent 5df0b3c6f6
commit 57782e27da
4 changed files with 28 additions and 5 deletions

View File

@@ -36,6 +36,21 @@ end)
for k, v in pairs(groups) do
o:value(k)
end
o.write = function(self, section, value)
value = api.trim(value)
local lower = value:lower()
if lower == "" or lower == "default" then
return m:del(section, self.option)
end
for _, v in ipairs(self.keylist or {}) do
if v:lower() == lower then
return m:set(section, self.option, v)
end
end
m:set(section, self.option, value)
end
o = s:option(ListValue, "type", translate("Type"))

View File

@@ -176,7 +176,7 @@ o = s:option(Value, "remark", translate("Remarks"))
o.width = "auto"
o.rmempty = false
o.validate = function(self, value, section)
value = (value or ""):match("^%s*(.-)%s*$")
value = api.trim(value)
if value == "" then
return nil, translate("Remark cannot be empty.")
end
@@ -187,7 +187,7 @@ o.validate = function(self, value, section)
return false
end
end)
if duplicate then
if duplicate or value:lower() == "default" then
return nil, translate("This remark already exists, please change a new remark.")
end
return value

View File

@@ -89,7 +89,7 @@ s.dynamic = false
o = s:option(Value, "remark", translate("Subscribe Remark"))
o.rmempty = false
o.validate = function(self, value, section)
value = (value or ""):match("^%s*(.-)%s*$")
value = api.trim(value)
if value == "" then
return nil, translate("Remark cannot be empty.")
end
@@ -100,7 +100,7 @@ o.validate = function(self, value, section)
return false
end
end)
if duplicate then
if duplicate or value:lower() == "default" then
return nil, translate("This remark already exists, please change a new remark.")
end
return value

View File

@@ -126,8 +126,16 @@ local api = require "luci.passwall.api"
var val = input.value.trim();
if (!val) return;
if (val.toLowerCase() === "default") {
var emptyLi = Array.from(list.querySelectorAll(".dropdown-item"))
.find(function(el){ return !el.dataset.value; });
if (emptyLi) selectItem(emptyLi);
input.value = "";
return;
}
var li = Array.from(list.querySelectorAll(".dropdown-item")).find(function(el){
return el.dataset.value === val;
return el.dataset.value.toLowerCase() === val.toLowerCase();
});
if (!li) {
li = document.createElement("li");