mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 03:23:02 +00:00
feat: initial implementation of qtfm android
This commit is contained in:
@@ -9,6 +9,7 @@ import { XimalayaAndroidCrypto } from './xmly/xmly_android';
|
||||
import { KWMCrypto } from './kwm/kwm';
|
||||
import { MiguCrypto } from './migu/migu3d_keyless';
|
||||
import { TransparentCrypto } from './transparent/transparent';
|
||||
import { QingTingFM$Device } from './qtfm/qtfm_device';
|
||||
|
||||
export const allCryptoFactories: CryptoFactory[] = [
|
||||
// Xiami (*.xm)
|
||||
@@ -40,6 +41,9 @@ export const allCryptoFactories: CryptoFactory[] = [
|
||||
XimalayaAndroidCrypto.makeX2M,
|
||||
XimalayaAndroidCrypto.makeX3M,
|
||||
|
||||
// QingTingFM (Android)
|
||||
QingTingFM$Device.make,
|
||||
|
||||
// Transparent crypto (not encrypted)
|
||||
TransparentCrypto.make,
|
||||
];
|
||||
|
||||
25
src/decrypt-worker/crypto/qtfm/qtfm_device.ts
Normal file
25
src/decrypt-worker/crypto/qtfm/qtfm_device.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { transformBlob } from '~/decrypt-worker/util/transformBlob';
|
||||
import type { CryptoBase } from '../CryptoBase';
|
||||
import { DecryptCommandOptions } from '~/decrypt-worker/types';
|
||||
|
||||
export class QingTingFM$Device implements CryptoBase {
|
||||
cryptoName = 'QingTing FM/Device ID';
|
||||
checkByDecryptHeader = false;
|
||||
|
||||
async checkBySignature(_buffer: ArrayBuffer, options: DecryptCommandOptions) {
|
||||
return Boolean(/^\.p~?!.*\.qta$/.test(options.fileName) && options.qingTingAndroidDevice);
|
||||
}
|
||||
|
||||
async decrypt(buffer: ArrayBuffer, options: DecryptCommandOptions): Promise<Blob> {
|
||||
const { fileName: name, qingTingAndroidDevice: qingTingDevice } = options;
|
||||
if (!qingTingDevice) {
|
||||
throw new Error('QingTingFM Device Info was not provided');
|
||||
}
|
||||
|
||||
return transformBlob(buffer, (p) => p.make.QingTingFM(name, qingTingDevice));
|
||||
}
|
||||
|
||||
public static make() {
|
||||
return new QingTingFM$Device();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user