fix: support files that were not encrypted (e.g. kgma), close #36
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
鲁树人 2023-06-18 18:00:31 +01:00
parent ed488ea204
commit d070332f98
2 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import { NCMCrypto } from './ncm/ncm_pc';
import { XimalayaAndroidCrypto } from './xmly/xmly_android';
import { KWMCrypto } from './kwm/kwm';
import { MiguCrypto } from './migu/migu3d_keyless';
import { TransparentCrypto } from './transparent/transparent';
export const allCryptoFactories: CryptoFactory[] = [
// Xiami (*.xm)
@ -38,4 +39,7 @@ export const allCryptoFactories: CryptoFactory[] = [
// Ximalaya (Android)
XimalayaAndroidCrypto.makeX2M,
XimalayaAndroidCrypto.makeX3M,
// Transparent crypto (not encrypted)
TransparentCrypto.make,
];

View File

@ -0,0 +1,14 @@
import type { CryptoBase } from '../CryptoBase';
export class TransparentCrypto implements CryptoBase {
cryptoName = 'Transparent';
checkByDecryptHeader = true;
async decrypt(buffer: ArrayBuffer): Promise<Blob> {
return new Blob([buffer]);
}
public static make() {
return new TransparentCrypto();
}
}