diff --git a/manifest.json b/manifest.json index a395c727..1ecc41be 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "2.4.8", + "version": "2.4.9", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 65b9bfba..3a1d96f1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "2.4.8", + "version": "2.4.9", "scripts": { "build:framework": "vite build --mode framework", "build:shell": "vite build --mode shell", diff --git a/src/common/file.ts b/src/common/file.ts index 502648aa..60477fce 100644 --- a/src/common/file.ts +++ b/src/common/file.ts @@ -128,6 +128,7 @@ export async function httpDownload(options: string | HttpDownloadOptions): Promi let url: string; let headers: Record = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36', + 'referer': typeof options === 'string' ? options : options.url, }; if (typeof options === 'string') { url = options; diff --git a/src/common/version.ts b/src/common/version.ts index ec01a8e5..66725915 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '2.4.8'; +export const napCatVersion = '2.4.9'; diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index 07b1537d..a3ba862c 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -147,7 +147,15 @@ export class NTQQFileApi { } catch (e) { logger.logError('获取视频信息失败,将使用默认值', e); } - const newFilePath = filePath + '.mp4'; + + let fileExt = 'mp4' + try { + let tempExt = (await fileType.fileTypeFromFile(filePath))?.ext; + if (tempExt) fileExt = tempExt; + } catch (e) { + this.context.logger.logError('获取文件类型失败', e); + } + const newFilePath = filePath + '.'+fileExt; fs.copyFileSync(filePath, newFilePath); context.deleteAfterSentFiles.push(newFilePath); filePath = newFilePath; diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 93350f8b..9d9bec4a 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V2.4.8', 'napcat-update-button', 'secondary'), + SettingButton('V2.4.9', 'napcat-update-button', 'secondary'), ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 6fd0496a..9cb07778 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V2.4.8", "napcat-update-button", "secondary") + SettingButton("V2.4.9", "napcat-update-button", "secondary") ) ]), SettingList([