From 5ef6caac0b3e405642bec3bd5d1c4da2bb011b47 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Tue, 3 Mar 2020 18:01:05 -0800 Subject: [PATCH] luci-app-ssr-plus: add support dnsmasq format ad-filter --- package/lean/luci-app-ssr-plus/Makefile | 2 +- .../luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua | 1 + package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index 4c8e336b18..b4318e2489 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus -PKG_VERSION:=158 +PKG_VERSION:=159 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua index d882b2ed2e..6242512c88 100644 --- a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua +++ b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua @@ -136,6 +136,7 @@ if sret== 0 then luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf") retstring=tostring(math.ceil(tonumber(icount))) if oldcount==0 then + luci.sys.exec("cp -f /etc/dnsmasq.ssr/ad.conf /tmp/dnsmasq.ssr/ad.conf") luci.sys.call("/etc/init.d/dnsmasq restart") end else diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad index 668a262664..5bddf9cec1 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad @@ -1,6 +1,10 @@ #!/bin/sh -e if [ -f /tmp/adnew.conf ]; then - cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf + if (grep -wq "address=" /tmp/adnew.conf) ; then + cp /tmp/adnew.conf /tmp/ad.conf + else + cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf + fi fi