From af9d2fdfa1cab4984ff7207e11c02b00034ce76e Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 14 Apr 2022 11:18:01 +1000 Subject: [PATCH] get rid of libtextsecure.js and componnets.js --- .eslintignore | 12 --------- .gitignore | 5 ---- .prettierignore | 12 --------- Gruntfile.js | 25 ------------------- background.html | 3 --- password.html | 3 --- ts/components/settings/SessionSettings.tsx | 12 ++++----- ts/mains/main_renderer.tsx | 3 +-- ts/models/conversation.ts | 2 +- ts/models/message.ts | 2 +- ts/node/sql.ts | 1 - ts/webworker/workers/util_worker_interface.ts | 4 ++- ts/window.d.ts | 2 +- 13 files changed, 13 insertions(+), 73 deletions(-) diff --git a/.eslintignore b/.eslintignore index b6cf47a16..8f2e164c9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,19 +4,7 @@ dist/** mnemonic_languages/** # Generated files -js/curve/* -js/components.js -js/libtextsecure.js js/util_worker.js -libtextsecure/components.js -test/test.js - - -# Third-party files -js/Mp3LameEncoder.min.js -js/WebAudioRecorderMp3.js -libtextsecure/test/blanket_mocha.js -test/blanket_mocha.js # TypeScript generated files ts/**/*.js diff --git a/.gitignore b/.gitignore index 80cc79bfd..c07b5c293 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ node_modules .sass-cache .eslintcache -build/curve25519_compiled.js stylesheets/*.css.map /dist .DS_Store @@ -14,12 +13,8 @@ release/ sql/ # generated files -js/components.js js/util_worker.js -js/libtextsecure.js -libtextsecure/components.js stylesheets/*.css -test/test.js # React / TypeScript ts/**/*.js diff --git a/.prettierignore b/.prettierignore index 20eb2bd97..72c5b7191 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,12 +5,8 @@ config/local-*.json config/local.json dist/** -js/components.js js/util_worker.js -js/libtextsecure.js -libtextsecure/components.js stylesheets/*.css -test/test.js test/ts/**/*.js ts/**/*.js @@ -22,20 +18,12 @@ ts/test/automation/notes # Third-party files node_modules/** -components/** -js/curve/** -js/Mp3LameEncoder.min.js -js/WebAudioRecorderMp3.js js/util_worker.js -libtextsecure/test/blanket_mocha.js mnemonic_languages/** playwright.config.js # Managed by package manager (`yarn`/`npm`): /package.json -# Symlink into third-party `components`: -stylesheets/_intlTelInput.scss - # Coverage release/** diff --git a/Gruntfile.js b/Gruntfile.js index e592c6a25..ecf2da664 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,32 +3,11 @@ const sass = require('node-sass'); /* eslint-disable more/no-then, no-console */ -const toConcatForApp = [ - 'node_modules/jquery/dist/jquery.js', - 'node_modules/bytebuffer/dist/bytebuffer.min.js', - 'node_modules/long/dist/long.js', - 'node_modules/mustache/mustache.js', - 'node_modules/underscore/underscore-min.js', - 'node_modules/backbone/backbone.js', -]; - module.exports = grunt => { - const components = []; - // eslint-disable-next-line guard-for-in, no-restricted-syntax - for (const i in toConcatForApp) { - components.push(toConcatForApp[i]); - } - grunt.loadNpmTasks('grunt-sass'); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - concat: { - components: { - src: components, - dest: 'js/components.js', - }, - }, sass: { options: { implementation: sass, @@ -42,10 +21,6 @@ module.exports = grunt => { }, }, watch: { - libtextsecure: { - files: ['./libtextsecure/*.js', './libtextsecure/storage/*.js'], - tasks: ['concat:libtextsecure'], - }, protobuf: { files: ['./protos/SignalService.proto'], tasks: ['exec:build-protobuf'], diff --git a/background.html b/background.html index 5e70bbd4d..2ee89ec0d 100644 --- a/background.html +++ b/background.html @@ -29,9 +29,6 @@ - - - diff --git a/password.html b/password.html index c25c2a502..c41dedf31 100644 --- a/password.html +++ b/password.html @@ -15,9 +15,6 @@ style-src 'self' 'unsafe-inline';" /> - - -
diff --git a/ts/components/settings/SessionSettings.tsx b/ts/components/settings/SessionSettings.tsx index 3bf38e389..6d902111e 100644 --- a/ts/components/settings/SessionSettings.tsx +++ b/ts/components/settings/SessionSettings.tsx @@ -110,7 +110,7 @@ export class SessionSettingsView extends React.Component (document.getElementById('password-lock-input') as any)?.focus(), 100); + setTimeout(() => document.getElementById('password-lock-input')?.focus(), 100); } public componentWillUnmount() { @@ -149,7 +149,9 @@ export class SessionSettingsView extends React.Component { }); // We're offline! - if (!window.textsecure.messaging) { + if (!window.isOnline) { const error = new Error('Network is not available'); error.name = 'SendMessageNetworkError'; (error as any).number = this.id; diff --git a/ts/models/message.ts b/ts/models/message.ts index e4267f936..d4daac8e2 100644 --- a/ts/models/message.ts +++ b/ts/models/message.ts @@ -812,7 +812,7 @@ export class MessageModel extends Backbone.Model { // One caller today: event handler for the 'Retry Send' entry on right click of a failed send message public async retrySend() { - if (!window.textsecure.messaging) { + if (!window.isOnline) { window?.log?.error('retrySend: Cannot retry since we are offline!'); return null; } diff --git a/ts/node/sql.ts b/ts/node/sql.ts index d8e7551bb..4ac1faf37 100644 --- a/ts/node/sql.ts +++ b/ts/node/sql.ts @@ -2226,7 +2226,6 @@ function getMessagesCountBySender({ source }: { source: string }) { .get({ source, }); - console.info('count messages of ', source, ' :', count); if (!count) { return 0; } diff --git a/ts/webworker/workers/util_worker_interface.ts b/ts/webworker/workers/util_worker_interface.ts index 83feaa3eb..e29bc2230 100644 --- a/ts/webworker/workers/util_worker_interface.ts +++ b/ts/webworker/workers/util_worker_interface.ts @@ -1,11 +1,13 @@ import { WorkerInterface } from '../worker_interface'; import { join } from 'path'; +import { ipcRenderer } from 'electron'; let utilWorkerInterface: WorkerInterface | undefined; export const callUtilsWorker = async (fnName: string, ...args: any): Promise => { if (!utilWorkerInterface) { - const utilWorkerPath = join('./', 'ts', 'webworker', 'workers', 'util.worker.js'); //app.getAppPath() + const apDataPath = await ipcRenderer.invoke('get-data-path'); + const utilWorkerPath = join(apDataPath, 'ts', 'webworker', 'workers', 'util.worker.js'); utilWorkerInterface = new WorkerInterface(utilWorkerPath, 3 * 60 * 1000); //{ type: 'module' } } return utilWorkerInterface?.callWorker(fnName, ...args); diff --git a/ts/window.d.ts b/ts/window.d.ts index 82d712062..89629304b 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -46,7 +46,7 @@ declare global { getSeedNodeList: () => Array | undefined; setPassword: any; storage: any; - textsecure: LibTextsecure; + isOnline: boolean; toggleMediaPermissions: () => Promise; toggleCallMediaPermissionsTo: (enabled: boolean) => Promise; getCallMediaPermissions: () => boolean;