diff --git a/package.json b/package.json index fb3b7f4bc..9578a2022 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "sourceMap": true }, "util-worker": { - "source": "ts/webworker/workers/util.worker.ts", + "source": "ts/webworker/workers/util/util.worker.ts", "distDir": "./ts/webworker/workers/", "optimize": true, "sourceMap": false, diff --git a/ts/receiver/attachments.ts b/ts/receiver/attachments.ts index b5a5ad18a..c2a6caa58 100644 --- a/ts/receiver/attachments.ts +++ b/ts/receiver/attachments.ts @@ -7,7 +7,7 @@ import { ConversationModel } from '../models/conversation'; import { OpenGroupRequestCommonType } from '../session/apis/open_group_api/opengroupV2/ApiUtil'; import { getUnpaddedAttachment } from '../session/crypto/BufferPadding'; import { decryptAttachment } from '../util/crypto/attachmentsEncrypter'; -import { callUtilsWorker } from '../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../webworker/workers/util/util_worker_interface'; import { sogsV3FetchFileByFileID } from '../session/apis/open_group_api/sogsv3/sogsV3FetchFile'; import { OpenGroupData } from '../data/opengroups'; import { diff --git a/ts/session/apis/open_group_api/opengroupV2/OpenGroupMessageV2.ts b/ts/session/apis/open_group_api/opengroupV2/OpenGroupMessageV2.ts index 9cd00578e..c576fed63 100644 --- a/ts/session/apis/open_group_api/opengroupV2/OpenGroupMessageV2.ts +++ b/ts/session/apis/open_group_api/opengroupV2/OpenGroupMessageV2.ts @@ -1,6 +1,6 @@ import { sign } from 'curve25519-js'; import { SessionKeyPair } from '../../../../receiver/keypairs'; -import { callUtilsWorker } from '../../../../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../../../../webworker/workers/util/util_worker_interface'; import { getSodiumRenderer } from '../../../crypto'; import { UserUtils } from '../../../utils'; import { fromBase64ToArray, fromHexToArray } from '../../../utils/String'; diff --git a/ts/session/apis/open_group_api/sogsv3/sogsApiV3.ts b/ts/session/apis/open_group_api/sogsv3/sogsApiV3.ts index 731fb6f34..6add3f88f 100644 --- a/ts/session/apis/open_group_api/sogsv3/sogsApiV3.ts +++ b/ts/session/apis/open_group_api/sogsv3/sogsApiV3.ts @@ -12,7 +12,7 @@ import { handleCapabilities } from './sogsCapabilities'; import { getConversationController } from '../../../conversations'; import { ConversationModel } from '../../../../models/conversation'; import { filterDuplicatesFromDbAndIncomingV4 } from '../opengroupV2/SogsFilterDuplicate'; -import { callUtilsWorker } from '../../../../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../../../../webworker/workers/util/util_worker_interface'; import { PubKey } from '../../../types'; import { addCachedBlindedKey, diff --git a/ts/session/apis/open_group_api/sogsv3/sogsV3FetchFile.ts b/ts/session/apis/open_group_api/sogsv3/sogsV3FetchFile.ts index 488ad5d61..e1af09f98 100644 --- a/ts/session/apis/open_group_api/sogsv3/sogsV3FetchFile.ts +++ b/ts/session/apis/open_group_api/sogsv3/sogsV3FetchFile.ts @@ -7,7 +7,7 @@ import { } from '../../../../data/opengroups'; import { MIME } from '../../../../types'; import { processNewAttachment } from '../../../../types/MessageAttachment'; -import { callUtilsWorker } from '../../../../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../../../../webworker/workers/util/util_worker_interface'; import { getConversationController } from '../../../conversations'; import { OnionSending } from '../../../onions/onionSend'; import { allowOnlyOneAtATime } from '../../../utils/Promise'; diff --git a/ts/session/apis/push_notification_api/PnServer.ts b/ts/session/apis/push_notification_api/PnServer.ts index 46f36ce83..9534156b0 100644 --- a/ts/session/apis/push_notification_api/PnServer.ts +++ b/ts/session/apis/push_notification_api/PnServer.ts @@ -1,5 +1,5 @@ import AbortController from 'abort-controller'; -import { callUtilsWorker } from '../../../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../../../webworker/workers/util/util_worker_interface'; import { OnionSending } from '../../onions/onionSend'; export const pnServerPubkeyHex = '642a6585919742e5a2d4dc51244964fbcd8bcab2b75612407de58b810740d049'; diff --git a/ts/session/apis/snode_api/onions.ts b/ts/session/apis/snode_api/onions.ts index 824d53d5b..a937e0184 100644 --- a/ts/session/apis/snode_api/onions.ts +++ b/ts/session/apis/snode_api/onions.ts @@ -14,7 +14,7 @@ let snodeFailureCount: Record = {}; import { Snode } from '../../../data/data'; import { ERROR_CODE_NO_CONNECT } from './SNodeAPI'; import { hrefPnServerProd } from '../push_notification_api/PnServer'; -import { callUtilsWorker } from '../../../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../../../webworker/workers/util/util_worker_interface'; import { encodeV4Request } from '../../onions/onionv4'; import { AbortSignal } from 'abort-controller'; import { to_string } from 'libsodium-wrappers-sumo'; diff --git a/ts/test/test-utils/utils/stubbing.ts b/ts/test/test-utils/utils/stubbing.ts index 7ec27485f..044c70133 100644 --- a/ts/test/test-utils/utils/stubbing.ts +++ b/ts/test/test-utils/utils/stubbing.ts @@ -3,7 +3,7 @@ import Sinon from 'sinon'; import { Data } from '../../../../ts/data/data'; import { OpenGroupData } from '../../../data/opengroups'; -import * as utilWorker from '../../../webworker/workers/util_worker_interface'; +import * as utilWorker from '../../../webworker/workers/util/util_worker_interface'; const globalAny: any = global; diff --git a/ts/util/local_attachments_encrypter.ts b/ts/util/local_attachments_encrypter.ts index 90b2a5d9e..914ff17f1 100644 --- a/ts/util/local_attachments_encrypter.ts +++ b/ts/util/local_attachments_encrypter.ts @@ -1,6 +1,6 @@ import { isArrayBuffer } from 'lodash'; import { fromHexToArray } from '../session/utils/String'; -import { callUtilsWorker } from '../webworker/workers/util_worker_interface'; +import { callUtilsWorker } from '../webworker/workers/util/util_worker_interface'; import { Data } from '../data/data'; export const encryptAttachmentBufferRenderer = async (bufferIn: ArrayBuffer) => { diff --git a/ts/webworker/workers/index.ts b/ts/webworker/workers/index.ts index e5c972ea7..693d96037 100644 --- a/ts/webworker/workers/index.ts +++ b/ts/webworker/workers/index.ts @@ -1,2 +1,2 @@ -import * as utilWorkerInterface from './util_worker_interface'; +import * as utilWorkerInterface from './util/util_worker_interface'; export { utilWorkerInterface }; diff --git a/ts/webworker/workers/util.worker.ts b/ts/webworker/workers/util/util.worker.ts similarity index 99% rename from ts/webworker/workers/util.worker.ts rename to ts/webworker/workers/util/util.worker.ts index 46600edc0..f997e531f 100644 --- a/ts/webworker/workers/util.worker.ts +++ b/ts/webworker/workers/util/util.worker.ts @@ -5,7 +5,7 @@ import _ from 'lodash'; import { decryptAttachmentBufferNode as realDecryptAttachmentBufferNode, encryptAttachmentBufferNode as realEncryptAttachmentBufferNode, -} from '../../node/encrypt_attachment_buffer'; +} from '../../../node/encrypt_attachment_buffer'; /* eslint-disable no-console */ /* eslint-disable strict */ diff --git a/ts/webworker/workers/util_worker_interface.ts b/ts/webworker/workers/util/util_worker_interface.ts similarity index 85% rename from ts/webworker/workers/util_worker_interface.ts rename to ts/webworker/workers/util/util_worker_interface.ts index 6a818b250..a54b4e2d2 100644 --- a/ts/webworker/workers/util_worker_interface.ts +++ b/ts/webworker/workers/util/util_worker_interface.ts @@ -1,6 +1,6 @@ -import { WorkerInterface } from '../worker_interface'; +import { WorkerInterface } from '../../worker_interface'; import { join } from 'path'; -import { getAppRootPath } from '../../node/getRootPath'; +import { getAppRootPath } from '../../../node/getRootPath'; let utilWorkerInterface: WorkerInterface | undefined; @@ -19,7 +19,7 @@ export const internalCallUtilsWorker = async ( ): Promise => { if (!utilWorkerInterface) { const utilWorkerPath = join(getAppRootPath(), 'ts', 'webworker', 'workers', 'util.worker.js'); - utilWorkerInterface = new WorkerInterface(utilWorkerPath, 3 * 60 * 1000); //{ type: 'module' } + utilWorkerInterface = new WorkerInterface(utilWorkerPath, 3 * 60 * 1000); } return utilWorkerInterface?.callWorker(fnName, ...args); };