2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2017 Signal Messenger, LLC
|
2022-06-13 21:39:35 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as log from '../../logging/log';
|
|
|
|
|
|
|
|
import './phase1-ipc';
|
|
|
|
import '../preload';
|
|
|
|
import './phase2-dependencies';
|
|
|
|
import './phase3-post-signal';
|
|
|
|
import './phase4-test';
|
|
|
|
|
|
|
|
window.addEventListener('contextmenu', e => {
|
|
|
|
const node = e.target as Element | null;
|
|
|
|
|
|
|
|
const isEditable = Boolean(
|
|
|
|
node?.closest('textarea, input, [contenteditable="true"]')
|
|
|
|
);
|
|
|
|
const isLink = Boolean(node?.closest('a'));
|
|
|
|
const isImage = Boolean(node?.closest('.Lightbox img'));
|
|
|
|
const hasSelection = Boolean(window.getSelection()?.toString());
|
|
|
|
|
|
|
|
if (!isEditable && !hasSelection && !isLink && !isImage) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (window.SignalContext.config.proxyUrl) {
|
|
|
|
log.info('Using provided proxy url');
|
|
|
|
}
|