mirror of
				https://git.unlock-music.dev/um/web.git
				synced 2025-11-04 22:03:29 +08:00 
			
		
		
		
	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.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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user