refactor: change common -> index
(cherry picked from commit eb6be0d9d13a0834b6a7ada9aab846cfbbdfd664)
This commit is contained in:
parent
976077e3e1
commit
8260e744ca
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { spawn, Worker, Pool } from 'threads';
|
import { spawn, Worker, Pool } from 'threads';
|
||||||
import { CommonDecrypt } from '@/decrypt/common.ts';
|
import { Decrypt } from '@/decrypt';
|
||||||
import { DecryptQueue } from '@/utils/utils';
|
import { DecryptQueue } from '@/utils/utils';
|
||||||
import { storage } from '@/utils/storage';
|
import { storage } from '@/utils/storage';
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async addFile(file) {
|
async addFile(file) {
|
||||||
this.task_all++;
|
this.task_all++;
|
||||||
this.queue.queue(async (dec = CommonDecrypt) => {
|
this.queue.queue(async (dec = Decrypt) => {
|
||||||
console.log('start handling', file.name);
|
console.log('start handling', file.name);
|
||||||
try {
|
try {
|
||||||
this.$emit('success', await dec(file, await storage.getAll()));
|
this.$emit('success', await dec(file, await storage.getAll()));
|
||||||
|
@ -13,7 +13,7 @@ import { SplitFilename } from '@/decrypt/utils';
|
|||||||
import { storage } from '@/utils/storage';
|
import { storage } from '@/utils/storage';
|
||||||
import InMemoryStorage from '@/utils/storage/InMemoryStorage';
|
import InMemoryStorage from '@/utils/storage/InMemoryStorage';
|
||||||
|
|
||||||
export async function CommonDecrypt(file: FileInfo, config: Record<string, any>): Promise<DecryptResult> {
|
export async function Decrypt(file: FileInfo, config: Record<string, any>): Promise<DecryptResult> {
|
||||||
// Worker thread will fallback to in-memory storage.
|
// Worker thread will fallback to in-memory storage.
|
||||||
if (storage instanceof InMemoryStorage) {
|
if (storage instanceof InMemoryStorage) {
|
||||||
await storage.setAll(config);
|
await storage.setAll(config);
|
@ -1,4 +1,4 @@
|
|||||||
import { expose } from 'threads/worker';
|
import { expose } from 'threads/worker';
|
||||||
import { CommonDecrypt } from '@/decrypt/common';
|
import { Decrypt } from '@/decrypt';
|
||||||
|
|
||||||
expose(CommonDecrypt);
|
expose(Decrypt);
|
||||||
|
Loading…
Reference in New Issue
Block a user