Compare commits

..

4 Commits

Author SHA1 Message Date
NewUse
23879741fb
Update zapret-tpws.lua
add error message
2024-09-26 11:14:51 +03:00
NewUse
7c7d66d4ef
Update zapret-tpws.lua
change error message
2024-09-26 10:21:53 +03:00
NewUse
bbb337e5d5
Update zapret-tpws.lua
fix return value
2024-09-26 10:11:39 +03:00
NewUse
bc4ed19080
Update zapret-tpws.lua
fix validation function
2024-09-26 09:03:28 +03:00

View File

@ -1,24 +1,23 @@
m = Map("zapret", translate("TPWS Proxy Settings"))
c = m:section(NamedSection, "tpws", "zapret", translate("Configuration"))
m = Map("zapret", translate("TPWS Proxy Settings"))c = m:section(NamedSection, "tpws", "zapret", translate("Configuration"))
opt = c:option(Value, "opts", translate("TPWS Options"))
opt.placeholder = "--split-pos=2"
function checkDoubleMinus(inputString)
function opt.validate(self, value)
-- Split the string into words
local words = {}
for word in inputString:gmatch("%S+") do
for word in value:gmatch("%S+") do
table.insert(words, word)
end
-- Check each word
for _, word in ipairs(words) do
if not word:sub(1, 2) == "--" then
return false, translate("Error: Not all words start with double minuses.")
return nil, opt.error = translate("Error: Not all options start with double dash.")
end
end
return true
return value
end
opt.validate = checkDoubleMinus(opt.Value)
b = c:option(Flag, "block_quic", "Block QUIC", translate("Block QUIC protocol to come outside"))
lp = c:option(Value, "port", translate("Listen Port"))
lp.datatype = "port"