summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua
diff options
context:
space:
mode:
authorPaul Donald <newtwen@gmail.com>2023-12-05 04:33:47 +0100
committerPaul Donald <newtwen@gmail.com>2023-12-05 04:33:47 +0100
commitb3d1d056f471f82ffc931a5cffef125ce36b6d41 (patch)
tree17642bab1c4d06d67e05c9e19bd28f7bc672009a /applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua
parentfd2d2ac734429a81c9289e33635f28367a97fafe (diff)
luci-app-tinyproxy: error check socks5 upstream (#6303)
Signed-off-by: Paul Donald <newtwen@gmail.com>
Diffstat (limited to 'applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua')
-rw-r--r--applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua b/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua
index 686a46378d..f8c420bc1c 100644
--- a/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua
+++ b/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua
@@ -236,4 +236,16 @@ v = s:option(Value, "via", translate("Via proxy"),
v:depends({type="proxy"})
v.placeholder = "10.0.0.1:8080"
+function v.write(self, section, value)
+
+ local pattern1 = "^%d+%.%d+%.%d+%.%d+:%d+$"
+ local pattern2 = "^socks5 %d+%.%d+%.%d+%.%d+:%d+$"
+
+ if string.match(value, pattern1) or string.match(value, pattern2) then
+ Value.write(self, section, value)
+ else
+ return
+ end
+end
+
return m