remove permissions popup window and related stuff

pull/1403/head
Audric Ackermann 4 years ago
parent c9fc3be6c3
commit 3df0a425de
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1,21 +0,0 @@
/* global $, i18n */
$(document).on('keyup', e => {
'use strict';
if (e.keyCode === 27) {
window.closePermissionsPopup();
}
});
window.confirmationDialog({
title: i18n('audioPermissionNeeded'),
okText: i18n('allowAccess'),
resolve: () => {
'use strict';
window.setMediaPermissions(true);
window.closePermissionsPopup();
},
onClose: window.closePermissionsPopup,
});

@ -669,56 +669,6 @@ async function showDebugLogWindow() {
});
}
let permissionsPopupWindow;
async function showPermissionsPopupWindow() {
if (permissionsPopupWindow) {
permissionsPopupWindow.show();
return;
}
if (!mainWindow) {
return;
}
const theme = await getThemeFromMainWindow();
const size = mainWindow.getSize();
const options = {
width: Math.min(400, size[0]),
height: Math.min(150, size[1]),
resizable: false,
title: locale.messages.permissions.message,
autoHideMenuBar: true,
backgroundColor: '#FFFFFF',
show: false,
modal: true,
webPreferences: {
nodeIntegration: false,
nodeIntegrationInWorker: false,
contextIsolation: false,
preload: path.join(__dirname, 'permissions_popup_preload.js'),
nativeWindowOpen: true,
},
parent: mainWindow,
};
permissionsPopupWindow = new BrowserWindow(options);
captureClicks(permissionsPopupWindow);
permissionsPopupWindow.loadURL(
prepareURL([__dirname, 'permissions_popup.html'], { theme })
);
permissionsPopupWindow.on('closed', () => {
removeDarkOverlay();
permissionsPopupWindow = null;
});
permissionsPopupWindow.once('ready-to-show', () => {
addDarkOverlay();
permissionsPopupWindow.show();
});
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
@ -1079,15 +1029,6 @@ ipc.on('close-debug-log', () => {
}
});
// Permissions Popup-related IPC calls
ipc.on('show-permissions-popup', showPermissionsPopupWindow);
ipc.on('close-permissions-popup', () => {
if (permissionsPopupWindow) {
permissionsPopupWindow.close();
}
});
// Settings-related IPC calls
function addDarkOverlay() {

@ -280,7 +280,6 @@
"background.html",
"about.html",
"password.html",
"permissions_popup.html",
"debug_log.html",
"_locales/**",
"libloki/modules/*.js",
@ -296,7 +295,6 @@
"preload.js",
"about_preload.js",
"settings_preload.js",
"permissions_popup_preload.js",
"debug_log_preload.js",
"password_preload.js",
"main.js",

@ -1,26 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Security-Policy"
content="default-src 'none';
child-src 'self';
connect-src 'self' https: wss:;
font-src 'self';
form-action 'self';
frame-src 'none';
img-src 'self' blob: data:;
media-src 'self' blob:;
object-src 'none';
script-src 'self';
style-src 'self' 'unsafe-inline';"
>
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
<style>
</style>
</head>
<body class='permissions-popup'>
</body>
</script>
<script type='text/javascript' src='js/components.js'></script>
<script type='text/javascript' src='js/views/whisper_view.js'></script>
<script type='text/javascript' src='js/permissions_popup_start.js'></script>
</html>

@ -1,52 +0,0 @@
/* global window */
const { ipcRenderer } = require('electron');
const url = require('url');
const i18n = require('./js/modules/i18n');
const config = url.parse(window.location.toString(), true).query;
const { locale } = config;
const localeMessages = ipcRenderer.sendSync('locale-data');
global.dcodeIO = global.dcodeIO || {};
global.dcodeIO.ByteBuffer = require('bytebuffer');
window.getVersion = () => config.version;
window.theme = config.theme;
window.i18n = i18n.setup(locale, localeMessages);
require('./js/logging');
window.closePermissionsPopup = () =>
ipcRenderer.send('close-permissions-popup');
window.getMediaPermissions = makeGetter('media-permissions');
window.setMediaPermissions = makeSetter('media-permissions');
function makeGetter(name) {
return () =>
new Promise((resolve, reject) => {
ipcRenderer.once(`get-success-${name}`, (event, error, value) => {
if (error) {
return reject(error);
}
return resolve(value);
});
ipcRenderer.send(`get-${name}`);
});
}
function makeSetter(name) {
return value =>
new Promise((resolve, reject) => {
ipcRenderer.once(`set-success-${name}`, (event, error) => {
if (error) {
return reject(error);
}
return resolve();
});
ipcRenderer.send(`set-${name}`, value);
});
}

@ -250,8 +250,6 @@ ipc.on('get-theme-setting', () => {
// Settings-related events
window.showPermissionsPopup = () => ipc.send('show-permissions-popup');
ipc.on('add-dark-overlay', () => {
const { addDarkOverlay } = window.Events;
if (addDarkOverlay) {

@ -267,33 +267,6 @@
"reasonCategory": "falseMatch",
"updated": "2018-09-19T18:13:29.628Z"
},
{
"rule": "jQuery-$(",
"path": "js/permissions_popup_start.js",
"line": "$(document).on('keyup', e => {",
"lineNumber": 3,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
},
{
"rule": "jQuery-$(",
"path": "js/permissions_popup_start.js",
"line": "const $body = $(document.body);",
"lineNumber": 11,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
},
{
"rule": "jQuery-appendTo(",
"path": "js/permissions_popup_start.js",
"line": "window.view.$el.appendTo($body);",
"lineNumber": 26,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T18:13:29.628Z",
"reasonDetail": "Interacting with already-existing DOM nodes"
},
{
"rule": "jQuery-$(",
"path": "js/settings_start.js",

Loading…
Cancel
Save