fix: check version catch

This commit is contained in:
linyuchen 2024-04-18 20:10:09 +08:00
parent 22f74be4cd
commit cc211706d5
2 changed files with 11 additions and 5 deletions

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;

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(() => {