luci-app-ssr-plus: Fix disable shunt mode Netflix list domain name unavailable.

This commit is contained in:
zxlhhyccc committed 2025-03-10 22:10:25 +08:00
1 parent fc58f1f1fb
commit 06e07cd679
3 files changed
+22 -10

No files matched your search

@@ -66,7 +66,7 @@ o:value("https://fastly.jsdelivr.net/gh/gaoyifan/china-operator-ip@ip-lists/chin
o.default = "https://ispip.clang.cn/all_cn.txt"
o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
o.description = translate("Disable shunt mode before, Please must first disable shunt node.")
o.description = translate("When disabled shunt mode, will same time stopped shunt service.")
o.rmempty = false
o = s:option(Value, "nfip_url", translate("nfip_url"))
+2 -2
View File
@@ -1209,8 +1209,8 @@ msgstr "应用"
msgid "Enable Netflix Mode"
msgstr "启用 Netflix 分流模式"
msgid "Disable shunt mode before, Please must first disable shunt node."
msgstr "停用分流模式之前,请务必先停用分流节点。"
msgid "When disabled shunt mode, will same time stopped shunt service."
msgstr "当停用分流模式时,将同时停止分流服务。"
msgid "TUIC User UUID"
msgstr "TUIC 用户 uuid"
@@ -1,5 +1,7 @@
#!/bin/sh
. $IPKG_INSTROOT/etc/init.d/shadowsocksr
netflix() {
if [ -f "$TMP_DNSMASQ_PATH/gfw_list.conf" ]; then
for line in $(cat /etc/ssrplus/netflix.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done
@@ -14,7 +16,14 @@ else
cp -rf /etc/ssrplus/gfw_list.conf $TMP_DNSMASQ_PATH/
cp -rf /etc/ssrplus/gfw_base.conf $TMP_DNSMASQ_PATH/
fi
case "$(uci_get_by_type global netflix_server nil)" in
if [ "$(uci_get_by_type global netflix_enable 0)" == "1" ]; then
# 只有开启 NetFlix分流 才需要取值
SHUNT_SERVER=$(uci_get_by_type global netflix_server nil)
else
# 没有开启 设置为 nil
SHUNT_SERVER=nil
fi
case "$SHUNT_SERVER" in
nil)
rm -f $TMP_DNSMASQ_PATH/netflix_forward.conf
;;
@@ -25,12 +34,14 @@ $(uci_get_by_type global global_server nil) | $switch_server | same)
netflix $tmp_shunt_dns_port
;;
esac
for line in $(cat /etc/ssrplus/black.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done
for line in $(cat /etc/ssrplus/black.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done
for line in $(cat /etc/ssrplus/white.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done
for line in $(cat /etc/ssrplus/white.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done
for line in $(cat /etc/ssrplus/deny.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done
for line in $(cat /etc/ssrplus/deny.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done
# 此处使用while方式读取 防止 /etc/ssrplus/ 目录下的 black.list white.list deny.list 等2个或多个文件一行中存在空格 比如:# abc.com 而丢失:server
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done < /etc/ssrplus/black.list
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done < /etc/ssrplus/black.list
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done < /etc/ssrplus/white.list
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done < /etc/ssrplus/white.list
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done < /etc/ssrplus/deny.list
while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done < /etc/ssrplus/deny.list
# 此处直接使用 cat 因为有 sed '/#/d' 删除了 数据
cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$dns_port\nipset=\/&\/blacklist/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf
cat /etc/ssrplus/white.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1\nipset=\/&\/whitelist/" >$TMP_DNSMASQ_PATH/whitelist_forward.conf
cat /etc/ssrplus/deny.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/address=\/&\//" >$TMP_DNSMASQ_PATH/denylist.conf
@@ -45,3 +56,4 @@ if [ "$(uci_get_by_type global adblock 0)" == "1" ]; then
else
rm -f $TMP_DNSMASQ_PATH/ad.conf
fi