Merge pull request 'fix(kwm): allow new magic header on unlock-music web edition' (#22) from Yuki1536/um-web:master into master

Reviewed-on: https://git.unlock-music.dev/um/web/pulls/22
Reviewed-by: um-dev <dev@unlock-music.dev>
remotes/origin/HEAD
um-dev 2 years ago
commit e22e9ae698

@ -15,12 +15,16 @@ import { DecryptResult } from '@/decrypt/entity';
const MagicHeader = [
0x79, 0x65, 0x65, 0x6C, 0x69, 0x6F, 0x6E, 0x2D,
0x6B, 0x75, 0x77, 0x6F, 0x2D, 0x74, 0x6D, 0x65,
]
];
const MagicHeader2 = [
0x79, 0x65, 0x65, 0x6C, 0x69, 0x6F, 0x6E, 0x2D,
0x6B, 0x75, 0x77, 0x6F, 0x00, 0x00, 0x00, 0x00,
];
const PreDefinedKey = 'MoOtOiTvINGwd2E6n0E1i7L5t2IoOoNk';
export async function Decrypt(file: File, raw_filename: string, _: string): Promise<DecryptResult> {
const oriData = new Uint8Array(await GetArrayBuffer(file));
if (!BytesHasPrefix(oriData, MagicHeader)) {
if (!BytesHasPrefix(oriData, MagicHeader) && !BytesHasPrefix(oriData, MagicHeader2)) {
if (SniffAudioExt(oriData) === 'aac') {
return await RawDecrypt(file, raw_filename, 'aac', false);
}

Loading…
Cancel
Save