From 47d2fc24bc710f11e8a4c61ab7752afe20a4696f Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 16 Mar 2024 13:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=20reload?= =?UTF-8?q?=20=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 12 ++++----- src/pages/setting/checkUpdate.tsx | 2 ++ src/pages/setting/other.tsx | 2 ++ src/utils/index.ts | 42 +++++++++++++++++++++++-------- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index d04b8d04..1f2601ab 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -235,14 +235,14 @@ reload_qinglong() { local reload_target="${1}" local primary_branch="master" - if [[ "${QL_BRANCH}" == "develop" ]]; then - primary_branch="develop" + if [[ "${QL_BRANCH}" == "develop" ]] || [[ "${QL_BRANCH}" == "debian" ]] || [[ "${QL_BRANCH}" == "debian-dev" ]]; then + primary_branch="${QL_BRANCH}" fi if [[ "$reload_target" == 'system' ]]; then - cp -rf ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}/ + mv -f ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}/ rm -rf $dir_static/* - cp -rf ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}/ + mv -f ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}/ cp -f $file_config_sample $dir_config/config.sample.sh fi @@ -314,9 +314,9 @@ check_update_dep() { if [[ "$needRestart" == 'true' ]]; then delete_pm2 - cp -rf ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}/ + mv -f ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}/ rm -rf $dir_static/* - cp -rf ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}/ + mv -f ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}/ cp -f $file_config_sample $dir_config/config.sample.sh reload_pm2 diff --git a/src/pages/setting/checkUpdate.tsx b/src/pages/setting/checkUpdate.tsx index 2a35d21e..a87a44b8 100644 --- a/src/pages/setting/checkUpdate.tsx +++ b/src/pages/setting/checkUpdate.tsx @@ -1,3 +1,4 @@ +import { disableBody } from '@/utils'; import config from '@/utils/config'; import { request } from '@/utils/http'; import WebSocketManager from '@/utils/websocket'; @@ -132,6 +133,7 @@ const CheckUpdate = ({ systemInfo }: any) => { ), duration: 30, }); + disableBody(); setTimeout(() => { window.location.reload(); }, 30000); diff --git a/src/pages/setting/other.tsx b/src/pages/setting/other.tsx index 2e4fc520..5665ad89 100644 --- a/src/pages/setting/other.tsx +++ b/src/pages/setting/other.tsx @@ -22,6 +22,7 @@ import { UploadOutlined } from '@ant-design/icons'; import Countdown from 'antd/lib/statistic/Countdown'; import useProgress from './progress'; import pick from 'lodash/pick'; +import { disableBody } from '@/utils'; const dataMap = { 'log-remove-frequency': 'logRemoveFrequency', @@ -157,6 +158,7 @@ const Other = ({ ), duration: 30, }); + disableBody(); setTimeout(() => { window.location.reload(); }, 30000); diff --git a/src/utils/index.ts b/src/utils/index.ts index 65b71e8c..a0becf5a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -154,9 +154,9 @@ export default function browserType() { shell === 'none' ? {} : { - shell, // wechat qq uc 360 2345 sougou liebao maxthon - shellVs, - }, + shell, // wechat qq uc 360 2345 sougou liebao maxthon + shellVs, + }, ); console.log( @@ -335,20 +335,23 @@ export function parseCrontab(schedule: string): Date | null { if (time) { return time.next().toDate(); } - } catch (error) { } + } catch (error) {} return null; } -export function getCrontabsNextDate(schedule: string, extra_schedules: string[]): Date | null { - let date = parseCrontab(schedule) +export function getCrontabsNextDate( + schedule: string, + extra_schedules: string[], +): Date | null { + let date = parseCrontab(schedule); if (extra_schedules?.length) { - extra_schedules.forEach(x => { - const _date = parseCrontab(x) + extra_schedules.forEach((x) => { + const _date = parseCrontab(x); if (_date && (!date || _date < date)) { date = _date; } - }) + }); } return date; } @@ -362,4 +365,23 @@ export function getExtension(filename: string) { export function getEditorMode(filename: string) { const extension = getExtension(filename) as keyof typeof LANG_MAP; return LANG_MAP[extension]; -} \ No newline at end of file +} + +export function disableBody() { + const overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = '0px'; + overlay.style.left = '0px'; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'transparent'; + overlay.style.zIndex = '9999'; + document.body.appendChild(overlay); + + overlay.addEventListener('click', function (event) { + event.stopPropagation(); + event.preventDefault(); + }); + + document.body.style.overflow = 'hidden'; +}