mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-27 18:22:16 +00:00
fix: #50 audio ext mp4
-> m4a
This commit is contained in:
parent
128649076e
commit
aca0a4deb6
@ -16,7 +16,7 @@ class DecryptCommandHandler {
|
|||||||
label: string,
|
label: string,
|
||||||
private parakeet: Parakeet,
|
private parakeet: Parakeet,
|
||||||
private buffer: ArrayBuffer,
|
private buffer: ArrayBuffer,
|
||||||
private options: DecryptCommandOptions
|
private options: DecryptCommandOptions,
|
||||||
) {
|
) {
|
||||||
this.label = `DecryptCommandHandler(${label})`;
|
this.label = `DecryptCommandHandler(${label})`;
|
||||||
}
|
}
|
||||||
@ -59,10 +59,13 @@ class DecryptCommandHandler {
|
|||||||
const decrypted = await this.log(`decrypt (${crypto.cryptoName})`, () => crypto.decrypt(this.buffer, this.options));
|
const decrypted = await this.log(`decrypt (${crypto.cryptoName})`, () => crypto.decrypt(this.buffer, this.options));
|
||||||
|
|
||||||
// Check if we had a successful decryption
|
// Check if we had a successful decryption
|
||||||
const audioExt = crypto.overrideExtension ?? (await this.detectAudioExtension(decrypted));
|
let audioExt = crypto.overrideExtension ?? (await this.detectAudioExtension(decrypted));
|
||||||
if (crypto.checkByDecryptHeader && audioExt === 'bin') {
|
if (crypto.checkByDecryptHeader && audioExt === 'bin') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (audioExt.toLowerCase() === 'mp4') {
|
||||||
|
audioExt = 'm4a';
|
||||||
|
}
|
||||||
|
|
||||||
return { decrypted: URL.createObjectURL(toBlob(decrypted)), ext: audioExt };
|
return { decrypted: URL.createObjectURL(toBlob(decrypted)), ext: audioExt };
|
||||||
}
|
}
|
||||||
@ -82,7 +85,7 @@ class DecryptCommandHandler {
|
|||||||
|
|
||||||
// Check by decrypt max first 8MiB
|
// Check by decrypt max first 8MiB
|
||||||
const decryptedBuffer = await this.log(`${crypto.cryptoName}/decrypt-header-test`, async () =>
|
const decryptedBuffer = await this.log(`${crypto.cryptoName}/decrypt-header-test`, async () =>
|
||||||
toArrayBuffer(await crypto.decrypt(this.buffer.slice(0, TEST_FILE_HEADER_LEN), this.options))
|
toArrayBuffer(await crypto.decrypt(this.buffer.slice(0, TEST_FILE_HEADER_LEN), this.options)),
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.parakeet.detectAudioExtension(decryptedBuffer) !== 'bin';
|
return this.parakeet.detectAudioExtension(decryptedBuffer) !== 'bin';
|
||||||
|
Loading…
Reference in New Issue
Block a user