forked from um/web
Fix Xiami return info
This commit is contained in:
parent
24bfc9e603
commit
6410576adb
@ -50,8 +50,8 @@ export async function CommonDecrypt(file) {
|
|||||||
rt_data = {status: false, message: "不支持此文件格式",}
|
rt_data = {status: false, message: "不支持此文件格式",}
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_data.rawExt = raw_ext;
|
if (!rt_data.rawExt) rt_data.rawExt = raw_ext;
|
||||||
rt_data.rawFilename = raw_filename;
|
if (!rt_data.rawFilename) rt_data.rawFilename = raw_filename;
|
||||||
|
|
||||||
return rt_data;
|
return rt_data;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
import {
|
import {AudioMimeType, DetectAudioExt, GetArrayBuffer, GetFileInfo, GetMetaCoverURL, IsBytesEqual} from "./util";
|
||||||
AudioMimeType,
|
|
||||||
DetectAudioExt,
|
|
||||||
GetArrayBuffer,
|
|
||||||
GetFileInfo,
|
|
||||||
GetMetaCoverURL,
|
|
||||||
IsBytesEqual
|
|
||||||
} from "./util";
|
|
||||||
|
|
||||||
import {Decrypt as RawDecrypt} from "./raw";
|
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)) ||
|
if (!IsBytesEqual(MagicHeader, oriData.slice(0, 4)) ||
|
||||||
!IsBytesEqual(MagicHeader2, oriData.slice(8, 12))) {
|
!IsBytesEqual(MagicHeader2, oriData.slice(8, 12))) {
|
||||||
if (raw_ext === "xm") {
|
if (raw_ext === "xm") {
|
||||||
return {status: false, message: "Not a valid xm file!"}
|
return {status: false, message: "此xm文件已损坏"}
|
||||||
} else {
|
} else {
|
||||||
return await RawDecrypt(file, raw_filename, raw_ext, true)
|
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))
|
let typeText = (new TextDecoder()).decode(oriData.slice(4, 8))
|
||||||
if (!FileTypeMap.hasOwnProperty(typeText)) {
|
if (!FileTypeMap.hasOwnProperty(typeText)) {
|
||||||
return {status: false, message: "New Xiami file category!"}
|
return {status: false, message: "未知的xm文件类型"}
|
||||||
}
|
}
|
||||||
|
|
||||||
let key = oriData[0xf]
|
let key = oriData[0xf]
|
||||||
@ -66,7 +59,8 @@ export async function Decrypt(file, raw_filename, raw_ext) {
|
|||||||
album: musicMeta.common.album,
|
album: musicMeta.common.album,
|
||||||
picture: imgUrl,
|
picture: imgUrl,
|
||||||
file: URL.createObjectURL(musicBlob),
|
file: URL.createObjectURL(musicBlob),
|
||||||
mime: mime
|
mime: mime,
|
||||||
|
rawExt: "xm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user