From 660c7d5a7e3b129e626bade76fa2b289699da3b6 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Mon, 29 Jul 2024 14:21:51 +0800 Subject: [PATCH] fix(shell): fix chrononeko/bugtracker#76 --- packages/docs/docs/code/2151/index.mdx | 14 ++++++++++++++ packages/shell/src/index.ts | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 packages/docs/docs/code/2151/index.mdx diff --git a/packages/docs/docs/code/2151/index.mdx b/packages/docs/docs/code/2151/index.mdx new file mode 100644 index 0000000..8ad3749 --- /dev/null +++ b/packages/docs/docs/code/2151/index.mdx @@ -0,0 +1,14 @@ +--- +title: 2151:启动了其他应用 +sidebar_position: 2151 +--- + +import { ErrorScope } from '@site/src/components/ErrorScope' + + + +启动的应用并非 QQ,而是其他应用。 + +一般情况下,当 QQ 在下列情况下启动时,Chronocat 不会启动: + +1. 小程序 diff --git a/packages/shell/src/index.ts b/packages/shell/src/index.ts index e54460f..ec85ce6 100644 --- a/packages/shell/src/index.ts +++ b/packages/shell/src/index.ts @@ -1,4 +1,5 @@ import h from '@satorijs/element' +import { app } from 'electron' import { initServers } from './server' import { api } from './services/api' import { getAuthData } from './services/authData' @@ -28,6 +29,11 @@ export const chronocat = () => { l.info(`${cyan('Chronocat')} ${bold(__DEFINE_CHRONO_VERSION__)}`) l.info(grey('当左侧错误指示灯亮起时,点击错误码以检查说明。')) + if (app.commandLine.hasSwitch('loadapp')) { + l.warn('启动的应用并非 QQ,Chronocat 不会启用。', { code: 2151 }) + return + } + let ready: () => void const readyPromise = new Promise((res) => { ready = res