mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 11:56:08 +08:00
修改检查更新逻辑
This commit is contained in:
parent
44e2caedfc
commit
cb870fad85
|
@ -42,13 +42,13 @@ echo -e "定时任务启动成功...\n"
|
||||||
|
|
||||||
if [[ $AutoStartBot == true ]]; then
|
if [[ $AutoStartBot == true ]]; then
|
||||||
echo -e "======================7. 启动bot========================\n"
|
echo -e "======================7. 启动bot========================\n"
|
||||||
nohup ql bot >>$dir_log/bot.log 2>&1 &
|
nohup ql bot >$dir_log/bot.log 2>&1 &
|
||||||
echo -e "bot后台启动中...\n"
|
echo -e "bot后台启动中...\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $EnableExtraShell == true ]]; then
|
if [[ $EnableExtraShell == true ]]; then
|
||||||
echo -e "======================8. 执行自定义脚本========================\n"
|
echo -e "======================8. 执行自定义脚本========================\n"
|
||||||
nohup ql extra >>$dir_log/extra.log 2>&1 &
|
nohup ql extra >$dir_log/extra.log 2>&1 &
|
||||||
echo -e "自定义脚本后台执行中...\n"
|
echo -e "自定义脚本后台执行中...\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -349,8 +349,8 @@ reset_branch() {
|
||||||
local branch="$1"
|
local branch="$1"
|
||||||
if [[ $branch ]]; then
|
if [[ $branch ]]; then
|
||||||
part_cmd="origin/${branch}"
|
part_cmd="origin/${branch}"
|
||||||
git checkout -B "$branch"
|
git checkout -B "$branch" &>/dev/null
|
||||||
git branch --set-upstream-to=$part_cmd $branch
|
git branch --set-upstream-to=$part_cmd $branch &>/dev/null
|
||||||
fi
|
fi
|
||||||
git reset --hard $part_cmd &>/dev/null
|
git reset --hard $part_cmd &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,6 @@ update_qinglong() {
|
||||||
|
|
||||||
export isFirstStartServer=false
|
export isFirstStartServer=false
|
||||||
|
|
||||||
local no_restart="$1"
|
|
||||||
local all_branch=$(git branch -a)
|
local all_branch=$(git branch -a)
|
||||||
local primary_branch="master"
|
local primary_branch="master"
|
||||||
if [[ "${all_branch}" =~ "${current_branch}" ]]; then
|
if [[ "${all_branch}" =~ "${current_branch}" ]]; then
|
||||||
|
@ -266,10 +265,16 @@ update_qinglong() {
|
||||||
|
|
||||||
[[ -f $dir_root/package.json ]] && ql_depend_new=$(cat $dir_root/package.json)
|
[[ -f $dir_root/package.json ]] && ql_depend_new=$(cat $dir_root/package.json)
|
||||||
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
|
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
|
||||||
else
|
|
||||||
echo -e "\n更新青龙源文件失败,请检查原因...\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
update_qinglong_static "$1" "$primary_branch"
|
||||||
|
else
|
||||||
|
echo -e "\n更新青龙源文件失败,请检查网络...\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
update_qinglong_static() {
|
||||||
|
local no_restart="$1"
|
||||||
|
local primary_branch="$2"
|
||||||
local url="https://github.com/whyour/qinglong-static.git"
|
local url="https://github.com/whyour/qinglong-static.git"
|
||||||
if [[ -d ${ql_static_repo}/.git ]]; then
|
if [[ -d ${ql_static_repo}/.git ]]; then
|
||||||
reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
|
reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
|
||||||
|
@ -291,9 +296,8 @@ update_qinglong() {
|
||||||
reload_pm2
|
reload_pm2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "\n更新青龙静态资源失败,请检查原因...\n"
|
echo -e "\n更新青龙静态资源失败,请检查网络...\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## 对比脚本
|
## 对比脚本
|
||||||
|
|
|
@ -137,7 +137,12 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const newMessage = `${value}${_message}`;
|
const newMessage = `${value}${_message}`;
|
||||||
|
const updateFailed = newMessage.includes('失败,请检查');
|
||||||
|
|
||||||
modalRef.current.update({
|
modalRef.current.update({
|
||||||
|
maskClosable: updateFailed,
|
||||||
|
closable: updateFailed,
|
||||||
|
okButtonProps: { disabled: !updateFailed },
|
||||||
content: (
|
content: (
|
||||||
<div style={{ height: '60vh', overflowY: 'auto' }}>
|
<div style={{ height: '60vh', overflowY: 'auto' }}>
|
||||||
<pre
|
<pre
|
||||||
|
@ -156,6 +161,10 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||||
});
|
});
|
||||||
setValue(newMessage);
|
setValue(newMessage);
|
||||||
|
|
||||||
|
if (updateFailed) {
|
||||||
|
message.error('更新失败,请检查网络及日志或稍后再试');
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('log-identifier') &&
|
document.getElementById('log-identifier') &&
|
||||||
document
|
document
|
||||||
.getElementById('log-identifier')!
|
.getElementById('log-identifier')!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user