mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-18 17:33:31 +00:00
improve luci ssr plus subscribe and remove severs function
This commit is contained in:
parent
4eef1f3c91
commit
c07ec3b95a
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for SSR Plus
|
||||
LUCI_DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=30
|
||||
PKG_RELEASE:=31
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -3,6 +3,12 @@
|
||||
local m, s, o
|
||||
local shadowsocksr = "shadowsocksr"
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
local server_count = 0
|
||||
uci:foreach("shadowsocksr", "servers", function(s)
|
||||
server_count = server_count + 1
|
||||
end)
|
||||
|
||||
m = Map(shadowsocksr, translate("Servers subscription and manage"))
|
||||
|
||||
-- Server Subscribe
|
||||
@ -32,16 +38,16 @@ o.description = translate("Through proxy update list, Not Recommended ")
|
||||
o = s:option(Button,"update",translate("Update"))
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
luci.sys.call("nohup bash /usr/share/shadowsocksr/subscribe.sh > /tmp/subupdate.log 2>&1 &")
|
||||
luci.sys.call("sleep 8")
|
||||
luci.sys.call("bash /usr/share/shadowsocksr/subscribe.sh >/dev/null 2>&1")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
|
||||
end
|
||||
|
||||
o = s:option(Button,"delete",translate("Delete all severs"))
|
||||
o.inputstyle = "reset"
|
||||
o.description = string.format(translate("Server Count") .. ": %d", server_count)
|
||||
o.write = function()
|
||||
luci.sys.call("nohup bash /usr/share/shadowsocksr/delservers.sh > /tmp/subupdate.log 2>&1 &")
|
||||
luci.sys.call("sleep 5")
|
||||
uci:delete_all("shadowsocksr", "servers", function(s) return true end)
|
||||
luci.sys.call("uci commit shadowsocksr && /etc/init.d/shadowsocksr stop")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
|
||||
end
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
for((i=1;i<=200;i++));
|
||||
do
|
||||
uci delete shadowsocksr.@servers[$1] >/dev/null 2>&1
|
||||
done
|
||||
uci commit shadowsocksr
|
||||
|
||||
/etc/init.d/shadowsocksr stop
|
@ -8,18 +8,6 @@ urlsafe_b64decode() {
|
||||
echo $data | base64 -d
|
||||
}
|
||||
|
||||
CheckIPAddr() {
|
||||
echo $1 | grep "^[0-9]\{1,3\}\.\([0-9]\{1,3\}\.\)\{2\}[0-9]\{1,3\}$" >/dev/null 2>&1
|
||||
[ $? -ne 0 ] && return 1
|
||||
local ipaddr=($(echo $1 | sed 's/\./ /g'))
|
||||
[ ${#ipaddr[@]} -ne 4 ] && return 1
|
||||
for ((i=0;i<${#ipaddr[@]};i++))
|
||||
do
|
||||
[ ${ipaddr[i]} -gt 255 -a ${ipaddr[i]} -lt 0 ] && return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
Server_Update() {
|
||||
local uci_set="uci -q set $name.$1."
|
||||
${uci_set}alias="[$ssr_group] $ssr_remarks"
|
||||
|
Loading…
Reference in New Issue
Block a user