chore: move util worker to its own folder

pull/2620/head
Audric Ackermann 2 years ago
parent 65df3157bd
commit bace70c6bc

@ -21,7 +21,7 @@
"sourceMap": true "sourceMap": true
}, },
"util-worker": { "util-worker": {
"source": "ts/webworker/workers/util.worker.ts", "source": "ts/webworker/workers/util/util.worker.ts",
"distDir": "./ts/webworker/workers/", "distDir": "./ts/webworker/workers/",
"optimize": true, "optimize": true,
"sourceMap": false, "sourceMap": false,

@ -7,7 +7,7 @@ import { ConversationModel } from '../models/conversation';
import { OpenGroupRequestCommonType } from '../session/apis/open_group_api/opengroupV2/ApiUtil'; import { OpenGroupRequestCommonType } from '../session/apis/open_group_api/opengroupV2/ApiUtil';
import { getUnpaddedAttachment } from '../session/crypto/BufferPadding'; import { getUnpaddedAttachment } from '../session/crypto/BufferPadding';
import { decryptAttachment } from '../util/crypto/attachmentsEncrypter'; 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 { sogsV3FetchFileByFileID } from '../session/apis/open_group_api/sogsv3/sogsV3FetchFile';
import { OpenGroupData } from '../data/opengroups'; import { OpenGroupData } from '../data/opengroups';
import { import {

@ -1,6 +1,6 @@
import { sign } from 'curve25519-js'; import { sign } from 'curve25519-js';
import { SessionKeyPair } from '../../../../receiver/keypairs'; 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 { getSodiumRenderer } from '../../../crypto';
import { UserUtils } from '../../../utils'; import { UserUtils } from '../../../utils';
import { fromBase64ToArray, fromHexToArray } from '../../../utils/String'; import { fromBase64ToArray, fromHexToArray } from '../../../utils/String';

@ -12,7 +12,7 @@ import { handleCapabilities } from './sogsCapabilities';
import { getConversationController } from '../../../conversations'; import { getConversationController } from '../../../conversations';
import { ConversationModel } from '../../../../models/conversation'; import { ConversationModel } from '../../../../models/conversation';
import { filterDuplicatesFromDbAndIncomingV4 } from '../opengroupV2/SogsFilterDuplicate'; 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 { PubKey } from '../../../types';
import { import {
addCachedBlindedKey, addCachedBlindedKey,

@ -7,7 +7,7 @@ import {
} from '../../../../data/opengroups'; } from '../../../../data/opengroups';
import { MIME } from '../../../../types'; import { MIME } from '../../../../types';
import { processNewAttachment } from '../../../../types/MessageAttachment'; 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 { getConversationController } from '../../../conversations';
import { OnionSending } from '../../../onions/onionSend'; import { OnionSending } from '../../../onions/onionSend';
import { allowOnlyOneAtATime } from '../../../utils/Promise'; import { allowOnlyOneAtATime } from '../../../utils/Promise';

@ -1,5 +1,5 @@
import AbortController from 'abort-controller'; 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'; import { OnionSending } from '../../onions/onionSend';
export const pnServerPubkeyHex = '642a6585919742e5a2d4dc51244964fbcd8bcab2b75612407de58b810740d049'; export const pnServerPubkeyHex = '642a6585919742e5a2d4dc51244964fbcd8bcab2b75612407de58b810740d049';

@ -14,7 +14,7 @@ let snodeFailureCount: Record<string, number> = {};
import { Snode } from '../../../data/data'; import { Snode } from '../../../data/data';
import { ERROR_CODE_NO_CONNECT } from './SNodeAPI'; import { ERROR_CODE_NO_CONNECT } from './SNodeAPI';
import { hrefPnServerProd } from '../push_notification_api/PnServer'; 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 { encodeV4Request } from '../../onions/onionv4';
import { AbortSignal } from 'abort-controller'; import { AbortSignal } from 'abort-controller';
import { to_string } from 'libsodium-wrappers-sumo'; import { to_string } from 'libsodium-wrappers-sumo';

@ -3,7 +3,7 @@ import Sinon from 'sinon';
import { Data } from '../../../../ts/data/data'; import { Data } from '../../../../ts/data/data';
import { OpenGroupData } from '../../../data/opengroups'; 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; const globalAny: any = global;

@ -1,6 +1,6 @@
import { isArrayBuffer } from 'lodash'; import { isArrayBuffer } from 'lodash';
import { fromHexToArray } from '../session/utils/String'; 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'; import { Data } from '../data/data';
export const encryptAttachmentBufferRenderer = async (bufferIn: ArrayBuffer) => { export const encryptAttachmentBufferRenderer = async (bufferIn: ArrayBuffer) => {

@ -1,2 +1,2 @@
import * as utilWorkerInterface from './util_worker_interface'; import * as utilWorkerInterface from './util/util_worker_interface';
export { utilWorkerInterface }; export { utilWorkerInterface };

@ -5,7 +5,7 @@ import _ from 'lodash';
import { import {
decryptAttachmentBufferNode as realDecryptAttachmentBufferNode, decryptAttachmentBufferNode as realDecryptAttachmentBufferNode,
encryptAttachmentBufferNode as realEncryptAttachmentBufferNode, encryptAttachmentBufferNode as realEncryptAttachmentBufferNode,
} from '../../node/encrypt_attachment_buffer'; } from '../../../node/encrypt_attachment_buffer';
/* eslint-disable no-console */ /* eslint-disable no-console */
/* eslint-disable strict */ /* eslint-disable strict */

@ -1,6 +1,6 @@
import { WorkerInterface } from '../worker_interface'; import { WorkerInterface } from '../../worker_interface';
import { join } from 'path'; import { join } from 'path';
import { getAppRootPath } from '../../node/getRootPath'; import { getAppRootPath } from '../../../node/getRootPath';
let utilWorkerInterface: WorkerInterface | undefined; let utilWorkerInterface: WorkerInterface | undefined;
@ -19,7 +19,7 @@ export const internalCallUtilsWorker = async (
): Promise<any> => { ): Promise<any> => {
if (!utilWorkerInterface) { if (!utilWorkerInterface) {
const utilWorkerPath = join(getAppRootPath(), 'ts', 'webworker', 'workers', 'util.worker.js'); 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); return utilWorkerInterface?.callWorker(fnName, ...args);
}; };
Loading…
Cancel
Save