mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
Feature/v0 scripts (#512)
* update contributors[no ci] * Add v0 release * Add install.sh to keep the v0 panel functioning properly * Modify sync.py * Remove release-v0.yaml --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
b994a52422
commit
dae8f7f24e
3
.github/sync.py
vendored
3
.github/sync.py
vendored
@ -52,7 +52,10 @@ def delete_gitee_releases(latest_id, client, uri, token):
|
|||||||
print(f'Current release ids: {release_ids}')
|
print(f'Current release ids: {release_ids}')
|
||||||
release_ids.remove(latest_id)
|
release_ids.remove(latest_id)
|
||||||
|
|
||||||
|
# 2024.12.01 保留 v0 开头的 Release
|
||||||
for id in release_ids:
|
for id in release_ids:
|
||||||
|
if id.startswith('v0'):
|
||||||
|
continue
|
||||||
release_uri = f"{uri}/{id}"
|
release_uri = f"{uri}/{id}"
|
||||||
delete_data = {
|
delete_data = {
|
||||||
'access_token': token
|
'access_token': token
|
||||||
|
@ -66,7 +66,6 @@ You can change the dashboard language in the settings page (`/setting`) after th
|
|||||||
<a href="https://github.com/DarcJC" title="Darc Z."><img src="https://avatars.githubusercontent.com/u/53445798?v=4" width="50;" alt="Darc Z."/></a>
|
<a href="https://github.com/DarcJC" title="Darc Z."><img src="https://avatars.githubusercontent.com/u/53445798?v=4" width="50;" alt="Darc Z."/></a>
|
||||||
<a href="https://github.com/Creling" title="Creling"><img src="https://avatars.githubusercontent.com/u/43109504?v=4" width="50;" alt="Creling"/></a>
|
<a href="https://github.com/Creling" title="Creling"><img src="https://avatars.githubusercontent.com/u/43109504?v=4" width="50;" alt="Creling"/></a>
|
||||||
<a href="https://github.com/coreff" title="Core F"><img src="https://avatars.githubusercontent.com/u/38347122?v=4" width="50;" alt="Core F"/></a>
|
<a href="https://github.com/coreff" title="Core F"><img src="https://avatars.githubusercontent.com/u/38347122?v=4" width="50;" alt="Core F"/></a>
|
||||||
<a href="https://github.com/nickfox-taterli" title="Tater Li"><img src="https://avatars.githubusercontent.com/u/19658596?v=4" width="50;" alt="Tater Li"/></a>
|
|
||||||
<a href="https://github.com/hmsjy2017" title="Tony"><img src="https://avatars.githubusercontent.com/u/42692274?v=4" width="50;" alt="Tony"/></a>
|
<a href="https://github.com/hmsjy2017" title="Tony"><img src="https://avatars.githubusercontent.com/u/42692274?v=4" width="50;" alt="Tony"/></a>
|
||||||
<a href="https://github.com/adminsama" title="adminsama"><img src="https://avatars.githubusercontent.com/u/60880076?v=4" width="50;" alt="adminsama"/></a>
|
<a href="https://github.com/adminsama" title="adminsama"><img src="https://avatars.githubusercontent.com/u/60880076?v=4" width="50;" alt="adminsama"/></a>
|
||||||
<a href="https://github.com/acgpiano" title="Acgpiano"><img src="https://avatars.githubusercontent.com/u/15900800?v=4" width="50;" alt="Acgpiano"/></a>
|
<a href="https://github.com/acgpiano" title="Acgpiano"><img src="https://avatars.githubusercontent.com/u/15900800?v=4" width="50;" alt="Acgpiano"/></a>
|
||||||
@ -78,8 +77,10 @@ You can change the dashboard language in the settings page (`/setting`) after th
|
|||||||
<a href="https://github.com/lyj0309" title="lyj"><img src="https://avatars.githubusercontent.com/u/50474995?v=4" width="50;" alt="lyj"/></a>
|
<a href="https://github.com/lyj0309" title="lyj"><img src="https://avatars.githubusercontent.com/u/50474995?v=4" width="50;" alt="lyj"/></a>
|
||||||
<a href="https://github.com/unclezs" title="unclezs"><img src="https://avatars.githubusercontent.com/u/42318775?v=4" width="50;" alt="unclezs"/></a>
|
<a href="https://github.com/unclezs" title="unclezs"><img src="https://avatars.githubusercontent.com/u/42318775?v=4" width="50;" alt="unclezs"/></a>
|
||||||
<a href="https://github.com/ysicing" title="缘生"><img src="https://avatars.githubusercontent.com/u/8605565?v=4" width="50;" alt="缘生"/></a>
|
<a href="https://github.com/ysicing" title="缘生"><img src="https://avatars.githubusercontent.com/u/8605565?v=4" width="50;" alt="缘生"/></a>
|
||||||
|
<a href="https://github.com/yanhao98" title="严浩"><img src="https://avatars.githubusercontent.com/u/37316281?v=4" width="50;" alt="严浩"/></a>
|
||||||
<a href="https://github.com/arkylin" title="凌"><img src="https://avatars.githubusercontent.com/u/35104502?v=4" width="50;" alt="凌"/></a>
|
<a href="https://github.com/arkylin" title="凌"><img src="https://avatars.githubusercontent.com/u/35104502?v=4" width="50;" alt="凌"/></a>
|
||||||
<a href="https://github.com/colour93" title="玖叁"><img src="https://avatars.githubusercontent.com/u/64313711?v=4" width="50;" alt="玖叁"/></a>
|
<a href="https://github.com/colour93" title="玖叁"><img src="https://avatars.githubusercontent.com/u/64313711?v=4" width="50;" alt="玖叁"/></a>
|
||||||
|
<a href="https://github.com/nickfox-taterli" title="Tater Li"><img src="https://avatars.githubusercontent.com/u/19658596?v=4" width="50;" alt="Tater Li"/></a>
|
||||||
<a href="https://github.com/IamTaoChen" title="Tao Chen"><img src="https://avatars.githubusercontent.com/u/42793494?v=4" width="50;" alt="Tao Chen"/></a>
|
<a href="https://github.com/IamTaoChen" title="Tao Chen"><img src="https://avatars.githubusercontent.com/u/42793494?v=4" width="50;" alt="Tao Chen"/></a>
|
||||||
<a href="https://github.com/Septrum101" title="Spetrum"><img src="https://avatars.githubusercontent.com/u/11692994?v=4" width="50;" alt="Spetrum"/></a>
|
<a href="https://github.com/Septrum101" title="Spetrum"><img src="https://avatars.githubusercontent.com/u/11692994?v=4" width="50;" alt="Spetrum"/></a>
|
||||||
<a href="https://github.com/dreamingsleeping" title="Nanjing Hopefun Network Technology Co. Ltd."><img src="https://avatars.githubusercontent.com/u/13828658?v=4" width="50;" alt="Nanjing Hopefun Network Technology Co. Ltd."/></a>
|
<a href="https://github.com/dreamingsleeping" title="Nanjing Hopefun Network Technology Co. Ltd."><img src="https://avatars.githubusercontent.com/u/13828658?v=4" width="50;" alt="Nanjing Hopefun Network Technology Co. Ltd."/></a>
|
||||||
|
102
script/install.sh
Normal file
102
script/install.sh
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#========================================================
|
||||||
|
# master 分支安装脚本重定向
|
||||||
|
#========================================================
|
||||||
|
|
||||||
|
# 判断是否应使用中国镜像
|
||||||
|
|
||||||
|
geo_check() {
|
||||||
|
api_list="https://blog.cloudflare.com/cdn-cgi/trace https://developers.cloudflare.com/cdn-cgi/trace"
|
||||||
|
ua="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
|
||||||
|
set -- "$api_list"
|
||||||
|
for url in $api_list; do
|
||||||
|
text="$(curl -A "$ua" -m 10 -s "$url")"
|
||||||
|
endpoint="$(echo "$text" | sed -n 's/.*h=\([^ ]*\).*/\1/p')"
|
||||||
|
if echo "$text" | grep -qw 'CN'; then
|
||||||
|
isCN=true
|
||||||
|
break
|
||||||
|
elif echo "$url" | grep -q "$endpoint"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# 向用户确认是否使用中国镜像
|
||||||
|
geo_check
|
||||||
|
|
||||||
|
if [ "$isCN" = true ]; then
|
||||||
|
read -p "检测到您的IP可能来自中国大陆,是否使用中国镜像? [y/n] " choice
|
||||||
|
case "$choice" in
|
||||||
|
y|Y)
|
||||||
|
echo "将使用中国镜像..."
|
||||||
|
USE_CN_MIRROR=true
|
||||||
|
;;
|
||||||
|
n|N)
|
||||||
|
echo "将使用国际镜像..."
|
||||||
|
USE_CN_MIRROR=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "输入无效,将使用国际镜像..."
|
||||||
|
USE_CN_MIRROR=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
USE_CN_MIRROR=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 默认引导用户使用 master 分支 v1 新面板安装脚本,但若使用了 install_agent 参数,则默认重定向至 v0
|
||||||
|
if echo "$@" | grep -q "install_agent"; then
|
||||||
|
echo "检测到 v0 面板 install_agent 参数,将使用 v0 分支脚本..."
|
||||||
|
echo "警告: v0 面板已停止维护,请尽快升级至 v1 面板,详见文档:https://nezha.wiki/,5s 后继续运行脚本"
|
||||||
|
# 强制等待 5 秒
|
||||||
|
sleep 5
|
||||||
|
is_v1=false
|
||||||
|
else
|
||||||
|
# 让用户选择是否执行新脚本
|
||||||
|
echo "v1 面板已正式发布,v0 已停止维护,若您已安装 v0 面板,请尽快升级至 v1 面板"
|
||||||
|
echo "v1 与 v0 有较大差异,详见文档:https://nezha.wiki/"
|
||||||
|
echo "若您暂时不想升级,请输入 n 并按回车键以继续使用 v0 面板脚本"
|
||||||
|
read -p "是否执行 v1 面板安装脚本? [y/n] " choice
|
||||||
|
case "$choice" in
|
||||||
|
n|N)
|
||||||
|
is_v1=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
is_v1=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_v1" = true ]; then
|
||||||
|
echo "将使用 v1 面板安装脚本..."
|
||||||
|
if [ "$USE_CN_MIRROR" = true ]; then
|
||||||
|
shell_url="https://gitee.com/naibahq/scripts/raw/main/install.sh"
|
||||||
|
else
|
||||||
|
shell_url="https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh"
|
||||||
|
fi
|
||||||
|
file_name="nezha.sh"
|
||||||
|
else
|
||||||
|
echo "将使用 v0 面板安装脚本,脚本将会下载为nezha_v0.sh"
|
||||||
|
if [ "$USE_CN_MIRROR" = true ]; then
|
||||||
|
shell_url="https://gitee.com/naibahq/scripts/raw/v0/install.sh"
|
||||||
|
else
|
||||||
|
shell_url="https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install.sh"
|
||||||
|
fi
|
||||||
|
file_name="nezha_v0.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if command -v wget >/dev/null 2>&1; then
|
||||||
|
wget -O "/tmp/nezha.sh" "$shell_url"
|
||||||
|
elif command -v curl >/dev/null 2>&1; then
|
||||||
|
curl -o "/tmp/nezha.sh" "$shell_url"
|
||||||
|
else
|
||||||
|
echo "错误: 未找到 wget 或 curl,请安装其中任意一个后再试"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x "/tmp/nezha.sh"
|
||||||
|
mv "/tmp/nezha.sh" "./$file_name"
|
||||||
|
# 携带原参数运行新脚本
|
||||||
|
exec ./"$file_name" "$@"
|
52
script/install_en.sh
Normal file
52
script/install_en.sh
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#========================================================
|
||||||
|
# master install script redirect
|
||||||
|
#========================================================
|
||||||
|
|
||||||
|
# Default: Guide users to use master branch v1 new panel installation script
|
||||||
|
# However, if install_agent parameter is used, redirect to v0 by default
|
||||||
|
if echo "$@" | grep -q "install_agent"; then
|
||||||
|
echo "Detected v0 panel install_agent parameter, will use v0 branch script..."
|
||||||
|
echo "Warning: v0 panel is no longer maintained, please upgrade to v1 panel ASAP. See docs: https://nezha.wiki/, script will continue in 5s"
|
||||||
|
sleep 5
|
||||||
|
is_v1=false
|
||||||
|
else
|
||||||
|
echo "v1 panel has been officially released, v0 is no longer maintained. If you have v0 panel installed, please upgrade to v1 ASAP"
|
||||||
|
echo "v1 differs significantly from v0, see documentation: https://nezha.wiki/"
|
||||||
|
echo "If you don't want to upgrade now, enter 'n' and press Enter to continue using v0 panel script"
|
||||||
|
read -p "Execute v1 panel installation script? [y/n] " choice
|
||||||
|
case "$choice" in
|
||||||
|
n|N)
|
||||||
|
is_v1=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
is_v1=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_v1" = true ]; then
|
||||||
|
echo "Will use v1 panel installation script..."
|
||||||
|
shell_url="https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh"
|
||||||
|
file_name="nezha.sh"
|
||||||
|
else
|
||||||
|
echo "Will use v0 panel installation script, script will be downloaded as nezha_v0.sh"
|
||||||
|
shell_url="https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install_en.sh"
|
||||||
|
file_name="nezha_v0.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if command -v wget >/dev/null 2>&1; then
|
||||||
|
wget -O "/tmp/nezha.sh" "$shell_url"
|
||||||
|
elif command -v curl >/dev/null 2>&1; then
|
||||||
|
curl -o "/tmp/nezha.sh" "$shell_url"
|
||||||
|
else
|
||||||
|
echo "Error: wget or curl not found, please install either one and try again"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x "/tmp/nezha.sh"
|
||||||
|
mv "/tmp/nezha.sh" "./$file_name"
|
||||||
|
# Run the new script with the original parameters
|
||||||
|
exec ./"$file_name" "$@"
|
Loading…
Reference in New Issue
Block a user