feat(storage): Pass over config to worker thread on decryption call

This commit is contained in:
Jixun Wu
2021-12-20 22:22:35 +00:00
parent ed84a4732d
commit 36d616398e
2 changed files with 10 additions and 2 deletions

View File

@@ -8,8 +8,15 @@ import { Decrypt as TmDecrypt } from '@/decrypt/tm';
import { Decrypt as JooxDecrypt } from '@/decrypt/joox';
import { DecryptResult, FileInfo } from '@/decrypt/entity';
import { SplitFilename } from '@/decrypt/utils';
import { storage } from '@/utils/storage';
import InMemoryStorage from '@/utils/storage/InMemoryStorage';
export async function CommonDecrypt(file: FileInfo, config: Record<string, any>): Promise<DecryptResult> {
// Worker thread will fallback to in-memory storage.
if (storage instanceof InMemoryStorage) {
await storage.setAll(config);
}
export async function CommonDecrypt(file: FileInfo): Promise<DecryptResult> {
const raw = SplitFilename(file.name);
let rt_data: DecryptResult;
switch (raw.ext) {