Enables context isolation for loading window
This commit is contained in:
parent
ccfb9579ad
commit
6c906d5da8
5 changed files with 17 additions and 39 deletions
|
@ -19,9 +19,8 @@
|
|||
<span class="dot"></span>
|
||||
<span class="dot"></span>
|
||||
</div>
|
||||
<div class="message"></div>
|
||||
<div id="message"></div>
|
||||
</div>
|
||||
<script type="text/javascript" src="js/components.js"></script>
|
||||
<script type="text/javascript" src="ts/windows/loading/start.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
2
main.js
2
main.js
|
@ -1340,7 +1340,7 @@ app.on('ready', async () => {
|
|||
webPreferences: {
|
||||
...defaultWebPrefs,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: false,
|
||||
contextIsolation: true,
|
||||
preload: path.join(__dirname, 'ts', 'windows', 'loading', 'preload.js'),
|
||||
},
|
||||
icon: windowIcon,
|
||||
|
|
|
@ -14386,31 +14386,17 @@
|
|||
"updated": "2021-09-15T21:07:50.995Z"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"rule": "DOM-innerHTML",
|
||||
"path": "ts/windows/loading/start.js",
|
||||
"line": "$(() => {",
|
||||
"line": " message.innerHTML = window.SignalWindow.i18n('optimizingApplication');",
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-03-25T15:45:04.024Z"
|
||||
"updated": "2021-09-17T21:02:59.414Z"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "ts/windows/loading/start.js",
|
||||
"line": " $('.message').text(window.i18n('optimizingApplication'));",
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2021-07-22T03:00:34.561Z"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"rule": "DOM-innerHTML",
|
||||
"path": "ts/windows/loading/start.ts",
|
||||
"line": " $('.message').text(window.i18n('optimizingApplication'));",
|
||||
"line": " message.innerHTML = window.SignalWindow.i18n('optimizingApplication');",
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-03-25T15:45:04.024Z"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "ts/windows/loading/start.ts",
|
||||
"line": "$(() => {",
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2021-07-22T03:00:34.561Z"
|
||||
"updated": "2021-09-17T21:02:59.414Z"
|
||||
}
|
||||
]
|
|
@ -1,19 +1,11 @@
|
|||
// Copyright 2020-2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import * as url from 'url';
|
||||
import * as i18n from '../../../js/modules/i18n';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { contextBridge } from 'electron';
|
||||
|
||||
const config = url.parse(window.location.toString(), true).query;
|
||||
// It is important to call this as early as possible
|
||||
import '../context';
|
||||
|
||||
const { locale } = config;
|
||||
strictAssert(
|
||||
typeof locale === 'string',
|
||||
'Expected to be configured with a string locale'
|
||||
);
|
||||
import { SignalWindow } from '../configure';
|
||||
|
||||
const localeMessages = ipcRenderer.sendSync('locale-data');
|
||||
|
||||
window.i18n = i18n.setup(locale, localeMessages);
|
||||
contextBridge.exposeInMainWorld('SignalWindow', SignalWindow);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2020-2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
$(() => {
|
||||
$('.message').text(window.i18n('optimizingApplication'));
|
||||
});
|
||||
const message = document.getElementById('message');
|
||||
if (message) {
|
||||
message.innerHTML = window.SignalWindow.i18n('optimizingApplication');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue