diff --git a/src/decrypt/common.js b/src/decrypt/common.js index c059263..d97e498 100644 --- a/src/decrypt/common.js +++ b/src/decrypt/common.js @@ -50,8 +50,8 @@ export async function CommonDecrypt(file) { rt_data = {status: false, message: "不支持此文件格式",} } - rt_data.rawExt = raw_ext; - rt_data.rawFilename = raw_filename; + if (!rt_data.rawExt) rt_data.rawExt = raw_ext; + if (!rt_data.rawFilename) rt_data.rawFilename = raw_filename; return rt_data; } diff --git a/src/decrypt/xm.js b/src/decrypt/xm.js index de27b21..c25e2d4 100644 --- a/src/decrypt/xm.js +++ b/src/decrypt/xm.js @@ -1,11 +1,4 @@ -import { - AudioMimeType, - DetectAudioExt, - GetArrayBuffer, - GetFileInfo, - GetMetaCoverURL, - IsBytesEqual -} from "./util"; +import {AudioMimeType, DetectAudioExt, GetArrayBuffer, GetFileInfo, GetMetaCoverURL, IsBytesEqual} from "./util"; import {Decrypt as RawDecrypt} from "./raw"; @@ -24,7 +17,7 @@ export async function Decrypt(file, raw_filename, raw_ext) { if (!IsBytesEqual(MagicHeader, oriData.slice(0, 4)) || !IsBytesEqual(MagicHeader2, oriData.slice(8, 12))) { if (raw_ext === "xm") { - return {status: false, message: "Not a valid xm file!"} + return {status: false, message: "此xm文件已损坏"} } else { return await RawDecrypt(file, raw_filename, raw_ext, true) } @@ -32,7 +25,7 @@ export async function Decrypt(file, raw_filename, raw_ext) { let typeText = (new TextDecoder()).decode(oriData.slice(4, 8)) if (!FileTypeMap.hasOwnProperty(typeText)) { - return {status: false, message: "New Xiami file category!"} + return {status: false, message: "未知的xm文件类型"} } let key = oriData[0xf] @@ -66,7 +59,8 @@ export async function Decrypt(file, raw_filename, raw_ext) { album: musicMeta.common.album, picture: imgUrl, file: URL.createObjectURL(musicBlob), - mime: mime + mime: mime, + rawExt: "xm" } }