1
0
forked from um/web

Fix Xiami return info

This commit is contained in:
MengYX 2020-05-14 17:36:16 +08:00
parent 24bfc9e603
commit 6410576adb
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604
2 changed files with 7 additions and 13 deletions

View File

@ -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;
}

View File

@ -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"
}
}