get rid of libtextsecure.js and componnets.js

pull/2242/head
Audric Ackermann 3 years ago
parent 323b7ec45c
commit af9d2fdfa1
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -4,19 +4,7 @@ dist/**
mnemonic_languages/** mnemonic_languages/**
# Generated files # Generated files
js/curve/*
js/components.js
js/libtextsecure.js
js/util_worker.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 # TypeScript generated files
ts/**/*.js ts/**/*.js

5
.gitignore vendored

@ -1,7 +1,6 @@
node_modules node_modules
.sass-cache .sass-cache
.eslintcache .eslintcache
build/curve25519_compiled.js
stylesheets/*.css.map stylesheets/*.css.map
/dist /dist
.DS_Store .DS_Store
@ -14,12 +13,8 @@ release/
sql/ sql/
# generated files # generated files
js/components.js
js/util_worker.js js/util_worker.js
js/libtextsecure.js
libtextsecure/components.js
stylesheets/*.css stylesheets/*.css
test/test.js
# React / TypeScript # React / TypeScript
ts/**/*.js ts/**/*.js

@ -5,12 +5,8 @@
config/local-*.json config/local-*.json
config/local.json config/local.json
dist/** dist/**
js/components.js
js/util_worker.js js/util_worker.js
js/libtextsecure.js
libtextsecure/components.js
stylesheets/*.css stylesheets/*.css
test/test.js
test/ts/**/*.js test/ts/**/*.js
ts/**/*.js ts/**/*.js
@ -22,20 +18,12 @@ ts/test/automation/notes
# Third-party files # Third-party files
node_modules/** node_modules/**
components/**
js/curve/**
js/Mp3LameEncoder.min.js
js/WebAudioRecorderMp3.js
js/util_worker.js js/util_worker.js
libtextsecure/test/blanket_mocha.js
mnemonic_languages/** mnemonic_languages/**
playwright.config.js playwright.config.js
# Managed by package manager (`yarn`/`npm`): # Managed by package manager (`yarn`/`npm`):
/package.json /package.json
# Symlink into third-party `components`:
stylesheets/_intlTelInput.scss
# Coverage # Coverage
release/** release/**

@ -3,32 +3,11 @@ const sass = require('node-sass');
/* eslint-disable more/no-then, no-console */ /* 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 => { 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.loadNpmTasks('grunt-sass');
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
concat: {
components: {
src: components,
dest: 'js/components.js',
},
},
sass: { sass: {
options: { options: {
implementation: sass, implementation: sass,
@ -42,10 +21,6 @@ module.exports = grunt => {
}, },
}, },
watch: { watch: {
libtextsecure: {
files: ['./libtextsecure/*.js', './libtextsecure/storage/*.js'],
tasks: ['concat:libtextsecure'],
},
protobuf: { protobuf: {
files: ['./protos/SignalService.proto'], files: ['./protos/SignalService.proto'],
tasks: ['exec:build-protobuf'], tasks: ['exec:build-protobuf'],

@ -29,9 +29,6 @@
<script> <script>
var exports = {}; var exports = {};
</script> </script>
<script type="text/javascript" src="js/components.js"></script>
<script type="text/javascript" src="js/libtextsecure.js"></script>
</head> </head>
<body id="body"> <body id="body">

@ -15,9 +15,6 @@
style-src 'self' 'unsafe-inline';" style-src 'self' 'unsafe-inline';"
/> />
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" /> <link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
<style></style>
<script type="text/javascript" src="js/components.js"></script>
</head> </head>
<body> <body>
<div id="root"> <div id="root">

@ -110,7 +110,7 @@ export class SessionSettingsView extends React.Component<SettingsViewProps, Stat
const callMediaSetting = getCallMediaPermissionsSettings(); const callMediaSetting = getCallMediaPermissionsSettings();
this.setState({ mediaSetting, callMediaSetting }); this.setState({ mediaSetting, callMediaSetting });
setTimeout(() => (document.getElementById('password-lock-input') as any)?.focus(), 100); setTimeout(() => document.getElementById('password-lock-input')?.focus(), 100);
} }
public componentWillUnmount() { public componentWillUnmount() {
@ -149,7 +149,9 @@ export class SessionSettingsView extends React.Component<SettingsViewProps, Stat
} }
public async validatePasswordLock() { public async validatePasswordLock() {
const enteredPassword = String((document.getElementById('password-lock-input') as any)?.val()); const enteredPassword = String(
(document.getElementById('password-lock-input') as HTMLInputElement)?.value
);
if (!enteredPassword) { if (!enteredPassword) {
this.setState({ this.setState({
@ -236,11 +238,9 @@ export class SessionSettingsView extends React.Component<SettingsViewProps, Stat
} }
private async onKeyUp(event: any) { private async onKeyUp(event: any) {
const lockPasswordFocussed = (document.getElementById('password-lock-input') as any)?.is( const lockPasswordVisible = Boolean(document.getElementById('password-lock-input'));
':focus'
);
if (event.key === 'Enter' && lockPasswordFocussed) { if (event.key === 'Enter' && lockPasswordVisible) {
await this.validatePasswordLock(); await this.validatePasswordLock();
} }

@ -423,8 +423,7 @@ async function connect() {
logger: window.log, logger: window.log,
}); });
window.textsecure = window.textsecure || {}; window.isOnline = true;
window.textsecure.messaging = true;
} }
function onEmpty() { function onEmpty() {

@ -847,7 +847,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
}); });
// We're offline! // We're offline!
if (!window.textsecure.messaging) { if (!window.isOnline) {
const error = new Error('Network is not available'); const error = new Error('Network is not available');
error.name = 'SendMessageNetworkError'; error.name = 'SendMessageNetworkError';
(error as any).number = this.id; (error as any).number = this.id;

@ -812,7 +812,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
// One caller today: event handler for the 'Retry Send' entry on right click of a failed send message // One caller today: event handler for the 'Retry Send' entry on right click of a failed send message
public async retrySend() { public async retrySend() {
if (!window.textsecure.messaging) { if (!window.isOnline) {
window?.log?.error('retrySend: Cannot retry since we are offline!'); window?.log?.error('retrySend: Cannot retry since we are offline!');
return null; return null;
} }

@ -2226,7 +2226,6 @@ function getMessagesCountBySender({ source }: { source: string }) {
.get({ .get({
source, source,
}); });
console.info('count messages of ', source, ' :', count);
if (!count) { if (!count) {
return 0; return 0;
} }

@ -1,11 +1,13 @@
import { WorkerInterface } from '../worker_interface'; import { WorkerInterface } from '../worker_interface';
import { join } from 'path'; import { join } from 'path';
import { ipcRenderer } from 'electron';
let utilWorkerInterface: WorkerInterface | undefined; let utilWorkerInterface: WorkerInterface | undefined;
export const callUtilsWorker = async (fnName: string, ...args: any): Promise<any> => { export const callUtilsWorker = async (fnName: string, ...args: any): Promise<any> => {
if (!utilWorkerInterface) { 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' } utilWorkerInterface = new WorkerInterface(utilWorkerPath, 3 * 60 * 1000); //{ type: 'module' }
} }
return utilWorkerInterface?.callWorker(fnName, ...args); return utilWorkerInterface?.callWorker(fnName, ...args);

2
ts/window.d.ts vendored

@ -46,7 +46,7 @@ declare global {
getSeedNodeList: () => Array<any> | undefined; getSeedNodeList: () => Array<any> | undefined;
setPassword: any; setPassword: any;
storage: any; storage: any;
textsecure: LibTextsecure; isOnline: boolean;
toggleMediaPermissions: () => Promise<void>; toggleMediaPermissions: () => Promise<void>;
toggleCallMediaPermissionsTo: (enabled: boolean) => Promise<void>; toggleCallMediaPermissionsTo: (enabled: boolean) => Promise<void>;
getCallMediaPermissions: () => boolean; getCallMediaPermissions: () => boolean;

Loading…
Cancel
Save