Просмотр исходного кода

luci-app-ssr-plus: add adblock black domain list

coolsnowwolf 5 лет назад
Родитель
Сommit
3acba20f52

+ 2 - 2
luci-app-ssr-plus/Makefile

@@ -1,8 +1,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-ssr-plus
-PKG_VERSION:=179
-PKG_RELEASE:=3
+PKG_VERSION:=180
+PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
 

+ 13 - 12
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua

@@ -98,36 +98,37 @@ end
 o.remove = function(self, section, value)
 	nixio.fs.writefile(blockconf, "")
 end
-s:tab("netflix", translate("Netflix Domain List"))
-local netflixconf = "/etc/ssr/netflix.list"
-o = s:taboption("netflix", TextValue, "netflixconf")
+
+s:tab("denydomain", translate("Deny Domain List"))
+local denydomainconf = "/etc/ssr/deny.list"
+o = s:taboption("denydomain", TextValue, "denydomainconf")
 o.rows = 13
 o.wrap = "off"
 o.rmempty = true
 o.cfgvalue = function(self, section)
-	return nixio.fs.readfile(netflixconf) or " "
+	return nixio.fs.readfile(denydomainconf) or " "
 end
 o.write = function(self, section, value)
-	nixio.fs.writefile(netflixconf, value:gsub("\r\n", "\n"))
+	nixio.fs.writefile(denydomainconf, value:gsub("\r\n", "\n"))
 end
 o.remove = function(self, section, value)
-	nixio.fs.writefile(netflixconf, "")
+	nixio.fs.writefile(denydomainconf, "")
 end
 
-s:tab("netflixip", translate("Netflix IP List"))
-local netflixipconf = "/etc/ssr/netflixip.list"
-o = s:taboption("netflixip", TextValue, "netflixipconf")
+s:tab("netflix", translate("Netflix Domain List"))
+local netflixconf = "/etc/ssr/netflix.list"
+o = s:taboption("netflix", TextValue, "netflixconf")
 o.rows = 13
 o.wrap = "off"
 o.rmempty = true
 o.cfgvalue = function(self, section)
-	return nixio.fs.readfile(netflixipconf) or " "
+	return nixio.fs.readfile(netflixconf) or " "
 end
 o.write = function(self, section, value)
-	nixio.fs.writefile(netflixipconf, value:gsub("\r\n", "\n"))
+	nixio.fs.writefile(netflixconf, value:gsub("\r\n", "\n"))
 end
 o.remove = function(self, section, value)
-	nixio.fs.writefile(netflixipconf, "")
+	nixio.fs.writefile(netflixconf, "")
 end
 
 return m

+ 3 - 0
luci-app-ssr-plus/po/zh-cn/ssr-plus.po

@@ -672,3 +672,6 @@ msgstr "SOCKS5 代理服务端(全局)"
 
 msgid "warning! Please do not reuse the port!"
 msgstr "警告!请不要重复使用端口!"
+
+msgid "Deny Domain List"
+msgstr "禁止连接的域名"

+ 2 - 2
luci-app-ssr-plus/root/etc/config/shadowsocksr

@@ -12,7 +12,7 @@ config global
 	option switch_try_count '3'
 	option gfwlist_url 'https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt'
 	option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
-	option nfip_url 'https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt'
+	option nfip_url 'https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt'
 	option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
 	option threads '0'
 	option global_server 'disable'
@@ -20,7 +20,7 @@ config global
 	option netflix_proxy '0'
 
 config access_control
-	option lan_ac_mode 'b'
+	option lan_ac_mode '0'
 	option router_proxy '1'
 	list wan_fw_ips '149.154.160.0/20'
 	list wan_fw_ips '67.198.55.0/24'

+ 9 - 7
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -697,6 +697,14 @@ start() {
 	if [ "$NETFLIX_SERVER" == "same" ]; then
 		NETFLIX_SERVER=$GLOBAL_SERVER
 	fi
+	mkdir -p /tmp/dnsmasq.d /tmp/dnsmasq.ssr
+	cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
+		conf-dir=/tmp/dnsmasq.ssr
+	EOF
+	if [ "$(uci_get_by_type global adblock 0)" == "1" ]; then
+		cp -rf /etc/ssr/ad.conf /tmp/dnsmasq.ssr/
+		awk '!/^$/&&!/^#/{printf("address=/%s/''\n",$0)}' /etc/ssr/deny.list >/tmp/dnsmasq.ssr/denylist.conf
+	fi
 	if rules; then
 		if start_redir_tcp; then
 			start_redir_udp
@@ -704,24 +712,18 @@ start() {
 			start_switch
 			start_dns
 			add_cron
-			mkdir -p /tmp/dnsmasq.d /tmp/dnsmasq.ssr
-			cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
-				conf-dir=/tmp/dnsmasq.ssr
-			EOF
 			if [ "$run_mode" == "oversea" ]; then
 				cp -rf /etc/ssr/oversea_list.conf /tmp/dnsmasq.ssr/
 			else
 				cp -rf /etc/ssr/gfw_list.conf /tmp/dnsmasq.ssr/
 				cp -rf /etc/ssr/gfw_base.conf /tmp/dnsmasq.ssr/
 			fi
-			if [ "$(uci_get_by_type global adblock 0)" == "1" ]; then
-				cp -rf /etc/ssr/ad.conf /tmp/dnsmasq.ssr/
-			fi
 			/usr/share/shadowsocksr/gfw2ipset.sh
 		else
 			/usr/bin/ssr-rules -f
 		fi
 	fi
+	/etc/init.d/dnsmasq restart >/dev/null 2>&1
 	start_server
 	start_local
 	start_monitor

+ 14 - 0
luci-app-ssr-plus/root/etc/ssr/deny.list

@@ -0,0 +1,14 @@
+gvod.aiseejapp.atianqi.com
+stat.pandora.xiaomi.com
+upgrade.mishop.pandora.xiaomi.com
+logonext.tv.kuyun.com
+config.kuyun.com
+mishop.pandora.xiaomi.com
+dvb.pandora.xiaomi.com
+api.ad.xiaomi.com
+de.pandora.xiaomi.com
+data.mistat.xiaomi.com
+jellyfish.pandora.xiaomi.com
+gallery.pandora.xiaomi.com
+o2o.api.xiaomi.com
+bss.pandora.xiaomi.com

+ 1 - 2
luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus

@@ -15,8 +15,6 @@ chmod 0755 /etc/init.d/shadowsocksr /usr/bin/ssr-* /usr/share/shadowsocksr/*.sh
 chmod 0644 /etc/ssr/* \
 /usr/share/shadowsocksr/*.lua \
 /usr/share/rpcd/acl.d/luci-app-ssr-plus.json \
-/usr/lib/upgrade/keep.d/luci-app-ssr-plus\
-/usr/lib/lua/luci/controller/shadowsocksr.lua \
 /usr/lib/lua/luci/model/cbi/shadowsocksr/*.lua \
 /usr/lib/lua/luci/view/shadowsocksr/*.htm
 chmod 0600 /etc/config/shadowsocksr
@@ -27,5 +25,6 @@ touch /etc/ssr/netflix.list
 touch /etc/ssr/netflixip.list
 touch /etc/ssr/ad.conf
 touch /etc/ssr/gfw_list.conf
+touch /etc/ssr/deny.list
 rm -rf /tmp/luci-modulecache /tmp/luci-indexcache
 exit 0

+ 1 - 0
luci-app-ssr-plus/root/lib/upgrade/keep.d/luci-app-ssr-plus

@@ -6,3 +6,4 @@
 /etc/ssr/netflixip.list
 /etc/ssr/gfw_list.conf
 /etc/ssr/ad.conf
+/etc/ssr/deny.list

+ 0 - 1
luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh

@@ -28,4 +28,3 @@ if [ "$1" == "" ]; then
 	awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/ssr/black.list >>/tmp/dnsmasq.ssr/blacklist_forward.conf
 	awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/ssr/white.list >/tmp/dnsmasq.ssr/whitelist_forward.conf
 fi
-/etc/init.d/dnsmasq restart >/dev/null 2>&1

+ 3 - 15
luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

@@ -180,26 +180,14 @@ local function processData(szType, content)
 		end
 		local info = content:sub(1, idx_sp - 1)
 		local hostInfo = split(base64Decode(info), "@")
-		local hostInfoLen = #hostInfo
-		local host = nil
-		local userinfo = nil
-		if hostInfoLen > 2 then
-			host = split(hostInfo[hostInfoLen], ":")
-			userinfo = {}
-			for i = 1, hostInfoLen - 1 do
-				tinsert(userinfo, hostInfo[i])
-			end
-			userinfo = table.concat(userinfo, "@")
-		else
-			host = split(hostInfo[2], ":")
-			userinfo = base64Decode(hostInfo[1])
-		end
+		local host = split(hostInfo[2], ":")
+		local userinfo = base64Decode(hostInfo[1])
 		local method = userinfo:sub(1, userinfo:find(":") - 1)
 		local password = userinfo:sub(userinfo:find(":") + 1, #userinfo)
 		result.alias = UrlDecode(alias)
 		result.type = "ss"
 		result.server = host[1]
-		if host[2] and host[2]:find("/%?") then
+		if host[2]:find("/%?") then
 			local query = split(host[2], "/%?")
 			result.server_port = query[1]
 			local params = {}