mirror of
https://github.com/kenzok8/small-package
synced 2025-09-20 19:11:30 +08:00
update-09.05
This commit is contained in:
94
adguardhome/Makefile
Normal file
94
adguardhome/Makefile
Normal file
@ -0,0 +1,94 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adguardhome
|
||||
PKG_VERSION:=0.106.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome
|
||||
PKG_MIRROR_HASH:=bdf5ad833df90969cd82b9fb6a91846338c738ed01671fc768d867b592102f7c
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE.txt
|
||||
PKG_MAINTAINER:=Dobroslaw Kijowski <dobo90@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host packr/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_ADGUARDHOME_COMPRESS_GOPROXY \
|
||||
CONFIG_ADGUARDHOME_COMPRESS_UPX
|
||||
|
||||
GO_PKG:=github.com/AdguardTeam/AdGuardHome
|
||||
GO_PKG_BUILD_PKG:=github.com/AdguardTeam/AdGuardHome
|
||||
|
||||
AGH_BUILD_TIME:=$(shell date -d @$(SOURCE_DATE_EPOCH) +%FT%TZ%z)
|
||||
AGH_VERSION_PKG:=github.com/AdguardTeam/AdGuardHome/internal/version
|
||||
GO_PKG_LDFLAGS_X:=$(AGH_VERSION_PKG).channel=release \
|
||||
$(AGH_VERSION_PKG).version=$(PKG_SOURCE_VERSION) \
|
||||
$(AGH_VERSION_PKG).buildtime=$(AGH_BUILD_TIME) \
|
||||
$(AGH_VERSION_PKG).goarm=$(GO_ARM) \
|
||||
$(AGH_VERSION_PKG).gomips=$(GO_MIPS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/golang/golang-package.mk
|
||||
|
||||
define Package/adguardhome
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Network-wide ads and trackers blocking DNS server
|
||||
URL:=https://github.com/AdguardTeam/AdGuardHome
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
|
||||
endef
|
||||
|
||||
define Package/adguardhome/conffiles
|
||||
/etc/adguardhome.yaml
|
||||
endef
|
||||
|
||||
define Package/adguardhome/description
|
||||
Free and open source, powerful network-wide ads and trackers blocking DNS server.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
config ADGUARDHOME_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config ADGUARDHOME_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default n
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_ADGUARDHOME_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.baidu.com
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
( \
|
||||
pushd $(PKG_BUILD_DIR) ; \
|
||||
make js-deps js-build ; \
|
||||
packr -z -v -i internal ; \
|
||||
popd ; \
|
||||
$(call GoPackage/Build/Compile) ; \
|
||||
)
|
||||
ifeq ($(CONFIG_ADGUARDHOME_COMPRESS_UPX),y)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/AdGuardHome
|
||||
endif
|
||||
endef
|
||||
|
||||
#define Package/adguardhome/install
|
||||
# $(call GoPackage/Package/Install/Bin,$(1))
|
||||
# $(INSTALL_DIR) $(1)/etc/init.d
|
||||
# $(INSTALL_BIN) ./files/adguardhome.init $(1)/etc/init.d/adguardhome
|
||||
#endef
|
||||
|
||||
$(eval $(call GoBinPackage,adguardhome))
|
||||
$(eval $(call BuildPackage,adguardhome))
|
21
adguardhome/files/adguardhome.init
Normal file
21
adguardhome/files/adguardhome.init
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
PROG=/usr/bin/AdGuardHome
|
||||
WORK_DIR=/tmp/adguardhome
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
# starts after network starts
|
||||
START=21
|
||||
# stops before networking stops
|
||||
STOP=89
|
||||
|
||||
start_service() {
|
||||
[ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" -c /etc/adguardhome.yaml -w "$WORK_DIR" --no-check-update
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
74
brook/Makefile
Normal file
74
brook/Makefile
Normal file
@ -0,0 +1,74 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=brook
|
||||
PKG_VERSION:=20210701
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/txthinking/brook/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=92c2253349af05ea5aa7a45cddd39ca638c732b2ffdb5066a5f03d2df40cb0b5
|
||||
|
||||
PKG_MAINTAINER:=CN_SZTL <cnsztl@immortalwrt.org>
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_BROOK_COMPRESS_GOPROXY \
|
||||
CONFIG_BROOK_COMPRESS_UPX
|
||||
|
||||
GO_PKG:=github.com/txthinking/brook
|
||||
GO_PKG_BUILD_PKG:=github.com/txthinking/brook/cli/brook
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/brook
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=A cross-platform proxy software
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
|
||||
URL:=https://github.com/txthinking/brook
|
||||
endef
|
||||
|
||||
define Package/brook/description
|
||||
Brook is a cross-platform strong encryption and not detectable proxy.
|
||||
Zero-Configuration.
|
||||
endef
|
||||
|
||||
define Package/brook/config
|
||||
config BROOK_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config BROOK_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default y
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BROOK_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.baidu.com
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifeq ($(CONFIG_BROOK_COMPRESS_UPX),y)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/brook
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,brook))
|
||||
$(eval $(call BuildPackage,brook))
|
41
chinadns-ng/Makefile
Normal file
41
chinadns-ng/Makefile
Normal file
@ -0,0 +1,41 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=chinadns-ng
|
||||
PKG_VERSION:=1.0-beta.25
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/zfl9/chinadns-ng.git
|
||||
PKG_MIRROR_HASH:=3b66fc0888d9488e3b8e39df3016d51fae1b43325d292381e94aa3c7d2318282
|
||||
PKG_SOURCE_VERSION:=14cc6348d67b09cae37d9bce554c89c2c0e0b265
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_LICENSE:=AGPL-3.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=pexcn <i@pexcn.me>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/chinadns-ng
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=ChinaDNS next generation, refactoring with epoll and ipset
|
||||
URL:=https://github.com/zfl9/chinadns-ng
|
||||
DEPENDS:=+ipset
|
||||
endef
|
||||
|
||||
define Package/chinadns-ng/description
|
||||
ChinaDNS next generation, refactoring with epoll and ipset.
|
||||
endef
|
||||
|
||||
define Package/chinadns-ng/conffiles
|
||||
endef
|
||||
|
||||
define Package/chinadns-ng/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chinadns-ng $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,chinadns-ng))
|
66
dns2socks/Makefile
Normal file
66
dns2socks/Makefile
Normal file
@ -0,0 +1,66 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dns2socks
|
||||
PKG_VERSION:=2.1
|
||||
PKG_RELEASE:=20200218
|
||||
|
||||
PKG_SOURCE:=SourceCode.zip
|
||||
PKG_SOURCE_SUBDIR:=DNS2SOCKS
|
||||
PKG_SOURCE_URL:=@SF/dns2socks
|
||||
PKG_MD5SUM:=ec82de936ad004cc940502cd2a1bff5b
|
||||
|
||||
PKG_MAINTAINER:=ghostmaker
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dns2socks/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=The utility to resolve DNS requests via a SOCKS5 tunnel.
|
||||
URL:=http://dns2socks.sourceforge.net/
|
||||
MAINTAINER:=ghostmaker
|
||||
DEPENDS:=+libpthread
|
||||
endef
|
||||
|
||||
define Package/dns2socks
|
||||
$(call Package/dns2socks/Default)
|
||||
endef
|
||||
|
||||
define Package/dns2socks/description
|
||||
This is a utility to resolve DNS requests via a SOCKS5 tunnel and caches the answers.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
unzip $(DL_DIR)/$(PKG_SOURCE) -d $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) \
|
||||
$(TARGET_CFLAGS) \
|
||||
$(TARGET_CPPFLAGS) \
|
||||
$(FPIC) \
|
||||
-o $(PKG_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)/$(PKG_NAME) \
|
||||
$(PKG_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)/DNS2SOCKS.c \
|
||||
$(TARGET_LDFLAGS) -pthread
|
||||
endef
|
||||
|
||||
define Build/Install
|
||||
endef
|
||||
|
||||
define Package/dns2socks/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)/$(PKG_NAME) $(1)/usr/bin/dns2socks
|
||||
endef
|
||||
|
||||
#$(shell $(RM) $(DL_DIR)/$(PKG_SOURCE))
|
||||
|
||||
$(eval $(call BuildPackage,dns2socks))
|
85
gost/Makefile
Normal file
85
gost/Makefile
Normal file
@ -0,0 +1,85 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gost
|
||||
PKG_VERSION:=2.11.1
|
||||
PKG_RELEASE:=23
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/ginuerzh/gost/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=CN_SZTL <cnsztl@immortalwrt.org>
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_GOST_COMPRESS_GOPROXY \
|
||||
CONFIG_GOST_COMPRESS_UPX
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/ginuerzh/gost
|
||||
GO_PKG_BUILD_PKG:=github.com/ginuerzh/gost/cmd/gost
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/gost
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=GO Simple Tunnel
|
||||
URL:=https://github.com/ginuerzh/gost
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/gost/description
|
||||
A simple security tunnel written in Golang
|
||||
endef
|
||||
|
||||
define Package/gost/config
|
||||
config GOST_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config GOST_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default y
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_GOST_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.baidu.com
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifeq ($(CONFIG_GOST_COMPRESS_UPX),y)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/gost
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/gost/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gost $(1)/usr/bin/gost
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/gost.config $(1)/etc/config/gost
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/gost.init $(1)/etc/init.d/gost
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,gost))
|
||||
$(eval $(call BuildPackage,gost))
|
5
gost/files/gost.config
Normal file
5
gost/files/gost.config
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
config gost
|
||||
option enable '0'
|
||||
option run_command ''
|
||||
|
22
gost/files/gost.init
Executable file
22
gost/files/gost.init
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Created By ImmortalWrt
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
enable="$(uci get gost.@gost[0].enable)"
|
||||
run_command="$(uci get gost.@gost[0].run_command)"
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
/usr/bin/gost ${run_command} &
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
killall -9 "gost" > "/dev/null" 2>&1
|
||||
}
|
40
ipt2socks/Makefile
Normal file
40
ipt2socks/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2014 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipt2socks
|
||||
PKG_VERSION:=1.1.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/zfl9/ipt2socks.git
|
||||
PKG_MIRROR_HASH:=914465049c065c9fd21a6eabb96418acf134f2b6f0a1b861d5987ae0d10da83a
|
||||
PKG_SOURCE_VERSION:=384dab4bae5ed9402e07ec1950e502c05812bc26
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipt2socks
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5
|
||||
URL:=https://github.com/zfl9/ipt2socks
|
||||
endef
|
||||
|
||||
define Package/ipt2socks/description
|
||||
Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5.
|
||||
endef
|
||||
|
||||
define Package/ipt2socks/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ipt2socks $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ipt2socks))
|
65
kcptun/Makefile
Normal file
65
kcptun/Makefile
Normal file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# Copyright (C) 2019 Xingwang Liao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=kcptun
|
||||
PKG_VERSION:=20210624
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/xtaci/kcptun/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=3f39eb2e6ee597751888b710afc83147b429c232591e91bc97565b32895f33a8
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.md
|
||||
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/xtaci/kcptun
|
||||
|
||||
GO_PKG_LDFLAGS:=-s -w -X 'main.VERSION=$(PKG_VERSION)-$(PKG_RELEASE) for OpenWrt'
|
||||
|
||||
# Can't use GO_PKG_LDFLAGS_X to define X args with space
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/kcptun/Default
|
||||
define Package/kcptun-$(1)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
DEPENDS:=$$(GO_ARCH_DEPENDS)
|
||||
TITLE:=Simple UDP Tunnel Based On KCP ($1)
|
||||
URL:=https://github.com/xtaci/kcptun
|
||||
endef
|
||||
|
||||
define Package/kcptun-$(1)/description
|
||||
A Stable & Secure Tunnel Based On KCP with N:M Multiplexing.
|
||||
|
||||
This package contains the kcptun $(1).
|
||||
endef
|
||||
|
||||
define Package/kcptun-$(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/kcptun-$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
KCPTUN_COMPONENTS:=client server
|
||||
|
||||
$(foreach component,$(KCPTUN_COMPONENTS), \
|
||||
$(eval $(call Package/kcptun/Default,$(component))) \
|
||||
$(eval $(call GoBinPackage,kcptun-$(component))) \
|
||||
$(eval $(call BuildPackage,kcptun-$(component))) \
|
||||
)
|
44
lua-maxminddb/Makefile
Normal file
44
lua-maxminddb/Makefile
Normal file
@ -0,0 +1,44 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2020 jerryk <jerrykuku@qq.com>
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=lua-maxminddb
|
||||
PKG_VERSION:=0.2
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/fabled/lua-maxminddb.git
|
||||
PKG_SOURCE_DATE:=2019-03-14
|
||||
PKG_SOURCE_VERSION:=93da9f4e6c814c3a23044dd2cdd22d4a6b4f665b
|
||||
PKG_MIRROR_HASH:=b99ef18516b705b3e73b15a9d5ddc99add359299b52639fe3c81dd761591d9d9
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=fabled
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/lua-maxminddb
|
||||
SUBMENU:=Lua
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=libmaxminddb bindings for lua
|
||||
URL:=https://github.com/jerrykuku/lua-maxminddb
|
||||
DEPENDS:=+lua +libmaxminddb
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
MAKE_VARS += LUA_PKG=lua
|
||||
|
||||
define Package/lua-maxminddb/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/maxminddb.so $(1)/usr/lib/lua/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,lua-maxminddb))
|
201
luci-app-UUGameAcc/LICENSE
Normal file
201
luci-app-UUGameAcc/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
76
luci-app-UUGameAcc/Makefile
Normal file
76
luci-app-UUGameAcc/Makefile
Normal file
@ -0,0 +1,76 @@
|
||||
#
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-UUGameAcc
|
||||
PKG_VERSION:=20210806
|
||||
PKG_RELEASE:=2.13.4
|
||||
PKG_MAINTAINER:=BCYDTZ <https://github.com/BCYDTZ/luci-app-UUGameAcc>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI support for UUGameAcc
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+kmod-tun
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI Support of Simple Switch to turn UUGameAcc ON/OFF
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./root/etc/config/uuplugin $(1)/etc/config/uuplugin
|
||||
|
||||
$(INSTALL_DIR) $(1)/tmp/uuplugin
|
||||
cp -pR ./root/files/* $(1)/tmp/uuplugin
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./root/etc/init.d/uuplugin_luci $(1)/etc/init.d/uuplugin_luci
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_CONF) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/uuplugin.po $(1)/usr/lib/lua/luci/i18n/uuplugin.zh-cn.lmo
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
mkdir -p ./usr/bin/uuplugin
|
||||
chmod +x ./tmp/uuplugin/uuplugin.sh
|
||||
sh ./tmp/uuplugin/uuplugin.sh
|
||||
rm -rf ./tmp/uuplugin
|
||||
chmod +x ./usr/bin/uuplugin/*
|
||||
/etc/init.d/uuplugin_luci enable >/dev/null 2>&1
|
||||
chmod a+x $${IPKG_INSTROOT}/etc/init.d/uuplugin_luci >/dev/null 2>&1
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/uuplugin_luci disable
|
||||
/etc/init.d/uuplugin_luci stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
7
luci-app-UUGameAcc/README.md
Normal file
7
luci-app-UUGameAcc/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# luci-app-UUGameAcc
|
||||
Luci support of UU Game Accelerator
|
||||
用来控制启动uu路由器加速五合一插件
|
||||
使用说明:
|
||||
将整个文件放到lede或者openwrt的feeds文件夹下的二级文件夹中。
|
||||
ipk安装说明:
|
||||
在lede或者openwrt中上传ipk文件以后通过终端用命令opkg install安装
|
15
luci-app-UUGameAcc/luasrc/controller/uuplugin.lua
Normal file
15
luci-app-UUGameAcc/luasrc/controller/uuplugin.lua
Normal file
@ -0,0 +1,15 @@
|
||||
module("luci.controller.uuplugin",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/uuplugin") then return end
|
||||
|
||||
entry({"admin", "services", "uuplugin"}, cbi("uuplugin/uuplugin"), ("UU GameAcc"),99).dependent=true
|
||||
entry({"admin","services","uuplugin","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep -f uuplugin >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
20
luci-app-UUGameAcc/luasrc/model/cbi/uuplugin/uuplugin.lua
Normal file
20
luci-app-UUGameAcc/luasrc/model/cbi/uuplugin/uuplugin.lua
Normal file
@ -0,0 +1,20 @@
|
||||
require("luci.util")
|
||||
|
||||
mp = Map("uuplugin", translate("UU Game Accelerator"))
|
||||
mp.description = translate("A Paid Game Acceleration service")
|
||||
mp:section(SimpleSection).template = "uuplugin/uuplugin_status"
|
||||
|
||||
s = mp:section(TypedSection, "uuplugin")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.default = 0
|
||||
o.optional = false
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
io.popen("/etc/init.d/uuplugin_luci start &")
|
||||
end
|
||||
|
||||
return mp
|
21
luci-app-UUGameAcc/luasrc/view/uuplugin/uuplugin_status.htm
Normal file
21
luci-app-UUGameAcc/luasrc/view/uuplugin/uuplugin_status.htm
Normal file
@ -0,0 +1,21 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[uuplugin]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('uuplugin_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
tb.innerHTML = '<em><b><font color=green>UU GameAcc <%:RUNNING%></font></b></em>';
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UU GameAcc <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="uuplugin_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
12
luci-app-UUGameAcc/po/zh-cn/uuplugin.po
Normal file
12
luci-app-UUGameAcc/po/zh-cn/uuplugin.po
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "UU GameAcc"
|
||||
msgstr "UU游戏加速器"
|
||||
|
||||
msgid "UU Game Accelerator"
|
||||
msgstr "UU游戏加速器"
|
||||
|
||||
msgid "A Paid Game Acceleration service"
|
||||
msgstr "一个需要付费的游戏加速器"
|
4
luci-app-UUGameAcc/root/etc/config/uuplugin
Normal file
4
luci-app-UUGameAcc/root/etc/config/uuplugin
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
config uuplugin 'uuplugin'
|
||||
option enabled '0'
|
||||
|
22
luci-app-UUGameAcc/root/etc/init.d/uuplugin_luci
Normal file
22
luci-app-UUGameAcc/root/etc/init.d/uuplugin_luci
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
STOP=15
|
||||
|
||||
start() {
|
||||
config_load uuplugin
|
||||
local enable
|
||||
config_get_bool enable uuplugin enabled
|
||||
if [ "$enable" -eq 0 ]; then
|
||||
stop
|
||||
else
|
||||
/usr/bin/uuplugin/uuplugin >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
config_load uuplugin
|
||||
local enabled
|
||||
config_get_bool enabled uuplugin enabled
|
||||
kill -9 `pgrep -f "/usr/bin/uuplugin/uuplugin"` 2>/dev/null
|
||||
}
|
11
luci-app-UUGameAcc/root/etc/uci-defaults/45_luci-uuplugin
Normal file
11
luci-app-UUGameAcc/root/etc/uci-defaults/45_luci-uuplugin
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@uuplugin[-1]
|
||||
add ucitrack uuplugin
|
||||
set ucitrack.@uuplugin[-1].init=uuplugin_luci
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
2
luci-app-UUGameAcc/root/files/aarch64/uu.conf
Normal file
2
luci-app-UUGameAcc/root/files/aarch64/uu.conf
Normal file
@ -0,0 +1,2 @@
|
||||
log_level=info
|
||||
version=v2.13.4
|
BIN
luci-app-UUGameAcc/root/files/aarch64/uuplugin
Executable file
BIN
luci-app-UUGameAcc/root/files/aarch64/uuplugin
Executable file
Binary file not shown.
2
luci-app-UUGameAcc/root/files/arm/uu.conf
Normal file
2
luci-app-UUGameAcc/root/files/arm/uu.conf
Normal file
@ -0,0 +1,2 @@
|
||||
log_level=info
|
||||
version=v2.13.4
|
BIN
luci-app-UUGameAcc/root/files/arm/uuplugin
Executable file
BIN
luci-app-UUGameAcc/root/files/arm/uuplugin
Executable file
Binary file not shown.
2
luci-app-UUGameAcc/root/files/mipsel/uu.conf
Normal file
2
luci-app-UUGameAcc/root/files/mipsel/uu.conf
Normal file
@ -0,0 +1,2 @@
|
||||
log_level=info
|
||||
version=v2.13.4
|
BIN
luci-app-UUGameAcc/root/files/mipsel/uuplugin
Executable file
BIN
luci-app-UUGameAcc/root/files/mipsel/uuplugin
Executable file
Binary file not shown.
2
luci-app-UUGameAcc/root/files/uuplugin.sh
Normal file
2
luci-app-UUGameAcc/root/files/uuplugin.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
cp -a ./tmp/uuplugin/$(uname -m)/* ./usr/bin/uuplugin
|
2
luci-app-UUGameAcc/root/files/x86_64/uu.conf
Normal file
2
luci-app-UUGameAcc/root/files/x86_64/uu.conf
Normal file
@ -0,0 +1,2 @@
|
||||
log_level=info
|
||||
version=v2.13.4
|
BIN
luci-app-UUGameAcc/root/files/x86_64/uuplugin
Executable file
BIN
luci-app-UUGameAcc/root/files/x86_64/uuplugin
Executable file
Binary file not shown.
58
luci-app-adguardhome/Makefile
Normal file
58
luci-app-adguardhome/Makefile
Normal file
@ -0,0 +1,58 @@
|
||||
# Copyright (C) 2018-2019 Lienol
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-adguardhome
|
||||
PKG_VERSION:=1.8
|
||||
PKG_RELEASE:=12
|
||||
PKG_MAINTAINER:=<https://github.com/rufengsuixing/luci-app-adguardhome>
|
||||
|
||||
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
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_binary
|
||||
bool "Include Binary File"
|
||||
default y
|
||||
endef
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_binary
|
||||
|
||||
define Package/luci-app-adguardhome/conffiles
|
||||
/usr/share/AdGuardHome/links.txt
|
||||
/etc/config/AdGuardHome
|
||||
endef
|
||||
|
||||
define Package/luci-app-adguardhome/postinst
|
||||
#!/bin/sh
|
||||
/etc/init.d/AdGuardHome enable >/dev/null 2>&1
|
||||
enable=$(uci get AdGuardHome.AdGuardHome.enabled 2>/dev/null)
|
||||
if [ "$enable" == "1" ]; then
|
||||
/etc/init.d/AdGuardHome reload
|
||||
fi
|
||||
rm -f /tmp/luci-indexcache
|
||||
rm -f /tmp/luci-modulecache/*
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/luci-app-adguardhome/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/AdGuardHome disable
|
||||
/etc/init.d/AdGuardHome stop
|
||||
uci -q batch <<-EOF >/dev/null 2>&1
|
||||
delete ucitrack.@AdGuardHome[-1]
|
||||
commit ucitrack
|
||||
EOF
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
130
luci-app-adguardhome/luasrc/controller/AdGuardHome.lua
Normal file
130
luci-app-adguardhome/luasrc/controller/AdGuardHome.lua
Normal file
@ -0,0 +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()
|
||||
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"))
|
||||
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
|
||||
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('')
|
||||
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)
|
||||
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
|
||||
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)
|
||||
end
|
||||
function do_dellog()
|
||||
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
|
||||
end
|
304
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua
Normal file
304
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua
Normal file
@ -0,0 +1,304 @@
|
||||
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"
|
||||
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"
|
||||
|
||||
s = m:section(TypedSection, "AdGuardHome")
|
||||
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.optional = false
|
||||
o.description = translate("<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"..httpport.."\" onclick=\"window.open('http://'+window.location.hostname+':"..httpport.."/')\"/>")
|
||||
---- 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
|
||||
if not fs.access(binpath) then
|
||||
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
|
||||
end
|
||||
o=s:option(Button,"restart",translate("Update"))
|
||||
o.inputtitle=translate("Update core version")
|
||||
o.template = "AdGuardHome/AdGuardHome_check"
|
||||
o.showfastconfig=(not fs.access(configpath))
|
||||
o.description=string.format(translate("core version:").."<strong><font id=\"updateversion\" color=\"green\">%s </font></strong>",e)
|
||||
---- port warning not safe
|
||||
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.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.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.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
|
||||
end
|
||||
--- upx
|
||||
o = s:option(ListValue, "upxflag", translate("use upx to compress bin after download"))
|
||||
o:value("", translate("none"))
|
||||
o:value("-1", translate("compress faster"))
|
||||
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.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.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
|
||||
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.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
|
||||
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.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
|
||||
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"
|
||||
else
|
||||
a="Not added"
|
||||
end
|
||||
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"))
|
||||
end
|
||||
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"))
|
||||
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.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.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.widget = "checkbox"
|
||||
o.default = nil
|
||||
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"
|
||||
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
|
||||
end
|
||||
o.widget = "checkbox"
|
||||
o.default = nil
|
||||
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.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
|
||||
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.widget = "checkbox"
|
||||
o.default = nil
|
||||
o.optional=true
|
||||
|
||||
----downloadpath
|
||||
o = s:option(TextValue, "downloadlinks",translate("Download links for update"))
|
||||
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
|
||||
end
|
||||
return m
|
16
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua
Normal file
16
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua
Normal file
@ -0,0 +1,16 @@
|
||||
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","")
|
||||
return f
|
97
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua
Normal file
97
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua
Normal file
@ -0,0 +1,97 @@
|
||||
local m, s, o
|
||||
local fs = require "nixio.fs"
|
||||
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
|
||||
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")
|
||||
s = m:section(TypedSection, "AdGuardHome")
|
||||
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 ""
|
||||
end
|
||||
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
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
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.template = "AdGuardHome/yamleditor"
|
||||
if not fs.access(binpath) then
|
||||
o.description=translate("WARNING!!! no bin found apply config will not be test")
|
||||
end
|
||||
--- 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
|
||||
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
|
||||
end
|
||||
return m
|
@ -0,0 +1,78 @@
|
||||
<%+cbi/valueheader%>
|
||||
<%local fs=require"nixio.fs"%>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:Update core version%>" onclick=" return apply_update() "/>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_forceupdate_button" value="<%:Force update%>" onclick=" return apply_forceupdate()" style="display:none"/>
|
||||
<% if self.showfastconfig then %>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="to_configpage" value="<%:Fast config%>" onclick="location.href='<%=url([[admin]], [[services]], [[AdGuardHome]], [[manual]])%>'"/>
|
||||
<%end%>
|
||||
<div id="logview" style="display:none">
|
||||
<input type="checkbox" id="reversetag" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;"><%:reverse%></input>
|
||||
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:block;" data-update="change" rows="5" cols="60" readonly="readonly" > </textarea>
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var updatebtn = document.getElementById('apply_update_button');
|
||||
var forceupdatebtn = document.getElementById('apply_forceupdate_button');
|
||||
var islogreverse = false;
|
||||
function apply_forceupdate(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',{ force: 1 },function(x, data){}
|
||||
);
|
||||
updatebtn.disabled = true;
|
||||
poll_check();
|
||||
return
|
||||
}
|
||||
function reverselog(){
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
|
||||
if (islogreverse){
|
||||
islogreverse=false;
|
||||
}else{
|
||||
islogreverse=true;
|
||||
}
|
||||
return
|
||||
}
|
||||
function apply_update(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',null,function(x, data){}
|
||||
);
|
||||
updatebtn.disabled = true;
|
||||
updatebtn.value = '<%:Check...%>';
|
||||
forceupdatebtn.style.display="inline"
|
||||
poll_check();
|
||||
return
|
||||
}
|
||||
function poll_check(){
|
||||
var tag = document.getElementById('logview');
|
||||
tag.style.display="block"
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>', null,
|
||||
function(x, data) {
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
if (x.responseText && lv) {
|
||||
if (x.responseText=="\u0000"){
|
||||
for(j = 0,len=this.XHR._q.length; j < len; j++) {
|
||||
if (this.XHR._q[j].url == '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>'){
|
||||
this.XHR._q.splice(j,1);
|
||||
updatebtn.disabled = false;
|
||||
updatebtn.value = '<%:Updated%>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if (islogreverse){
|
||||
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
|
||||
}else{
|
||||
lv.innerHTML += x.responseText;
|
||||
}
|
||||
}
|
||||
}
|
||||
);}
|
||||
<% if fs.access("/var/run/update_core") then %>
|
||||
updatebtn.disabled = true;
|
||||
updatebtn.value = '<%:Check...%>';
|
||||
forceupdatebtn.style.display="inline"
|
||||
poll_check();
|
||||
<%elseif fs.access("/var/run/update_core_error") then %>
|
||||
poll_check();
|
||||
<%end%>
|
||||
//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,49 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function chpass(btn)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:loading...%>';
|
||||
if (typeof bcryptloaded == 'undefined' ){
|
||||
var theHead = document.getElementsByTagName('head').item(0);
|
||||
//创建脚本的dom对象实例
|
||||
var myScript = document.createElement('script');
|
||||
myScript.src = '<%=resource%>/twin-bcrypt.min.js'; //指定脚本路径
|
||||
myScript.type = 'text/javascript'; //指定脚本类型
|
||||
myScript.defer = true; //程序下载完后再解析和执行
|
||||
theHead.appendChild(myScript);
|
||||
bcryptloaded=1;
|
||||
btn.value = '<%:Culculate%>';
|
||||
btn.disabled = false;
|
||||
return
|
||||
}
|
||||
var lv = document.getElementById('cbid.AdGuardHome.AdGuardHome.hashpass');
|
||||
if (lv.value != ""){
|
||||
var hash = TwinBcrypt.hashSync(lv.value);
|
||||
lv.value=hash;
|
||||
btn.value = '<%:Please save/apply%>';
|
||||
}else{
|
||||
btn.value = '<%:is empty%>';
|
||||
btn.disabled = false;
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<input data-update="change"<%=
|
||||
attr("id", cbid) ..
|
||||
attr("name", cbid) ..
|
||||
attr("type", self.password and "password" or "text") ..
|
||||
attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
|
||||
attr("value", self:cfgvalue(section) or self.default) ..
|
||||
ifattr(self.size, "size") ..
|
||||
ifattr(self.placeholder, "placeholder") ..
|
||||
ifattr(self.readonly, "readonly") ..
|
||||
ifattr(self.maxlength, "maxlength") ..
|
||||
ifattr(self.datatype, "data-type", self.datatype) ..
|
||||
ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
|
||||
ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
|
||||
ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
|
||||
%> />
|
||||
<% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="cbid.AdGuardHome.AdGuardHome.applychpass" value="<%:Load culculate model%>" onclick="return chpass(this)"/>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,27 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('AdGuardHome_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
tb.innerHTML = '<em><b><font color=green>AdGuardHome <%:RUNNING%></font></b></em>';
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>AdGuardHome <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
if (data.redirect)
|
||||
{
|
||||
tb.innerHTML+='<em><b><font color=green><%:Redirected%></font></b></em>'
|
||||
} else {
|
||||
tb.innerHTML+='<em><b><font color=red><%:Not redirect%></font></b></em>'
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="AdGuardHome_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
110
luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm
Normal file
110
luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm
Normal file
@ -0,0 +1,110 @@
|
||||
<%+cbi/valueheader%>
|
||||
<input type="checkbox" name="NAME" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;" checked><%:reverse%></input>
|
||||
<%if self.timereplace then%>
|
||||
<input type="checkbox" name="NAME" value="localtime" onclick=" return chlogtime()" style="vertical-align:middle;height: auto;" checked><%:localtime%></input><br>
|
||||
<%end%>
|
||||
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:dellog%>" onclick=" return apply_del_log() "/>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:download log%>" style=" display:inline;" onclick=" return download_log()" />
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var islogreverse = true;
|
||||
var isutc2local = <%=tostring(self.timereplace)%>;
|
||||
function createAndDownloadFile(fileName, content) {
|
||||
var aTag = document.createElement('a');
|
||||
var blob = new Blob([content]);
|
||||
aTag.download = fileName;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(blob);
|
||||
}
|
||||
function download_log(){
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
var dt = new Date();
|
||||
var timestamp = (dt.getMonth()+1)+"-"+dt.getDate()+"-"+dt.getHours()+"_"+dt.getMinutes();
|
||||
createAndDownloadFile("AdGuardHome"+timestamp+".log",lv.innerHTML)
|
||||
return
|
||||
}
|
||||
function apply_del_log(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[dodellog]])%>',null,function(x, data){
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML="";
|
||||
}
|
||||
);
|
||||
return
|
||||
}
|
||||
function chlogtime(){
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
if (isutc2local){
|
||||
lv.innerHTML=line_toUTC(lv.innerHTML).join('\n');
|
||||
isutc2local=false;
|
||||
}else{
|
||||
lv.innerHTML=line_tolocal(lv.innerHTML).join('\n');
|
||||
isutc2local=true;
|
||||
}
|
||||
return
|
||||
}
|
||||
function reverselog(){
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
|
||||
if (islogreverse){
|
||||
islogreverse=false;
|
||||
}else{
|
||||
islogreverse=true;
|
||||
}
|
||||
return
|
||||
}
|
||||
function p(s) {
|
||||
return s < 10 ? '0' + s: s;
|
||||
}
|
||||
function line_tolocal(str){
|
||||
var strt=new Array();
|
||||
str.trim().split('\n').forEach(function(v, i) {
|
||||
var dt = new Date(v.substring(0,19)+" UTC");
|
||||
if (dt != "Invalid Date"){
|
||||
strt[i]=dt.getFullYear()+"/"+p(dt.getMonth()+1)+"/"+p(dt.getDate())+" "+p(dt.getHours())+":"+p(dt.getMinutes())+":"+p(dt.getSeconds())+v.substring(19);
|
||||
}else{
|
||||
strt[i]=v;}})
|
||||
return strt
|
||||
}
|
||||
function line_toUTC(str){
|
||||
var strt=new Array();
|
||||
str.trim().split('\n').forEach(function(v, i) {
|
||||
var dt = new Date(v.substring(0,19))
|
||||
if (dt != "Invalid Date"){
|
||||
strt[i]=dt.getUTCFullYear()+"/"+p(dt.getUTCMonth()+1)+"/"+p(dt.getUTCDate())+" "+p(dt.getUTCHours())+":"+p(dt.getUTCMinutes())+":"+p(dt.getUTCSeconds())+v.substring(19);
|
||||
}else{
|
||||
strt[i]=v;}})
|
||||
return strt
|
||||
}
|
||||
function poll_check(){
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[getlog]])%>', null,
|
||||
function(x, data) {
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
if (x.responseText && lv) {
|
||||
if (isutc2local)
|
||||
{
|
||||
var lines=line_tolocal(x.responseText);
|
||||
if (islogreverse){
|
||||
lv.innerHTML = lines.reverse().join('\n')+lv.innerHTML;
|
||||
}else{
|
||||
lv.innerHTML += lines.join('\n');
|
||||
}
|
||||
}else{
|
||||
if (islogreverse){
|
||||
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
|
||||
}else{
|
||||
lv.innerHTML += x.responseText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);}
|
||||
<%if self.pollcheck then%>
|
||||
poll_check();
|
||||
<%else%>
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML="<%:Please add log path in config to enable log%>"
|
||||
<%end%>
|
||||
//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
39
luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm
Normal file
39
luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm
Normal file
@ -0,0 +1,39 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script src="/luci-static/resources/codemirror/lib/codemirror.js"></script>
|
||||
<link rel="stylesheet" href="/luci-static/resources/codemirror/lib/codemirror.css"/>
|
||||
<script src="/luci-static/resources/codemirror/mode/yaml/yaml.js"></script>
|
||||
<link rel="stylesheet" href="/luci-static/resources/codemirror/theme/dracula.css"/>
|
||||
<link rel="stylesheet" href="/luci-static/resources/codemirror/addon/fold/foldgutter.css"/>
|
||||
<script src="/luci-static/resources/codemirror/addon/fold/foldcode.js"></script>
|
||||
<script src="/luci-static/resources/codemirror/addon/fold/foldgutter.js"></script>
|
||||
<script src="/luci-static/resources/codemirror/addon/fold/indent-fold.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("cbid.AdGuardHome.AdGuardHome.escconf"), {
|
||||
mode: "text/yaml", //实现groovy代码高亮
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true, //显示行号
|
||||
theme: "dracula", //设置主题
|
||||
lineWrapping: true, //代码折叠
|
||||
foldGutter: true,
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||
matchBrackets: true //括号匹配
|
||||
}
|
||||
);
|
||||
function reload_config(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[reloadconfig]])%>', null,
|
||||
function(x, data) {
|
||||
location.reload();
|
||||
});}
|
||||
function use_template(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[gettemplateconfig]])%>', null,
|
||||
function(x, data) {
|
||||
editor.setValue(x.responseText)
|
||||
});}
|
||||
//]]>
|
||||
</script>
|
||||
<%fs=require"nixio.fs"%>
|
||||
<%if fs.access("/tmp/AdGuardHometmpconfig.yaml") then%>
|
||||
<input type="button" id="apply_update_button" value="<%:Reload Config%>" onclick=" return reload_config() "/>
|
||||
<%end%>
|
||||
<input type="button" id="template_button" value="<%:Use template%>" onclick=" return use_template() "/>
|
||||
<%+cbi/valuefooter%>
|
408
luci-app-adguardhome/po/zh_Hans/adguardhome.po
Normal file
408
luci-app-adguardhome/po/zh_Hans/adguardhome.po
Normal file
@ -0,0 +1,408 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: zh_Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:27
|
||||
msgid ""
|
||||
"<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:"
|
||||
"center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:6
|
||||
msgid "AdGuard Home"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
|
||||
msgid "AdGuardHome Bin path if no bin will auto download"
|
||||
msgstr "AdGuardHome 执行文件路径 如果没有执行文件将自动下载"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
|
||||
msgid "AdGuardHome config path"
|
||||
msgstr "AdGuardHome 配置文件路径"
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
|
||||
msgid "AdGuardHome redirect mode"
|
||||
msgstr "AdGuardHome重定向模式"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
|
||||
msgid ""
|
||||
"AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log"
|
||||
msgstr "AdGuardHome 运行日志 如果填syslog将写入系统日志;如果空则不记录日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
|
||||
msgid "AdGuardHome work dir include rules,audit log and database"
|
||||
msgstr "AdGuardHome 工作目录包含规则,审计日志和数据库"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:179
|
||||
msgid "Add"
|
||||
msgstr "添加"
|
||||
|
||||
# hide div
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:177
|
||||
msgid "Add gfwlist"
|
||||
msgstr "加入gfw列表"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:259
|
||||
msgid "Auto tail querylog"
|
||||
msgstr "自动截短查询日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:260
|
||||
msgid "Auto tail runtime log"
|
||||
msgstr "自动截短运行日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:258
|
||||
msgid "Auto update core"
|
||||
msgstr "自动升级核心"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:262
|
||||
msgid "Auto update gfwlist and restart adh"
|
||||
msgstr "自动更新gfw列表并重启adh"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:261
|
||||
msgid "Auto update ipv6 hosts and restart adh"
|
||||
msgstr "自动更新ipv6主机并重启adh"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:212
|
||||
msgid "Backup workdir files when shutdown"
|
||||
msgstr "在关机时备份工作目录文件"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:213
|
||||
msgid "Backup workdir path"
|
||||
msgstr "工作目录备份路径"
|
||||
|
||||
# /cgi-bin/luci/admin/services/AdGuardHome
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:7
|
||||
msgid "Base Setting"
|
||||
msgstr "基础设置"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
|
||||
msgid "Bin Path"
|
||||
msgstr "执行文件路径"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:22
|
||||
msgid "Browser management port"
|
||||
msgstr "网页管理端口"
|
||||
|
||||
# hide div
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
|
||||
msgid "Change browser management password"
|
||||
msgstr "改变网页登录密码"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:37
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:70
|
||||
msgid "Check..."
|
||||
msgstr "检查中..."
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:25
|
||||
msgid "Collecting data..."
|
||||
msgstr "获取数据中..."
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
|
||||
msgid "Config Path"
|
||||
msgstr "配置文件路径"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
|
||||
msgid "Crontab task"
|
||||
msgstr "计划任务"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:16
|
||||
msgid "Culculate"
|
||||
msgstr "计算"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:172
|
||||
msgid "Del"
|
||||
msgstr "删除"
|
||||
|
||||
# hide div
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:170
|
||||
msgid "Del gfwlist"
|
||||
msgstr "删除gfw列表"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:268
|
||||
msgid "Download links for update"
|
||||
msgstr "升级用的下载链接"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:18
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:6
|
||||
msgid "Fast config"
|
||||
msgstr "快速配置"
|
||||
|
||||
# button hide
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:4
|
||||
msgid "Force update"
|
||||
msgstr "强制更新"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:11
|
||||
msgid ""
|
||||
"Free and open source, powerful network-wide ads & trackers blocking DNS "
|
||||
"server."
|
||||
msgstr "免费开源,功能强大的全网络广告和跟踪程序拦截DNS服务器"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
|
||||
msgid "Gfwlist domain upstream dns service"
|
||||
msgstr "gfw列表域名上游服务器"
|
||||
|
||||
# hide div
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
|
||||
msgid "Gfwlist upstream dns server"
|
||||
msgstr "gfw列表上游服务器"
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:195
|
||||
msgid "Keep files when system upgrade"
|
||||
msgstr "系统升级时保留文件"
|
||||
|
||||
# #button change
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:48
|
||||
msgid "Load culculate model"
|
||||
msgstr "载入计算模块"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:8
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:9
|
||||
msgid "Manual Config"
|
||||
msgstr "手动设置"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:9
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:15
|
||||
msgid "Not redirect"
|
||||
msgstr "未重定向"
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:207
|
||||
msgid "On boot when network ok restart"
|
||||
msgstr "开机后网络准备好时重启"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:106
|
||||
msgid "Please add log path in config to enable log"
|
||||
msgstr "请在设置里填写日志路径以启用日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
|
||||
msgid "Please change time and args in crontab"
|
||||
msgstr "请在计划任务中修改时间和参数"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:24
|
||||
msgid "Please save/apply"
|
||||
msgstr "请提交"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
|
||||
msgid "Press load culculate model and culculate finally save/apply"
|
||||
msgstr "按载入计算模块 然后计算 最后保存/提交"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:7
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
|
||||
msgid "Redirect"
|
||||
msgstr "重定向"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:62
|
||||
msgid "Redirect 53 port to AdGuardHome"
|
||||
msgstr "重定向53端口到AdGuardHome"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:13
|
||||
msgid "Redirected"
|
||||
msgstr "已重定向"
|
||||
|
||||
# hide button
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:36
|
||||
msgid "Reload Config"
|
||||
msgstr "重新载入配置"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:47
|
||||
msgid "Reveal/hide password"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:61
|
||||
msgid "Run as dnsmasq upstream server"
|
||||
msgstr "作为dnsmasq的上游服务器"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
|
||||
msgid "Runtime log file"
|
||||
msgstr "运行日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:49
|
||||
msgid "Update"
|
||||
msgstr "更新"
|
||||
|
||||
# button change
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:50
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:3
|
||||
msgid "Update core version"
|
||||
msgstr "更新核心版本"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:54
|
||||
msgid "Updated"
|
||||
msgstr "已更新"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:63
|
||||
msgid "Use port 53 replace dnsmasq"
|
||||
msgstr "使用53端口替换dnsmasq"
|
||||
|
||||
# /cgi-bin/luci//admin/services/AdGuardHome/manual/
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:38
|
||||
msgid "Use template"
|
||||
msgstr "使用模板"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:160
|
||||
msgid "Verbose log"
|
||||
msgstr "详细日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua:71
|
||||
msgid "WARNING!!! no bin found apply config will not be test"
|
||||
msgstr "警告!!!未找到执行文件,提交配置将不会进行校验"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:234
|
||||
msgid "Will be restore when workdir/data is empty"
|
||||
msgstr "在工作目录/data为空的时候恢复"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
|
||||
msgid "Work dir"
|
||||
msgstr "工作目录"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:96
|
||||
msgid "bin use less space,but may have compatibility issues"
|
||||
msgstr "减小执行文件空间占用,但是可能压缩后有兼容性问题"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:92
|
||||
msgid "compress best(can be slow for big files)"
|
||||
msgstr "最好的压缩(大文件可能慢)"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:91
|
||||
msgid "compress better"
|
||||
msgstr "更好的压缩"
|
||||
|
||||
# inlist
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:90
|
||||
msgid "compress faster"
|
||||
msgstr "快速压缩"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:197
|
||||
msgid "config file"
|
||||
msgstr "配置文件"
|
||||
|
||||
# checkbox
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:196
|
||||
msgid "core bin"
|
||||
msgstr "核心执行文件"
|
||||
|
||||
#
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:53
|
||||
msgid "core version:"
|
||||
msgstr "核心版本:"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:7
|
||||
msgid "dellog"
|
||||
msgstr "删除日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:8
|
||||
msgid "download log"
|
||||
msgstr "下载日志"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:202
|
||||
msgid "filters"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:26
|
||||
msgid "is empty"
|
||||
msgstr "为空"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:6
|
||||
msgid "loading..."
|
||||
msgstr "载入中"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:4
|
||||
msgid "localtime"
|
||||
msgstr "本地时间"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:198
|
||||
msgid "log file"
|
||||
msgstr "日志文件"
|
||||
|
||||
# description change
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:32
|
||||
msgid "no config"
|
||||
msgstr "没有配置文件"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:35
|
||||
msgid "no core"
|
||||
msgstr "没有核心"
|
||||
|
||||
# inlist
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:60
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:89
|
||||
msgid "none"
|
||||
msgstr "无"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:201
|
||||
msgid "querylog.json"
|
||||
msgstr "审计日志.json"
|
||||
|
||||
# /cgi-bin/luci/admin/services/AdGuardHome/log/
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:9
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:2
|
||||
msgid "reverse"
|
||||
msgstr "逆序"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:199
|
||||
msgid "sessions.db"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:200
|
||||
msgid "stats.db"
|
||||
msgstr ""
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:93
|
||||
msgid "try all available compression methods & filters [slow]"
|
||||
msgstr "尝试所有可能的压缩方法和过滤器[慢]"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:94
|
||||
msgid "try even more compression variants [very slow]"
|
||||
msgstr "尝试更多变体压缩手段[很慢]"
|
||||
|
||||
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:88
|
||||
msgid "use upx to compress bin after download"
|
||||
msgstr "下载后使用upx压缩执行文件"
|
||||
|
||||
#~ msgid "Added"
|
||||
#~ msgstr "已添加"
|
||||
|
||||
#~ msgid "Not added"
|
||||
#~ msgstr "未添加"
|
||||
|
||||
# unused
|
||||
#~ msgid "Change browser management username"
|
||||
#~ msgstr "改变网页登录用户名"
|
||||
|
||||
#~ msgid "Username"
|
||||
#~ msgstr "用户名"
|
||||
|
||||
#~ msgid "Check Config"
|
||||
#~ msgstr "检查配置"
|
||||
|
||||
#~ msgid "unknown"
|
||||
#~ msgstr "未知"
|
||||
|
||||
#~ msgid "Keep database when system upgrade"
|
||||
#~ msgstr "系统升级时保留数据"
|
||||
|
||||
#~ msgid "Boot delay until network ok"
|
||||
#~ msgstr "开机时直到网络准备好再启动"
|
11
luci-app-adguardhome/root/etc/config/AdGuardHome
Normal file
11
luci-app-adguardhome/root/etc/config/AdGuardHome
Normal file
@ -0,0 +1,11 @@
|
||||
config AdGuardHome 'AdGuardHome'
|
||||
option enabled '0'
|
||||
option httpport '3000'
|
||||
option redirect 'none'
|
||||
option configpath '/etc/AdGuardHome.yaml'
|
||||
option workdir '/etc/AdGuardHome'
|
||||
option logfile '/tmp/AdGuardHome.log'
|
||||
option verbose '0'
|
||||
option binpath '/usr/bin/AdGuardHome'
|
||||
option upxflag ''
|
||||
|
632
luci-app-adguardhome/root/etc/init.d/AdGuardHome
Executable file
632
luci-app-adguardhome/root/etc/init.d/AdGuardHome
Executable file
@ -0,0 +1,632 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=95
|
||||
STOP=01
|
||||
|
||||
CONFIGURATION=AdGuardHome
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
|
||||
extra_command "do_redirect" "0 or 1"
|
||||
extra_command "testbackup" "backup or restore"
|
||||
extra_command "test_crontab"
|
||||
extra_command "force_reload"
|
||||
extra_command "isrunning"
|
||||
|
||||
set_forward_dnsmasq()
|
||||
{
|
||||
local PORT="$1"
|
||||
addr="127.0.0.1#$PORT"
|
||||
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
|
||||
uci add_list dhcp.@dnsmasq[0].server=$addr
|
||||
for server in $OLD_SERVER; do
|
||||
if [ "$server" = "$addr" ]; then
|
||||
continue
|
||||
fi
|
||||
uci add_list dhcp.@dnsmasq[0].server=$server
|
||||
done
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
}
|
||||
|
||||
stop_forward_dnsmasq()
|
||||
{
|
||||
local OLD_PORT="$1"
|
||||
addr="127.0.0.1#$OLD_PORT"
|
||||
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
|
||||
addrlist="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||
if [ -z "$addrlist" ] ; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
|
||||
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
|
||||
fi
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
}
|
||||
|
||||
set_iptable()
|
||||
{
|
||||
local ipv6_server=$1
|
||||
local tcp_server=$2
|
||||
uci -q batch <<-EOF >/dev/null 2>&1
|
||||
delete firewall.AdGuardHome
|
||||
set firewall.AdGuardHome=include
|
||||
set firewall.AdGuardHome.type=script
|
||||
set firewall.AdGuardHome.path=/usr/share/AdGuardHome/firewall.start
|
||||
set firewall.AdGuardHome.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
|
||||
for IP in $IPS
|
||||
do
|
||||
if [ "$tcp_server" == "1" ]; then
|
||||
iptables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [ "$ipv6_server" == 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
|
||||
for IP in $IPS
|
||||
do
|
||||
if [ "$tcp_server" == "1" ]; then
|
||||
ip6tables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||
fi
|
||||
ip6tables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
clear_iptable()
|
||||
{
|
||||
uci -q batch <<-EOF >/dev/null 2>&1
|
||||
delete firewall.AdGuardHome
|
||||
commit firewall
|
||||
EOF
|
||||
local OLD_PORT="$1"
|
||||
local ipv6_server=$2
|
||||
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
|
||||
for IP in $IPS
|
||||
do
|
||||
iptables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||
iptables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [ "$ipv6_server" == 0 ]; then
|
||||
return
|
||||
fi
|
||||
echo "warn ip6tables nat mod is needed"
|
||||
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
|
||||
for IP in $IPS
|
||||
do
|
||||
ip6tables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||
ip6tables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONFIGURATION"
|
||||
[ "$(uci get AdGuardHome.AdGuardHome.redirect)" == "redirect" ] && procd_add_reload_trigger firewall
|
||||
}
|
||||
|
||||
isrunning(){
|
||||
config_load "${CONFIGURATION}"
|
||||
_isrunning
|
||||
local r=$?
|
||||
([ "$r" == "0" ] && echo "running") || ([ "$r" == "1" ] && echo "not run" ) || echo "no bin"
|
||||
return $r
|
||||
}
|
||||
|
||||
_isrunning(){
|
||||
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||
[ ! -f "$binpath" ] && return 2
|
||||
pgrep $binpath 2>&1 >/dev/null && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
force_reload(){
|
||||
config_load "${CONFIGURATION}"
|
||||
_isrunning && procd_send_signal "$CONFIGURATION" || start
|
||||
}
|
||||
|
||||
get_tz()
|
||||
{
|
||||
SET_TZ=""
|
||||
|
||||
if [ -e "/etc/localtime" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
for tzfile in /etc/TZ /var/etc/TZ
|
||||
do
|
||||
if [ ! -e "$tzfile" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
tz="`cat $tzfile 2>/dev/null`"
|
||||
done
|
||||
|
||||
if [ -z "$tz" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
SET_TZ=$tz
|
||||
}
|
||||
|
||||
rm_port53()
|
||||
{
|
||||
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||
if [ -z "$dnsmasq_port" ]; then
|
||||
dnsmasq_port="53"
|
||||
fi
|
||||
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
|
||||
if [ "$dnsmasq_port" == "53" ]; then
|
||||
dnsmasq_port="1745"
|
||||
fi
|
||||
elif [ "$dnsmasq_port" == "53" ]; then
|
||||
return
|
||||
fi
|
||||
config_editor "dns.port" "$dnsmasq_port" "$configpath"
|
||||
uci set dhcp.@dnsmasq[0].port="53"
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq reload
|
||||
}
|
||||
|
||||
use_port53()
|
||||
{
|
||||
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||
if [ -z "$dnsmasq_port" ]; then
|
||||
dnsmasq_port="53"
|
||||
fi
|
||||
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
|
||||
if [ "$dnsmasq_port" == "53" ]; then
|
||||
AdGuardHome_PORT="1745"
|
||||
fi
|
||||
elif [ "$AdGuardHome_PORT" == "53" ]; then
|
||||
return
|
||||
fi
|
||||
config_editor "dns.port" "53" "$configpath"
|
||||
uci set dhcp.@dnsmasq[0].port="$AdGuardHome_PORT"
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq reload
|
||||
}
|
||||
|
||||
do_redirect()
|
||||
{
|
||||
config_load "${CONFIGURATION}"
|
||||
_do_redirect $1
|
||||
}
|
||||
|
||||
_do_redirect()
|
||||
{
|
||||
local section="$CONFIGURATION"
|
||||
args=""
|
||||
ipv6_server=1
|
||||
tcp_server=0
|
||||
enabled=$1
|
||||
if [ "$enabled" == "1" ]; then
|
||||
echo -n "1">/var/run/AdGredir
|
||||
else
|
||||
echo -n "0">/var/run/AdGredir
|
||||
fi
|
||||
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
||||
AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||
if [ -z "$AdGuardHome_PORT" ]; then
|
||||
AdGuardHome_PORT="0"
|
||||
fi
|
||||
config_get "redirect" "$section" "redirect" "none"
|
||||
config_get "old_redirect" "$section" "old_redirect" "none"
|
||||
config_get "old_port" "$section" "old_port" "0"
|
||||
config_get "old_enabled" "$section" "old_enabled" "0"
|
||||
uci get dhcp.@dnsmasq[0].port >/dev/null 2>&1 || uci set dhcp.@dnsmasq[0].port="53" >/dev/null 2>&1
|
||||
if [ "$old_enabled" = "1" -a "$old_redirect" == "exchange" ]; then
|
||||
AdGuardHome_PORT=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$old_redirect" != "$redirect" ] || [ "$old_port" != "$AdGuardHome_PORT" ] || [ "$old_enabled" = "1" -a "$enabled" = "0" ]; then
|
||||
if [ "$old_redirect" != "none" ]; then
|
||||
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
|
||||
clear_iptable "$old_port" "$ipv6_server"
|
||||
elif [ "$old_redirect" == "dnsmasq-upstream" ]; then
|
||||
stop_forward_dnsmasq "$old_port"
|
||||
elif [ "$old_redirect" == "exchange" ]; then
|
||||
rm_port53
|
||||
fi
|
||||
fi
|
||||
elif [ "$old_enabled" = "1" -a "$enabled" = "1" ]; then
|
||||
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
|
||||
clear_iptable "$old_port" "$ipv6_server"
|
||||
fi
|
||||
fi
|
||||
uci delete AdGuardHome.@AdGuardHome[0].old_redirect 2>/dev/null
|
||||
uci delete AdGuardHome.@AdGuardHome[0].old_port 2>/dev/null
|
||||
uci delete AdGuardHome.@AdGuardHome[0].old_enabled 2>/dev/null
|
||||
uci add_list AdGuardHome.@AdGuardHome[0].old_redirect="$redirect" 2>/dev/null
|
||||
uci add_list AdGuardHome.@AdGuardHome[0].old_port="$AdGuardHome_PORT" 2>/dev/null
|
||||
uci add_list AdGuardHome.@AdGuardHome[0].old_enabled="$enabled" 2>/dev/null
|
||||
uci commit AdGuardHome
|
||||
[ "$enabled" == "0" ] && return 1
|
||||
if [ "$AdGuardHome_PORT" == "0" ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ "$redirect" = "redirect" ]; then
|
||||
set_iptable $ipv6_server $tcp_server
|
||||
elif [ "$redirect" = "dnsmasq-upstream" ]; then
|
||||
set_forward_dnsmasq "$AdGuardHome_PORT"
|
||||
elif [ "$redirect" == "exchange" -a "$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)" == "53" ]; then
|
||||
use_port53
|
||||
fi
|
||||
}
|
||||
|
||||
get_filesystem()
|
||||
{
|
||||
# print out path filesystem
|
||||
echo $1 | awk '
|
||||
BEGIN{
|
||||
while (("mount"| getline ret) > 0)
|
||||
{
|
||||
split(ret,d);
|
||||
fs[d[3]]=d[5];
|
||||
m=index(d[1],":")
|
||||
if (m==0)
|
||||
{
|
||||
pt[d[3]]=d[1]
|
||||
}else{
|
||||
pt[d[3]]=substr(d[1],m+1)
|
||||
}}}{
|
||||
split($0,d,"/");
|
||||
if ("/" in fs)
|
||||
{
|
||||
result1=fs["/"];
|
||||
}
|
||||
if ("/" in pt)
|
||||
{
|
||||
result2=pt["/"];
|
||||
}
|
||||
for (i=2;i<=length(d);i++)
|
||||
{
|
||||
p[i]=p[i-1]"/"d[i];
|
||||
if (p[i] in fs)
|
||||
{
|
||||
result1=fs[p[i]];
|
||||
result2=pt[p[i]];
|
||||
}
|
||||
}
|
||||
if (result2 in fs){
|
||||
result=fs[result2]}
|
||||
else{
|
||||
result=result1}
|
||||
print(result);}'
|
||||
}
|
||||
|
||||
config_editor()
|
||||
{
|
||||
awk -v yaml="$1" -v value="$2" -v file="$3" -v ro="$4" '
|
||||
BEGIN{split(yaml,part,"\.");s="";i=1;l=length(part);}
|
||||
{
|
||||
if (match($0,s""part[i]":"))
|
||||
{
|
||||
if (i==l)
|
||||
{
|
||||
split($0,t,": ");
|
||||
if (ro==""){
|
||||
system("sed -i '\''"FNR"c \\"t[1]": "value"'\'' "file);
|
||||
}else{
|
||||
print(t[2]);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
s=s"[- ]{2}";
|
||||
i++;
|
||||
}
|
||||
}' $3
|
||||
}
|
||||
|
||||
boot_service() {
|
||||
rm /var/run/AdGserverdis >/dev/null 2>&1
|
||||
config_load "${CONFIGURATION}"
|
||||
config_get waitonboot $CONFIGURATION waitonboot "0"
|
||||
config_get_bool enabled $CONFIGURATION enabled 0
|
||||
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||
[ -f "$binpath" ] && start_service
|
||||
if [ "$enabled" == "1" ] && [ "$waitonboot" == "1" ]; then
|
||||
procd_open_instance "waitnet"
|
||||
procd_set_param command "/usr/share/AdGuardHome/waitnet.sh"
|
||||
procd_close_instance
|
||||
echo "no net start pinging"
|
||||
fi
|
||||
}
|
||||
|
||||
testbackup(){
|
||||
config_load "${CONFIGURATION}"
|
||||
if [ "$1" == "backup" ]; then
|
||||
backup
|
||||
elif [ "$1" == "restore" ]; then
|
||||
restore
|
||||
fi
|
||||
}
|
||||
|
||||
restore()
|
||||
{
|
||||
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
|
||||
cp -u -r -f $backupwdpath/data $workdir
|
||||
}
|
||||
|
||||
backup() {
|
||||
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
|
||||
mkdir -p $backupwdpath/data
|
||||
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||
config_get backupfile $CONFIGURATION backupfile ""
|
||||
for one in $backupfile;
|
||||
do
|
||||
while :
|
||||
do
|
||||
if [ -d "$backupwdpath/data/$one" ]; then
|
||||
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data 2>&1)
|
||||
else
|
||||
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data/$one 2>&1)
|
||||
fi
|
||||
echo "$cpret"
|
||||
echo "$cpret" | grep "no space left on device"
|
||||
if [ "$?" == "0" ]; then
|
||||
echo "磁盘已满,删除log重试中"
|
||||
del_querylog && continue
|
||||
rm -f -r $backupwdpath/data/filters
|
||||
rm -f -r $workdir/data/filters && continue
|
||||
echo "backup failed"
|
||||
fi
|
||||
break
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
start_service() {
|
||||
# Reading config
|
||||
rm /var/run/AdGserverdis >/dev/null 2>&1
|
||||
config_load "${CONFIGURATION}"
|
||||
# update password
|
||||
config_get hashpass $CONFIGURATION hashpass ""
|
||||
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
||||
if [ -n "$hashpass" ]; then
|
||||
config_editor "users.password" "$hashpass" "$configpath"
|
||||
uci set $CONFIGURATION.$CONFIGURATION.hashpass=""
|
||||
fi
|
||||
local enabled
|
||||
config_get_bool enabled $CONFIGURATION enabled 0
|
||||
# update crontab
|
||||
do_crontab
|
||||
if [ "$enabled" == "0" ]; then
|
||||
_do_redirect 0
|
||||
return
|
||||
fi
|
||||
#what need to do before reload
|
||||
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||
|
||||
config_get backupfile $CONFIGURATION backupfile ""
|
||||
mkdir -p $workdir/data
|
||||
if [ -n "$backupfile" ] && [ ! -d "$workdir/data" ]; then
|
||||
restore
|
||||
fi
|
||||
# for overlay data-stk-oo not suppport
|
||||
local cwdfs=$(get_filesystem $workdir)
|
||||
echo "workdir is a $cwdfs filesystem"
|
||||
if [ "$cwdfs" == "jffs2" ]; then
|
||||
echo "fs error ln db to tmp $workdir $cwdfs"
|
||||
logger "AdGuardHome" "warning db redirect to tmp"
|
||||
touch $workdir/data/stats.db
|
||||
if [ ! -L $workdir/data/stats.db ]; then
|
||||
mv -f $workdir/data/stats.db /tmp/stats.db 2>/dev/null
|
||||
ln -s /tmp/stats.db $workdir/data/stats.db 2>/dev/null
|
||||
fi
|
||||
touch $workdir/data/sessions.db
|
||||
if [ ! -L $workdir/data/sessions.db ]; then
|
||||
mv -f $workdir/data/sessions.db /tmp/sessions.db 2>/dev/null
|
||||
ln -s /tmp/sessions.db $workdir/data/sessions.db 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
local ADDITIONAL_ARGS=""
|
||||
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||
|
||||
mkdir -p ${binpath%/*}
|
||||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -c $configpath"
|
||||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -w $workdir"
|
||||
config_get httpport $CONFIGURATION httpport 3000
|
||||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -p $httpport"
|
||||
|
||||
# hack to save config file when upgrade system
|
||||
config_get upprotect $CONFIGURATION upprotect ""
|
||||
eval upprotect=${upprotect// /\\\\n}
|
||||
echo -e "$upprotect">/lib/upgrade/keep.d/luci-app-adguardhome
|
||||
|
||||
config_get logfile $CONFIGURATION logfile ""
|
||||
if [ -n "$logfile" ]; then
|
||||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -l $logfile"
|
||||
fi
|
||||
|
||||
if [ ! -f "$binpath" ]; then
|
||||
_do_redirect 0
|
||||
/usr/share/AdGuardHome/update_core.sh 2>&1 >/tmp/AdGuardHome_update.log &
|
||||
exit 0
|
||||
fi
|
||||
|
||||
config_get_bool verbose $CONFIGURATION verbose 0
|
||||
if [ "$verbose" -eq 1 ]; then
|
||||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -v"
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
get_tz
|
||||
if [ -n "$SET_TZ" ]; then
|
||||
procd_set_param env TZ="$SET_TZ"
|
||||
fi
|
||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
||||
procd_set_param limits core="unlimited" nofile="65535 65535"
|
||||
procd_set_param stderr 1
|
||||
procd_set_param command $binpath $ADDITIONAL_ARGS
|
||||
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
|
||||
procd_close_instance
|
||||
if [ -f "$configpath" ]; then
|
||||
_do_redirect 1
|
||||
else
|
||||
_do_redirect 0
|
||||
config_get "redirect" "AdGuardHome" "redirect" "none"
|
||||
if [ "$redirect" != "none" ]; then
|
||||
procd_open_instance "waitconfig"
|
||||
procd_set_param command "/usr/share/AdGuardHome/watchconfig.sh"
|
||||
procd_close_instance
|
||||
echo "no config start watching"
|
||||
fi
|
||||
fi
|
||||
echo "AdGuardHome service enabled"
|
||||
echo "luci enable switch=$enabled"
|
||||
(sleep 10 && [ -z "$(pgrep $binpath)" ] && logger "AdGuardHome" "no process in 10s cancel redirect" && _do_redirect 0 )&
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
rm /var/run/AdGlucitest >/dev/null 2>&1
|
||||
echo "AdGuardHome reloading"
|
||||
start
|
||||
}
|
||||
|
||||
del_querylog(){
|
||||
local btarget=$(ls $backupwdpath/data | grep -F "querylog.json" | sort -r | head -n 1)
|
||||
local wtarget=$(ls $workdir/data | grep -F "querylog.json" | sort -r | head -n 1)
|
||||
if [ "$btarget"x == "$wtarget"x ]; then
|
||||
[ -z "$btarget" ] && return 1
|
||||
rm -f $workdir/data/$wtarget
|
||||
rm -f $backupwdpath/data/$btarget
|
||||
return 0
|
||||
fi
|
||||
if [ "$btarget" \> "$wtarget" ]; then
|
||||
rm -f $backupwdpath/data/$btarget
|
||||
return 0
|
||||
else
|
||||
rm -f $workdir/data/$wtarget
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
config_load "${CONFIGURATION}"
|
||||
_do_redirect 0
|
||||
do_crontab
|
||||
if [ "$1" != "nobackup" ]; then
|
||||
config_get backupfile $CONFIGURATION backupfile "0"
|
||||
if [ -n "$backupfile" ]; then
|
||||
backup
|
||||
fi
|
||||
fi
|
||||
echo "AdGuardHome service disabled"
|
||||
touch /var/run/AdGserverdis
|
||||
}
|
||||
|
||||
boot() {
|
||||
rc_procd boot_service "$@"
|
||||
if eval "type service_started" 2>/dev/null >/dev/null; then
|
||||
service_started
|
||||
fi
|
||||
}
|
||||
|
||||
test_crontab(){
|
||||
config_load "${CONFIGURATION}"
|
||||
do_crontab
|
||||
}
|
||||
|
||||
do_crontab(){
|
||||
config_get_bool enabled $CONFIGURATION enabled 0
|
||||
config_get crontab $CONFIGURATION crontab ""
|
||||
local findstr default cronenable replace commit
|
||||
local cronreload=0
|
||||
local commit=0
|
||||
findstr="/usr/share/AdGuardHome/update_core.sh"
|
||||
default="30 3 * * * /usr/share/AdGuardHome/update_core.sh 2>&1"
|
||||
[ "$enabled" == "0" ] || [ "${crontab//autoupdate/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||
crontab_editor
|
||||
|
||||
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||
config_get lastworkdir $CONFIGURATION lastworkdir "/etc/AdGuardHome"
|
||||
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
|
||||
#[ -n "$lastworkdir" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastworkdir/data/querylog.json" && [ "$lastworkdir" != "$workdir" ] && replace="${lastworkdir//\//\\/}/${workdir//\//\\/}"
|
||||
default="0 * * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
|
||||
[ "$enabled" == "0" ] || [ "${crontab//cutquerylog/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||
crontab_editor
|
||||
#[ "$lastworkdir" != "$workdir" ] && uci set AdGuardHome.AdGuardHome.lastworkdir="$workdir" && commit=1
|
||||
|
||||
config_get logfile $CONFIGURATION logfile ""
|
||||
config_get lastlogfile $CONFIGURATION lastlogfile ""
|
||||
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.logfile)"
|
||||
default="30 3 * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.logfile)"
|
||||
#[ -n "$lastlogfile" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastlogfile" && [ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && replace="${lastlogfile//\//\\/}/${logfile//\//\\/}"
|
||||
[ "$logfile" == "syslog" ] || [ "$logfile" == "" ] || [ "$enabled" == "0" ] || [ "${crontab//cutruntimelog/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||
crontab_editor
|
||||
#[ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && uci set AdGuardHome.AdGuardHome.lastlogfile="$logfile" && commit=1
|
||||
|
||||
findstr="/usr/share/AdGuardHome/addhost.sh"
|
||||
default="0 * * * * /usr/share/AdGuardHome/addhost.sh"
|
||||
[ "$enabled" == "0" ] || [ "${crontab//autohost/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||
crontab_editor
|
||||
[ "$cronenable" == "0" ] && /usr/share/AdGuardHome/addhost.sh "del" "noreload" || /usr/share/AdGuardHome/addhost.sh "" "noreload"
|
||||
|
||||
findstr="/usr/share/AdGuardHome/gfw2adg.sh"
|
||||
default="30 3 * * * /usr/share/AdGuardHome/gfw2adg.sh"
|
||||
[ "$enabled" == "0" ] || [ "${crontab//autogfw/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||
crontab_editor
|
||||
[ "$cronreload" -gt 0 ] && /etc/init.d/cron restart
|
||||
#[ "$commit" -gt 0 ] && uci commit AdGuardHome
|
||||
}
|
||||
|
||||
crontab_editor(){
|
||||
#usage input:
|
||||
#findstr=
|
||||
#default=
|
||||
#cronenable=
|
||||
#replace="${last//\//\\/}/${now//\//\\/}"
|
||||
#output:cronreload:if >1 please /etc/init.d/cron restart manual
|
||||
local testline reload
|
||||
local line="$(grep "$findstr" $CRON_FILE)"
|
||||
[ -n "$replace" ] && [ -n "$line" ] && eval testline="\${line//$replace}" && [ "$testline" != "$line" ] && line="$testline" && reload="1" && replace=""
|
||||
if [ "${line:0:1}" != "#" ]; then
|
||||
if [ $cronenable -eq 1 ]; then
|
||||
[ -z "$line" ] && line="$default" && reload="1"
|
||||
if [ -n "$reload" ]; then
|
||||
sed -i "\,$findstr,d" $CRON_FILE
|
||||
echo "$line" >> $CRON_FILE
|
||||
cronreload=$((cronreload+1))
|
||||
fi
|
||||
elif [ -n "$line" ]; then
|
||||
sed -i "\,$findstr,d" $CRON_FILE
|
||||
echo "#$line" >> $CRON_FILE
|
||||
cronreload=$((cronreload+1))
|
||||
fi
|
||||
else
|
||||
if [ $cronenable -eq 1 ]; then
|
||||
sed -i "\,$findstr,d" $CRON_FILE
|
||||
echo "${line:1}" >> $CRON_FILE
|
||||
cronreload=$((cronreload+1))
|
||||
elif [ -z "$reload" ]; then
|
||||
sed -i "\,$findstr,d" $CRON_FILE
|
||||
echo "$line" >> $CRON_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
12
luci-app-adguardhome/root/etc/uci-defaults/40_luci-AdGuardHome
Executable file
12
luci-app-adguardhome/root/etc/uci-defaults/40_luci-AdGuardHome
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null 2>&1
|
||||
delete ucitrack.@AdGuardHome[-1]
|
||||
add ucitrack AdGuardHome
|
||||
set ucitrack.@AdGuardHome[-1].init=AdGuardHome
|
||||
commit ucitrack
|
||||
delete AdGuardHome.AdGuardHome.ucitracktest
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,109 @@
|
||||
#提交就可以直接用的配置模板文件
|
||||
#a template config can be use with a apply
|
||||
bind_host: 0.0.0.0
|
||||
bind_port: 3000
|
||||
users:
|
||||
- name: root
|
||||
password: $2y$10$FfeQavihMUiXCuJhHuQwy.6EOXDvkXb/S50qI5fXizqarNT/ShhQm
|
||||
language: ""
|
||||
rlimit_nofile: 0
|
||||
dns:
|
||||
bind_host: 0.0.0.0
|
||||
port: 5553
|
||||
statistics_interval: 1
|
||||
protection_enabled: true
|
||||
filtering_enabled: true
|
||||
filters_update_interval: 24
|
||||
blocking_mode: nxdomain
|
||||
blocked_response_ttl: 10
|
||||
querylog_enabled: false
|
||||
querylog_interval: 1
|
||||
ratelimit: 0
|
||||
ratelimit_whitelist: []
|
||||
refuse_any: false
|
||||
bootstrap_dns:
|
||||
#bootstrap_dns
|
||||
all_servers: false
|
||||
allowed_clients: []
|
||||
disallowed_clients: []
|
||||
blocked_hosts: []
|
||||
parental_block_host: ""
|
||||
safebrowsing_block_host: ""
|
||||
blocked_services: []
|
||||
cache_size: 4194304
|
||||
parental_sensitivity: 13
|
||||
parental_enabled: false
|
||||
safesearch_enabled: false
|
||||
safebrowsing_enabled: false
|
||||
safebrowsing_cache_size: 1048576
|
||||
safesearch_cache_size: 1048576
|
||||
parental_cache_size: 1048576
|
||||
cache_time: 30
|
||||
rewrites: []
|
||||
upstream_dns:
|
||||
#upstream_dns
|
||||
tls:
|
||||
enabled: false
|
||||
server_name: ""
|
||||
force_https: false
|
||||
port_https: 443
|
||||
port_dns_over_tls: 853
|
||||
certificate_chain: ""
|
||||
private_key: ""
|
||||
certificate_path: ""
|
||||
private_key_path: ""
|
||||
filters:
|
||||
- enabled: true
|
||||
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
|
||||
name: AdGuard Simplified Domain Names filter
|
||||
id: 1
|
||||
- enabled: true
|
||||
url: https://adaway.org/hosts.txt
|
||||
name: AdAway
|
||||
id: 2
|
||||
- enabled: false
|
||||
url: https://hosts-file.net/ad_servers.txt
|
||||
name: hpHosts - Ad and Tracking servers only
|
||||
id: 3
|
||||
- enabled: true
|
||||
url: https://www.malwaredomainlist.com/hostslist/hosts.txt
|
||||
name: MalwareDomainList.com Hosts List
|
||||
id: 4
|
||||
- enabled: false
|
||||
url: https://raw.githubusercontent.com/vokins/yhosts/master/data/tvbox.txt
|
||||
name: tvbox
|
||||
id: 1575018007
|
||||
- enabled: true
|
||||
url: https://hosts.nfz.moe/full/hosts
|
||||
name: neoHosts full
|
||||
id: 1575618240
|
||||
- enabled: false
|
||||
url: https://hosts.nfz.moe/basic/hosts
|
||||
name: neoHosts basic
|
||||
id: 1575618241
|
||||
- enabled: false
|
||||
url: http://sbc.io/hosts/hosts
|
||||
name: StevenBlack host basic
|
||||
id: 1575618242
|
||||
- enabled: false
|
||||
url: http://sbc.io/hosts/alternates/fakenews-gambling-porn-social/hosts
|
||||
name: StevenBlack host+fakenews + gambling + porn + social
|
||||
id: 1575618243
|
||||
- enabled: false
|
||||
url: https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-easylist.txt
|
||||
name: anti-AD(Adblock+neohosts+yhosts+cjxlist+adhlist)
|
||||
id: 1577113202
|
||||
user_rules: []
|
||||
dhcp:
|
||||
enabled: false
|
||||
interface_name: ""
|
||||
gateway_ip: ""
|
||||
subnet_mask: ""
|
||||
range_start: ""
|
||||
range_end: ""
|
||||
lease_duration: 86400
|
||||
icmp_timeout_msec: 1000
|
||||
clients: []
|
||||
log_file: ""
|
||||
verbose: false
|
||||
schema_version: 5
|
35
luci-app-adguardhome/root/usr/share/AdGuardHome/addhost.sh
Executable file
35
luci-app-adguardhome/root/usr/share/AdGuardHome/addhost.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
checkmd5(){
|
||||
local nowmd5=$(md5sum /etc/hosts)
|
||||
nowmd5=${nowmd5%% *}
|
||||
local lastmd5=$(uci get AdGuardHome.AdGuardHome.hostsmd5 2>/dev/null)
|
||||
if [ "$nowmd5" != "$lastmd5" ]; then
|
||||
uci set AdGuardHome.AdGuardHome.hostsmd5="$nowmd5"
|
||||
uci commit AdGuardHome
|
||||
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
|
||||
fi
|
||||
}
|
||||
|
||||
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' /etc/hosts && checkmd5 "$2" && exit 0
|
||||
/usr/bin/awk 'BEGIN{
|
||||
while ((getline < "/tmp/dhcp.leases") > 0)
|
||||
{
|
||||
a[$2]=$4;
|
||||
}
|
||||
while (("ip -6 neighbor show | grep -v fe80" | getline) > 0)
|
||||
{
|
||||
if (a[$5]) {print $1" "a[$5] >"/tmp/tmphost"; }
|
||||
}
|
||||
print "#programaddend" >"/tmp/tmphost";
|
||||
}'
|
||||
grep programaddstart /etc/hosts >/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
sed -i '/programaddstart/,/programaddend/c\#programaddstart' /etc/hosts
|
||||
sed -i '/programaddstart/'r/tmp/tmphost /etc/hosts
|
||||
else
|
||||
echo "#programaddstart" >>/etc/hosts
|
||||
cat /tmp/tmphost >> /etc/hosts
|
||||
fi
|
||||
rm /tmp/tmphost
|
||||
checkmd5 "$2"
|
8
luci-app-adguardhome/root/usr/share/AdGuardHome/firewall.start
Executable file
8
luci-app-adguardhome/root/usr/share/AdGuardHome/firewall.start
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
AdGuardHome_enable=$(uci get AdGuardHome.AdGuardHome.enabled)
|
||||
redirect=$(uci get AdGuardHome.AdGuardHome.redirect)
|
||||
|
||||
if [ $AdGuardHome_enable -eq 1 -a "$redirect" == "redirect" ]; then
|
||||
/etc/init.d/AdGuardHome do_redirect 1
|
||||
fi
|
20
luci-app-adguardhome/root/usr/share/AdGuardHome/getsyslog.sh
Executable file
20
luci-app-adguardhome/root/usr/share/AdGuardHome/getsyslog.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
logread -e AdGuardHome > /tmp/AdGuardHometmp.log
|
||||
logread -e AdGuardHome -f >> /tmp/AdGuardHometmp.log &
|
||||
pid=$!
|
||||
echo "1">/var/run/AdGuardHomesyslog
|
||||
while true
|
||||
do
|
||||
sleep 12
|
||||
watchdog=$(cat /var/run/AdGuardHomesyslog)
|
||||
if [ "$watchdog"x == "0"x ]; then
|
||||
kill $pid
|
||||
rm /tmp/AdGuardHometmp.log
|
||||
rm /var/run/AdGuardHomesyslog
|
||||
exit 0
|
||||
else
|
||||
echo "0">/var/run/AdGuardHomesyslog
|
||||
fi
|
||||
done
|
89
luci-app-adguardhome/root/usr/share/AdGuardHome/gfw2adg.sh
Executable file
89
luci-app-adguardhome/root/usr/share/AdGuardHome/gfw2adg.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
checkmd5(){
|
||||
local nowmd5=$(md5sum /tmp/adguard.list 2>/dev/null)
|
||||
nowmd5=${nowmd5%% *}
|
||||
local lastmd5=$(uci get AdGuardHome.AdGuardHome.gfwlistmd5 2>/dev/null)
|
||||
if [ "$nowmd5" != "$lastmd5" ]; then
|
||||
uci set AdGuardHome.AdGuardHome.gfwlistmd5="$nowmd5"
|
||||
uci commit AdGuardHome
|
||||
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
|
||||
fi
|
||||
}
|
||||
|
||||
configpath=$(uci get AdGuardHome.AdGuardHome.configpath 2>/dev/null)
|
||||
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' $configpath && checkmd5 "$2" && exit 0
|
||||
gfwupstream=$(uci get AdGuardHome.AdGuardHome.gfwupstream 2>/dev/null)
|
||||
if [ -z $gfwupstream ]; then
|
||||
gfwupstream="tcp://208.67.220.220:5353"
|
||||
fi
|
||||
if [ ! -f "$configpath" ]; then
|
||||
echo "please make a config first"
|
||||
exit 1
|
||||
fi
|
||||
wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O- | base64 -d > /tmp/gfwlist.txt
|
||||
cat /tmp/gfwlist.txt | awk -v upst="$gfwupstream" 'BEGIN{getline;}{
|
||||
s1=substr($0,1,1);
|
||||
if (s1=="!")
|
||||
{next;}
|
||||
if (s1=="@"){
|
||||
$0=substr($0,3);
|
||||
s1=substr($0,1,1);
|
||||
white=1;}
|
||||
else{
|
||||
white=0;
|
||||
}
|
||||
|
||||
if (s1=="|")
|
||||
{s2=substr($0,2,1);
|
||||
if (s2=="|")
|
||||
{
|
||||
$0=substr($0,3);
|
||||
split($0,d,"/");
|
||||
$0=d[1];
|
||||
}else{
|
||||
split($0,d,"/");
|
||||
$0=d[3];
|
||||
}}
|
||||
else{
|
||||
split($0,d,"/");
|
||||
$0=d[1];
|
||||
}
|
||||
star=index($0,"*");
|
||||
if (star!=0)
|
||||
{
|
||||
$0=substr($0,star+1);
|
||||
dot=index($0,".");
|
||||
if (dot!=0)
|
||||
$0=substr($0,dot+1);
|
||||
else
|
||||
next;
|
||||
s1=substr($0,1,1);
|
||||
}
|
||||
if (s1==".")
|
||||
{fin=substr($0,2);}
|
||||
else{fin=$0;}
|
||||
if (index(fin,".")==0) next;
|
||||
if (index(fin,"%")!=0) next;
|
||||
if (index(fin,":")!=0) next;
|
||||
match(fin,"^[0-9\.]+")
|
||||
if (RSTART==1 && RLENGTH==length(fin)) {print "ipset add gfwlist "fin>"/tmp/doipset.sh";next;}
|
||||
if (fin=="" || finl==fin) next;
|
||||
finl=fin;
|
||||
if (white==0)
|
||||
{print(" - '\''[/"fin"/]"upst"'\''");}
|
||||
else{
|
||||
print(" - '\''[/"fin"/]#'\''");}
|
||||
}END{print(" - '\''[/programaddend/]#'\''")}' > /tmp/adguard.list
|
||||
grep programaddstart $configpath
|
||||
if [ "$?" == "0" ]; then
|
||||
sed -i '/programaddstart/,/programaddend/c\ - '\''\[\/programaddstart\/\]#'\''' $configpath
|
||||
sed -i '/programaddstart/'r/tmp/adguard.list $configpath
|
||||
else
|
||||
sed -i '1i\ - '\''[/programaddstart/]#'\''' /tmp/adguard.list
|
||||
sed -i '/upstream_dns:/'r/tmp/adguard.list $configpath
|
||||
fi
|
||||
checkmd5 "$2"
|
||||
rm -f /tmp/gfwlist.txt /tmp/adguard.list
|
@ -0,0 +1,3 @@
|
||||
https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz
|
||||
https://static.adguard.com/adguardhome/release/AdGuardHome_linux_${Arch}.tar.gz
|
||||
#https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_${Arch}.tar.gz
|
5
luci-app-adguardhome/root/usr/share/AdGuardHome/tailto.sh
Executable file
5
luci-app-adguardhome/root/usr/share/AdGuardHome/tailto.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
tail -n $1 "$2" > /var/run/tailtmp
|
||||
cat /var/run/tailtmp > "$2"
|
||||
rm /var/run/tailtmp
|
236
luci-app-adguardhome/root/usr/share/AdGuardHome/update_core.sh
Executable file
236
luci-app-adguardhome/root/usr/share/AdGuardHome/update_core.sh
Executable file
@ -0,0 +1,236 @@
|
||||
#!/bin/bash
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
|
||||
if [ -z "$binpath" ]; then
|
||||
uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
|
||||
binpath="/tmp/AdGuardHome/AdGuardHome"
|
||||
fi
|
||||
mkdir -p ${binpath%/*}
|
||||
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
|
||||
|
||||
check_if_already_running(){
|
||||
running_tasks="$(ps |grep "AdGuardHome" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
[ "${running_tasks}" -gt "2" ] && echo -e "\nA task is already running." && EXIT 2
|
||||
}
|
||||
|
||||
check_wgetcurl(){
|
||||
which curl && downloader="curl -L -k --retry 2 --connect-timeout 20 -o" && return
|
||||
which wget-ssl && downloader="wget-ssl --no-check-certificate -t 2 -T 20 -O" && return
|
||||
[ -z "$1" ] && opkg update || (echo error opkg && EXIT 1)
|
||||
[ -z "$1" ] && (opkg remove wget wget-nossl --force-depends ; opkg install wget ; check_wgetcurl 1 ;return)
|
||||
[ "$1" == "1" ] && (opkg install curl ; check_wgetcurl 2 ; return)
|
||||
echo error curl and wget && EXIT 1
|
||||
}
|
||||
|
||||
check_latest_version(){
|
||||
check_wgetcurl
|
||||
latest_ver="$($downloader - https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
|
||||
if [ -z "${latest_ver}" ]; then
|
||||
echo -e "\nFailed to check latest version, please try again later." && EXIT 1
|
||||
fi
|
||||
now_ver="$($binpath -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o)"
|
||||
if [ "${latest_ver}"x != "${now_ver}"x ] || [ "$1" == "force" ]; then
|
||||
echo -e "Local version: ${now_ver}., cloud version: ${latest_ver}."
|
||||
doupdate_core
|
||||
else
|
||||
echo -e "\nLocal version: ${now_ver}, cloud version: ${latest_ver}."
|
||||
echo -e "You're already using the latest version."
|
||||
if [ ! -z "$upxflag" ]; then
|
||||
filesize=$(ls -l $binpath | awk '{ print $5 }')
|
||||
if [ $filesize -gt 8000000 ]; then
|
||||
echo -e "start upx may take a long time"
|
||||
doupx
|
||||
mkdir -p "/tmp/AdGuardHomeupdate/AdGuardHome" >/dev/null 2>&1
|
||||
rm -fr /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
|
||||
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $binpath -o /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
|
||||
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||
/etc/init.d/AdGuardHome stop nobackup
|
||||
rm $binpath
|
||||
mv -f /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/} $binpath
|
||||
/etc/init.d/AdGuardHome start
|
||||
echo -e "finished"
|
||||
fi
|
||||
fi
|
||||
EXIT 0
|
||||
fi
|
||||
}
|
||||
|
||||
doupx(){
|
||||
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
|
||||
case $Archt in
|
||||
"i386")
|
||||
Arch="i386"
|
||||
;;
|
||||
"i686")
|
||||
Arch="i386"
|
||||
echo -e "i686 use $Arch may have bug"
|
||||
;;
|
||||
"x86")
|
||||
Arch="amd64"
|
||||
;;
|
||||
"mipsel")
|
||||
Arch="mipsel"
|
||||
;;
|
||||
"mips64el")
|
||||
Arch="mips64el"
|
||||
Arch="mipsel"
|
||||
echo -e "mips64el use $Arch may have bug"
|
||||
;;
|
||||
"mips")
|
||||
Arch="mips"
|
||||
;;
|
||||
"mips64")
|
||||
Arch="mips64"
|
||||
Arch="mips"
|
||||
echo -e "mips64 use $Arch may have bug"
|
||||
;;
|
||||
"arm")
|
||||
Arch="arm"
|
||||
;;
|
||||
"armeb")
|
||||
Arch="armeb"
|
||||
;;
|
||||
"aarch64")
|
||||
Arch="arm64"
|
||||
;;
|
||||
"powerpc")
|
||||
Arch="powerpc"
|
||||
;;
|
||||
"powerpc64")
|
||||
Arch="powerpc64"
|
||||
;;
|
||||
*)
|
||||
echo -e "error not support $Archt if you can use offical release please issue a bug"
|
||||
EXIT 1
|
||||
;;
|
||||
esac
|
||||
upx_latest_ver="$($downloader - https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E '[0-9.]+' -o 2>/dev/null)"
|
||||
$downloader /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/upx-${upx_latest_ver}-${Arch}_linux.tar.xz" 2>&1
|
||||
#tar xvJf
|
||||
which xz || (opkg list | grep ^xz || opkg update && opkg install xz) || (echo "xz download fail" && EXIT 1)
|
||||
mkdir -p /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||
xz -d -c /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz| tar -x -C "/tmp" >/dev/null 2>&1
|
||||
if [ ! -e "/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx" ]; then
|
||||
echo -e "Failed to download upx."
|
||||
EXIT 1
|
||||
fi
|
||||
rm /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz
|
||||
}
|
||||
|
||||
doupdate_core(){
|
||||
echo -e "Updating core..."
|
||||
mkdir -p "/tmp/AdGuardHomeupdate"
|
||||
rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1
|
||||
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
|
||||
case $Archt in
|
||||
"i386")
|
||||
Arch="386"
|
||||
;;
|
||||
"i686")
|
||||
Arch="386"
|
||||
;;
|
||||
"x86")
|
||||
Arch="amd64"
|
||||
;;
|
||||
"mipsel")
|
||||
Arch="mipsle"
|
||||
;;
|
||||
"mips64el")
|
||||
Arch="mips64le"
|
||||
Arch="mipsle"
|
||||
echo -e "mips64el use $Arch may have bug"
|
||||
;;
|
||||
"mips")
|
||||
Arch="mips"
|
||||
;;
|
||||
"mips64")
|
||||
Arch="mips64"
|
||||
Arch="mips"
|
||||
echo -e "mips64 use $Arch may have bug"
|
||||
;;
|
||||
"arm")
|
||||
Arch="arm"
|
||||
;;
|
||||
"aarch64")
|
||||
Arch="arm64"
|
||||
;;
|
||||
"powerpc")
|
||||
Arch="ppc"
|
||||
echo -e "error not support $Archt"
|
||||
EXIT 1
|
||||
;;
|
||||
"powerpc64")
|
||||
Arch="ppc64"
|
||||
echo -e "error not support $Archt"
|
||||
EXIT 1
|
||||
;;
|
||||
*)
|
||||
echo -e "error not support $Archt if you can use offical release please issue a bug"
|
||||
EXIT 1
|
||||
;;
|
||||
esac
|
||||
echo -e "start download"
|
||||
grep -v "^#" /usr/share/AdGuardHome/links.txt >/tmp/run/AdHlinks.txt
|
||||
while read link
|
||||
do
|
||||
eval link="$link"
|
||||
$downloader /tmp/AdGuardHomeupdate/${link##*/} "$link" 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "download failed try another download"
|
||||
rm -f /tmp/AdGuardHomeupdate/${link##*/}
|
||||
else
|
||||
local success="1"
|
||||
break
|
||||
fi
|
||||
done < "/tmp/run/AdHlinks.txt"
|
||||
rm /tmp/run/AdHlinks.txt
|
||||
[ -z "$success" ] && echo "no download success" && EXIT 1
|
||||
if [ "${link##*.}" == "gz" ]; then
|
||||
tar -zxf "/tmp/AdGuardHomeupdate/${link##*/}" -C "/tmp/AdGuardHomeupdate/"
|
||||
if [ ! -e "/tmp/AdGuardHomeupdate/AdGuardHome" ]; then
|
||||
echo -e "Failed to download core."
|
||||
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
||||
EXIT 1
|
||||
fi
|
||||
downloadbin="/tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome"
|
||||
else
|
||||
downloadbin="/tmp/AdGuardHomeupdate/${link##*/}"
|
||||
fi
|
||||
chmod 755 $downloadbin
|
||||
echo -e "download success start copy"
|
||||
if [ -n "$upxflag" ]; then
|
||||
echo -e "start upx may take a long time"
|
||||
doupx
|
||||
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $downloadbin
|
||||
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||
fi
|
||||
echo -e "start copy"
|
||||
/etc/init.d/AdGuardHome stop nobackup
|
||||
rm "$binpath"
|
||||
mv -f "$downloadbin" "$binpath"
|
||||
if [ "$?" == "1" ]; then
|
||||
echo "mv failed maybe not enough space please use upx or change bin to /tmp/AdGuardHome"
|
||||
EXIT 1
|
||||
fi
|
||||
/etc/init.d/AdGuardHome start
|
||||
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
||||
echo -e "Succeeded in updating core."
|
||||
echo -e "Local version: ${latest_ver}, cloud version: ${latest_ver}.\n"
|
||||
EXIT 0
|
||||
}
|
||||
|
||||
EXIT(){
|
||||
rm /var/run/update_core 2>/dev/null
|
||||
[ "$1" != "0" ] && touch /var/run/update_core_error
|
||||
exit $1
|
||||
}
|
||||
|
||||
main(){
|
||||
check_if_already_running
|
||||
check_latest_version $1
|
||||
}
|
||||
trap "EXIT 1" SIGTERM SIGINT
|
||||
touch /var/run/update_core
|
||||
rm /var/run/update_core_error 2>/dev/null
|
||||
main $1
|
35
luci-app-adguardhome/root/usr/share/AdGuardHome/waitnet.sh
Executable file
35
luci-app-adguardhome/root/usr/share/AdGuardHome/waitnet.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
count=0
|
||||
while :
|
||||
do
|
||||
ping -c 1 -W 1 -q www.baidu.com 1>/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
/etc/init.d/AdGuardHome force_reload
|
||||
break
|
||||
fi
|
||||
ping -c 1 -W 1 -q 202.108.22.5 1>/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
/etc/init.d/AdGuardHome force_reload
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
ping -c 1 -W 1 -q www.google.com 1>/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
/etc/init.d/AdGuardHome force_reload
|
||||
break
|
||||
fi
|
||||
ping -c 1 -W 1 -q 8.8.8.8 1>/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
/etc/init.d/AdGuardHome force_reload
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
count=$((count+1))
|
||||
if [ $count -gt 18 ]; then
|
||||
/etc/init.d/AdGuardHome force_reload
|
||||
break
|
||||
fi
|
||||
done
|
||||
return 0
|
13
luci-app-adguardhome/root/usr/share/AdGuardHome/watchconfig.sh
Executable file
13
luci-app-adguardhome/root/usr/share/AdGuardHome/watchconfig.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
configpath=$(uci get AdGuardHome.AdGuardHome.configpath)
|
||||
while :
|
||||
do
|
||||
sleep 10
|
||||
if [ -f "$configpath" ]; then
|
||||
/etc/init.d/AdGuardHome do_redirect 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
return 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-adguardhome": {
|
||||
"description": "Grant UCI access for luci-app-adguardhome",
|
||||
"read": {
|
||||
"uci": [ "AdGuardHome" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "AdGuardHome" ]
|
||||
}
|
||||
}
|
||||
}
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldcode.js
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldcode.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function e(e,o,i,t){if(i&&i.call){var l=i;i=null}else l=r(e,i,"rangeFinder");"number"==typeof o&&(o=n.Pos(o,0));var f=r(e,i,"minFoldSize");function d(n){var r=l(e,o);if(!r||r.to.line-r.from.line<f)return null;for(var i=e.findMarksAt(r.from),d=0;d<i.length;++d)if(i[d].__isFold&&"fold"!==t){if(!n)return null;r.cleared=!0,i[d].clear()}return r}var u=d(!0);if(r(e,i,"scanUp"))for(;!u&&o.line>e.firstLine();)o=n.Pos(o.line-1,0),u=d(!1);if(u&&!u.cleared&&"unfold"!==t){var a=function(n,e){var o=r(n,e,"widget");if("string"==typeof o){var i=document.createTextNode(o);(o=document.createElement("span")).appendChild(i),o.className="CodeMirror-foldmarker"}else o&&(o=o.cloneNode(!0));return o}(e,i);n.on(a,"mousedown",function(e){c.clear(),n.e_preventDefault(e)});var c=e.markText(u.from,u.to,{replacedWith:a,clearOnEnter:r(e,i,"clearOnEnter"),__isFold:!0});c.on("clear",function(o,r){n.signal(e,"unfold",e,o,r)}),n.signal(e,"fold",e,u.from,u.to)}}n.newFoldFunction=function(n,o){return function(r,i){e(r,i,{rangeFinder:n,widget:o})}},n.defineExtension("foldCode",function(n,o,r){e(this,n,o,r)}),n.defineExtension("isFolded",function(n){for(var e=this.findMarksAt(n),o=0;o<e.length;++o)if(e[o].__isFold)return!0}),n.commands.toggleFold=function(n){n.foldCode(n.getCursor())},n.commands.fold=function(n){n.foldCode(n.getCursor(),null,"fold")},n.commands.unfold=function(n){n.foldCode(n.getCursor(),null,"unfold")},n.commands.foldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"fold")})},n.commands.unfoldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"unfold")})},n.registerHelper("fold","combine",function(){var n=Array.prototype.slice.call(arguments,0);return function(e,o){for(var r=0;r<n.length;++r){var i=n[r](e,o);if(i)return i}}}),n.registerHelper("fold","auto",function(n,e){for(var o=n.getHelpers(e,"fold"),r=0;r<o.length;r++){var i=o[r](n,e);if(i)return i}});var o={rangeFinder:n.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function r(n,e,r){if(e&&void 0!==e[r])return e[r];var i=n.options.foldOptions;return i&&void 0!==i[r]?i[r]:o[r]}n.defineOption("foldOptions",null),n.defineExtension("foldOption",function(n,e){return r(this,n,e)})});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.css
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.js
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)}(function(t){"use strict";t.defineOption("foldGutter",!1,function(o,e,r){r&&r!=t.Init&&(o.clearGutter(o.state.foldGutter.options.gutter),o.state.foldGutter=null,o.off("gutterClick",a),o.off("changes",d),o.off("viewportChange",u),o.off("fold",l),o.off("unfold",l),o.off("swapDoc",d)),e&&(o.state.foldGutter=new function(t){this.options=t,this.from=this.to=0}(function(t){!0===t&&(t={});null==t.gutter&&(t.gutter="CodeMirror-foldgutter");null==t.indicatorOpen&&(t.indicatorOpen="CodeMirror-foldgutter-open");null==t.indicatorFolded&&(t.indicatorFolded="CodeMirror-foldgutter-folded");return t}(e)),f(o),o.on("gutterClick",a),o.on("changes",d),o.on("viewportChange",u),o.on("fold",l),o.on("unfold",l),o.on("swapDoc",d))});var o=t.Pos;function e(t,e){for(var r=t.findMarks(o(e,0),o(e+1,0)),n=0;n<r.length;++n)if(r[n].__isFold){var i=r[n].find(-1);if(i&&i.line===e)return r[n]}}function r(t){if("string"==typeof t){var o=document.createElement("div");return o.className=t+" CodeMirror-guttermarker-subtle",o}return t.cloneNode(!0)}function n(t,n,f){var a=t.state.foldGutter.options,d=n-1,u=t.foldOption(a,"minFoldSize"),l=t.foldOption(a,"rangeFinder"),c="string"==typeof a.indicatorFolded&&i(a.indicatorFolded),s="string"==typeof a.indicatorOpen&&i(a.indicatorOpen);t.eachLine(n,f,function(n){++d;var i=null,f=n.gutterMarkers;if(f&&(f=f[a.gutter]),e(t,d)){if(c&&f&&c.test(f.className))return;i=r(a.indicatorFolded)}else{var p=o(d,0),m=l&&l(t,p);if(m&&m.to.line-m.from.line>=u){if(s&&f&&s.test(f.className))return;i=r(a.indicatorOpen)}}(i||f)&&t.setGutterMarker(n,a.gutter,i)})}function i(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function f(t){var o=t.getViewport(),e=t.state.foldGutter;e&&(t.operation(function(){n(t,o.from,o.to)}),e.from=o.from,e.to=o.to)}function a(t,r,n){var i=t.state.foldGutter;if(i){var f=i.options;if(n==f.gutter){var a=e(t,r);a?a.clear():t.foldCode(o(r,0),f)}}}function d(t){var o=t.state.foldGutter;if(o){var e=o.options;o.from=o.to=0,clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){f(t)},e.foldOnChangeTimeSpan||600)}}function u(t){var o=t.state.foldGutter;if(o){var e=o.options;clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){var e=t.getViewport();o.from==o.to||e.from-o.to>20||o.from-e.to>20?f(t):t.operation(function(){e.from<o.from&&(n(t,e.from,o.from),o.from=e.from),e.to>o.to&&(n(t,o.to,e.to),o.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(t,o){var e=t.state.foldGutter;if(e){var r=o.line;r>=e.from&&r<e.to&&n(t,r,r+1)}}});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/indent-fold.js
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/indent-fold.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(n,t){var i=n.getLine(t),o=i.search(/\S/);return-1==o||/\bcomment\b/.test(n.getTokenTypeAt(e.Pos(t,o+1)))?-1:e.countColumn(i,null,n.getOption("tabSize"))}e.registerHelper("fold","indent",function(t,i){var o=n(t,i.line);if(!(o<0)){for(var r=null,l=i.line+1,f=t.lastLine();l<=f;++l){var u=n(t,l);if(-1==u);else{if(!(u>o))break;r=l}}return r?{from:e.Pos(i.line,t.getLine(i.line).length),to:e.Pos(r,t.getLine(r).length)}:void 0}})});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.css
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.js
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/mode/yaml/yaml.js
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/mode/yaml/yaml.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");return{token:function(i,t){var r=i.peek(),n=t.escaped;if(t.escaped=!1,"#"==r&&(0==i.pos||/\s/.test(i.string.charAt(i.pos-1))))return i.skipToEnd(),"comment";if(i.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(t.literal&&i.indentation()>t.keyCol)return i.skipToEnd(),"string";if(t.literal&&(t.literal=!1),i.sol()){if(t.keyCol=0,t.pair=!1,t.pairStart=!1,i.match(/---/))return"def";if(i.match(/\.\.\./))return"def";if(i.match(/\s*-\s+/))return"meta"}if(i.match(/^(\{|\}|\[|\])/))return"{"==r?t.inlinePairs++:"}"==r?t.inlinePairs--:"["==r?t.inlineList++:t.inlineList--,"meta";if(t.inlineList>0&&!n&&","==r)return i.next(),"meta";if(t.inlinePairs>0&&!n&&","==r)return t.keyCol=0,t.pair=!1,t.pairStart=!1,i.next(),"meta";if(t.pairStart){if(i.match(/^\s*(\||\>)\s*/))return t.literal=!0,"meta";if(i.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==t.inlinePairs&&i.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(t.inlinePairs>0&&i.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(i.match(e))return"keyword"}return!t.pair&&i.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(t.pair=!0,t.keyCol=i.indentation(),"atom"):t.pair&&i.match(/^:\s*/)?(t.pairStart=!0,"meta"):(t.pairStart=!1,t.escaped="\\"==r,i.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-yaml","yaml"),e.defineMIME("text/yaml","yaml")});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/theme/dracula.css
vendored
Normal file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/theme/dracula.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.cm-s-dracula.CodeMirror,.cm-s-dracula .CodeMirror-gutters{background-color:#282a36 !important;color:#f8f8f2 !important;border:0}.cm-s-dracula .CodeMirror-gutters{color:#282a36}.cm-s-dracula .CodeMirror-cursor{border-left:solid thin #f8f8f0}.cm-s-dracula .CodeMirror-linenumber{color:#6d8a88}.cm-s-dracula .CodeMirror-selected{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line>span::selection,.cm-s-dracula .CodeMirror-line>span>span::selection{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line>span::-moz-selection,.cm-s-dracula .CodeMirror-line>span>span::-moz-selection{background:rgba(255,255,255,0.10)}.cm-s-dracula span.cm-comment{color:#6272a4}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2{color:#f1fa8c}.cm-s-dracula span.cm-number{color:#bd93f9}.cm-s-dracula span.cm-variable{color:#50fa7b}.cm-s-dracula span.cm-variable-2{color:white}.cm-s-dracula span.cm-def{color:#50fa7b}.cm-s-dracula span.cm-operator{color:#ff79c6}.cm-s-dracula span.cm-keyword{color:#ff79c6}.cm-s-dracula span.cm-atom{color:#bd93f9}.cm-s-dracula span.cm-meta{color:#f8f8f2}.cm-s-dracula span.cm-tag{color:#ff79c6}.cm-s-dracula span.cm-attribute{color:#50fa7b}.cm-s-dracula span.cm-qualifier{color:#50fa7b}.cm-s-dracula span.cm-property{color:#66d9ef}.cm-s-dracula span.cm-builtin{color:#50fa7b}.cm-s-dracula span.cm-variable-3,.cm-s-dracula span.cm-type{color:#ffb86c}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,0.1)}.cm-s-dracula .CodeMirror-matchingbracket{text-decoration:underline;color:white !important}
|
7
luci-app-adguardhome/root/www/luci-static/resources/twin-bcrypt.min.js
vendored
Normal file
7
luci-app-adguardhome/root/www/luci-static/resources/twin-bcrypt.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
luci-app-advanced/Makefile
Normal file
17
luci-app-advanced/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2019 sirpdboy <https://github.com/sirpdboy/luci-app-advanced/>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for advanced and filebrowser
|
||||
PKG_VERSION:=1.9
|
||||
|
||||
define Package/luci-app-advanced/conffiles
|
||||
/etc/config/advanced
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
2
luci-app-advanced/README.md
Normal file
2
luci-app-advanced/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# luci-app-advanced
|
||||
luci-app-advanced 高级设置,包括smartdns,openclash,防火墙,DHCP等。
|
@ -0,0 +1,68 @@
|
||||
.fb-container {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.fb-container .cbi-button {
|
||||
height: 2.6rem;
|
||||
}
|
||||
.fb-container .cbi-input-text {
|
||||
margin-bottom: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
.fb-container .panel-title {
|
||||
padding-bottom: 0;
|
||||
width: 50%;
|
||||
border-bottom: none;
|
||||
}
|
||||
.fb-container .panel-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
.fb-container .upload-container {
|
||||
display: none;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.fb-container .upload-file {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
.fb-container .cbi-value-field {
|
||||
text-align: left;
|
||||
}
|
||||
.fb-container .parent-icon strong {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.fb-container td[class$="-icon"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
.fb-container .file-icon, .fb-container .folder-icon, .fb-container .link-icon {
|
||||
position: relative;
|
||||
}
|
||||
.fb-container .file-icon:before, .fb-container .folder-icon:before, .fb-container .link-icon:before {
|
||||
display: inline-block;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
content: '';
|
||||
background-size: contain;
|
||||
margin: 0 0.5rem 0 1rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fb-container .file-icon:before {
|
||||
background-image: url(file-icon.png);
|
||||
}
|
||||
.fb-container .folder-icon:before {
|
||||
background-image: url(folder-icon.png);
|
||||
}
|
||||
.fb-container .link-icon:before {
|
||||
background-image: url(link-icon.png);
|
||||
}
|
||||
@media screen and (max-width: 480px) {
|
||||
.fb-container .upload-file {
|
||||
width: 14.6rem;
|
||||
}
|
||||
.fb-container .cbi-value-owner,
|
||||
.fb-container .cbi-value-perm {
|
||||
display: none;
|
||||
}
|
||||
}
|
@ -0,0 +1,288 @@
|
||||
String.prototype.replaceAll = function(search, replacement) {
|
||||
var target = this;
|
||||
return target.replace(new RegExp(search, 'g'), replacement);
|
||||
};
|
||||
(function () {
|
||||
var iwxhr = new XHR();
|
||||
var listElem = document.getElementById("list-content");
|
||||
listElem.onclick = handleClick;
|
||||
var currentPath;
|
||||
var pathElem = document.getElementById("current-path");
|
||||
pathElem.onblur = function () {
|
||||
update_list(this.value.trim());
|
||||
};
|
||||
pathElem.onkeyup = function (evt) {
|
||||
if (evt.keyCode == 13) {
|
||||
this.blur();
|
||||
}
|
||||
};
|
||||
function removePath(filename, isdir) {
|
||||
var c = confirm('你确定要删除 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/delete',
|
||||
{
|
||||
path: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function installPath(filename, isdir) {
|
||||
if (isdir === "1") {
|
||||
alert('这是一个目录,请选择 ipk 文件进行安装!');
|
||||
return;
|
||||
}
|
||||
var isipk = isIPK(filename);
|
||||
if (isipk === 0) {
|
||||
alert('只允许安装 ipk 格式的文件!');
|
||||
return;
|
||||
}
|
||||
var c = confirm('你确定要安装 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/install',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
location.reload();
|
||||
alert('安装成功!');
|
||||
} else {
|
||||
alert('安装失败,请检查文件格式!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isIPK(filename) {
|
||||
var index= filename.lastIndexOf(".");
|
||||
var ext = filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function renamePath(filename) {
|
||||
var newname = prompt('请输入新的文件名:', filename);
|
||||
if (newname) {
|
||||
newname = newname.trim();
|
||||
if (newname != filename) {
|
||||
var newpath = concatPath(currentPath, newname);
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/rename',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newpath: newpath
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function openpath(filename, dirname) {
|
||||
dirname = dirname || currentPath;
|
||||
window.open('/cgi-bin/luci/admin/system/fileassistant/open?path='
|
||||
+ encodeURIComponent(dirname) + '&filename='
|
||||
+ encodeURIComponent(filename));
|
||||
}
|
||||
|
||||
function getFileElem(elem) {
|
||||
if (elem.className.indexOf('-icon') > -1) {
|
||||
return elem;
|
||||
}
|
||||
else if (elem.parentNode.className.indexOf('-icon') > -1) {
|
||||
return elem.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
function concatPath(path, filename) {
|
||||
if (path === '/') {
|
||||
return path + filename;
|
||||
}
|
||||
else {
|
||||
return path.replace(/\/$/, '') + '/' + filename;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(evt) {
|
||||
var targetElem = evt.target;
|
||||
var infoElem;
|
||||
if (targetElem.className.indexOf('cbi-button-remove') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
removePath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-install') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
installPath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
|
||||
renamePath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem = getFileElem(targetElem)) {
|
||||
if (targetElem.className.indexOf('parent-icon') > -1) {
|
||||
update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
|
||||
}
|
||||
else if (targetElem.className.indexOf('file-icon') > -1) {
|
||||
openpath(targetElem.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('link-icon') > -1) {
|
||||
infoElem = targetElem.parentNode;
|
||||
var filepath = infoElem.dataset['linktarget'];
|
||||
if (filepath) {
|
||||
if (infoElem.dataset['isdir'] === "1") {
|
||||
update_list(filepath);
|
||||
}
|
||||
else {
|
||||
var lastSlash = filepath.lastIndexOf('/');
|
||||
openpath(filepath.substring(lastSlash + 1), filepath.substring(0, lastSlash));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetElem.className.indexOf('folder-icon') > -1) {
|
||||
update_list(concatPath(currentPath, targetElem.parentNode.dataset['filename']))
|
||||
}
|
||||
}
|
||||
}
|
||||
function refresh_list(filenames, path) {
|
||||
var listHtml = '<table class="cbi-section-table"><tbody>';
|
||||
if (path !== '/') {
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-2"><td class="parent-icon" colspan="6"><strong>..返回上级目录</strong></td></tr>';
|
||||
}
|
||||
if (filenames) {
|
||||
for (var i = 0; i < filenames.length; i++) {
|
||||
var line = filenames[i];
|
||||
if (line) {
|
||||
var f = line.match(/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+([\S\s]+)/);
|
||||
var isLink = f[1][0] === 'z' || f[1][0] === 'l' || f[1][0] === 'x';
|
||||
var o = {
|
||||
displayname: f[9],
|
||||
filename: isLink ? f[9].split(' -> ')[0] : f[9],
|
||||
perms: f[1],
|
||||
date: f[7] + ' ' + f[6] + ' ' + f[8],
|
||||
size: f[5],
|
||||
owner: f[3],
|
||||
icon: (f[1][0] === 'd') ? "folder-icon" : (isLink ? "link-icon" : "file-icon")
|
||||
};
|
||||
|
||||
var install_btn = ' <button class="cbi-button cbi-button-install" style="visibility: hidden;">安装</button>';
|
||||
var index= o.filename.lastIndexOf(".");
|
||||
var ext = o.filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
install_btn = ' <button class="cbi-button cbi-button-install">安装</button>';
|
||||
}
|
||||
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-' + (1 + i%2)
|
||||
+ '" data-filename="' + o.filename + '" data-isdir="' + Number(f[1][0] === 'd' || f[1][0] === 'z') + '"'
|
||||
+ ((f[1][0] === 'z' || f[1][0] === 'l') ? (' data-linktarget="' + f[9].split(' -> ')[1]) : '')
|
||||
+ '">'
|
||||
+ '<td class="cbi-value-field ' + o.icon + '">'
|
||||
+ '<strong>' + o.displayname + '</strong>'
|
||||
+ '</td>'
|
||||
|
||||
+ '<td class="cbi-value-field cbi-value-date">'+o.date+'</td>'
|
||||
+ '<td class="cbi-value-field cbi-value-size">'+o.size+'</td>'
|
||||
+ '<td class="cbi-value-field cbi-value-perm">'+o.perms+'</td>'
|
||||
+ '<td class="cbi-section-table-cell">\
|
||||
<button class="cbi-button cbi-button-edit">重命名</button>\
|
||||
<button class="cbi-button cbi-button-remove">删除</button>'
|
||||
+ install_btn
|
||||
+ '</td>'
|
||||
+ '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
listHtml += "</table>";
|
||||
listElem.innerHTML = listHtml;
|
||||
}
|
||||
function update_list(path, opt) {
|
||||
opt = opt || {};
|
||||
path = concatPath(path, '');
|
||||
if (currentPath != path) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/list',
|
||||
{path: path},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, path);
|
||||
}
|
||||
else {
|
||||
refresh_list([], path);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!opt.popState) {
|
||||
history.pushState({path: path}, null, '?path=' + path);
|
||||
}
|
||||
currentPath = path;
|
||||
pathElem.value = currentPath;
|
||||
}
|
||||
};
|
||||
|
||||
var uploadToggle = document.getElementById('upload-toggle');
|
||||
var uploadContainer = document.getElementById('upload-container');
|
||||
var isUploadHide = true;
|
||||
uploadToggle.onclick = function() {
|
||||
if (isUploadHide) {
|
||||
uploadContainer.style.display = 'inline-flex';
|
||||
}
|
||||
else {
|
||||
uploadContainer.style.display = 'none';
|
||||
}
|
||||
isUploadHide = !isUploadHide;
|
||||
};
|
||||
var uploadBtn = uploadContainer.getElementsByClassName('cbi-input-apply')[0];
|
||||
uploadBtn.onclick = function (evt) {
|
||||
var uploadinput = document.getElementById('upload-file');
|
||||
var fullPath = uploadinput.value;
|
||||
if (!fullPath) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
else {
|
||||
var formData = new FormData();
|
||||
var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
|
||||
formData.append('upload-filename', fullPath.substring(startIndex + 1));
|
||||
formData.append('upload-dir', concatPath(currentPath, ''));
|
||||
formData.append('upload-file', uploadinput.files[0]);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/system/fileassistant/upload", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
refresh_list(res.data, currentPath);
|
||||
uploadinput.value = '';
|
||||
}
|
||||
else {
|
||||
alert('上传失败,请稍后再试...');
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(evt) {
|
||||
var initPath = '/';
|
||||
if (/path=([/\w]+)/.test(location.search)) {
|
||||
initPath = RegExp.$1;
|
||||
}
|
||||
update_list(initPath, {popState: true});
|
||||
});
|
||||
window.addEventListener('popstate', function (evt) {
|
||||
var path = '/';
|
||||
if (evt.state && evt.state.path) {
|
||||
path = evt.state.path;
|
||||
}
|
||||
update_list(path, {popState: true});
|
||||
});
|
||||
|
||||
})();
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
9
luci-app-advanced/luasrc/controller/advanced.lua
Normal file
9
luci-app-advanced/luasrc/controller/advanced.lua
Normal file
@ -0,0 +1,9 @@
|
||||
module("luci.controller.advanced",package.seeall)
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/advanced")then
|
||||
return
|
||||
end
|
||||
local e
|
||||
e=entry({"admin","system","advanced"},cbi("advanced"),_("高级设置"),60)
|
||||
e.dependent=true
|
||||
end
|
228
luci-app-advanced/luasrc/controller/fileassistant.lua
Normal file
228
luci-app-advanced/luasrc/controller/fileassistant.lua
Normal file
@ -0,0 +1,228 @@
|
||||
module("luci.controller.fileassistant", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
local page
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 84)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
end
|
||||
|
||||
function list_response(path, success)
|
||||
luci.http.prepare_content("application/json")
|
||||
local result
|
||||
if success then
|
||||
local rv = scandir(path)
|
||||
result = {
|
||||
ec = 0,
|
||||
data = rv
|
||||
}
|
||||
else
|
||||
result = {
|
||||
ec = 1
|
||||
}
|
||||
end
|
||||
luci.http.write_json(result)
|
||||
end
|
||||
|
||||
function fileassistant_list()
|
||||
local path = luci.http.formvalue("path")
|
||||
list_response(path, true)
|
||||
end
|
||||
|
||||
function fileassistant_open()
|
||||
local path = luci.http.formvalue("path")
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local io = require "io"
|
||||
local mime = to_mime(filename)
|
||||
|
||||
file = path..filename
|
||||
|
||||
local download_fpi = io.open(file, "r")
|
||||
luci.http.header('Content-Disposition', 'inline; filename="'..filename..'"' )
|
||||
luci.http.prepare_content(mime)
|
||||
luci.ltn12.pump.all(luci.ltn12.source.file(download_fpi), luci.http.write)
|
||||
end
|
||||
|
||||
function fileassistant_delete()
|
||||
local path = luci.http.formvalue("path")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
path = path:gsub("<>", "/")
|
||||
path = path:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir then
|
||||
success = os.execute('rm -r "'..path..'"')
|
||||
else
|
||||
success = os.remove(path)
|
||||
end
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function fileassistant_rename()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local newpath = luci.http.formvalue("newpath")
|
||||
local success = os.execute('mv "'..filepath..'" "'..newpath..'"')
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function fileassistant_install()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
local ext = filepath:match(".+%.(%w+)$")
|
||||
filepath = filepath:gsub("<>", "/")
|
||||
filepath = filepath:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir == "1" then
|
||||
success = false
|
||||
elseif ext == "ipk" then
|
||||
success = installIPK(filepath)
|
||||
else
|
||||
success = false
|
||||
end
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function installIPK(filepath)
|
||||
luci.sys.exec('opkg --force-depends install "'..filepath..'"')
|
||||
luci.sys.exec('rm -rf /tmp/luci-*')
|
||||
return true;
|
||||
end
|
||||
|
||||
function fileassistant_upload()
|
||||
local filecontent = luci.http.formvalue("upload-file")
|
||||
local filename = luci.http.formvalue("upload-filename")
|
||||
local uploaddir = luci.http.formvalue("upload-dir")
|
||||
local filepath = uploaddir..filename
|
||||
|
||||
local fp
|
||||
luci.http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fp and meta and meta.name == "upload-file" then
|
||||
fp = io.open(filepath, "w")
|
||||
end
|
||||
if fp and chunk then
|
||||
fp:write(chunk)
|
||||
end
|
||||
if fp and eof then
|
||||
fp:close()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
list_response(uploaddir, true)
|
||||
end
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
|
||||
local pfile = popen("ls -lh \""..directory.."\" | egrep '^d' ; ls -lh \""..directory.."\" | egrep -v '^d|^l'")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
pfile = popen("ls -lh \""..directory.."\" | egrep '^l' ;")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
linkindex, _, linkpath = string.find(fileinfo, "->%s+(.+)$")
|
||||
local finalpath;
|
||||
if string.sub(linkpath, 1, 1) == "/" then
|
||||
finalpath = linkpath
|
||||
else
|
||||
finalpath = nixio.fs.realpath(directory..linkpath)
|
||||
end
|
||||
local linktype;
|
||||
if not finalpath then
|
||||
finalpath = linkpath;
|
||||
linktype = 'x'
|
||||
elseif nixio.fs.stat(finalpath, "type") == "dir" then
|
||||
linktype = 'z'
|
||||
else
|
||||
linktype = 'l'
|
||||
end
|
||||
fileinfo = string.sub(fileinfo, 2, linkindex - 1)
|
||||
fileinfo = linktype..fileinfo.."-> "..finalpath
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
MIME_TYPES = {
|
||||
["txt"] = "text/plain";
|
||||
["conf"] = "text/plain";
|
||||
["ovpn"] = "text/plain";
|
||||
["log"] = "text/plain";
|
||||
["js"] = "text/javascript";
|
||||
["json"] = "application/json";
|
||||
["css"] = "text/css";
|
||||
["htm"] = "text/html";
|
||||
["html"] = "text/html";
|
||||
["patch"] = "text/x-patch";
|
||||
["c"] = "text/x-csrc";
|
||||
["h"] = "text/x-chdr";
|
||||
["o"] = "text/x-object";
|
||||
["ko"] = "text/x-object";
|
||||
|
||||
["bmp"] = "image/bmp";
|
||||
["gif"] = "image/gif";
|
||||
["png"] = "image/png";
|
||||
["jpg"] = "image/jpeg";
|
||||
["jpeg"] = "image/jpeg";
|
||||
["svg"] = "image/svg+xml";
|
||||
|
||||
["zip"] = "application/zip";
|
||||
["pdf"] = "application/pdf";
|
||||
["xml"] = "application/xml";
|
||||
["xsl"] = "application/xml";
|
||||
["doc"] = "application/msword";
|
||||
["ppt"] = "application/vnd.ms-powerpoint";
|
||||
["xls"] = "application/vnd.ms-excel";
|
||||
["odt"] = "application/vnd.oasis.opendocument.text";
|
||||
["odp"] = "application/vnd.oasis.opendocument.presentation";
|
||||
["pl"] = "application/x-perl";
|
||||
["sh"] = "application/x-shellscript";
|
||||
["php"] = "application/x-php";
|
||||
["deb"] = "application/x-deb";
|
||||
["iso"] = "application/x-cd-image";
|
||||
["tgz"] = "application/x-compressed-tar";
|
||||
|
||||
["mp3"] = "audio/mpeg";
|
||||
["ogg"] = "audio/x-vorbis+ogg";
|
||||
["wav"] = "audio/x-wav";
|
||||
|
||||
["mpg"] = "video/mpeg";
|
||||
["mpeg"] = "video/mpeg";
|
||||
["avi"] = "video/x-msvideo";
|
||||
}
|
||||
|
||||
function to_mime(filename)
|
||||
if type(filename) == "string" then
|
||||
local ext = filename:match("[^%.]+$")
|
||||
|
||||
if ext and MIME_TYPES[ext:lower()] then
|
||||
return MIME_TYPES[ext:lower()]
|
||||
end
|
||||
end
|
||||
|
||||
return "application/octet-stream"
|
||||
end
|
240
luci-app-advanced/luasrc/model/cbi/advanced.lua
Normal file
240
luci-app-advanced/luasrc/model/cbi/advanced.lua
Normal file
@ -0,0 +1,240 @@
|
||||
local e=require"nixio.fs"
|
||||
local t=require"luci.sys"
|
||||
m=Map("advanced",translate("高级进阶设置"),translate("<font color=\"Red\"><strong>配置文档是直接编辑的除非你知道自己在干什么,否则请不要轻易修改这些配置文档。配置不正确可能会导致不能开机等错误。</strong></font><br/>"))
|
||||
m.apply_on_parse=true
|
||||
s=m:section(TypedSection,"advanced")
|
||||
s.anonymous=true
|
||||
if nixio.fs.access("/etc/config/network")then
|
||||
s:tab("netwrokconf",translate("网络"),translate("本页是配置/etc/config/network包含网络配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("netwrokconf",Value,"netwrokconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/network")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/network",t)
|
||||
if(luci.sys.call("cmp -s /tmp/network /etc/config/network")==1)then
|
||||
e.writefile("/etc/config/network",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/network")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/arpbind")then
|
||||
s:tab("arpbindconf",translate("ARP绑定"),translate("本页是配置/etc/config/arpbind包含APR绑定MAC地址文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("arpbindconf",Value,"arpbindconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/arpbind")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/arpbind",t)
|
||||
if(luci.sys.call("cmp -s /tmp/arpbind /etc/config/arpbind")==1)then
|
||||
e.writefile("/etc/config/arpbind",t)
|
||||
luci.sys.call("/etc/init.d/arpbind restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/arpbind")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/firewall")then
|
||||
s:tab("firewallconf",translate("防火墙"),translate("本页是配置/etc/config/firewall包含防火墙协议设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("firewallconf",Value,"firewallconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/firewall")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/firewall",t)
|
||||
if(luci.sys.call("cmp -s /tmp/firewall /etc/config/firewall")==1)then
|
||||
e.writefile("/etc/config/firewall",t)
|
||||
luci.sys.call("/etc/init.d/firewall restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/firewall")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/mwan3")then
|
||||
s:tab("mwan3conf",translate("负载均衡"),translate("本页是配置/etc/config/mwan3包含负载均衡设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("mwan3conf",Value,"mwan3conf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/mwan3")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/mwan3",t)
|
||||
if(luci.sys.call("cmp -s /tmp/mwan3 /etc/config/mwan3")==1)then
|
||||
e.writefile("/etc/config/mwan3",t)
|
||||
luci.sys.call("/etc/init.d/mwan3 restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/mwan3")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/dhcp")then
|
||||
s:tab("dhcpconf",translate("DHCP"),translate("本页是配置/etc/config/DHCP包含机器名等设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("dhcpconf",Value,"dhcpconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/dhcp")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/dhcp",t)
|
||||
if(luci.sys.call("cmp -s /tmp/dhcp /etc/config/dhcp")==1)then
|
||||
e.writefile("/etc/config/dhcp",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/dhcp")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/ddns")then
|
||||
s:tab("ddnsconf",translate("DDNS"),translate("本页是配置/etc/config/ddns包含动态域名设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("ddnsconf",Value,"ddnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/ddns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/ddns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/ddns /etc/config/ddns")==1)then
|
||||
e.writefile("/etc/config/ddns",t)
|
||||
luci.sys.call("/etc/init.d/ddns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/ddns")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/timecontrol")then
|
||||
s:tab("timecontrolconf",translate("时间控制"),translate("本页是配置/etc/config/timecontrol包含上网时间控制配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("timecontrolconf",Value,"timecontrolconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/timecontrol")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/timecontrol",t)
|
||||
if(luci.sys.call("cmp -s /tmp/timecontrol /etc/config/timecontrol")==1)then
|
||||
e.writefile("/etc/config/timecontrol",t)
|
||||
luci.sys.call("/etc/init.d/timecontrol restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/timecontrol")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/rebootschedule")then
|
||||
s:tab("rebootscheduleconf",translate("定时设置"),translate("本页是配置/etc/config/rebootschedule包含定时设置任务配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("rebootscheduleconf",Value,"rebootscheduleconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/rebootschedule")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/rebootschedule",t)
|
||||
if(luci.sys.call("cmp -s /tmp/rebootschedule /etc/config/rebootschedule")==1)then
|
||||
e.writefile("/etc/config/rebootschedule",t)
|
||||
luci.sys.call("/etc/init.d/rebootschedule restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/rebootschedule")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/wolplus")then
|
||||
s:tab("wolplusconf",translate("网络唤醒"),translate("本页是配置/etc/config/wolplus包含网络唤醒配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("wolplusconf",Value,"wolplusconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/wolplus")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/wolplus",t)
|
||||
if(luci.sys.call("cmp -s /tmp/wolplus /etc/config/wolplus")==1)then
|
||||
e.writefile("/etc/config/wolplus",t)
|
||||
luci.sys.call("/etc/init.d/wolplus restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/wolplus")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/ksmbd")then
|
||||
s:tab("ksmbdconf",translate("网络共享"),translate("本页是配置/etc/config/ksmbd包含网络唤醒配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("ksmbdconf",Value,"ksmbdconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/ksmbd")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/ksmbd",t)
|
||||
if(luci.sys.call("cmp -s /tmp/ksmbd/etc/config/ksmbd")==1)then
|
||||
e.writefile("/etc/config/ksmbd",t)
|
||||
luci.sys.call("/etc/init.d/ksmbd restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/ksmbd")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/smartdns")then
|
||||
s:tab("smartdnsconf",translate("SMARTDNS"),translate("本页是配置/etc/config/smartdns包含smartdns配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("smartdnsconf",Value,"smartdnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/smartdns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/smartdns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/smartdns /etc/config/smartdns")==1)then
|
||||
e.writefile("/etc/config/smartdns",t)
|
||||
luci.sys.call("/etc/init.d/smartdns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/smartdns")
|
||||
end
|
||||
end
|
||||
end
|
||||
return m
|
20
luci-app-advanced/luasrc/view/fileassistant.htm
Normal file
20
luci-app-advanced/luasrc/view/fileassistant.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css?v=@ver">
|
||||
<h2 name="content">文件管理【集成上传删除及安装,非专业人员请谨慎操作】</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传文件</button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
<button type="button" class="cbi-button cbi-input-apply">执行上传</button>
|
||||
</div>
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fileassistant/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
20
luci-app-advanced/luasrc/view/filebrowser.htm
Normal file
20
luci-app-advanced/luasrc/view/filebrowser.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fb/fb.css?v=@ver">
|
||||
<h2 name="content">文件管理</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表:</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传</button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
<button type="button" class="cbi-button cbi-input-apply">点我上传</button>
|
||||
</div>
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fb/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
2
luci-app-advanced/root/etc/config/advanced
Normal file
2
luci-app-advanced/root/etc/config/advanced
Normal file
@ -0,0 +1,2 @@
|
||||
config advanced
|
||||
option enabled '1'
|
7
luci-app-advanced/root/etc/uci-defaults/40_luci-fb
Normal file
7
luci-app-advanced/root/etc/uci-defaults/40_luci-fb
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
ver=$(date +%s)
|
||||
sed -i "s/@ver/$ver/g" /usr/lib/lua/luci/view/filebrowser.htm
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
24
luci-app-aliddns/Makefile
Normal file
24
luci-app-aliddns/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Copyright (C) 2018 chenhw2 <https://github.com/chenhw2/>
|
||||
#
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for aliddns
|
||||
LUCI_DESCRIPTION:=LuCI Support for ALiDDNS.
|
||||
LUCI_DEPENDS:=+openssl-util +curl
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-aliddns
|
||||
PKG_VERSION:=0.3.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=chenhw2 <https://github.com/chenhw2/>
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
4
luci-app-aliddns/luasrc/controller/aliddns.lua
Normal file
4
luci-app-aliddns/luasrc/controller/aliddns.lua
Normal file
@ -0,0 +1,4 @@
|
||||
module("luci.controller.aliddns",package.seeall)
|
||||
function index()
|
||||
entry({"admin","services","aliddns"},cbi("aliddns"),_("AliDDNS"),58).acl_depends = { "luci-app-aliddns" }
|
||||
end
|
56
luci-app-aliddns/luasrc/model/cbi/aliddns.lua
Normal file
56
luci-app-aliddns/luasrc/model/cbi/aliddns.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local a=require"luci.sys"
|
||||
local e=luci.model.uci.cursor()
|
||||
local e=require"nixio.fs"
|
||||
require("luci.sys")
|
||||
local t,e,o
|
||||
|
||||
t=Map("aliddns",translate("AliDDNS"))
|
||||
|
||||
e=t:section(TypedSection,"base",translate("Base"))
|
||||
e.anonymous=true
|
||||
|
||||
enable=e:option(Flag,"enable",translate("enable"))
|
||||
enable.rmempty=false
|
||||
|
||||
enable=e:option(Flag,"clean",translate("Clean Before Update"))
|
||||
enable.rmempty=false
|
||||
|
||||
token=e:option(Value,"app_key",translate("Access Key ID"))
|
||||
email=e:option(Value,"app_secret",translate("Access Key Secret"))
|
||||
|
||||
iface=e:option(ListValue,"interface",translate("WAN-IP Source"),translate("Select the WAN-IP Source for AliDDNS, like wan/internet"))
|
||||
iface:value("",translate("Select WAN-IP Source"))
|
||||
iface:value("internet")
|
||||
iface:value("wan")
|
||||
|
||||
iface.rmempty=false
|
||||
main=e:option(Value,"main_domain",translate("Main Domain"),translate("For example: test.github.com -> github.com"))
|
||||
main.rmempty=false
|
||||
sub=e:option(Value,"sub_domain",translate("Sub Domain"),translate("For example: test.github.com -> test"))
|
||||
sub.rmempty=false
|
||||
time=e:option(Value,"time",translate("Inspection Time"),translate("Unit: Minute, Range: 1-59"))
|
||||
time.rmempty=false
|
||||
|
||||
e=t:section(TypedSection,"base",translate("Update Log"))
|
||||
e.anonymous=true
|
||||
local a="/var/log/aliddns.log"
|
||||
tvlog=e:option(TextValue,"sylogtext")
|
||||
tvlog.rows=16
|
||||
tvlog.readonly="readonly"
|
||||
tvlog.wrap="off"
|
||||
|
||||
function tvlog.cfgvalue(e,e)
|
||||
sylogtext=""
|
||||
if a and nixio.fs.access(a) then
|
||||
sylogtext=luci.sys.exec("tail -n 100 %s"%a)
|
||||
end
|
||||
return sylogtext
|
||||
end
|
||||
|
||||
tvlog.write=function(e,e,e)
|
||||
end
|
||||
local e=luci.http.formvalue("cbi.apply")
|
||||
if e then
|
||||
io.popen("/etc/init.d/aliddns restart")
|
||||
end
|
||||
return t
|
44
luci-app-aliddns/po/zh_Hans/aliddns.po
Normal file
44
luci-app-aliddns/po/zh_Hans/aliddns.po
Normal file
@ -0,0 +1,44 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "AliDDNS"
|
||||
msgstr "阿里DDNS"
|
||||
|
||||
msgid "enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Clean Before Update"
|
||||
msgstr "清除所有同名记录"
|
||||
|
||||
msgid "Base"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "WAN-IP Source"
|
||||
msgstr "WAN-IP来源"
|
||||
|
||||
msgid "Select WAN-IP Source"
|
||||
msgstr "选择WAN-IP来源"
|
||||
|
||||
msgid "Select the WAN-IP Source for AliDDNS, like wan/internet"
|
||||
msgstr "动态域名的IP来源,如wan/internet"
|
||||
|
||||
msgid "Main Domain"
|
||||
msgstr "主域名"
|
||||
|
||||
msgid "Sub Domain"
|
||||
msgstr "子域名"
|
||||
|
||||
msgid "For example: test.github.com -> github.com"
|
||||
msgstr "例如: test.github.com 则填: github.com"
|
||||
|
||||
msgid "For example: test.github.com -> test"
|
||||
msgstr "例如: test.github.com, 则填: test"
|
||||
|
||||
msgid "Inspection Time"
|
||||
msgstr "检查时间"
|
||||
|
||||
msgid "Unit: Minute, Range: 1-59"
|
||||
msgstr "域名检查间隔时间,单位分钟,范围1-59"
|
||||
|
||||
msgid "Update Log"
|
||||
msgstr "更新记录"
|
4
luci-app-aliddns/root/etc/config/aliddns
Normal file
4
luci-app-aliddns/root/etc/config/aliddns
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
config base 'base'
|
||||
option enable '0'
|
||||
option time '10'
|
64
luci-app-aliddns/root/etc/init.d/aliddns
Executable file
64
luci-app-aliddns/root/etc/init.d/aliddns
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
NAME=aliddns
|
||||
|
||||
NE_TIPS='AliDDNS NOT ENABLED'
|
||||
|
||||
restart() {
|
||||
start
|
||||
}
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_bool_by_name() {
|
||||
case "$(uci_get_by_name $1 $2)" in
|
||||
1|on|true|yes|enabled) return 0;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
add_hotplug() {
|
||||
cat <<EOF > "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
[ "Z\$ACTION" = "Zifup" -a "Z\$INTERFACE" = "Zwan" ] || exit 0
|
||||
|
||||
DATE=\$(date +'%Y-%m-%d %H:%M:%S')
|
||||
( sleep 10 && ( echo "\$DATE IFUP-WAN" && /usr/sbin/aliddns ) >> /var/log/aliddns.log 2>&1 ) &
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
}
|
||||
|
||||
start() {
|
||||
$(uci_bool_by_name base enable) || {
|
||||
stop
|
||||
return 0
|
||||
}
|
||||
|
||||
add_hotplug
|
||||
|
||||
sed -i "/${NE_TIPS}/d" /var/log/aliddns.log
|
||||
|
||||
time=$(uci_get_by_name base time 10)
|
||||
[ 0 -lt $time -a $time -lt 60 ] || time=10
|
||||
|
||||
[ -f /etc/crontabs/root ] || mkdir -p /etc/crontabs && touch /etc/crontabs/root
|
||||
sed -i '/aliddns/d' /etc/crontabs/root
|
||||
echo "*/$time * * * * /usr/sbin/aliddns >> /var/log/aliddns.log 2>&1" >> /etc/crontabs/root
|
||||
/etc/init.d/cron restart
|
||||
|
||||
( /usr/sbin/aliddns >> /var/log/aliddns.log 2>&1 ) &
|
||||
}
|
||||
|
||||
stop() {
|
||||
rm -rf "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
sed -i '/aliddns/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
/etc/init.d/cron restart
|
||||
echo "${NE_TIPS}" > /var/log/aliddns.log
|
||||
}
|
10
luci-app-aliddns/root/etc/uci-defaults/luci-aliddns
Executable file
10
luci-app-aliddns/root/etc/uci-defaults/luci-aliddns
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@aliddns[-1]
|
||||
add ucitrack aliddns
|
||||
set ucitrack.@aliddns[-1].init=aliddns
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
exit 0
|
164
luci-app-aliddns/root/usr/sbin/aliddns
Executable file
164
luci-app-aliddns/root/usr/sbin/aliddns
Executable file
@ -0,0 +1,164 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME=aliddns
|
||||
log_file=/var/log/$NAME.log
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_bool_by_name() {
|
||||
case "$(uci_get_by_name $1 $2)" in
|
||||
1|on|true|yes|enabled) return 0;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
intelnetip() {
|
||||
tmp_ip=`curl -sL --connect-timeout 3 ns1.dnspod.net:6666`
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 members.3322.org/dyndns/getip`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 14.215.150.17:6666`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 whatismyip.akamai.com`
|
||||
fi
|
||||
echo -n $tmp_ip
|
||||
}
|
||||
|
||||
resolve2ip() {
|
||||
# resolve2ip domain<string>
|
||||
domain=$1
|
||||
tmp_ip=`nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain"`
|
||||
fi
|
||||
echo -n $tmp_ip
|
||||
}
|
||||
|
||||
check_aliddns() {
|
||||
echo "$DATE WAN-IP: ${ip}"
|
||||
if [ "Z$ip" == "Z" ]; then
|
||||
echo "$DATE ERROR, cant get WAN-IP..."
|
||||
return 0
|
||||
fi
|
||||
current_ip=$(resolve2ip "$sub_dm.$main_dm")
|
||||
if [ "Z$current_ip" == "Z" ]; then
|
||||
rrid='' # NO Resolve IP Means new Record_ID
|
||||
fi
|
||||
echo "$DATE DOMAIN-IP: ${current_ip}"
|
||||
if [ "Z$ip" == "Z$current_ip" ]; then
|
||||
echo "$DATE IP dont need UPDATE..."
|
||||
return 0
|
||||
else
|
||||
echo "$DATE UPDATING..."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
urlencode() {
|
||||
# urlencode url<string>
|
||||
out=''
|
||||
for c in $(echo -n $1 | sed 's/[^\n]/&\n/g'); do
|
||||
case $c in
|
||||
[a-zA-Z0-9._-]) out="$out$c" ;;
|
||||
*) out="$out$(printf '%%%02X' "'$c")" ;;
|
||||
esac
|
||||
done
|
||||
echo -n $out
|
||||
}
|
||||
|
||||
send_request() {
|
||||
# send_request action<string> args<string>
|
||||
local args="AccessKeyId=$ak_id&Action=$1&Format=json&$2&Version=2015-01-09"
|
||||
local hash=$(urlencode $(echo -n "GET&%2F&$(urlencode $args)" | openssl dgst -sha1 -hmac "$ak_sec&" -binary | openssl base64))
|
||||
curl -sSL --connect-timeout 5 "http://alidns.aliyuncs.com/?$args&Signature=$hash"
|
||||
}
|
||||
|
||||
get_recordid() {
|
||||
sed 's/RR/\n/g' | sed -n 's/.*RecordId[^0-9]*\([0-9]*\).*/\1\n/p' | sort -ru | sed /^$/d
|
||||
}
|
||||
|
||||
query_recordid() {
|
||||
send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$sub_dm.$main_dm&Timestamp=$timestamp"
|
||||
}
|
||||
|
||||
update_record() {
|
||||
send_request "UpdateDomainRecord" "RR=$sub_dm&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip"
|
||||
}
|
||||
|
||||
add_record() {
|
||||
send_request "AddDomainRecord&DomainName=$main_dm" "RR=$sub_dm&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip"
|
||||
}
|
||||
|
||||
del_record() {
|
||||
send_request "DeleteDomainRecord" "RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp"
|
||||
}
|
||||
|
||||
do_ddns_record() {
|
||||
if uci_bool_by_name base clean ; then
|
||||
query_recordid | get_recordid | while read rr; do
|
||||
echo "$DATE Clean record $sub_dm.$main_dm: $rr"
|
||||
del_record $rr >/dev/null
|
||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||
done
|
||||
rrid=''
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
rrid=`query_recordid | get_recordid`
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
rrid=`add_record | get_recordid`
|
||||
echo "$DATE ADD record $rrid"
|
||||
else
|
||||
update_record $rrid >/dev/null 2>&1
|
||||
echo "$DATE UPDATE record $rrid"
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
# failed
|
||||
echo "$DATE # ERROR, Please Check Config/Time"
|
||||
else
|
||||
# save rrid
|
||||
uci set aliddns.base.record_id=$rrid
|
||||
uci commit aliddns
|
||||
echo "$DATE # UPDATED($ip)"
|
||||
fi
|
||||
}
|
||||
|
||||
clean_log() {
|
||||
if [ $(cat $log_file 2>/dev/null | wc -l) -ge 16 ]; then
|
||||
rm -f $log_file && touch $log_file
|
||||
echo "$DATE Log Cleaned"
|
||||
fi
|
||||
}
|
||||
|
||||
[ -x /usr/bin/openssl -a -x /usr/bin/curl -a -x /bin/sed ] ||
|
||||
( echo "Need [ openssl + curl + sed ]" && exit 1 )
|
||||
|
||||
ak_id=$(uci_get_by_name base app_key)
|
||||
ak_sec=$(uci_get_by_name base app_secret)
|
||||
rrid=$(uci_get_by_name base record_id)
|
||||
main_dm=$(uci_get_by_name base main_domain)
|
||||
sub_dm=$(uci_get_by_name base sub_domain)
|
||||
|
||||
iface=$(uci_get_by_name base interface)
|
||||
if [ "Z$iface" == "Zinternet" -o "Z$iface" == "Z" ]; then
|
||||
ip=$(intelnetip)
|
||||
else
|
||||
ip=$(ubus call network.interface.$iface status | grep '"address"' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
fi
|
||||
|
||||
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||
|
||||
clean_log
|
||||
check_aliddns || do_ddns_record
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-aliddns": {
|
||||
"description": "Grant UCI access for luci-app-aliddns",
|
||||
"read": {
|
||||
"uci": [ "aliddns" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "aliddns" ]
|
||||
}
|
||||
}
|
||||
}
|
19
luci-app-argon-config/Makefile
Normal file
19
luci-app-argon-config/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-argon-config
|
||||
PKG_VERSION:=0.9
|
||||
PKG_RELEASE:=20210904
|
||||
|
||||
PKG_MAINTAINER:=jerrykuku <jerrykuku@qq.com>
|
||||
|
||||
LUCI_TITLE:=LuCI page for Argon Config
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+luci-compat
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/argon
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
4
luci-app-argon-config/README.md
Normal file
4
luci-app-argon-config/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# luci-app-argon-config
|
||||
Argon Theme Config Plugin
|
||||
|
||||
You can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.
|
13
luci-app-argon-config/luasrc/controller/argon-config.lua
Normal file
13
luci-app-argon-config/luasrc/controller/argon-config.lua
Normal file
@ -0,0 +1,13 @@
|
||||
--[[
|
||||
luci-app-argon-config
|
||||
]]--
|
||||
|
||||
module("luci.controller.argon-config", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access('/www/luci-static/argon/css/cascade.css') then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "system", "argon-config"}, form("argon-config"), _("Argon Config"), 90)
|
||||
end
|
223
luci-app-argon-config/luasrc/model/cbi/argon-config.lua
Normal file
223
luci-app-argon-config/luasrc/model/cbi/argon-config.lua
Normal file
@ -0,0 +1,223 @@
|
||||
local nxfs = require 'nixio.fs'
|
||||
local wa = require 'luci.tools.webadmin'
|
||||
local opkg = require 'luci.model.ipkg'
|
||||
local sys = require 'luci.sys'
|
||||
local http = require 'luci.http'
|
||||
local nutil = require 'nixio.util'
|
||||
local name = 'argon'
|
||||
local uci = require 'luci.model.uci'.cursor()
|
||||
|
||||
local fstat = nxfs.statvfs(opkg.overlay_root())
|
||||
local space_total = fstat and fstat.blocks or 0
|
||||
local space_free = fstat and fstat.bfree or 0
|
||||
local space_used = space_total - space_free
|
||||
|
||||
local free_byte = space_free * fstat.frsize
|
||||
|
||||
local primary, dark_primary, blur_radius, blur_radius_dark, blur_opacity, mode
|
||||
if nxfs.access('/etc/config/argon') then
|
||||
primary = uci:get_first('argon', 'global', 'primary')
|
||||
dark_primary = uci:get_first('argon', 'global', 'dark_primary')
|
||||
blur_radius = uci:get_first('argon', 'global', 'blur')
|
||||
blur_radius_dark = uci:get_first('argon', 'global', 'blur_dark')
|
||||
blur_opacity = uci:get_first('argon', 'global', 'transparency')
|
||||
blur_opacity_dark = uci:get_first('argon', 'global', 'transparency_dark')
|
||||
mode = uci:get_first('argon', 'global', 'mode')
|
||||
bing_background = uci:get_first('argon', 'global', 'bing_background')
|
||||
end
|
||||
|
||||
function glob(...)
|
||||
local iter, code, msg = nxfs.glob(...)
|
||||
if iter then
|
||||
return nutil.consume(iter)
|
||||
else
|
||||
return nil, code, msg
|
||||
end
|
||||
end
|
||||
|
||||
local transparency_sets = {
|
||||
0,
|
||||
0.1,
|
||||
0.2,
|
||||
0.3,
|
||||
0.4,
|
||||
0.5,
|
||||
0.6,
|
||||
0.7,
|
||||
0.8,
|
||||
0.9,
|
||||
1
|
||||
}
|
||||
|
||||
-- [[ 模糊设置 ]]--
|
||||
br = SimpleForm('config', translate('Argon Config'), translate('Here you can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended]'))
|
||||
br.reset = false
|
||||
br.submit = false
|
||||
s = br:section(SimpleSection)
|
||||
|
||||
o = s:option(ListValue, 'bing_background', translate('Wallpaper Source'))
|
||||
o:value('0', translate('Built-in'))
|
||||
o:value('1', translate('Bing Wallpapers'))
|
||||
o.default = bing_background
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, 'mode', translate('Theme mode'))
|
||||
o:value('normal', translate('Follow System'))
|
||||
o:value('light', translate('Force Light'))
|
||||
o:value('dark', translate('Force Dark'))
|
||||
o.default = mode
|
||||
o.rmempty = false
|
||||
o.description = translate('You can choose Theme color mode here')
|
||||
|
||||
o = s:option(Value, 'primary', translate('[Light mode] Primary Color'), translate('A HEX Color ; ( Default: #5e72e4 )'))
|
||||
o.default = primary
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
|
||||
|
||||
o = s:option(ListValue, 'transparency', translate('[Light mode] Transparency'), translate('0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: 0.5 )'))
|
||||
for _, v in ipairs(transparency_sets) do
|
||||
o:value(v)
|
||||
end
|
||||
o.default = blur_opacity
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'blur', translate('[Light mode] Frosted Glass Radius'), translate('Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )'))
|
||||
o.default = blur_radius
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'dark_primary', translate('[Dark mode] Primary Color'), translate('A HEX Color ; ( Default: #483d8b )'))
|
||||
o.default = dark_primary
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, 'transparency_dark', translate('[Dark mode] Transparency'), translate('0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )'))
|
||||
for _, v in ipairs(transparency_sets) do
|
||||
o:value(v)
|
||||
end
|
||||
o.default = blur_opacity_dark
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'blur_dark', translate('[Dark mode] Frosted Glass Radius'), translate('Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )'))
|
||||
o.default = blur_radius_dark
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Button, 'save', translate('Save Changes'))
|
||||
o.inputstyle = 'reload'
|
||||
|
||||
function br.handle(self, state, data)
|
||||
if (state == FORM_VALID and data.blur ~= nil and data.blur_dark ~= nil and data.transparency ~= nil and data.transparency_dark ~= nil and data.mode ~= nil) then
|
||||
nxfs.writefile('/tmp/aaa', data)
|
||||
for key, value in pairs(data) do
|
||||
uci:set('argon','@global[0]',key,value)
|
||||
end
|
||||
uci:commit('argon')
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
ful = SimpleForm('upload', translate('Upload (Free: ') .. wa.byte_format(free_byte) .. ')', translate("You can upload files such as jpg,png,gif,mp4 files, To change the login page background."))
|
||||
ful.reset = false
|
||||
ful.submit = false
|
||||
|
||||
sul = ful:section(SimpleSection, '', translate("Upload file to '/www/luci-static/argon/background/'"))
|
||||
fu = sul:option(FileUpload, '')
|
||||
fu.template = 'argon-config/other_upload'
|
||||
um = sul:option(DummyValue, '', nil)
|
||||
um.template = 'argon-config/other_dvalue'
|
||||
|
||||
local dir, fd
|
||||
dir = '/www/luci-static/argon/background/'
|
||||
nxfs.mkdir(dir)
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then
|
||||
return
|
||||
end
|
||||
|
||||
if meta and chunk then
|
||||
fd = nixio.open(dir .. meta.file, 'w')
|
||||
end
|
||||
|
||||
if not fd then
|
||||
um.value = translate('Create upload file error.')
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate('File saved to') .. ' "/www/luci-static/argon/background/' .. meta.file .. '"'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if http.formvalue('upload') then
|
||||
local f = http.formvalue('ulfile')
|
||||
if #f <= 0 then
|
||||
um.value = translate('No specify upload file.')
|
||||
end
|
||||
end
|
||||
|
||||
local function getSizeStr(size)
|
||||
local i = 0
|
||||
local byteUnits = {' kB', ' MB', ' GB', ' TB'}
|
||||
repeat
|
||||
size = size / 1024
|
||||
i = i + 1
|
||||
until (size <= 1024)
|
||||
return string.format('%.1f', size) .. byteUnits[i]
|
||||
end
|
||||
|
||||
local inits, attr = {}
|
||||
for i, f in ipairs(glob(dir .. '*')) do
|
||||
attr = nxfs.stat(f)
|
||||
if attr then
|
||||
inits[i] = {}
|
||||
inits[i].name = nxfs.basename(f)
|
||||
inits[i].mtime = os.date('%Y-%m-%d %H:%M:%S', attr.mtime)
|
||||
inits[i].modestr = attr.modestr
|
||||
inits[i].size = getSizeStr(attr.size)
|
||||
inits[i].remove = 0
|
||||
inits[i].install = false
|
||||
end
|
||||
end
|
||||
|
||||
form = SimpleForm('filelist', translate('Background file list'), nil)
|
||||
form.reset = false
|
||||
form.submit = false
|
||||
|
||||
tb = form:section(Table, inits)
|
||||
nm = tb:option(DummyValue, 'name', translate('File name'))
|
||||
mt = tb:option(DummyValue, 'mtime', translate('Modify time'))
|
||||
sz = tb:option(DummyValue, 'size', translate('Size'))
|
||||
btnrm = tb:option(Button, 'remove', translate('Remove'))
|
||||
btnrm.render = function(self, section, scope)
|
||||
self.inputstyle = 'remove'
|
||||
Button.render(self, section, scope)
|
||||
end
|
||||
|
||||
btnrm.write = function(self, section)
|
||||
local v = nxfs.unlink(dir .. nxfs.basename(inits[section].name))
|
||||
if v then
|
||||
table.remove(inits, section)
|
||||
end
|
||||
return v
|
||||
end
|
||||
|
||||
function IsIpkFile(name)
|
||||
name = name or ''
|
||||
local ext = string.lower(string.sub(name, -4, -1))
|
||||
return ext == '.ipk'
|
||||
end
|
||||
|
||||
return br, ful, form
|
@ -0,0 +1,7 @@
|
||||
<%+cbi/valueheader%>
|
||||
<% if self:cfgvalue(section) ~= false then %>
|
||||
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
|
||||
<% else %>
|
||||
-
|
||||
<% end %>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,8 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span style="color: red">
|
||||
<%
|
||||
local val = self:cfgvalue(section) or self.default or ""
|
||||
write(pcdata(val))
|
||||
%>
|
||||
</span>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,5 @@
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value" style="display:inline-block; width: 130px" for="ulfile"><%:Choose local file:%></label>
|
||||
<input class="cbi-input-file" style="width: 400px" type="file" id="ulfile" name="ulfile" accept="image/png, image/jpeg, image/gif, video/mp4"/>
|
||||
<input type="submit" class="btn cbi-button cbi-input-apply" name="upload" value="<%:Upload%>" />
|
||||
<%+cbi/valuefooter%>
|
176
luci-app-argon-config/po/es/argon-config.po
Normal file
176
luci-app-argon-config/po/es/argon-config.po
Normal file
@ -0,0 +1,176 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: 2021-03-15 21:25-0300\n"
|
||||
"PO-Revision-Date: 2021-03-15 21:58-0300\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.4.2\n"
|
||||
"Last-Translator: Franco Castillo <castillofrancodamian@gmail.com>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: es\n"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr ""
|
||||
"0 transparente - 1 opaco; (Sugerencia: negro translúcido preestablecido: 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid ""
|
||||
"0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: "
|
||||
"0.5 )"
|
||||
msgstr ""
|
||||
"0 transparente - 1 opaco; (Sugerencia: transparente: 0 o translúcido "
|
||||
"preestablecido: 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr "Un color HEX; (Predeterminado: #483d8b)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr "Un color HEX; (Predeterminado: #5e72e4)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/controller/argon-config.lua:11
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid "Argon Config"
|
||||
msgstr "Configuración de Argon"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:195
|
||||
msgid "Background file list"
|
||||
msgstr "Lista de archivos de fondo"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:60
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr "Fondos de Bing"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:59
|
||||
msgid "Built-in"
|
||||
msgstr "Integrado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:2
|
||||
msgid "Choose local file:"
|
||||
msgstr "Elija un archivo local:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:149
|
||||
msgid "Create upload file error."
|
||||
msgstr "Crear archivo de error de carga."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:200
|
||||
msgid "File name"
|
||||
msgstr "Nombre del archivo"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:159
|
||||
msgid "File saved to"
|
||||
msgstr "Archivo guardado en"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:65
|
||||
msgid "Follow System"
|
||||
msgstr "Seguir el sistema"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:67
|
||||
msgid "Force Dark"
|
||||
msgstr "Fuerza oscuro"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:66
|
||||
msgid "Force Light"
|
||||
msgstr "Forzar claro"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid ""
|
||||
"Here you can set the blur and transparency of the login page of argon theme, "
|
||||
"and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr ""
|
||||
"Aquí puede configurar el desenfoque y la transparencia de la página de "
|
||||
"inicio de sesión del tema argon y administrar las imágenes de fondo y los "
|
||||
"videos. [Se recomienda Chrome]"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid ""
|
||||
"Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr ""
|
||||
"El valor más grande se verá más borroso; (Sugerencia: claro: 1 o desenfoque "
|
||||
"predeterminado: 10)"
|
||||
|
||||
#: applications/luci-app-argon-config/root/usr/share/rpcd/acl.d/luci-app-argon-config.json:3
|
||||
msgid "Luci Argon theme config"
|
||||
msgstr "Configuración del tema Luci Argon"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:201
|
||||
msgid "Modify time"
|
||||
msgstr "Modificar la hora"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:167
|
||||
msgid "No specify upload file."
|
||||
msgstr "No especificar archivo de carga."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:203
|
||||
msgid "Remove"
|
||||
msgstr "Eliminar"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:110
|
||||
msgid "Save Changes"
|
||||
msgstr "Guardar cambios"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:202
|
||||
msgid "Size"
|
||||
msgstr "Tamaño"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:64
|
||||
msgid "Theme mode"
|
||||
msgstr "Modo del tema"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:4
|
||||
msgid "Upload"
|
||||
msgstr "Cargar"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid "Upload (Free:"
|
||||
msgstr "Cargar (Libre:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:128
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr "Subir archivo a '/www/luci-static/argon/background/'"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:58
|
||||
msgid "Wallpaper Source"
|
||||
msgstr "Fuente del fondo de pantalla"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:70
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "Puede elegir el modo de color del tema aquí"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid ""
|
||||
"You can upload files such as jpg,png,gif,mp4 files, To change the login page "
|
||||
"background."
|
||||
msgstr ""
|
||||
"Puede cargar archivos como jpg, png, gif, mp4, para cambiar el fondo de la "
|
||||
"página de inicio de sesión."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr "[Modo oscuro] Radio de vidrio esmerilado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr "[Modo oscuro] Color primario"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr "[Modo oscuro] Transparencia"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr "[Modo claro] Radio de vidrio esmerilado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr "[Modo claro] Color primario"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "[Modo claro] Transparencia"
|
155
luci-app-argon-config/po/templates/argon-config.pot
Normal file
155
luci-app-argon-config/po/templates/argon-config.pot
Normal file
@ -0,0 +1,155 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid ""
|
||||
"0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: "
|
||||
"0.5 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/controller/argon-config.lua:11
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid "Argon Config"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:195
|
||||
msgid "Background file list"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:60
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:59
|
||||
msgid "Built-in"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:2
|
||||
msgid "Choose local file:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:149
|
||||
msgid "Create upload file error."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:200
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:159
|
||||
msgid "File saved to"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:65
|
||||
msgid "Follow System"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:67
|
||||
msgid "Force Dark"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:66
|
||||
msgid "Force Light"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid ""
|
||||
"Here you can set the blur and transparency of the login page of argon theme, "
|
||||
"and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid ""
|
||||
"Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/root/usr/share/rpcd/acl.d/luci-app-argon-config.json:3
|
||||
msgid "Luci Argon theme config"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:201
|
||||
msgid "Modify time"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:167
|
||||
msgid "No specify upload file."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:203
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:110
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:202
|
||||
msgid "Size"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:64
|
||||
msgid "Theme mode"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:4
|
||||
msgid "Upload"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid "Upload (Free:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:128
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:58
|
||||
msgid "Wallpaper Source"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:70
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid ""
|
||||
"You can upload files such as jpg,png,gif,mp4 files, To change the login page "
|
||||
"background."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr ""
|
133
luci-app-argon-config/po/zh-cn/argon-config.po
Normal file
133
luci-app-argon-config/po/zh-cn/argon-config.po
Normal file
@ -0,0 +1,133 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: dingpengyu <jerrykuku@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: zh_CN\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
|
||||
msgid "Argon Config"
|
||||
msgstr "Argon 主题设置"
|
||||
|
||||
msgid "Here you can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr "在这里你可以设置argon 主题的登录页面的模糊和透明度,并管理背景图片与视频。[建议使用 Chrome]"
|
||||
|
||||
msgid "Wallpaper Source"
|
||||
msgstr "壁纸来源"
|
||||
|
||||
msgid "Built-in"
|
||||
msgstr "内建"
|
||||
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr "Bing 壁纸"
|
||||
|
||||
msgid "Theme mode"
|
||||
msgstr "主题模式"
|
||||
|
||||
msgid "Follow System"
|
||||
msgstr "跟随系统"
|
||||
|
||||
msgid "Force Light"
|
||||
msgstr "强制亮色"
|
||||
|
||||
msgid "Force Dark"
|
||||
msgstr "强制暗色"
|
||||
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "你可以选择喜欢的主题模式"
|
||||
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr "[亮色模式] 主色调"
|
||||
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr "[暗色模式] 主色调"
|
||||
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr "十六进制颜色值 ( 预设为:#5e72e4 )"
|
||||
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr "十六进制颜色值 ( 预设为:#483d8b )"
|
||||
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "[亮色模式] 透明度"
|
||||
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "[亮色模式] 透明度"
|
||||
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr "[暗色模式] 透明度"
|
||||
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: 0.5 )"
|
||||
msgstr "0最透明 - 1不透明 ; ( 建议: 透明 0 或 半透明预设 0.5 )"
|
||||
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr "0最透明 - 1不透明 ; ( 建议: 黑色半透明 0.5 )"
|
||||
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr "[亮色模式] 毛玻璃模糊半径"
|
||||
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr "[暗色模式] 毛玻璃模糊半径"
|
||||
|
||||
msgid "Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr "值越大越模糊; ( 建议: 清透 1 或 模糊预设 10 )"
|
||||
|
||||
msgid "You can upload files such as jpg,png,gif,mp4 files, To change the login page background."
|
||||
msgstr "你可以上传jpg、png、gif或mp4文件,以创建自己喜欢的登录界面"
|
||||
|
||||
msgid "Save Changes"
|
||||
msgstr "保存更改"
|
||||
|
||||
msgid "Choose local file:"
|
||||
msgstr "选择本地文件:"
|
||||
|
||||
msgid "Couldn't open file:"
|
||||
msgstr "无法打开文件:"
|
||||
|
||||
msgid "Create upload file error."
|
||||
msgstr "创建上传文件失败。"
|
||||
|
||||
|
||||
msgid "File name"
|
||||
msgstr "文件名"
|
||||
|
||||
msgid "File saved to"
|
||||
msgstr "文件保存到"
|
||||
|
||||
msgid "FileTransfer"
|
||||
msgstr "文件传输"
|
||||
|
||||
msgid "Install"
|
||||
msgstr "安装"
|
||||
|
||||
msgid "Attributes"
|
||||
msgstr "属性"
|
||||
|
||||
msgid "Modify time"
|
||||
msgstr "修改时间"
|
||||
|
||||
msgid "No specify upload file."
|
||||
msgstr "未指定上传文件。"
|
||||
|
||||
msgid "Path on Route:"
|
||||
msgstr "路由根目录:"
|
||||
|
||||
msgid "Remove"
|
||||
msgstr "移除"
|
||||
|
||||
msgid "Size"
|
||||
msgstr "大小"
|
||||
|
||||
msgid "Upload (Free:"
|
||||
msgstr "上传 (剩余空间:"
|
||||
|
||||
msgid "Background file list"
|
||||
msgstr "背景文件列表"
|
||||
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr "文件将上传到'/www/luci-static/argon/background/'"
|
9
luci-app-argon-config/root/etc/config/argon
Normal file
9
luci-app-argon-config/root/etc/config/argon
Normal file
@ -0,0 +1,9 @@
|
||||
config global
|
||||
option primary '#5e72e4'
|
||||
option dark_primary '#483d8b'
|
||||
option blur '10'
|
||||
option blur_dark '10'
|
||||
option transparency '0.5'
|
||||
option transparency_dark '0.5'
|
||||
option mode 'normal'
|
||||
option bing_background '0'
|
6
luci-app-argon-config/root/etc/uci-defaults/luci-argon-config
Executable file
6
luci-app-argon-config/root/etc/uci-defaults/luci-argon-config
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-argon-config": {
|
||||
"description": "Luci Argon theme config ",
|
||||
"read": {
|
||||
"uci": [ "argon" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "argon" ]
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user