1
0
mirror of https://github.com/kenzok8/small-package synced 2025-09-20 19:11:30 +08:00

update 2023-03-11 00:26:05

This commit is contained in:
github-actions[bot]
2023-03-11 00:26:05 +08:00
parent c663366d46
commit 19ea1034f1
10 changed files with 193 additions and 180 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=chinadns-ng
PKG_VERSION:=2023.03.06
PKG_VERSION:=2023.03.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/zfl9/chinadns-ng/tar.gz/$(PKG_VERSION)?
PKG_HASH:=skip
PKG_HASH:=
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILES:=LICENSE

View File

@ -45,6 +45,11 @@ else
end
e=version..e
end
o = s:option(ListValue, "core_version", translate("Core Version"))
o:value("latest", translate("Latest Version"))
o:value("beta", translate("Beta Version"))
o.default = "latest"
o=s:option(Button,"restart",translate("Update"))
o.inputtitle=translate("Update core version")
o.template = "AdGuardHome/AdGuardHome_check"
@ -263,18 +268,12 @@ o.widget = "checkbox"
o.default = nil
o.optional=true
----downloadpath
o = s:option(TextValue, "downloadlinks",translate("Download links for update"))
o = s:option(Value, "update_url", translate("Core Update URL"))
o.default = "https://github.com/AdguardTeam/AdGuardHome/releases/download/${Cloud_Version}/AdGuardHome_linux_${Arch}.tar.gz"
o.placeholder = "https://github.com/AdguardTeam/AdGuardHome/releases/download/${Cloud_Version}/AdGuardHome_linux_${Arch}.tar.gz"
o.rmempty = false
o.optional = false
o.rows = 4
o.wrap = "soft"
o.cfgvalue = function(self, section)
return fs.readfile("/usr/share/AdGuardHome/links.txt")
end
o.write = function(self, section, value)
fs.writefile("/usr/share/AdGuardHome/links.txt", value:gsub("\r\n", "\n"))
end
fs.writefile("/var/run/lucilogpos","0")
function m.on_commit(map)
if (fs.access("/var/run/AdGserverdis")) then
io.popen("/etc/init.d/AdGuardHome reload &")
@ -297,7 +296,7 @@ function m.on_commit(map)
uci:set("AdGuardHome","AdGuardHome","ucitracktest","2")
end
end
uci:save("AdGuardHome")
uci:commit("AdGuardHome")
end
end
return m

View File

@ -1,7 +1,7 @@
config AdGuardHome 'AdGuardHome'
option enabled '0'
option httpport '3000'
option redirect 'none'
option redirect 'dnsmasq-upstream'
option configpath '/etc/AdGuardHome.yaml'
option workdir '/etc/AdGuardHome'
option logfile '/tmp/AdGuardHome.log'

View File

@ -1,5 +1,7 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
update_mode=$1
binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
if [[ -z ${binpath} ]]; then
uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
@ -7,124 +9,148 @@ if [[ -z ${binpath} ]]; then
fi
[[ ! -d ${binpath%/*} ]] && mkdir -p ${binpath%/*}
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
LOCKU=/var/lock/AdGuardHome-update.lock
[ -f $LOCKU ] && EXIT 1
touch $LOCKU
check_if_already_running(){
[[ -z ${upxflag} ]] && upxflag=off
enabled=$(uci get AdGuardHome.AdGuardHome.enabled 2>/dev/null)
core_version=$(uci get AdGuardHome.AdGuardHome.core_version 2>/dev/null)
update_url=$(uci get AdGuardHome.AdGuardHome.update_url 2>/dev/null)
running_tasks=$(ps |grep 'AdGuardHome' |grep 'update_core' |grep -v 'grep' |awk '{print $1}' |wc -l)
[ "x${running_tasks}" != "x0" ] && echo -e "\nA task is already running." && EXIT 2
case "${core_version}" in
beta)
core_api_url=https://api.github.com/repos/AdguardTeam/AdGuardHome/releases
;;
*)
core_api_url=https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest
;;
esac
Check_Task(){
running_tasks="$(ps -efww | grep -v grep | grep "AdGuardHome" | grep "update_core" | awk '{print $1}' | wc -l)"
case $1 in
force)
echo -e "执行: 强制更新核心"
echo -e "清除 ${running_tasks} 个进程 ..."
ps -efww | grep -v grep | grep -v $$ | grep "AdGuardHome" | grep "update_core" | awk '{print $1}' | xargs kill -9 2> /dev/null
;;
*)
[[ ${running_tasks} -gt 2 ]] && echo -e "已经有 ${running_tasks} 个任务正在运行, 请等待其执行结束或将其强行停止!" && EXIT 2
;;
esac
}
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_Downloader(){
which curl > /dev/null 2>&1 && PKG="curl" && return
echo -e "\n未安装 curl"
which wget-ssl > /dev/null 2>&1 && PKG="wget-ssl" && return
echo "未安装 curl 和 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
Check_Updates(){
Check_Downloader
case "${PKG}" in
curl)
Downloader="curl -L -k -o"
_Downloader="curl -s"
;;
wget-ssl)
Downloader="wget-ssl --no-check-certificate -T 5 -O"
_Downloader="wget-ssl -q -O -"
;;
esac
echo "[${PKG}] 开始检查更新, 请耐心等待 ..."
Cloud_Version="$(${_Downloader} ${core_api_url} 2>/dev/null | grep 'tag_name' | egrep -o "v[0-9].+[0-9.]" | awk 'NR==1')"
[[ -z ${Cloud_Version} ]] && echo -e "\n检查更新失败, 请检查网络或稍后重试!" && EXIT 1
if [[ -f ${binpath} ]]; then
Current_Version="$(${binpath} --version 2>/dev/null | egrep -o "v[0-9].+[0-9]" | sed -r 's/(.*), c(.*)/\1/')"
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
Current_Version="未知"
fi
[[ -z ${Current_Version} ]] && Current_Version="未知"
echo -e "\n执行文件路径: ${binpath%/*}\n\n正在检查更新, 请耐心等待 ..."
echo -e "\n当前 AdGuardHome 版本: ${Current_Version}\n云端 AdGuardHome 版本: ${Cloud_Version}"
if [[ ! "${Cloud_Version}" == "${Current_Version}" || "$1" == force ]]; then
Update_Core
else
echo -e "\n已是最新版本, 无需更新!"
EXIT 0
fi
EXIT 0
}
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"
UPX_Compress(){
GET_Arch
upx_name="upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz"
echo -e "开始下载 ${upx_name} ...\n"
$Downloader /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/${upx_name}"
if [[ ! -e /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz ]]; then
echo -e "\n${upx_name} 下载失败!\n"
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."
else
echo -e "\n${upx_name} 下载成功!\n"
fi
which xz > /dev/null 2>&1 || (opkg list | grep ^xz || opkg update > /dev/null 2>&1 && opkg install xz --force-depends) || (echo "软件包 xz 安装失败!" && EXIT 1)
mkdir -p /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux
echo -e "正在解压 ${upx_name} ...\n"
xz -d -c /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux.tar.xz | tar -x -C "/tmp"
[[ ! -f /tmp/upx-${upx_latest_ver}-${Arch_upx}_linux/upx ]] && echo -e "\n${upx_name} 解压失败!" && EXIT 1
}
Update_Core(){
rm -r /tmp/AdGuardHome_Update > /dev/null 2>&1
mkdir -p "/tmp/AdGuardHome_Update"
GET_Arch
eval link="${update_url}"
echo -e "下载链接:${link}"
echo -e "文件名称:${link##*/}"
echo -e "\n开始下载 AdGuardHome 核心文件 ...\n"
$Downloader /tmp/AdGuardHome_Update/${link##*/} ${link}
if [[ $? != 0 ]];then
echo -e "\nAdGuardHome 核心下载失败 ..."
rm -r /tmp/AdGuardHome_Update
EXIT 1
fi
if [[ ${link##*.} == gz ]]; then
echo -e "\n正在解压 AdGuardHome ..."
tar -zxf "/tmp/AdGuardHome_Update/${link##*/}" -C "/tmp/AdGuardHome_Update/"
if [[ ! -e /tmp/AdGuardHome_Update/AdGuardHome ]]
then
echo "AdGuardHome 核心解压失败!"
rm -rf "/tmp/AdGuardHome_Update" > /dev/null 2>&1
EXIT 1
fi
downloadbin="/tmp/AdGuardHome_Update/AdGuardHome/AdGuardHome"
else
downloadbin="/tmp/AdGuardHome_Update/${link##*/}"
fi
chmod +x ${downloadbin}
echo -e "\nAdGuardHome 核心体积: $(awk 'BEGIN{printf "%.2fMB\n",'$((`ls -l $downloadbin | awk '{print $5}'`))'/1000000}')"
if [[ ${upxflag} != off ]]; then
UPX_Compress
echo -e "使用 UPX 压缩可能会花很长时间, 期间请耐心等待!\n正在压缩 $downloadbin ..."
/tmp/upx-${upx_latest_ver}-${Arch_upx}_linux/upx $upxflag $downloadbin > /dev/null 2>&1
echo -e "\n压缩后的核心体积: $(awk 'BEGIN{printf "%.2fMB\n",'$((`ls -l $downloadbin | awk '{print $5}'`))'/1000000}')"
else
echo "未启用 UPX 压缩, 跳过操作..."
fi
/etc/init.d/AdGuardHome stop > /dev/null 2>&1
echo -e "\n移动 AdGuardHome 核心文件到 ${binpath%/*} ..."
mv -f ${downloadbin} ${binpath} > /dev/null 2>&1
if [[ ! -s ${binpath} && $? != 0 ]]; then
echo -e "AdGuardHome 核心移动失败!\n可能是设备空间不足导致, 请尝试开启 UPX 压缩, 或更改 [执行文件路径] 为 /tmp/AdGuardHome"
EXIT 1
fi
rm /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz
rm -f /tmp/upx*.tar.xz
rm -rf /tmp/upx*
rm -rf /tmp/AdGuardHome_Update
chmod +x ${binpath}
if [[ ${enabled} == 1 ]]; then
echo -e "\n正在重启 AdGuardHome 服务..."
/etc/init.d/AdGuardHome restart
fi
echo -e "\nAdGuardHome 核心更新成功!"
}
doupdate_core(){
echo -e "Updating core..."
mkdir -p "/tmp/AdGuardHomeupdate"
rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1
GET_Arch() {
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
case "${Archt}" in
i386)
@ -158,71 +184,35 @@ doupdate_core(){
Arch=arm64
;;
*)
echo -e "error not support $Archt if you can use offical release please issue a bug"
echo -e "\nAdGuardHome 暂不支持当前的设备架构: [${Archt}]!"
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
case "${Archt}" in
mipsel)
Arch_upx="mipsel"
upx_latest_ver="3.95"
;;
*)
Arch_upx="${Arch}"
upx_latest_ver="$(${_Downloader} https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null | egrep 'tag_name' | egrep '[0-9.]+' -o 2>/dev/null)"
esac
echo -e "\n当前设备架构: ${Arch}\n"
}
EXIT(){
rm /var/run/update_core rm -rf $LOCKU 2>/dev/null
[ "$1" != "0" ] && touch /var/run/update_core_error
rm -rf /var/run/update_core $LOCKU 2>/dev/null
[[ $1 != 0 ]] && touch /var/run/update_core_error
exit $1
}
main(){
# check_if_already_running
check_latest_version $1
Check_Task ${update_mode}
Check_Updates ${update_mode}
}
trap "EXIT 1" SIGTERM SIGINT
touch /var/run/update_core
rm /var/run/update_core_error 2>/dev/null
main $1
trap "EXIT 1" SIGTERM SIGINT
touch /var/run/update_core
rm - rf /var/run/update_core_error 2>/dev/null
main

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-xray
PKG_VERSION:=1.27.1
PKG_VERSION:=1.28.0
PKG_RELEASE:=1
PKG_LICENSE:=MPLv2

View File

@ -39,6 +39,7 @@ Clone this repository under `package/extra` and find `luci-app-xray` under `Extr
* 2023-01-18 `[OpenWrt 22.03 or above only]` feat: option to ignore TP_SPEC_DEF_GW
* 2023-01-23 `[OpenWrt 22.03 or above only]` feat: custom configurations in outbounds. Say if you want to try [XTLS/Xray-core#1540](https://github.com/XTLS/Xray-core/pull/1540) before its release, you can specify `{"streamSettings": {"tlsSettings": {"fingerprint": "xray_random"}}}` in "Custom Options" tab of the corresponding outbound. See the help text in LuCI ui for the rules of configuration override.
* 2023-03-10 `[OpenWrt 22.03 or above only]` feat: experimental REALITY support
* 2023-03-11 feat: h2 read_idle_timeout and health_check_timeout settings
## Changelog 2022

View File

@ -122,7 +122,9 @@ local function stream_h2(server)
if (server.transport == "h2") then
return {
path = server.h2_path,
host = server.h2_host
host = server.h2_host,
read_idle_timeout = server.h2_health_check == "1" and tonumber(server.h2_read_idle_timeout or 10) or nil,
health_check_timeout = server.h2_health_check == "1" and tonumber(server.h2_health_check_timeout or 20) or nil,
}
else
return nil

View File

@ -105,7 +105,9 @@ function stream_h2(server) {
if (server["transport"] == "h2") {
return {
path: server["h2_path"],
host: server["h2_host"]
host: server["h2_host"],
read_idle_timeout: server["h2_health_check"] == "1" ? int(server["h2_read_idle_timeout"] || 10) : null,
health_check_timeout: server["h2_health_check"] == "1" ? int(server["h2_health_check_timeout"] || 20) : null,
}
}
return null;

View File

@ -581,6 +581,25 @@ return view.extend({
o.rmempty = true
o.modalonly = true
o = ss.taboption('transport', form.Flag, "h2_health_check", _("[h2] Health Check"))
o.depends("transport", "h2")
o.rmempty = true
o.modalonly = true
o = ss.taboption('transport', form.Value, "h2_read_idle_timeout", _("[h2] Read Idle Timeout"))
o.depends({ "transport": "h2", "h2_health_check": "1" })
o.rmempty = true
o.modalonly = true
o.default = 10
o.datatype = 'integer'
o = ss.taboption('transport', form.Value, "h2_health_check_timeout", _("[h2] Health Check Timeout"))
o.depends({ "transport": "h2", "h2_health_check": "1" })
o.rmempty = true
o.modalonly = true
o.default = 20
o.datatype = 'integer'
o = ss.taboption('transport', form.Value, "grpc_service_name", _("[grpc] Service Name"))
o.depends("transport", "grpc")
o.rmempty = true

View File

@ -21,13 +21,13 @@ define Download/geoip
HASH:=a17a7ad10116f2cdd7e5f5dfbfff99695641e6dddf57d35c8c32e3f07960b1ab
endef
GEOSITE_VER:=20230309131819
GEOSITE_VER:=20230310125840
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
define Download/geosite
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
HASH:=92320ac1016ce1cda80993790bda8c38facd6c42fa8fbb7cf94a36d04f772af1
HASH:=af2ee5c220b6c1a9d835cc1fb1340be8723e8ce814f43ce6c04a054c1c489c93
endef
define Package/v2ray-geodata/template