feat: enable context-isolation (#1361)

This commit is contained in:
JellyBrick
2023-11-06 17:21:29 +09:00
committed by GitHub
parent 6e52178074
commit 6366dc026e
35 changed files with 655 additions and 474 deletions

View File

@ -1,4 +1,3 @@
import { ipcRenderer } from 'electron';
import { toKeyEvent } from 'keyboardevent-from-electron-accelerator';
import keyEventAreEqual from 'keyboardevents-areequal';
@ -6,7 +5,7 @@ import pipHTML from './templates/picture-in-picture.html';
import { getSongMenu } from '../../providers/dom-elements';
import { ElementFromHtml } from '../utils';
import { ElementFromHtml } from '../utils-renderer';
import type { ConfigType } from '../../config/dynamic';
@ -85,7 +84,7 @@ const togglePictureInPicture = async () => {
}
}
ipcRenderer.send('picture-in-picture');
window.ipcRenderer.send('picture-in-picture');
return false;
};
// For UI (HTML)
@ -105,7 +104,7 @@ const listenForToggle = () => {
const titlebar = $<HTMLElement>('.cet-titlebar');
ipcRenderer.on('pip-toggle', (_, isPip: boolean) => {
window.ipcRenderer.on('pip-toggle', (_, isPip: boolean) => {
if (originalExitButton && player) {
if (isPip) {
replaceButton('.exit-fullscreen-button', originalExitButton)?.addEventListener('click', () => togglePictureInPicture());