diff --git a/api/main.ts b/api/main.ts index 9d00ff0..5e70e93 100644 --- a/api/main.ts +++ b/api/main.ts @@ -97,6 +97,7 @@ function createWindow(): void { webPreferences: { nodeIntegration: true, enableRemoteModule: true, + contextIsolation: false, }, }); diff --git a/app/App/Containers/AppContainer.tsx b/app/App/Containers/AppContainer.tsx index 83e911b..9ad3928 100644 --- a/app/App/Containers/AppContainer.tsx +++ b/app/App/Containers/AppContainer.tsx @@ -3,11 +3,7 @@ import { HashRouter } from 'react-router-dom'; import { ThemeProvider } from 'styled-components'; import styled from 'styled-components'; -import { IpcRenderer } from 'electron'; - -const { ipcRenderer }: { ipcRenderer: IpcRenderer } = window.require( - 'electron', -); +const { ipcRenderer } = window.require('electron'); import Routes from '../../App/Components/Routes'; import { themes } from '../../Themes'; diff --git a/app/Channel/Forms/ChannelForm.tsx b/app/Channel/Forms/ChannelForm.tsx index e258f2c..ce4f104 100644 --- a/app/Channel/Forms/ChannelForm.tsx +++ b/app/Channel/Forms/ChannelForm.tsx @@ -3,16 +3,7 @@ import styled, { withTheme } from 'styled-components'; import { Field } from 'react-final-form'; import Icon from 'react-icons-kit'; import { plus } from 'react-icons-kit/fa/plus'; -import { template } from '../../Channel/constants'; - -const { remote } = window.require('electron'); -const { Menu } = remote; - -const openMenu = () => { - const macMenu = Menu.buildFromTemplate(template); - - macMenu.popup(remote.getCurrentWindow()); -}; +import { openMenu } from '../constants'; @withTheme export default class ChannelForm extends Component { diff --git a/app/Channel/Forms/EditForm.tsx b/app/Channel/Forms/EditForm.tsx index f00c5c1..c10de2a 100644 --- a/app/Channel/Forms/EditForm.tsx +++ b/app/Channel/Forms/EditForm.tsx @@ -1,37 +1,6 @@ import React, { Component } from 'react'; import styled, { withTheme } from 'styled-components'; - -const { remote } = window.require('electron'); -const { Menu } = remote; - -const template = [ - { - label: 'Cut', - accelerator: 'CmdOrCtrl+X', - role: 'cut', - }, - { - label: 'Copy', - accelerator: 'CmdOrCtrl+C', - role: 'copy', - }, - { - label: 'Paste', - accelerator: 'CmdOrCtrl+V', - role: 'paste', - }, - { - label: 'Select All', - accelerator: 'CmdOrCtrl+A', - role: 'selectall', - }, -]; - -const openMenu = () => { - const macMenu = Menu.buildFromTemplate(template); - - macMenu.popup(remote.getCurrentWindow()); -}; +import { openMenu } from '../constants'; @withTheme export default class EditForm extends Component { diff --git a/app/Channel/Forms/SearchForm/SearchForm.tsx b/app/Channel/Forms/SearchForm/SearchForm.tsx index 7203372..6967418 100644 --- a/app/Channel/Forms/SearchForm/SearchForm.tsx +++ b/app/Channel/Forms/SearchForm/SearchForm.tsx @@ -3,17 +3,8 @@ import styled, { withTheme } from 'styled-components'; import { Field } from 'react-final-form'; import Icon from 'react-icons-kit'; import { search } from 'react-icons-kit/fa/search'; -import { template } from '../../../Channel/constants'; import AutoSave from './AutoSave'; - -const { remote } = window.require('electron'); -const { Menu } = remote; - -export const openMenu = () => { - const macMenu = Menu.buildFromTemplate(template); - - macMenu.popup(remote.getCurrentWindow()); -}; +import { openMenu } from '../../constants'; @withTheme class SearchForm extends Component { diff --git a/app/Channel/constants.tsx b/app/Channel/constants.tsx index cb67e99..05dc175 100644 --- a/app/Channel/constants.tsx +++ b/app/Channel/constants.tsx @@ -1,3 +1,6 @@ +const { remote } = window.require('electron'); +const { Menu } = remote; + export const getTab = (tab) => { return TABS.find((t) => t.value === tab); }; @@ -20,7 +23,7 @@ export const TABS = [ }, ]; -export const template = [ +export const template: any = [ { label: 'Cut', accelerator: 'CmdOrCtrl+X', @@ -42,3 +45,9 @@ export const template = [ role: 'selectall', }, ]; + +export const openMenu = () => { + const macMenu = Menu.buildFromTemplate(template); + + macMenu.popup({ window: remote.getCurrentWindow() }); +}; diff --git a/app/Settings/Forms/SettingsForm.tsx b/app/Settings/Forms/SettingsForm.tsx index 7e92885..202a35d 100644 --- a/app/Settings/Forms/SettingsForm.tsx +++ b/app/Settings/Forms/SettingsForm.tsx @@ -4,7 +4,7 @@ import { Field } from 'react-final-form'; import Toggle from 'react-toggle-button'; import styled from 'styled-components'; import Select from 'react-select'; -import { openMenu } from '../../Channel/Forms/SearchForm/SearchForm'; +import { openMenu } from '../../Channel/constants'; const { shell, ipcRenderer } = window.require('electron'); diff --git a/package.json b/package.json index b9fd6db..55ee374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "KolpaqueClientElectron", - "version": "0.5.6", + "version": "0.5.7", "description": "Multiplatform GUI for Streamlink", "main": "./dist-api/main.js", "scripts": { @@ -33,7 +33,7 @@ "archiver": "^4.0.1", "concurrently": "^5.3.0", "cross-env": "^5.0.5", - "electron": "^11.0.3", + "electron": "^12.0.0", "electron-packager": "^14.2.1", "eslint": "^7.13.0", "husky": "^1.3.1", diff --git a/yarn.lock b/yarn.lock index 3cf609d..16e9a07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -107,7 +107,23 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@electron/get@^1.0.1", "@electron/get@^1.6.0": +"@electron/get@^1.0.1": + version "1.13.0" + resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.13.0.tgz#95c6bcaff4f9a505ea46792424f451efea89228c" + integrity sha512-+SjZhRuRo+STTO1Fdhzqnv9D2ZhjxXP6egsJ9kiO8dtP68cDx7dFCwWi64dlMQV7sWcfW1OYCW4wviEBzmRsfQ== + dependencies: + debug "^4.1.1" + env-paths "^2.2.0" + fs-extra "^8.1.0" + got "^9.6.0" + progress "^2.0.3" + semver "^6.2.0" + sumchecker "^3.0.1" + optionalDependencies: + global-agent "^2.0.2" + global-tunnel-ng "^2.7.1" + +"@electron/get@^1.6.0": version "1.10.0" resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.10.0.tgz#258fdda22bbd5a247e0b663ba9c525dedc1bdfff" integrity sha512-hlueNXU51c3CwQjBw/i5fwt+VfQgSQVUTdicpCHkhEjNZaa4CXJ5W1GaxSwtLE2dvRmAHjpIjUMHTqJ53uojfg== @@ -238,10 +254,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.2.tgz#160d82623610db590a64e8ca81784e11117e5a54" integrity sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A== -"@types/node@^12.0.12": - version "12.12.37" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.37.tgz#cb4782d847f801fa58316da5b4801ca3a59ae790" - integrity sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg== +"@types/node@^14.6.2": + version "14.17.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.21.tgz#6359d8cf73481e312a43886fa50afc70ce5592c6" + integrity sha512-zv8ukKci1mrILYiQOwGSV4FpkZhyxQtuFWGya2GujWg+zVAeRQ4qbaMmWp9vb9889CFA8JECH7lkwCL6Ygg8kA== "@types/prop-types@*": version "15.7.3" @@ -2386,13 +2402,13 @@ electron-to-chromium@^1.2.7: version "1.3.33" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.33.tgz#bf00703d62a7c65238136578c352d6c5c042a545" -electron@^11.0.3: - version "11.0.3" - resolved "https://registry.yarnpkg.com/electron/-/electron-11.0.3.tgz#c29eaacda38ce561890e59906ca5f507c72b3ec4" - integrity sha512-nNfbLi7Q1xfJXOEO2adck5TS6asY4Jxc332E4Te8XfQ9hcaC3GiCdeEqk9FndNCwxhJA5Lr9jfSGRTwWebFa/w== +electron@^12.0.0: + version "12.2.1" + resolved "https://registry.yarnpkg.com/electron/-/electron-12.2.1.tgz#ef138fde11efd01743934c3e0df717cc53ee362b" + integrity sha512-Gp+rO81qoaRDP7PTVtBOvnSgDgGlwUuAEWXxi621uOJMIlYFas9ChXe8pjdL0R0vyUpiHVzp6Vrjx41VZqEpsw== dependencies: "@electron/get" "^1.0.1" - "@types/node" "^12.0.12" + "@types/node" "^14.6.2" extract-zip "^1.0.3" elliptic@^6.0.0: @@ -6575,7 +6591,7 @@ semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== -semver@^6.0.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==