mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-27 23:56:59 +00:00
feat: introduce worker action types and refactor decryption handling
- Added a new `actions.ts` file defining `WorkerActionMap` for better type management of worker actions. - Updated `client.ts`, `worker.ts`, and `decrypt.ts` to utilize the new action types, enhancing type safety. - Refactored `DecryptCommandPayload` to rename `id` to `fileId` for clarity and consistency. - Adjusted various components to align with the new payload structure and improved error handling in the worker event bus. - Enhanced tests to ensure compatibility with the new action type definitions and payload structures.
This commit is contained in:
1 parent
7a11d4f941
commit
4a7994df96
13 files changed
+105
-78
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { WorkerServerBus } from '~/util/WorkerEventBus';
|
||||
import type { WorkerActionMap } from './actions';
|
||||
import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
|
||||
import { getUmcVersion } from '@unlock-music/crypto';
|
||||
|
||||
@@ -8,7 +9,7 @@ import { workerGetQtfmDeviceKey } from '~/decrypt-worker/worker/qtfm_device_key.
|
||||
import { workerParseKuwoHeader } from '~/decrypt-worker/worker/kuwo_header_parse.ts';
|
||||
import { workerParseKugouHeader } from '~/decrypt-worker/worker/kugou_parse_header.ts';
|
||||
|
||||
const bus = new WorkerServerBus();
|
||||
const bus = new WorkerServerBus<WorkerActionMap>();
|
||||
onmessage = bus.onmessage;
|
||||
|
||||
bus.addEventHandler(DECRYPTION_WORKER_ACTION_NAME.DECRYPT, workerDecryptHandler);
|
||||
|
||||
Reference in new issue
Block a user