fix: check version catch

This commit is contained in:
linyuchen committed 2024-04-18 20:10:09 +08:00
1 parent 36669be891
commit 072b58ef50
2 files changed
+11 -5

No files matched your search

+6 -2
View File
@@ -16,7 +16,7 @@ import {
GrayTipElementSubType,
Group,
GroupMember,
IMAGE_HTTP_HOST,
IMAGE_HTTP_HOST, IMAGE_HTTP_HOST_NT,
RawMessage,
SelfInfo,
Sex,
@@ -160,7 +160,11 @@ export class OB11Constructor {
message_data['data']['url'] = IMAGE_HTTP_HOST + url;
} else {
// 有可能会碰到appid为1406的,这个不能使用新的NT域名,并且需要把appid改为1407才可访问
message_data['data']['url'] = `${IMAGE_HTTP_HOST}/download?appid=1407&fileid=${fileUuid}&rkey=${currentRKey}&spec=0`;
let host = IMAGE_HTTP_HOST_NT;
if (url.includes('appid=1406')) {
host = IMAGE_HTTP_HOST;
}
message_data['data']['url'] = `${host}/download?appid=1407&fileid=${fileUuid}&rkey=${currentRKey}&spec=0`;
}
} else {
message_data['data']['url'] = IMAGE_HTTP_HOST + url;
+5 -3
View File
@@ -21,17 +21,19 @@ checkVersion().then((remoteVersion: string) => {
const localVersion = require('./package.json').version;
const localVersionList = localVersion.split('.');
const remoteVersionList = remoteVersion.split('.');
console.log('[NapCat] [Upate] 当前版本:', localVersion);
console.log('[NapCat] 当前版本:', localVersion);
for (const k of [0, 1, 2]) {
if (parseInt(remoteVersionList[k]) > parseInt(localVersionList[k])) {
console.log('[NapCat] [Upate] 检测到更新,请前往 https://github.com/NapNeko/NapCatQQ 下载 NapCatQQ V', remoteVersion);
console.log('[NapCat] 检测到更新,请前往 https://github.com/NapNeko/NapCatQQ 下载 NapCatQQ V', remoteVersion);
return;
} else if (parseInt(remoteVersionList[k]) < parseInt(localVersionList[k])) {
break;
}
}
console.log('[NapCat] [Upate] 当前已是最新版本');
console.log('[NapCat] 当前已是最新版本');
return;
}).catch((e) => {
console.error('[NapCat] 检测更新失败');
});
new NapCatOnebot11();
napCatCore.addLoginSuccessCallback(() => {