From 458564b2b954fb3ecaf5fb2541a0f591bf566cd0 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Tue, 26 May 2020 19:09:01 +0800 Subject: [PATCH] luci-app-adbyby-plus: add block douyin option --- package/lean/luci-app-adbyby-plus/Makefile | 4 ++-- .../luasrc/model/cbi/adbyby/advanced.lua | 5 +++++ package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po | 3 +++ .../lean/luci-app-adbyby-plus/root/etc/init.d/adbyby | 12 ++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/package/lean/luci-app-adbyby-plus/Makefile b/package/lean/luci-app-adbyby-plus/Makefile index 1e9f74419..72b46f68c 100644 --- a/package/lean/luci-app-adbyby-plus/Makefile +++ b/package/lean/luci-app-adbyby-plus/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2016 Openwrt.org +# Copyright (C) 2020 Openwrt.org # # This is free software, licensed under the Apache License, Version 2.0 . # @@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +dnsmasq-full LUCI_PKGARCH:=all PKG_NAME:=luci-app-adbyby-plus PKG_VERSION:=2.0 -PKG_RELEASE:=71 +PKG_RELEASE:=72 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua index f71b49570..b8991d06f 100644 --- a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua +++ b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua @@ -22,6 +22,11 @@ o.title = translate("Block Apple iOS OTA update") o.default = 0 o.rmempty = false +o = s:option(Flag, "block_douyin") +o.title = translate("Block Douyin APP and Website") +o.default = 0 +o.rmempty = false + o = s:option(Flag, "cron_mode") o.title = translate("Update the rule at 6 a.m. every morning and restart adbyby") o.default = 0 diff --git a/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po b/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po index b462b053e..cbe23b737 100644 --- a/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po +++ b/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po @@ -112,6 +112,9 @@ msgstr "手动更新规则" msgid "Block Apple iOS OTA update" msgstr "拦截 Apple iOS 的OTA更新" +msgid "Block Douyin APP and Website" +msgstr "拦截 抖音 APP 和网站" + msgid "RAM Running Mode" msgstr "内存运行模式" diff --git a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby index 4c79b4710..182f3bbb0 100755 --- a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby +++ b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby @@ -34,6 +34,7 @@ get_config() config_get wan_mode $1 wan_mode 1 config_get_bool block_ios $1 block_ios 0 config_get_bool mem_mode $1 mem_mode 1 + config_get_bool block_douyin $1 block_douyin 0 } add_rules() @@ -131,6 +132,13 @@ add_dns() echo 'conf-dir=/tmp/adbyby/rules/data' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf [ $block_ios -eq 1 ] && echo 'address=/mesu.apple.com/0.0.0.0' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf + if [ $block_douyin -eq 1 ]; then + cat <<-EOF >/tmp/etc/dnsmasq-adbyby.d/08-dnsmasq.douyin +address=/api.amemv.com/0.0.0.0 +address=/.snssdk.com/0.0.0.0 +address=/.douyin.com/0.0.0.0 + EOF + fi } del_dns() @@ -201,7 +209,7 @@ start() add_dns add_rule - /etc/init.d/dnsmasq reload + /etc/init.d/dnsmasq restart fi } @@ -213,7 +221,7 @@ stop() del_rule del_cron del_dns - /etc/init.d/dnsmasq reload + /etc/init.d/dnsmasq restart } boot()