Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

based upon Kevinsbranch encrypted key in config.json using cryptojs && start performance fix #5465

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ release/
.nyc_output/
*.sublime*
/sql/
/start.sh
.eslintcache
tsconfig.tsbuildinfo

Expand All @@ -40,3 +39,5 @@ sticker-creator/dist/*
/storybook-static/
preload.bundle.*
ts/sql/mainWorker.bundle.js.LICENSE.txt

*.code-workspace
51 changes: 51 additions & 0 deletions ACKNOWLEDGMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,33 @@ Signal Desktop makes use of the following open source projects.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## crypto-js

# License

[The MIT License (MIT)](http://opensource.org/licenses/MIT)

Copyright (c) 2009-2013 Jeff Mott
Copyright (c) 2013-2016 Evan Vosberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

## dashdash

# This is the MIT license
Expand All @@ -854,6 +881,30 @@ Signal Desktop makes use of the following open source projects.
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## electron-prompt

MIT License

Copyright (c) 2020 p-sam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## emoji-datasource

The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ module.exports = grunt => {
process.platform === 'win32' ? 'electron.cmd' : 'electron';

const path = join(__dirname, 'node_modules', '.bin', electronBinary);
const args = [join(__dirname, 'main.js')];
const args = [join(__dirname, 'main.js')]; // change reverted by ksaadDE // SAAD-IT
console.log('Starting path', path, 'with args', args);
const app = new Application({
path,
Expand Down
8 changes: 8 additions & 0 deletions _locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5175,6 +5175,14 @@
"message": "Verifikation gescheitert. Bitte versuche es später erneut.",
"description": "Displayed after unsuccessful captcha"
},
"userPasswordRequiredNoKeyExisting": {
"message": "Bitte geben Sie Ihr neues Passwort ein!\nSie werden jedes Mal beim Starten gefragt.\n Es muss mindestens 20 Zeichen lang sein.",
"description": "Title of userPasswordPrompt window, shows up to get the user password (user has NOT already pw)"
},
"userPasswordRequiredAlreadyKeyExisting": {
"message": "Bitte geben Sie Ihr vorhandenes Passwort ein!\n Es muss mindestens 20 Zeichen lang sein.",
"description": "Title of userPasswordPrompt window, shows up to get the user password (user has already pw)"
},
"deleteForEveryoneFailed": {
"message": "Die Nachricht konnte nicht für alle Teilnehmer gelöscht werden. Bitte versuche es später erneut.",
"description": "Displayed when delete-for-everyone has failed to send to all recepients"
Expand Down
12 changes: 12 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,10 @@
"message": "Sharing screen",
"description": "Title for screen sharing window"
},
"captchaResponseRequired": {
"message": "CAPTCHA Response Required",
"description": "Title of the window that pops up when a CAPTCHA response is required"
},
"speech": {
"message": "Speech",
"description": "Item under the Edit menu, with 'start/stop speaking' items below it"
Expand Down Expand Up @@ -5285,6 +5289,14 @@
"message": "Verification failed. Please retry later.",
"description": "Displayed after unsuccessful captcha"
},
"userPasswordRequiredNoKeyExisting": {
"message": "Please enter your NEW password.\n It is required at every start of Signal\n needs at least 20 characters.",
"description": "Title of userPasswordPrompt window, shows up to get the user password (user has NOT already pw)"
},
"userPasswordRequiredAlreadyKeyExisting": {
"message": "Please enter your already existing password.\n must be at least 20 characters.",
"description": "Title of userPasswordPrompt window, shows up to get the user password (user has already pw)"
},
"deleteForEveryoneFailed": {
"message": "Failed to delete message for everyone. Please retry later.",
"description": "Displayed when delete-for-everyone has failed to send to all recepients"
Expand Down
202 changes: 202 additions & 0 deletions app/SystemTrayService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
"use strict";
// Copyright 2017-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemTrayService = void 0;
const path_1 = require("path");
const electron_1 = require("electron");
const log = __importStar(require("../ts/logging/log"));
/**
* A class that manages an [Electron `Tray` instance][0]. It's responsible for creating
* and destroying a `Tray`, and listening to the associated `BrowserWindow`'s visibility
* state.
*
* [0]: https://www.electronjs.org/docs/api/tray
*/
class SystemTrayService {
constructor({ messages }) {
this.isEnabled = false;
this.unreadCount = 0;
log.info('System tray service: created');
this.messages = messages;
this.boundRender = this.render.bind(this);
}
/**
* Update or clear the associated `BrowserWindow`. This is used for the hide/show
* functionality. It attaches event listeners to the window to manage the hide/show
* toggle in the tray's context menu.
*/
setMainWindow(newBrowserWindow) {
const oldBrowserWindow = this.browserWindow;
if (oldBrowserWindow === newBrowserWindow) {
return;
}
log.info(`System tray service: updating main window. Previously, there was ${oldBrowserWindow ? '' : 'not '}a window, and now there is${newBrowserWindow ? '' : ' not'}`);
if (oldBrowserWindow) {
oldBrowserWindow.off('show', this.boundRender);
oldBrowserWindow.off('hide', this.boundRender);
}
if (newBrowserWindow) {
newBrowserWindow.on('show', this.boundRender);
newBrowserWindow.on('hide', this.boundRender);
}
this.browserWindow = newBrowserWindow;
this.render();
}
/**
* Enable or disable the tray icon. Note: if there is no associated browser window (see
* `setMainWindow`), the tray icon will not be shown, even if enabled.
*/
setEnabled(isEnabled) {
if (this.isEnabled === isEnabled) {
return;
}
log.info(`System tray service: ${isEnabled ? 'enabling' : 'disabling'}`);
this.isEnabled = isEnabled;
this.render();
}
/**
* Update the unread count, which updates the tray icon if it's visible.
*/
setUnreadCount(unreadCount) {
if (this.unreadCount === unreadCount) {
return;
}
log.info(`System tray service: setting unread count to ${unreadCount}`);
this.unreadCount = unreadCount;
this.render();
}
render() {
if (this.isEnabled && this.browserWindow) {
this.renderEnabled();
return;
}
this.renderDisabled();
}
renderEnabled() {
log.info('System tray service: rendering the tray');
this.tray = this.tray || this.createTray();
const { browserWindow, tray } = this;
tray.setImage(getIcon(this.unreadCount));
// NOTE: we want to have the show/hide entry available in the tray icon
// context menu, since the 'click' event may not work on all platforms.
// For details please refer to:
// https://github.com/electron/electron/blob/master/docs/api/tray.md.
tray.setContextMenu(electron_1.Menu.buildFromTemplate([
Object.assign({ id: 'toggleWindowVisibility' }, ((browserWindow === null || browserWindow === void 0 ? void 0 : browserWindow.isVisible())
? {
label: this.messages.hide.message,
click: () => {
var _a;
log.info('System tray service: hiding the window from the context menu');
// We re-fetch `this.browserWindow` here just in case the browser window
// has changed while the context menu was open. Same applies in the
// "show" case below.
(_a = this.browserWindow) === null || _a === void 0 ? void 0 : _a.hide();
},
}
: {
label: this.messages.show.message,
click: () => {
log.info('System tray service: showing the window from the context menu');
if (this.browserWindow) {
this.browserWindow.show();
forceOnTop(this.browserWindow);
}
},
})),
{
id: 'quit',
label: this.messages.quit.message,
click: () => {
log.info('System tray service: quitting the app from the context menu');
electron_1.app.quit();
},
},
]));
}
renderDisabled() {
log.info('System tray service: rendering no tray');
if (!this.tray) {
return;
}
this.tray.destroy();
this.tray = undefined;
}
createTray() {
log.info('System tray service: creating the tray');
// This icon may be swiftly overwritten.
const result = new electron_1.Tray(getIcon(this.unreadCount));
// Note: "When app indicator is used on Linux, the click event is ignored." This
// doesn't mean that the click event is always ignored on Linux; it depends on how
// the app indicator is set up.
//
// See <https://github.com/electron/electron/blob/v13.1.3/docs/api/tray.md#class-tray>.
result.on('click', () => {
const { browserWindow } = this;
if (!browserWindow) {
return;
}
if (!browserWindow.isVisible()) {
browserWindow.show();
}
forceOnTop(browserWindow);
});
result.setToolTip(this.messages.signalDesktop.message);
return result;
}
/**
* This is exported for testing, because Electron doesn't have any easy way to hook
* into the existing tray instances. It should not be used by "real" code.
*/
_getTray() {
return this.tray;
}
}
exports.SystemTrayService = SystemTrayService;
function getIcon(unreadCount) {
let iconSize;
switch (process.platform) {
case 'darwin':
iconSize = '16';
break;
case 'win32':
iconSize = '32';
break;
default:
iconSize = '256';
break;
}
if (unreadCount > 0) {
const filename = `${String(unreadCount >= 10 ? 10 : unreadCount)}.png`;
return path_1.join(__dirname, '..', 'images', 'alert', iconSize, filename);
}
return path_1.join(__dirname, '..', 'images', `icon_${iconSize}.png`);
}
function forceOnTop(browserWindow) {
// On some versions of GNOME the window may not be on top when restored.
// This trick should fix it.
// Thanks to: https://github.com/Enrico204/Whatsapp-Desktop/commit/6b0dc86b64e481b455f8fce9b4d797e86d000dc1
browserWindow.setAlwaysOnTop(true);
browserWindow.focus();
browserWindow.setAlwaysOnTop(false);
}
Loading