From b591e2feeb758490e64c15a18e315d629620a325 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Mar 2023 17:53:19 +0800 Subject: [PATCH] update@20230310 --- GoQuiet/Makefile | 64 - adguardhome/Makefile | 6 +- aliyundrive-webdav/Makefile | 2 +- .../files/aliyundrive-webdav.config | 2 - .../files/aliyundrive-webdav.init | 60 +- brook/Makefile | 4 +- chinadns-ng/Makefile | 12 +- chinadns/Makefile | 48 - ddns-scripts_aliyun/update_aliyun_com.sh | 2 +- gost/Makefile | 2 +- hysteria/Makefile | 4 +- lua-neturl/Makefile | 4 +- lua-neturl/patches/010-userinfo-regex.patch | 9 + luci-app-adguardhome/Makefile | 50 +- luci-app-adguardhome/README.md | 17 + .../luasrc/controller/AdGuardHome.lua | 226 +- .../luasrc/model/cbi/AdGuardHome/base.lua | 434 +- .../luasrc/model/cbi/AdGuardHome/log.lua | 26 +- .../luasrc/model/cbi/AdGuardHome/manual.lua | 135 +- .../view/AdGuardHome/AdGuardHome_check.htm | 8 +- .../view/AdGuardHome/AdGuardHome_chpass.htm | 4 +- .../view/AdGuardHome/AdGuardHome_status.htm | 0 .../luasrc/view/AdGuardHome/log.htm | 9 +- .../luasrc/view/AdGuardHome/yamleditor.htm | 0 luci-app-adguardhome/po/zh-cn | 1 - luci-app-adguardhome/po/zh-cn/AdGuardHome.po | 275 + .../po/zh_Hans/AdGuardHome.po | 275 + .../po/zh_Hans/adguardhome.po | 408 - .../root/etc/config/AdGuardHome | 4 +- .../root/etc/init.d/AdGuardHome | 225 +- .../root/etc/uci-defaults/40_luci-AdGuardHome | 3 - .../AdGuardHome/AdGuardHome_template.yaml | 65 +- .../root/usr/share/AdGuardHome/addhost.sh | 4 +- .../root/usr/share/AdGuardHome/firewall.start | 0 .../root/usr/share/AdGuardHome/getsyslog.sh | 3 +- .../root/usr/share/AdGuardHome/gfw2adg.sh | 5 +- .../root/usr/share/AdGuardHome/links.txt | 7 +- .../root/usr/share/AdGuardHome/tailto.sh | 3 +- .../root/usr/share/AdGuardHome/update_core.sh | 379 +- .../root/usr/share/AdGuardHome/waitnet.sh | 13 +- .../root/usr/share/AdGuardHome/watchconfig.sh | 3 +- .../rpcd/acl.d/luci-app-adguardhome.json | 0 .../codemirror/addon/fold/foldcode.js | 0 .../codemirror/addon/fold/foldgutter.css | 0 .../codemirror/addon/fold/foldgutter.js | 0 .../codemirror/addon/fold/indent-fold.js | 0 .../resources/codemirror/lib/codemirror.css | 0 .../resources/codemirror/lib/codemirror.js | 0 .../resources/codemirror/mode/yaml/yaml.js | 0 .../resources/codemirror/theme/dracula.css | 0 .../luci-static/resources/twin-bcrypt.min.js | 0 luci-app-aliddns/LICENSE | 21 + luci-app-aliddns/Makefile | 78 +- luci-app-aliddns/README.md | 68 + .../files/luci/controller/aliddns.lua | 4 + .../luci/i18n/aliddns.zh-cn.po} | 12 + .../luci}/model/cbi/aliddns.lua | 16 +- .../{ => files}/root/etc/config/aliddns | 0 .../{ => files}/root/etc/init.d/aliddns | 18 +- .../root/etc/uci-defaults/luci-aliddns | 0 luci-app-aliddns/files/root/usr/sbin/aliddns | 283 + .../luasrc/controller/aliddns.lua | 11 - luci-app-aliddns/po/zh-cn | 1 - luci-app-aliddns/root/usr/sbin/aliddns | 164 - .../share/rpcd/acl.d/luci-app-aliddns.json | 11 - luci-app-aliddns/tools/po2lmo/Makefile | 12 + luci-app-aliddns/tools/po2lmo/src/po2lmo.c | 247 + .../tools/po2lmo/src/template_lmo.c | 328 + .../tools/po2lmo/src/template_lmo.h | 92 + luci-app-aliyundrive-webdav/Makefile | 2 +- .../luasrc/controller/aliyundrive-webdav.lua | 5 +- .../model/cbi/aliyundrive-webdav/client.lua | 7 - .../aliyundrive-webdav_qrcode.htm | 4 +- .../po/zh-cn/aliyundrive-webdav.po | 12 - luci-app-diskman/.github/workflows/build.yml | 1 + .../applications/luci-app-diskman/Makefile | 79 +- .../luci-app-diskman/Makefile.old | 97 + .../luci-app-diskman/luasrc/model/diskman.lua | 14 +- .../luasrc/view/diskman/partition_info.htm | 2 +- .../luci-app-diskman/po/zh-cn/diskman.po | 4 +- .../luci-app-diskman/po/zh-tw/diskman.po | 239 + .../applications/luci-app-diskman/po/zh_Hant | 1 + luci-app-openclash/Makefile | 22 +- .../luasrc/controller/openclash.lua | 194 +- .../model/cbi/openclash/config-overwrite.lua | 601 + .../model/cbi/openclash/config-subscribe.lua | 2 +- .../model/cbi/openclash/custom-dns-edit.lua | 2 +- .../model/cbi/openclash/game-rules-manage.lua | 3 +- .../model/cbi/openclash/groups-config.lua | 2 +- .../model/cbi/openclash/other-rules-edit.lua | 24 +- .../cbi/openclash/rule-providers-manage.lua | 3 +- .../cbi/openclash/rule-providers-settings.lua | 14 +- .../model/cbi/openclash/servers-config.lua | 134 +- .../luasrc/model/cbi/openclash/servers.lua | 16 +- .../luasrc/model/cbi/openclash/settings.lua | 1019 +- .../luasrc/view/openclash/config_editor.htm | 44 +- .../luasrc/view/openclash/debug.htm | 83 +- .../luasrc/view/openclash/dlercloud.htm | 62 +- .../luasrc/view/openclash/input_file_name.htm | 22 +- .../luasrc/view/openclash/myip.htm | 191 +- .../luasrc/view/openclash/ping.htm | 3 - .../luasrc/view/openclash/server_list.htm | 32 - .../luasrc/view/openclash/status.htm | 25 +- .../luasrc/view/openclash/sub_info_show.htm | 79 +- .../luasrc/view/openclash/tblsection.htm | 341 + .../luasrc/view/openclash/tblsection_dns.htm | 307 + .../luasrc/view/openclash/toolbar_show.htm | 56 +- .../luasrc/view/openclash/update.htm | 44 +- .../luasrc/view/openclash/upload.htm | 12 +- .../po/zh-cn/openclash.zh-cn.po | 318 +- luci-app-openclash/root/etc/config/openclash | 16 +- luci-app-openclash/root/etc/init.d/openclash | 1100 +- .../custom/openclash_custom_fake_filter.list | 9 +- .../openclash_custom_fallback_filter.yaml | 4 +- .../custom/openclash_custom_firewall_rules.sh | 10 + .../custom/openclash_custom_overwrite.sh | 69 + .../openclash_sniffing_domain_filter.yaml | 2 +- .../openclash_sniffing_port_filter.yaml | 4 - .../openclash_sniffing_ports_filter.yaml | 12 + .../root/etc/openclash/rule_provider/ChatGPT | 3 + .../root/etc/uci-defaults/luci-openclash | 4 +- .../cfg_servers_address_fake_filter.sh | 13 - .../root/usr/share/openclash/clash_version.sh | 10 +- .../root/usr/share/openclash/openclash.sh | 245 +- .../usr/share/openclash/openclash_chnroute.sh | 28 +- .../usr/share/openclash/openclash_core.sh | 38 +- .../openclash/openclash_custom_domain_dns.sh | 12 +- .../usr/share/openclash/openclash_debug.sh | 36 +- .../share/openclash/openclash_debug_dns.lua | 78 + .../openclash/openclash_download_dashboard.sh | 2 +- .../openclash/openclash_download_rule_list.sh | 20 +- .../usr/share/openclash/openclash_geoip.sh | 14 +- .../usr/share/openclash/openclash_geosite.sh | 14 +- .../usr/share/openclash/openclash_ipdb.sh | 12 +- .../usr/share/openclash/openclash_rule.sh | 32 +- .../openclash/openclash_server_fake_filter.sh | 32 - .../openclash/openclash_streaming_unlock.lua | 70 +- .../usr/share/openclash/openclash_update.sh | 15 +- .../usr/share/openclash/openclash_version.sh | 10 +- .../usr/share/openclash/openclash_watchdog.sh | 95 +- .../root/usr/share/openclash/res/default.yaml | 734 +- .../usr/share/openclash/res/game_rules.list | 35 +- .../root/usr/share/openclash/res/lhie1.yaml | 20 +- .../root/usr/share/openclash/ruby.sh | 2 +- .../ui/dashboard/assets/index-6ac9f125.js | 1 + ...{index.7e15a32d.css => index-7e15a32d.css} | 0 .../ui/dashboard/assets/index.4e943808.js | 1 - .../{logo.b453e72f.png => logo-b453e72f.png} | Bin .../ui/dashboard/assets/vendor-076c6210.js | 102 + .../ui/dashboard/assets/vendor.df6254b9.js | 98 - .../share/openclash/ui/dashboard/index.html | 6 +- .../usr/share/openclash/ui/dashboard/sw.js | 2 +- .../root/usr/share/openclash/yml_change.sh | 280 +- .../usr/share/openclash/yml_groups_get.sh | 48 +- .../usr/share/openclash/yml_groups_set.sh | 1 - .../usr/share/openclash/yml_proxys_get.sh | 128 +- .../usr/share/openclash/yml_proxys_set.sh | 147 +- .../usr/share/openclash/yml_rules_change.sh | 91 +- .../openclash/img/arrow-clockwise-light.svg | 1 + .../resources/openclash/img/eye-light.svg | 1 + .../openclash/img/eye-slash-light.svg | 1 + .../resources/openclash/img/version.svg | 2 +- .../resources/openclash/img/wrench-light.svg | 1 + .../resources/openclash/mode/shell/shell.js | 168 + luci-app-smartdns/Makefile | 18 +- .../luasrc/controller/smartdns.lua | 16 +- .../luasrc/model/cbi/smartdns/smartdns.lua | 96 +- .../luasrc/model/cbi/smartdns/upstream.lua | 19 +- luci-app-smartdns/luasrc/model/smartdns.lua | 2 +- .../luasrc/view/smartdns/smartdns_status.htm | 47 +- luci-app-smartdns/po/zh-cn/smartdns.po | 79 +- .../root/etc/uci-defaults/50_luci-smartdns | 17 +- luci-app-ssr-plus/Makefile | 2 +- .../model/cbi/shadowsocksr/advanced.lua | 1 + .../model/cbi/shadowsocksr/client-config.lua | 14 +- .../luasrc/view/shadowsocksr/ssrurl.htm | 1 + .../root/etc/ssrplus/china_ssr.txt | 239 +- .../root/etc/ssrplus/gfw_list.conf | 44684 ++++++++++------ .../root/etc/ssrplus/netflixip.list | 15 + .../root/etc/uci-defaults/luci-ssr-plus | 1 + .../root/usr/share/shadowsocksr/subscribe.lua | 2 + luci-theme-ifit/Makefile | 9 +- luci-theme-ifit/files/htdocs/css/style.css | 13 +- luci-theme-ifit/files/htdocs/js/script.js | 3 +- luci-theme-ifit/files/templates/footer.htm | 3 +- luci-theme-ifit/files/templates/header.htm | 3 +- .../files/htdocs/css/style.css | 3 +- mosdns/patches/001-go1.20.patch | 496 + naiveproxy/Makefile | 16 +- sing-box/Makefile | 125 +- sing-box/files/config.json.example | 96 +- sing-box/files/sing-box.init | 4 +- smartdns/Makefile | 27 +- v2ray-core/Makefile | 4 +- v2ray-plugin/Makefile | 4 +- v2raya/Makefile | 2 +- .../010-fixed-for-Docker-Compose.patch | 46 - v2raya/patches/011-cleaned-up.patch | 37 - v2raya/patches/012-improved.patch | 38 - ...-interface-ppp-to-avoid-to-break-net.patch | 4 +- xray-core/Makefile | 4 +- xray-plugin/Makefile | 4 +- 202 files changed, 37635 insertions(+), 20727 deletions(-) delete mode 100644 GoQuiet/Makefile delete mode 100644 chinadns/Makefile mode change 100644 => 100755 luci-app-adguardhome/Makefile create mode 100755 luci-app-adguardhome/README.md mode change 100644 => 100755 luci-app-adguardhome/luasrc/controller/AdGuardHome.lua mode change 100644 => 100755 luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua mode change 100644 => 100755 luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua mode change 100644 => 100755 luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua mode change 100644 => 100755 luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm mode change 100644 => 100755 luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm mode change 100644 => 100755 luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm mode change 100644 => 100755 luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm mode change 100644 => 100755 luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm delete mode 120000 luci-app-adguardhome/po/zh-cn create mode 100755 luci-app-adguardhome/po/zh-cn/AdGuardHome.po create mode 100644 luci-app-adguardhome/po/zh_Hans/AdGuardHome.po delete mode 100644 luci-app-adguardhome/po/zh_Hans/adguardhome.po mode change 100644 => 100755 luci-app-adguardhome/root/etc/config/AdGuardHome mode change 100644 => 100755 luci-app-adguardhome/root/etc/init.d/AdGuardHome mode change 100644 => 100755 luci-app-adguardhome/root/etc/uci-defaults/40_luci-AdGuardHome mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/AdGuardHome_template.yaml mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/addhost.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/firewall.start mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/getsyslog.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/gfw2adg.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/links.txt mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/tailto.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/update_core.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/waitnet.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/AdGuardHome/watchconfig.sh mode change 100644 => 100755 luci-app-adguardhome/root/usr/share/rpcd/acl.d/luci-app-adguardhome.json mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldcode.js mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.css mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.js mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/indent-fold.js mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.css mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.js mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/mode/yaml/yaml.js mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/codemirror/theme/dracula.css mode change 100644 => 100755 luci-app-adguardhome/root/www/luci-static/resources/twin-bcrypt.min.js create mode 100644 luci-app-aliddns/LICENSE create mode 100644 luci-app-aliddns/README.md create mode 100644 luci-app-aliddns/files/luci/controller/aliddns.lua rename luci-app-aliddns/{po/zh_Hans/aliddns.po => files/luci/i18n/aliddns.zh-cn.po} (77%) rename luci-app-aliddns/{luasrc => files/luci}/model/cbi/aliddns.lua (82%) rename luci-app-aliddns/{ => files}/root/etc/config/aliddns (100%) rename luci-app-aliddns/{ => files}/root/etc/init.d/aliddns (74%) mode change 100755 => 100644 rename luci-app-aliddns/{ => files}/root/etc/uci-defaults/luci-aliddns (100%) mode change 100755 => 100644 create mode 100755 luci-app-aliddns/files/root/usr/sbin/aliddns delete mode 100644 luci-app-aliddns/luasrc/controller/aliddns.lua delete mode 120000 luci-app-aliddns/po/zh-cn delete mode 100755 luci-app-aliddns/root/usr/sbin/aliddns delete mode 100644 luci-app-aliddns/root/usr/share/rpcd/acl.d/luci-app-aliddns.json create mode 100644 luci-app-aliddns/tools/po2lmo/Makefile create mode 100644 luci-app-aliddns/tools/po2lmo/src/po2lmo.c create mode 100644 luci-app-aliddns/tools/po2lmo/src/template_lmo.c create mode 100644 luci-app-aliddns/tools/po2lmo/src/template_lmo.h create mode 100644 luci-app-diskman/applications/luci-app-diskman/Makefile.old create mode 100644 luci-app-diskman/applications/luci-app-diskman/po/zh-tw/diskman.po create mode 120000 luci-app-diskman/applications/luci-app-diskman/po/zh_Hant create mode 100644 luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua delete mode 100644 luci-app-openclash/luasrc/view/openclash/ping.htm delete mode 100644 luci-app-openclash/luasrc/view/openclash/server_list.htm create mode 100644 luci-app-openclash/luasrc/view/openclash/tblsection.htm create mode 100644 luci-app-openclash/luasrc/view/openclash/tblsection_dns.htm create mode 100644 luci-app-openclash/root/etc/openclash/custom/openclash_custom_firewall_rules.sh create mode 100644 luci-app-openclash/root/etc/openclash/custom/openclash_custom_overwrite.sh delete mode 100644 luci-app-openclash/root/etc/openclash/custom/openclash_sniffing_port_filter.yaml create mode 100644 luci-app-openclash/root/etc/openclash/custom/openclash_sniffing_ports_filter.yaml create mode 100644 luci-app-openclash/root/etc/openclash/rule_provider/ChatGPT delete mode 100644 luci-app-openclash/root/usr/share/openclash/cfg_servers_address_fake_filter.sh create mode 100644 luci-app-openclash/root/usr/share/openclash/openclash_debug_dns.lua delete mode 100644 luci-app-openclash/root/usr/share/openclash/openclash_server_fake_filter.sh create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/index-6ac9f125.js rename luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/{index.7e15a32d.css => index-7e15a32d.css} (100%) delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/index.4e943808.js rename luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/{logo.b453e72f.png => logo-b453e72f.png} (100%) create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/vendor-076c6210.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/dashboard/assets/vendor.df6254b9.js create mode 100644 luci-app-openclash/root/www/luci-static/resources/openclash/img/arrow-clockwise-light.svg create mode 100644 luci-app-openclash/root/www/luci-static/resources/openclash/img/eye-light.svg create mode 100644 luci-app-openclash/root/www/luci-static/resources/openclash/img/eye-slash-light.svg create mode 100644 luci-app-openclash/root/www/luci-static/resources/openclash/img/wrench-light.svg create mode 100644 luci-app-openclash/root/www/luci-static/resources/openclash/mode/shell/shell.js create mode 100644 mosdns/patches/001-go1.20.patch delete mode 100644 v2raya/patches/010-fixed-for-Docker-Compose.patch delete mode 100644 v2raya/patches/011-cleaned-up.patch delete mode 100644 v2raya/patches/012-improved.patch diff --git a/GoQuiet/Makefile b/GoQuiet/Makefile deleted file mode 100644 index 0887585ce..000000000 --- a/GoQuiet/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# -# Copyright (C) 2015-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v3. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=GoQuiet -PKG_VERSION:=1.2.2 -PKG_RELEASE:=$(AUTORELEASE) - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/cbeuw/GoQuiet.git -PKG_SOURCE_VERSION:=013cdfdf72000dcd4691799c37a0cf960ab4c82f -PKG_MIRROR_HASH:=c9c97463e5286e8ad10de5e86512b98f60672235c47cfd9696188a16496fc56c - -PKG_LICENSE:=GPL-3.0 -PKG_LICENSE_FILES:=LICENSE - -PKG_BUILD_DEPENDS:=golang/host -PKG_BUILD_PARALLEL:=1 -PKG_USE_MIPS16:=0 - -GO_PKG:=github.com/cbeuw/GoQuiet -GO_PKG_LDFLAGS_X:=main.version=$(PKG_VERSION) - -include $(INCLUDE_DIR)/package.mk -include ../../lang/golang/golang-package.mk - -define gq/templates - define Package/$(1) - SECTION:=net - CATEGORY:=Network - SUBMENU:=Web Servers/Proxies - TITLE:=A Shadowsocks obfuscation plugin ($(1)) - DEPENDS:=$$(GO_ARCH_DEPENDS) +libpthread - URL:=https://github.com/cbeuw/GoQuiet - endef - - define Package/$(1)/description - A Shadowsocks plugin that obfuscates the traffic as normal HTTPS traffic to non-blocked - websites through domain fronting and disguises the proxy server as a normal webserver. - - This package contains the $(1). - endef - - define Package/$(1)/install - $$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR)) - - $$(INSTALL_DIR) $$(1)/usr/bin - $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/ - endef -endef - -GO_PKG_BUILD_VARS += GO111MODULE=auto - -GQ_COMPONENTS:=gq-client gq-server - -$(foreach component,$(GQ_COMPONENTS), \ - $(eval $(call gq/templates,$(component))) \ - $(eval $(call GoBinPackage,$(component))) \ - $(eval $(call BuildPackage,$(component))) \ -) diff --git a/adguardhome/Makefile b/adguardhome/Makefile index 51d92bd09..328c1329e 100644 --- a/adguardhome/Makefile +++ b/adguardhome/Makefile @@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adguardhome -PKG_VERSION:=0.107.21 +PKG_VERSION:=0.107.25 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome -PKG_MIRROR_HASH:=b7a5e666471f44e405088c5719c6bd030058a80ede1832c246cd70c10dc3993e +PKG_MIRROR_HASH:=609e991f0d03c1541e02fc656f8abea686e64ed350729b85ea87fe25640dd03a PKG_LICENSE:=GPL-3.0-only PKG_LICENSE_FILES:=LICENSE.txt @@ -56,7 +56,7 @@ endef define Build/Compile ( \ pushd $(PKG_BUILD_DIR) ; \ - make js-deps js-build ; \ + NODE_OPTIONS=--openssl-legacy-provider make js-deps js-build ; \ popd ; \ $(call GoPackage/Build/Compile) ; \ ) diff --git a/aliyundrive-webdav/Makefile b/aliyundrive-webdav/Makefile index e575e3611..e6a074b8b 100644 --- a/aliyundrive-webdav/Makefile +++ b/aliyundrive-webdav/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=aliyundrive-webdav -PKG_VERSION:=1.10.6 +PKG_VERSION:=2.0.4 PKG_RELEASE:=1 PKG_LICENSE:=MIT diff --git a/aliyundrive-webdav/files/aliyundrive-webdav.config b/aliyundrive-webdav/files/aliyundrive-webdav.config index 76f21d941..c1626dbcf 100644 --- a/aliyundrive-webdav/files/aliyundrive-webdav.config +++ b/aliyundrive-webdav/files/aliyundrive-webdav.config @@ -12,10 +12,8 @@ config server option cache_ttl '600' option root '/' option no_trash '0' - option domain_id '' option read_only '0' option tls_cert '' option tls_key '' option skip_upload_same_size '0' option prefer_http_download '0' - option no_redirect '0' diff --git a/aliyundrive-webdav/files/aliyundrive-webdav.init b/aliyundrive-webdav/files/aliyundrive-webdav.init index 69fa5b2fb..65b3a67a8 100755 --- a/aliyundrive-webdav/files/aliyundrive-webdav.init +++ b/aliyundrive-webdav/files/aliyundrive-webdav.init @@ -26,50 +26,38 @@ start_service() { local host=$(uci_get_by_type server host 127.0.0.1) local port=$(uci_get_by_type server port 8080) local root=$(uci_get_by_type server root /) - local domain_id=$(uci_get_by_type server domain_id) local tls_cert=$(uci_get_by_type server tls_cert) local tls_key=$(uci_get_by_type server tls_key) local extra_options="--auto-index" - if [[ ! -z "$domain_id" ]]; then - extra_options="$extra_options --domain-id $domain_id" - else - case "$(uci_get_by_type server no_trash 0)" in - 1|on|true|yes|enabled) - extra_options="$extra_options --no-trash" - ;; - *) ;; - esac - - case "$(uci_get_by_type server read_only 0)" in - 1|on|true|yes|enabled) - extra_options="$extra_options --read-only" - ;; - *) ;; - esac + case "$(uci_get_by_type server no_trash 0)" in + 1|on|true|yes|enabled) + extra_options="$extra_options --no-trash" + ;; + *) ;; + esac - case "$(uci_get_by_type server skip_upload_same_size 0)" in - 1|on|true|yes|enabled) - extra_options="$extra_options --skip-upload-same-size" - ;; - *) ;; - esac + case "$(uci_get_by_type server read_only 0)" in + 1|on|true|yes|enabled) + extra_options="$extra_options --read-only" + ;; + *) ;; + esac - case "$(uci_get_by_type server prefer_http_download 0)" in - 1|on|true|yes|enabled) - extra_options="$extra_options --prefer-http-download" - ;; - *) ;; - esac + case "$(uci_get_by_type server skip_upload_same_size 0)" in + 1|on|true|yes|enabled) + extra_options="$extra_options --skip-upload-same-size" + ;; + *) ;; + esac - case "$(uci_get_by_type server no_redirect 0)" in - 1|on|true|yes|enabled) - extra_options="$extra_options --no-redirect" - ;; - *) ;; - esac - fi + case "$(uci_get_by_type server prefer_http_download 0)" in + 1|on|true|yes|enabled) + extra_options="$extra_options --prefer-http-download" + ;; + *) ;; + esac if [[ ! -z "$tls_cert" && ! -z "$tls_key" ]]; then extra_options="$extra_options --tls-cert $tls_cert --tls-key $tls_key" diff --git a/brook/Makefile b/brook/Makefile index e5169193e..8c3cafac3 100644 --- a/brook/Makefile +++ b/brook/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=brook -PKG_VERSION:=20230101 +PKG_VERSION:=20230122 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/txthinking/brook/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=d131b408102ef6865c64a7cf9d7417308ef3109c79dc627e01bfd665cf80e47c +PKG_HASH:=52643df51144b4b1afbacb51156f92ba61adbcff77dd8f76e3278ce70644f237 PKG_MAINTAINER:=Tianling Shen PKG_LICENSE:=GPL-3.0 diff --git a/chinadns-ng/Makefile b/chinadns-ng/Makefile index 6208a920f..1d1488d6b 100644 --- a/chinadns-ng/Makefile +++ b/chinadns-ng/Makefile @@ -1,18 +1,16 @@ # SPDX-License-Identifier: GPL-3.0-only # -# Copyright (C) 2021 ImmortalWrt.org +# Copyright (C) 2023 ImmortalWrt.org include $(TOPDIR)/rules.mk PKG_NAME:=chinadns-ng -PKG_VERSION:=1.0-beta.25 +PKG_VERSION:=2023.03.08 PKG_RELEASE:=1 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/zfl9/chinadns-ng.git -PKG_SOURCE_DATE:=2021-05-08 -PKG_SOURCE_VERSION:=14cc6348d67b09cae37d9bce554c89c2c0e0b265 -PKG_MIRROR_HASH:=3b66fc0888d9488e3b8e39df3016d51fae1b43325d292381e94aa3c7d2318282 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/zfl9/chinadns-ng/tar.gz/$(PKG_VERSION)? +PKG_HASH:=9404a20c7241f4102dfa3fc197877ddbdb38f87d6044c98f62256078895732df PKG_LICENSE:=AGPL-3.0-only PKG_LICENSE_FILES:=LICENSE diff --git a/chinadns/Makefile b/chinadns/Makefile deleted file mode 100644 index 6119d8e43..000000000 --- a/chinadns/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-only -# -# Copyright (C) 2014-2018 Jian Chang -# Copyright (C) 2021 ImmortalWrt.org - -include $(TOPDIR)/rules.mk - -PKG_NAME:=chinadns -PKG_VERSION:=1.3.3 -PKG_RELEASE:=$(AUTORELEASE) - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/aa65535/ChinaDNS/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=74e53af32f8aa2ca7e63697385f12d89a06c486641556cfd8bc3f085d87e55ad -PKG_BUILD_DIR:=$(BUILD_DIR)/ChinaDNS-$(PKG_VERSION) - -PKG_LICENSE:=GPL-3.0-only -PKG_LICENSE_FILES:=LICENSE -PKG_MAINTAINER:=Jian Chang - -PKG_FIXUP:=autoreconf -PKG_BUILD_PARALLEL:=1 -PKG_INSTALL:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/chinadns - SECTION:=net - CATEGORY:=Network - SUBMENU:=IP Addresses and Names - TITLE:=Protect yourself against DNS poisoning in China. - URL:=https://github.com/shadowsocks/ChinaDNS -endef - -define Package/chinadns/conffiles -/usr/share/chinadns/chnroute.txt -/usr/share/chinadns/iplist.txt -endef - -define Package/chinadns/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chinadns $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/usr/share/chinadns - $(CP) $(PKG_INSTALL_DIR)/usr/share/chnroute.txt $(1)/usr/share/chinadns/ - $(CP) $(PKG_INSTALL_DIR)/usr/share/iplist.txt $(1)/usr/share/chinadns/ -endef - -$(eval $(call BuildPackage,chinadns)) diff --git a/ddns-scripts_aliyun/update_aliyun_com.sh b/ddns-scripts_aliyun/update_aliyun_com.sh index 8bfeeb576..0d109b8e3 100755 --- a/ddns-scripts_aliyun/update_aliyun_com.sh +++ b/ddns-scripts_aliyun/update_aliyun_com.sh @@ -199,7 +199,7 @@ enable_domain() { # 获取子域名解析记录列表 describe_domain() { local count value; local ret=0 - aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" "DomainName=${__DOMAIN}" || write_log 14 "服务器通信失败" + aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" "DomainName=${__DOMAIN}" "Line=default" || write_log 14 "服务器通信失败" write_log 7 "获取到解析记录: $(cat "$DATFILE" 2> /dev/null)" json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1 json_get_var count "TotalCount" diff --git a/gost/Makefile b/gost/Makefile index cbd5849fd..16cfa0fee 100644 --- a/gost/Makefile +++ b/gost/Makefile @@ -13,7 +13,7 @@ PKG_SOURCE_URL:=https://codeload.github.com/ginuerzh/gost/tar.gz/v$(PKG_VERSION) PKG_HASH:=aa3211282fce695584795fac20da77a2ac68d3e08602118afb0747bd64c1eac4 PKG_LICENSE:=MIT -PKG_LICENSE_FILE:=LICENSE +PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Tianling Shen PKG_BUILD_DEPENDS:=golang/host diff --git a/hysteria/Makefile b/hysteria/Makefile index 6510350a2..711cd40fe 100644 --- a/hysteria/Makefile +++ b/hysteria/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hysteria -PKG_VERSION:=1.3.2 +PKG_VERSION:=1.3.3 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/apernet/hysteria/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=1014287f6cca7cb3fa0e4ad36b33cf8f28c800fb9f99d431997036baef8240fa +PKG_HASH:=11ca9df98a8a17a348dcdac92a19fef0e25dde8e536a9778705f765ac208a202 PKG_LICENSE:=MIT PKG_LICENSE_FILE:=LICENSE diff --git a/lua-neturl/Makefile b/lua-neturl/Makefile index 5b661bd0c..0f6b16f35 100644 --- a/lua-neturl/Makefile +++ b/lua-neturl/Makefile @@ -1,12 +1,12 @@ # SPDX-License-Identifier: GPL-3.0-only # -# Copyright (C) 2022 ImmortalWrt.org +# Copyright (C) 2022-2023 ImmortalWrt.org include $(TOPDIR)/rules.mk PKG_NAME:=neturl PKG_VERSION:=1.1-1 -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/golgote/neturl/tar.gz/v$(PKG_VERSION)? diff --git a/lua-neturl/patches/010-userinfo-regex.patch b/lua-neturl/patches/010-userinfo-regex.patch index ad8946a96..9dbd91ccf 100644 --- a/lua-neturl/patches/010-userinfo-regex.patch +++ b/lua-neturl/patches/010-userinfo-regex.patch @@ -9,3 +9,12 @@ self.user = userinfo else -- incorrect userinfo +@@ -369,7 +369,7 @@ function M.parse(url) + comp.fragment = v + return '' + end) +- url =url:gsub('^([%w][%w%+%-%.]*)%:', function(v) ++ url =url:gsub('^([%w][%w%+%-%_%.]*)%:', function(v) + comp.scheme = v:lower() + return '' + end) diff --git a/luci-app-adguardhome/Makefile b/luci-app-adguardhome/Makefile old mode 100644 new mode 100755 index db03e8acb..f0bbf548e --- a/luci-app-adguardhome/Makefile +++ b/luci-app-adguardhome/Makefile @@ -1,30 +1,46 @@ -# Copyright (C) 2018-2019 Lienol -# -# This is free software, licensed under the Apache License, Version 2.0 . -# +# Copyright (C) 2020-2023 Hyy2001X include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-adguardhome -PKG_MAINTAINER:= +PKG_VERSION:=1.0 +PKG_RELEASE:=20230123 -LUCI_TITLE:=LuCI app for AdGuardHome -LUCI_PKGARCH:=all -LUCI_DEPENDS:=+ca-certs +curl +wget-ssl +PACKAGE_$(PKG_NAME)_INCLUDE_binary:adguardhome -LUCI_DESCRIPTION:=LuCI support for AdGuardHome +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) -define Package/$(PKG_NAME)/config -config PACKAGE_$(PKG_NAME)_INCLUDE_binary - bool "Include Binary File" - default y +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-adguardhome + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=LuCI support for AdGuard Home [Modified by Hyy2001] + PKGARCH:=all + DEPENDS:=+!wget-ssl&&!curl:wget-ssl +xz-utils +xz endef -PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_binary +define Package/luci-app-adguardhome/description + LuCI support for AdGuard Home +endef + +define Build/Prepare +endef + +define Build/Compile +endef define Package/luci-app-adguardhome/conffiles /usr/share/AdGuardHome/links.txt /etc/config/AdGuardHome -/etc/AdGuardHome.yaml +endef + +define Package/luci-app-adguardhome/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + cp -pR ./luasrc/* $(1)/usr/lib/lua/luci + $(INSTALL_DIR) $(1)/ + cp -pR ./root/* $(1)/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + po2lmo ./po/zh-cn/AdGuardHome.po $(1)/usr/lib/lua/luci/i18n/AdGuardHome.zh-cn.lmo endef define Package/luci-app-adguardhome/postinst @@ -52,6 +68,4 @@ fi exit 0 endef -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature +$(eval $(call BuildPackage,luci-app-adguardhome)) diff --git a/luci-app-adguardhome/README.md b/luci-app-adguardhome/README.md new file mode 100755 index 000000000..cb9e1090d --- /dev/null +++ b/luci-app-adguardhome/README.md @@ -0,0 +1,17 @@ +# luci-app-adguardhome + +## 修改内容 + + - 修复 本地 AdGuardHome 核心文件版本号获取 + + - 优化 AdGuardHome 核心更新以及UPX压缩流程 + + - 汉化 AdGuardHome 核心更新时显示的内容 + + - 优化 默认模板、DNS 服务器以及 DNS 封锁清单 + +## Based on + + - [rufengsuixing](https://github.com/rufengsuixing/luci-app-adguardhome) + + - [Lienol](https://github.com/Lienol) diff --git a/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua b/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua old mode 100644 new mode 100755 index e9d37a766..4ebd4794c --- a/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua +++ b/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua @@ -1,130 +1,130 @@ -module("luci.controller.AdGuardHome",package.seeall) -local fs=require"nixio.fs" -local http=require"luci.http" -local uci=require"luci.model.uci".cursor() +module("luci.controller.AdGuardHome", package.seeall) +local fs = require "nixio.fs" +local http = require "luci.http" +local uci = require"luci.model.uci".cursor() function index() -local page = entry({"admin", "services", "AdGuardHome"},alias("admin", "services", "AdGuardHome", "base"),_("AdGuard Home")) -page.order = 10 -page.dependent = true -page.acl_depends = { "luci-app-adguardhome" } -entry({"admin","services","AdGuardHome","base"},cbi("AdGuardHome/base"),_("Base Setting"),1).leaf = true -entry({"admin","services","AdGuardHome","log"},form("AdGuardHome/log"),_("Log"),2).leaf = true -entry({"admin","services","AdGuardHome","manual"},cbi("AdGuardHome/manual"),_("Manual Config"),3).leaf = true -entry({"admin","services","AdGuardHome","status"},call("act_status")).leaf=true -entry({"admin", "services", "AdGuardHome", "check"}, call("check_update")) -entry({"admin", "services", "AdGuardHome", "doupdate"}, call("do_update")) -entry({"admin", "services", "AdGuardHome", "getlog"}, call("get_log")) -entry({"admin", "services", "AdGuardHome", "dodellog"}, call("do_dellog")) -entry({"admin", "services", "AdGuardHome", "reloadconfig"}, call("reload_config")) -entry({"admin", "services", "AdGuardHome", "gettemplateconfig"}, call("get_template_config")) + entry({"admin", "services", "AdGuardHome"}, alias("admin", "services", "AdGuardHome", "base"), _("AdGuard Home"), 10).dependent = true + entry({"admin", "services", "AdGuardHome", "base"}, cbi("AdGuardHome/base"), _("Base Setting"), 1).leaf = true + entry({"admin", "services", "AdGuardHome", "log"}, form("AdGuardHome/log"), _("Log"), 2).leaf = true + entry({"admin", "services", "AdGuardHome", "manual"}, cbi("AdGuardHome/manual"), _("Manual Config"), 3).leaf = true + entry({"admin", "services", "AdGuardHome", "status"}, call("act_status")).leaf = true + entry({"admin", "services", "AdGuardHome", "check"}, call("check_update")) + entry({"admin", "services", "AdGuardHome", "doupdate"}, call("do_update")) + entry({"admin", "services", "AdGuardHome", "getlog"}, call("get_log")) + entry({"admin", "services", "AdGuardHome", "dodellog"}, call("do_dellog")) + entry({"admin", "services", "AdGuardHome", "reloadconfig"}, call("reload_config")) + entry({"admin", "services", "AdGuardHome", "gettemplateconfig"}, call("get_template_config")) end + function get_template_config() - local b - local d="" - for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do - b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$") - if (b~=nil) then - d=d.." - "..b.."\n" - end + local b + local d = "" + local file = "/tmp/resolv.conf.d/resolv.conf.auto" + if not fs.access(file) then + file = "/tmp/resolv.conf.auto" end - local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+") - local tbl = {} - local a="" - while (1) do - a=f:read("*l") - if (a=="#bootstrap_dns") then - a=d - elseif (a=="#upstream_dns") then - a=d - elseif (a==nil) then - break - end - table.insert(tbl, a) - end - f:close() - http.prepare_content("text/plain; charset=utf-8") - http.write(table.concat(tbl, "\n")) + for cnt in io.lines(file) do + b = string.match(cnt, "^[^#]*nameserver%s+([^%s]+)$") + if (b ~= nil) then d = d .. " - " .. b .. "\n" end + end + local f = io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+") + local tbl = {} + local a = "" + while (1) do + a = f:read("*l") + if (a == "#bootstrap_dns") then + a = d + elseif (a == "#upstream_dns") then + a = d + elseif (a == nil) then + break + end + table.insert(tbl, a) + end + f:close() + http.prepare_content("text/plain; charset=utf-8") + http.write(table.concat(tbl, "\n")) end + function reload_config() - fs.remove("/tmp/AdGuardHometmpconfig.yaml") - http.prepare_content("application/json") - http.write('') + fs.remove("/tmp/AdGuardHometmpconfig.yaml") + http.prepare_content("application/json") + http.write('') end + function act_status() - local e={} - local binpath=uci:get("AdGuardHome","AdGuardHome","binpath") - e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0 - e.redirect=(fs.readfile("/var/run/AdGredir")=="1") - http.prepare_content("application/json") - http.write_json(e) + local e = {} + local binpath = uci:get("AdGuardHome", "AdGuardHome", "binpath") + e.running = luci.sys.call("pgrep " .. binpath .. " >/dev/null") == 0 + e.redirect = (fs.readfile("/var/run/AdGredir") == "1") + http.prepare_content("application/json") + http.write_json(e) end + function do_update() - fs.writefile("/var/run/lucilogpos","0") - http.prepare_content("application/json") - http.write('') - local arg - if luci.http.formvalue("force") == "1" then - arg="force" - else - arg="" - end - if fs.access("/var/run/update_core") then - if arg=="force" then - luci.sys.exec("kill $(pgrep /usr/share/AdGuardHome/update_core.sh) ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &") - end - else - luci.sys.exec("sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &") - end + fs.writefile("/var/run/lucilogpos", "0") + http.prepare_content("application/json") + http.write('') + local arg + if luci.http.formvalue("force") == "1" then + arg = "force" + else + arg = "" + end + if fs.access("/var/run/update_core") then + if arg == "force" then + luci.sys.exec("kill $(pgrep /usr/share/AdGuardHome/update_core.sh) ; sh /usr/share/AdGuardHome/update_core.sh " .. arg .. " >/tmp/AdGuardHome_update.log 2>&1 &") + end + else + luci.sys.exec("sh /usr/share/AdGuardHome/update_core.sh " .. arg .. " >/tmp/AdGuardHome_update.log 2>&1 &") + end end + function get_log() - local logfile=uci:get("AdGuardHome","AdGuardHome","logfile") - if (logfile==nil) then - http.write("no log available\n") - return - elseif (logfile=="syslog") then - if not fs.access("/var/run/AdGuardHomesyslog") then - luci.sys.exec("(/usr/share/AdGuardHome/getsyslog.sh &); sleep 1;") - end - logfile="/tmp/AdGuardHometmp.log" - fs.writefile("/var/run/AdGuardHomesyslog","1") - elseif not fs.access(logfile) then - http.write("") - return - end - http.prepare_content("text/plain; charset=utf-8") - local fdp - if fs.access("/var/run/lucilogreload") then - fdp=0 - fs.remove("/var/run/lucilogreload") - else - fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0 - end - local f=io.open(logfile, "r+") - f:seek("set",fdp) - local a=f:read(2048000) or "" - fdp=f:seek() - fs.writefile("/var/run/lucilogpos",tostring(fdp)) - f:close() - http.write(a) + local logfile = uci:get("AdGuardHome", "AdGuardHome", "logfile") + if (logfile == nil) then + http.write("no log available\n") + return + elseif (logfile == "syslog") then + if not fs.access("/var/run/AdGuardHomesyslog") then + luci.sys.exec("(/usr/share/AdGuardHome/getsyslog.sh &); sleep 1;") + end + logfile = "/tmp/AdGuardHometmp.log" + fs.writefile("/var/run/AdGuardHomesyslog", "1") + elseif not fs.access(logfile) then + http.write("") + return + end + http.prepare_content("text/plain; charset=utf-8") + local fdp = tonumber(fs.readfile("/var/run/lucilogpos")) or 0 + local f = io.open(logfile, "r+") + f:seek("set", fdp) + local a = f:read(2048000) or "" + fdp = f:seek() + fs.writefile("/var/run/lucilogpos", tostring(fdp)) + f:close() + http.write(a) end + function do_dellog() - local logfile=uci:get("AdGuardHome","AdGuardHome","logfile") - fs.writefile(logfile,"") - http.prepare_content("application/json") - http.write('') + local logfile = uci:get("AdGuardHome", "AdGuardHome", "logfile") + fs.writefile(logfile, "") + http.prepare_content("application/json") + http.write('') end + function check_update() - http.prepare_content("text/plain; charset=utf-8") - local fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0 - local f=io.open("/tmp/AdGuardHome_update.log", "r+") - f:seek("set",fdp) - local a=f:read(2048000) or "" - fdp=f:seek() - fs.writefile("/var/run/lucilogpos",tostring(fdp)) - f:close() -if fs.access("/var/run/update_core") then - http.write(a) -else - http.write(a.."\0") -end + http.prepare_content("text/plain; charset=utf-8") + local fdp = tonumber(fs.readfile("/var/run/lucilogpos")) or 0 + local f = io.open("/tmp/AdGuardHome_update.log", "r+") + f:seek("set", fdp) + local a = f:read(2048000) or "" + fdp = f:seek() + fs.writefile("/var/run/lucilogpos", tostring(fdp)) + f:close() + if fs.access("/var/run/update_core") then + http.write(a) + else + http.write(a .. "\0") + end end diff --git a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua old mode 100644 new mode 100755 index 6896b61ef..1b7e50de0 --- a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua +++ b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua @@ -1,89 +1,100 @@ require("luci.sys") require("luci.util") require("io") -local m,s,o,o1 -local fs=require"nixio.fs" -local uci=require"luci.model.uci".cursor() -local configpath=uci:get("AdGuardHome","AdGuardHome","configpath") or "/etc/AdGuardHome.yaml" -local binpath=uci:get("AdGuardHome","AdGuardHome","binpath") or "/usr/bin/AdGuardHome" -httpport=uci:get("AdGuardHome","AdGuardHome","httpport") or "3000" +local m, s, o, o1 +local fs = require "nixio.fs" +local uci = require"luci.model.uci".cursor() +local configpath = uci:get("AdGuardHome", "AdGuardHome", "configpath") or "/etc/config/AdGuardHome.yaml" +local binpath = uci:get("AdGuardHome", "AdGuardHome", "binpath") or "/usr/bin/AdGuardHome/AdGuardHome" +httpport = uci:get("AdGuardHome", "AdGuardHome", "httpport") or "3000" + m = Map("AdGuardHome", "AdGuard Home") m.description = translate("Free and open source, powerful network-wide ads & trackers blocking DNS server.") -m:section(SimpleSection).template = "AdGuardHome/AdGuardHome_status" +m:section(SimpleSection).template = "AdGuardHome/AdGuardHome_status" s = m:section(TypedSection, "AdGuardHome") -s.anonymous=true -s.addremove=false +s.anonymous = true +s.addremove = false + ---- enable o = s:option(Flag, "enabled", translate("Enable")) o.default = 0 o.optional = false + ---- httpport -o =s:option(Value,"httpport",translate("Browser management port")) -o.placeholder=3000 -o.default=3000 -o.datatype="port" +o = s:option(Value, "httpport", translate("Browser management port")) +o.placeholder = 3000 +o.default = 3000 +o.datatype = "port" o.optional = false -o.description = translate("") +o.description = translate("") + ---- update warning not safe -local binmtime=uci:get("AdGuardHome","AdGuardHome","binmtime") or "0" -local e="" -if not fs.access(configpath) then - e=e.." "..translate("no config") -end +local binmtime = uci:get("AdGuardHome", "AdGuardHome", "binmtime") or "0" +local e = "" +if not fs.access(configpath) then e = e .. " " .. translate("no config") end if not fs.access(binpath) then - e=e.." "..translate("no core") + e = e .. " " .. translate("no core") else - local version=uci:get("AdGuardHome","AdGuardHome","version") - local testtime=fs.stat(binpath,"mtime") - if testtime~=tonumber(binmtime) or version==nil then - local tmp=luci.sys.exec(binpath.." --version | grep -m 1 -E 'v[0-9.]+' -o ") - version=string.sub(tmp, 1) - if version=="" then version="core error" end - uci:set("AdGuardHome","AdGuardHome","version",version) - uci:set("AdGuardHome","AdGuardHome","binmtime",testtime) - uci:save("AdGuardHome") - end - e=version..e + local version = uci:get("AdGuardHome", "AdGuardHome", "version") + local testtime = fs.stat(binpath, "mtime") + if testtime ~= tonumber(binmtime) or version == nil then + -- local tmp=luci.sys.exec(binpath.." -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o") + -- version=string.sub(tmp, 1, -2) + version = luci.sys.exec(string.format("echo -n $(%s --version 2>&1 | awk -F 'version ' '{print $2}' | awk -F ',' '{print $1}')", binpath)) + if version == "" then version = "core error" end + uci:set("AdGuardHome", "AdGuardHome", "version", version) + uci:set("AdGuardHome", "AdGuardHome", "binmtime", testtime) + uci:commit("AdGuardHome") + end + e = version .. e end -o=s:option(Button,"restart",translate("Update")) -o.inputtitle=translate("Update core version") + +o = s:option(ListValue, "core_version", translate("Core Version")) +o:value("latest", translate("Latest Version")) +o:value("beta", translate("Beta Version")) +o.default = "latest" + +o = s:option(Button, "restart", translate("Upgrade Core")) +o.inputtitle = translate("Update core version") o.template = "AdGuardHome/AdGuardHome_check" -o.showfastconfig=(not fs.access(configpath)) -o.description=string.format(translate("core version:").."%s ",e) +o.showfastconfig = (not fs.access(configpath)) +o.description = string.format(translate("Current core version:") .. "%s ", e) + ---- port warning not safe -local port=luci.sys.exec("awk '/ port:/{printf($2);exit;}' "..configpath.." 2>nul") -if (port=="") then port="?" end +local port = luci.sys.exec("awk '/ port:/{printf($2);exit;}' " .. configpath .. " 2>nul") +if (port == "") then port = "?" end + ---- Redirect -o = s:option(ListValue, "redirect", port..translate("Redirect"), translate("AdGuardHome redirect mode")) +o = s:option(ListValue, "redirect", port .. translate("Redirect"), translate("AdGuardHome redirect mode")) o.placeholder = "none" o:value("none", translate("none")) o:value("dnsmasq-upstream", translate("Run as dnsmasq upstream server")) o:value("redirect", translate("Redirect 53 port to AdGuardHome")) o:value("exchange", translate("Use port 53 replace dnsmasq")) -o.default = "none" +o.default = "none" o.optional = true + ---- bin path o = s:option(Value, "binpath", translate("Bin Path"), translate("AdGuardHome Bin path if no bin will auto download")) -o.default = "/usr/bin/AdGuardHome" -o.datatype = "string" +o.default = "/usr/bin/AdGuardHome/AdGuardHome" +o.datatype = "string" o.optional = false -o.rmempty=false -o.validate=function(self, value) -if value=="" then return nil end -if fs.stat(value,"type")=="dir" then - fs.rmdir(value) -end -if fs.stat(value,"type")=="dir" then - if (m.message) then - m.message =m.message.."\nerror!bin path is a dir" - else - m.message ="error!bin path is a dir" - end - return nil -end -return value +o.rmempty = false +o.validate = function(self, value) + if value == "" then return nil end + if fs.stat(value, "type") == "dir" then fs.rmdir(value) end + if fs.stat(value, "type") == "dir" then + if (m.message) then + m.message = m.message .. "\nerror!bin path is a dir" + else + m.message = "error!bin path is a dir" + end + return nil + end + return value end + --- upx o = s:option(ListValue, "upxflag", translate("use upx to compress bin after download")) o:value("", translate("none")) @@ -92,213 +103,214 @@ o:value("-9", translate("compress better")) o:value("--best", translate("compress best(can be slow for big files)")) o:value("--brute", translate("try all available compression methods & filters [slow]")) o:value("--ultra-brute", translate("try even more compression variants [very slow]")) -o.default = "" -o.description=translate("bin use less space,but may have compatibility issues") +o.default = "" +o.description = translate("bin use less space,but may have compatibility issues") o.rmempty = true + ---- config path o = s:option(Value, "configpath", translate("Config Path"), translate("AdGuardHome config path")) -o.default = "/etc/AdGuardHome.yaml" -o.datatype = "string" +o.default = "/etc/config/AdGuardHome.yaml" +o.datatype = "string" o.optional = false -o.rmempty=false -o.validate=function(self, value) -if value==nil then return nil end -if fs.stat(value,"type")=="dir" then - fs.rmdir(value) -end -if fs.stat(value,"type")=="dir" then - if m.message then - m.message =m.message.."\nerror!config path is a dir" - else - m.message ="error!config path is a dir" - end - return nil -end -return value +o.rmempty = false +o.validate = function(self, value) + if value == nil then return nil end + if fs.stat(value, "type") == "dir" then fs.rmdir(value) end + if fs.stat(value, "type") == "dir" then + if m.message then + m.message = m.message .. "\nerror!config path is a dir" + else + m.message = "error!config path is a dir" + end + return nil + end + return value end + ---- work dir o = s:option(Value, "workdir", translate("Work dir"), translate("AdGuardHome work dir include rules,audit log and database")) -o.default = "/etc/AdGuardHome" -o.datatype = "string" +o.default = "/usr/bin/AdGuardHome" +o.datatype = "string" o.optional = false -o.rmempty=false -o.validate=function(self, value) -if value=="" then return nil end -if fs.stat(value,"type")=="reg" then - if m.message then - m.message =m.message.."\nerror!work dir is a file" - else - m.message ="error!work dir is a file" - end - return nil -end -if string.sub(value, -1)=="/" then - return string.sub(value, 1, -2) -else - return value -end +o.rmempty = false +o.validate = function(self, value) + if value == "" then return nil end + if fs.stat(value, "type") == "reg" then + if m.message then + m.message = m.message .. "\nerror!work dir is a file" + else + m.message = "error!work dir is a file" + end + return nil + end + if string.sub(value, -1) == "/" then + return string.sub(value, 1, -2) + else + return value + end end + ---- log file o = s:option(Value, "logfile", translate("Runtime log file"), translate("AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log")) -o.datatype = "string" +o.datatype = "string" o.rmempty = true -o.validate=function(self, value) -if fs.stat(value,"type")=="dir" then - fs.rmdir(value) -end -if fs.stat(value,"type")=="dir" then - if m.message then - m.message =m.message.."\nerror!log file is a dir" - else - m.message ="error!log file is a dir" - end - return nil -end -return value +o.validate = function(self, value) + if fs.stat(value, "type") == "dir" then fs.rmdir(value) end + if fs.stat(value, "type") == "dir" then + if m.message then + m.message = m.message .. "\nerror!log file is a dir" + else + m.message = "error!log file is a dir" + end + return nil + end + return value end + ---- debug o = s:option(Flag, "verbose", translate("Verbose log")) o.default = 0 o.optional = true ----- gfwlist -local a=luci.sys.call("grep -m 1 -q programadd "..configpath) -if (a==0) then -a="Added" + +---- gfwlist +local a = luci.sys.call("grep -m 1 -q programadd " .. configpath) +if (a == 0) then + a = "Added" else -a="Not added" + a = "Not added" end -o=s:option(Button,"gfwdel",translate("Del gfwlist"),translate(a)) + +o = s:option(Button, "gfwdel", translate("Del gfwlist"), translate(a)) o.optional = true -o.inputtitle=translate("Del") -o.write=function() - luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh del 2>&1") - luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome")) +o.inputtitle = translate("Del") +o.write = function() + luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh del 2>&1") + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "AdGuardHome")) end -o=s:option(Button,"gfwadd",translate("Add gfwlist"),translate(a)) + +o = s:option(Button, "gfwadd", translate("Add gfwlist"), translate(a)) o.optional = true -o.inputtitle=translate("Add") -o.write=function() - luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh 2>&1") - luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome")) +o.inputtitle = translate("Add") +o.write = function() + luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh 2>&1") + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "AdGuardHome")) end -o = s:option(Value, "gfwupstream", translate("Gfwlist upstream dns server"), translate("Gfwlist domain upstream dns service")..translate(a)) -o.default = "tcp://208.67.220.220:5353" -o.datatype = "string" + +o = s:option(Value, "gfwupstream", translate("Gfwlist upstream dns server"), translate("Gfwlist domain upstream dns service") .. translate(a)) +o.default = "tcp://208.67.220.220:5353" +o.datatype = "string" o.optional = true + ---- chpass o = s:option(Value, "hashpass", translate("Change browser management password"), translate("Press load culculate model and culculate finally save/apply")) -o.default = "" -o.datatype = "string" +o.default = "" +o.datatype = "string" o.template = "AdGuardHome/AdGuardHome_chpass" o.optional = true + ---- upgrade protect o = s:option(MultiValue, "upprotect", translate("Keep files when system upgrade")) -o:value("$binpath",translate("core bin")) -o:value("$configpath",translate("config file")) -o:value("$logfile",translate("log file")) -o:value("$workdir/data/sessions.db",translate("sessions.db")) -o:value("$workdir/data/stats.db",translate("stats.db")) -o:value("$workdir/data/querylog.json",translate("querylog.json")) -o:value("$workdir/data/filters",translate("filters")) +o:value("$binpath", translate("core bin")) +o:value("$configpath", translate("config file")) +o:value("$logfile", translate("log file")) +o:value("$workdir/data/sessions.db", translate("sessions.db")) +o:value("$workdir/data/stats.db", translate("stats.db")) +o:value("$workdir/data/querylog.json", translate("querylog.json")) +o:value("$workdir/data/filters", translate("filters")) o.widget = "checkbox" o.default = nil -o.optional=true +o.optional = true + ---- wait net on boot o = s:option(Flag, "waitonboot", translate("On boot when network ok restart")) o.default = 1 o.optional = true + ---- backup workdir on shutdown -local workdir=uci:get("AdGuardHome","AdGuardHome","workdir") or "/etc/AdGuardHome" +local workdir = uci:get("AdGuardHome", "AdGuardHome", "workdir") or "/usr/bin/AdGuardHome" o = s:option(MultiValue, "backupfile", translate("Backup workdir files when shutdown")) o1 = s:option(Value, "backupwdpath", translate("Backup workdir path")) local name -o:value("filters","filters") -o:value("stats.db","stats.db") -o:value("querylog.json","querylog.json") -o:value("sessions.db","sessions.db") -o1:depends ("backupfile", "filters") -o1:depends ("backupfile", "stats.db") -o1:depends ("backupfile", "querylog.json") -o1:depends ("backupfile", "sessions.db") -for name in fs.glob(workdir.."/data/*") -do - name=fs.basename (name) - if name~="filters" and name~="stats.db" and name~="querylog.json" and name~="sessions.db" then - o:value(name,name) - o1:depends ("backupfile", name) - end +o:value("filters", "filters") +o:value("stats.db", "stats.db") +o:value("querylog.json", "querylog.json") +o:value("sessions.db", "sessions.db") +o1:depends("backupfile", "filters") +o1:depends("backupfile", "stats.db") +o1:depends("backupfile", "querylog.json") +o1:depends("backupfile", "sessions.db") +for name in fs.glob(workdir .. "/data/*") do + name = fs.basename(name) + if name ~= "filters" and name ~= "stats.db" and name ~= "querylog.json" and + name ~= "sessions.db" then + o:value(name, name) + o1:depends("backupfile", name) + end end o.widget = "checkbox" o.default = nil -o.optional=false -o.description=translate("Will be restore when workdir/data is empty") +o.optional = false +o.description = translate("Will be restore when workdir/data is empty") ----backup workdir path - -o1.default = "/etc/AdGuardHome" -o1.datatype = "string" +o1.default = "/usr/bin/AdGuardHome" +o1.datatype = "string" o1.optional = false -o1.validate=function(self, value) -if fs.stat(value,"type")=="reg" then - if m.message then - m.message =m.message.."\nerror!backup dir is a file" - else - m.message ="error!backup dir is a file" - end - return nil -end -if string.sub(value,-1)=="/" then - return string.sub(value, 1, -2) -else - return value -end +o1.validate = function(self, value) + if fs.stat(value, "type") == "reg" then + if m.message then + m.message = m.message .. "\nerror!backup dir is a file" + else + m.message = "error!backup dir is a file" + end + return nil + end + if string.sub(value, -1) == "/" then + return string.sub(value, 1, -2) + else + return value + end end ----Crontab -o = s:option(MultiValue, "crontab", translate("Crontab task"),translate("Please change time and args in crontab")) -o:value("autoupdate",translate("Auto update core")) -o:value("cutquerylog",translate("Auto tail querylog")) -o:value("cutruntimelog",translate("Auto tail runtime log")) -o:value("autohost",translate("Auto update ipv6 hosts and restart adh")) -o:value("autogfw",translate("Auto update gfwlist and restart adh")) +o = s:option(MultiValue, "crontab", translate("Crontab task"), translate("Please change time and args in crontab")) +o:value("autoupdate", translate("Auto update core")) +o:value("cutquerylog", translate("Auto tail querylog")) +o:value("cutruntimelog", translate("Auto tail runtime log")) +o:value("autohost", translate("Auto update ipv6 hosts and restart adh")) +o:value("autogfw", translate("Auto update gfwlist and restart adh")) o.widget = "checkbox" o.default = nil -o.optional=true +o.optional = true -----downloadpath -o = s:option(TextValue, "downloadlinks",translate("Download links for update")) +o = s:option(Value, "update_url", translate("Core Update URL")) +o.default = "https://github.com/AdguardTeam/AdGuardHome/releases/download/${Cloud_Version}/AdGuardHome_linux_${Arch}.tar.gz" +o.placeholder = "https://github.com/AdguardTeam/AdGuardHome/releases/download/${Cloud_Version}/AdGuardHome_linux_${Arch}.tar.gz" +o.rmempty = false o.optional = false -o.rows = 4 -o.wrap = "soft" -o.cfgvalue = function(self, section) - return fs.readfile("/usr/share/AdGuardHome/links.txt") -end -o.write = function(self, section, value) - fs.writefile("/usr/share/AdGuardHome/links.txt", value:gsub("\r\n", "\n")) -end -fs.writefile("/var/run/lucilogpos","0") + function m.on_commit(map) - if (fs.access("/var/run/AdGserverdis")) then - io.popen("/etc/init.d/AdGuardHome reload &") - return - end - local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest") - if ucitracktest=="1" then - return - elseif ucitracktest=="0" then - io.popen("/etc/init.d/AdGuardHome reload &") - else - if (fs.access("/var/run/AdGlucitest")) then - uci:set("AdGuardHome","AdGuardHome","ucitracktest","0") - io.popen("/etc/init.d/AdGuardHome reload &") - else - fs.writefile("/var/run/AdGlucitest","") - if (ucitracktest=="2") then - uci:set("AdGuardHome","AdGuardHome","ucitracktest","1") - else - uci:set("AdGuardHome","AdGuardHome","ucitracktest","2") - end - end - uci:save("AdGuardHome") - end + if (fs.access("/var/run/AdGserverdis")) then + io.popen("/etc/init.d/AdGuardHome reload &") + return + end + local ucitracktest = uci:get("AdGuardHome", "AdGuardHome", "ucitracktest") + if ucitracktest == "1" then + return + elseif ucitracktest == "0" then + io.popen("/etc/init.d/AdGuardHome reload &") + else + if (fs.access("/var/run/AdGlucitest")) then + uci:set("AdGuardHome", "AdGuardHome", "ucitracktest", "0") + io.popen("/etc/init.d/AdGuardHome reload &") + else + fs.writefile("/var/run/AdGlucitest", "") + if (ucitracktest == "2") then + uci:set("AdGuardHome", "AdGuardHome", "ucitracktest", "1") + else + uci:set("AdGuardHome", "AdGuardHome", "ucitracktest", "2") + end + end + uci:commit("AdGuardHome") + end end return m diff --git a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua old mode 100644 new mode 100755 index 5d18a88db..bcc86d73c --- a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua +++ b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua @@ -1,16 +1,16 @@ -local fs=require"nixio.fs" -local uci=require"luci.model.uci".cursor() -local f,t -f=SimpleForm("logview") +local fs = require "nixio.fs" +local uci = require"luci.model.uci".cursor() +local f, t +f = SimpleForm("logview") f.reset = false f.submit = false -t=f:field(TextValue,"conf") -t.rmempty=true -t.rows=20 -t.template="AdGuardHome/log" -t.readonly="readonly" -local logfile=uci:get("AdGuardHome","AdGuardHome","logfile") or "" -t.timereplace=(logfile~="syslog" and logfile~="" ) -t.pollcheck=logfile~="" -fs.writefile("/var/run/lucilogreload","") +t = f:field(TextValue, "conf") +t.rmempty = true +t.rows = 20 +t.template = "AdGuardHome/log" +t.readonly = "readonly" +local logfile = uci:get("AdGuardHome", "AdGuardHome", "logfile") or "" +t.timereplace = (logfile ~= "syslog" and logfile ~= "") +t.pollcheck = logfile ~= "" +fs.writefile("/var/run/lucilogpos", "0") return f diff --git a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua old mode 100644 new mode 100755 index ecf072bbc..297f69cd0 --- a/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua +++ b/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua @@ -1,97 +1,100 @@ local m, s, o local fs = require "nixio.fs" -local uci=require"luci.model.uci".cursor() -local sys=require"luci.sys" +local uci = require"luci.model.uci".cursor() +local sys = require "luci.sys" require("string") require("io") require("table") function gen_template_config() - local b - local d="" - for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do - b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$") - if (b~=nil) then - d=d.." - "..b.."\n" - end + local b + local d = "" + local file = "/tmp/resolv.conf.d/resolv.conf.auto" + if not fs.access(file) then + file = "/tmp/resolv.conf.auto" end - local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+") - local tbl = {} - local a="" - while (1) do - a=f:read("*l") - if (a=="#bootstrap_dns") then - a=d - elseif (a=="#upstream_dns") then - a=d - elseif (a==nil) then - break - end - table.insert(tbl, a) - end - f:close() - return table.concat(tbl, "\n") + for cnt in io.lines(file) do + b = string.match(cnt, "^[^#]*nameserver%s+([^%s]+)$") + if (b ~= nil) then d = d .. " - " .. b .. "\n" end + end + local f = io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+") + local tbl = {} + local a = "" + while (1) do + a = f:read("*l") + if (a == "#bootstrap_dns") then + a = d + elseif (a == "#upstream_dns") then + a = d + elseif (a == nil) then + break + end + table.insert(tbl, a) + end + f:close() + return table.concat(tbl, "\n") end + m = Map("AdGuardHome") -local configpath = uci:get("AdGuardHome","AdGuardHome","configpath") -local binpath = uci:get("AdGuardHome","AdGuardHome","binpath") +local configpath = uci:get("AdGuardHome", "AdGuardHome", "configpath") +local binpath = uci:get("AdGuardHome", "AdGuardHome", "binpath") s = m:section(TypedSection, "AdGuardHome") -s.anonymous=true -s.addremove=false +s.anonymous = true +s.addremove = false + --- config o = s:option(TextValue, "escconf") o.rows = 66 o.wrap = "off" o.rmempty = true o.cfgvalue = function(self, section) - return fs.readfile("/tmp/AdGuardHometmpconfig.yaml") or fs.readfile(configpath) or gen_template_config() or "" + return fs.readfile("/tmp/AdGuardHometmpconfig.yaml") or fs.readfile(configpath) or gen_template_config() or "" end -o.validate=function(self, value) +o.validate = function(self, value) fs.writefile("/tmp/AdGuardHometmpconfig.yaml", value:gsub("\r\n", "\n")) - if fs.access(binpath) then - if (sys.call(binpath.." -c /tmp/AdGuardHometmpconfig.yaml --check-config 2> /tmp/AdGuardHometest.log")==0) then - return value - end - else - return value - end - luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome","manual")) - return nil + if fs.access(binpath) then + if (sys.call(binpath .. " -c /tmp/AdGuardHometmpconfig.yaml --check-config 2> /tmp/AdGuardHometest.log") == 0) then return value end + else + return value + end + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "AdGuardHome", "manual")) + return nil end o.write = function(self, section, value) - fs.move("/tmp/AdGuardHometmpconfig.yaml",configpath) -end -o.remove = function(self, section, value) - fs.writefile(configpath, "") + fs.move("/tmp/AdGuardHometmpconfig.yaml", configpath) end +o.remove = function(self, section, value) fs.writefile(configpath, "") end + --- js and reload button o = s:option(DummyValue, "") -o.anonymous=true +o.anonymous = true o.template = "AdGuardHome/yamleditor" if not fs.access(binpath) then - o.description=translate("WARNING!!! no bin found apply config will not be test") + o.description = translate("WARNING!!! no bin found apply config will not be test") end ---- log + +--- log if (fs.access("/tmp/AdGuardHometmpconfig.yaml")) then -local c=fs.readfile("/tmp/AdGuardHometest.log") -if (c~="") then -o = s:option(TextValue, "") -o.readonly=true -o.rows = 5 -o.rmempty = true -o.name="" -o.cfgvalue = function(self, section) - return fs.readfile("/tmp/AdGuardHometest.log") -end -end + local c = fs.readfile("/tmp/AdGuardHometest.log") + if (c ~= "") then + o = s:option(TextValue, "") + o.readonly = true + o.rows = 5 + o.rmempty = true + o.name = "" + o.cfgvalue = function(self, section) + return fs.readfile("/tmp/AdGuardHometest.log") + end + end end + function m.on_commit(map) - local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest") - if ucitracktest=="1" then - return - elseif ucitracktest=="0" then - io.popen("/etc/init.d/AdGuardHome reload &") - else - fs.writefile("/var/run/AdGlucitest","") - end + local ucitracktest = uci:get("AdGuardHome", "AdGuardHome", "ucitracktest") + if ucitracktest == "1" then + return + elseif ucitracktest == "0" then + io.popen("/etc/init.d/AdGuardHome reload &") + else + fs.writefile("/var/run/AdGlucitest", "") + end end return m diff --git a/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm b/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm old mode 100644 new mode 100755 index 832a1df46..52315ef7e --- a/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm +++ b/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm @@ -1,9 +1,9 @@ <%+cbi/valueheader%> <%local fs=require"nixio.fs"%> - - + + <% if self.showfastconfig then %> - + <%end%>