Merge branch 'master' into patch-1

This commit is contained in:
hayper
2023-01-19 13:14:32 +07:00
committed by GitHub
5 changed files with 20 additions and 15 deletions

View File

@ -317,17 +317,6 @@ app.once("browser-window-created", (event, win) => {
win.webContents.on("will-prevent-unload", (event) => { win.webContents.on("will-prevent-unload", (event) => {
event.preventDefault(); event.preventDefault();
}); });
win.webContents.on(
"new-window",
(e, url, frameName, disposition, options) => {
// hook on new opened window
// at now new window in mainWindow renderer process.
// Also, this will automatically get an option `nodeIntegration=false`(not override to true, like in iframe's) - like in regular browsers
options.webPreferences.affinity = "main-window";
}
);
}); });
app.on("window-all-closed", () => { app.on("window-all-closed", () => {

View File

@ -1,7 +1,7 @@
const { existsSync } = require("fs"); const { existsSync } = require("fs");
const path = require("path"); const path = require("path");
const { app, Menu, dialog } = require("electron"); const { app, clipboard, Menu, dialog } = require("electron");
const is = require("electron-is"); const is = require("electron-is");
const { restart } = require("./providers/app-controls"); const { restart } = require("./providers/app-controls");
@ -329,6 +329,13 @@ const mainMenuTemplate = (win) => {
} }
}, },
}, },
{
label: "Copy current URL",
click: () => {
const currentURL = win.webContents.getURL();
clipboard.writeText(currentURL);
},
},
{ {
label: "Restart App", label: "Restart App",
click: restart click: restart

View File

@ -82,8 +82,9 @@
"build:win": "yarn run clean && electron-builder --win", "build:win": "yarn run clean && electron-builder --win",
"lint": "xo", "lint": "xo",
"changelog": "auto-changelog", "changelog": "auto-changelog",
"plugins": "yarn run plugin:adblocker", "plugins": "yarn run plugin:adblocker && yarn run plugin:bypass-age-restrictions",
"plugin:adblocker": "del-cli -f \"plugins/adblocker/ad-blocker-engine.bin\" && node plugins/adblocker/blocker.js", "plugin:adblocker": "del-cli -f \"plugins/adblocker/ad-blocker-engine.bin\" && node plugins/adblocker/blocker.js",
"plugin:bypass-age-restrictions": "yarn run generate:package Simple-YouTube-Age-Restriction-Bypass",
"release:linux": "yarn run clean && electron-builder --linux -p always -c.snap.publish=github", "release:linux": "yarn run clean && electron-builder --linux -p always -c.snap.publish=github",
"release:mac": "yarn run clean && electron-builder --mac -p always", "release:mac": "yarn run clean && electron-builder --mac -p always",
"release:win": "yarn run clean && electron-builder --win -p always" "release:win": "yarn run clean && electron-builder --win -p always"

View File

@ -1,4 +1,4 @@
module.exports = () => { module.exports = () => {
// See https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass#userscript // See https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass#userscript
require("simple-youtube-age-restriction-bypass/Simple-YouTube-Age-Restriction-Bypass.user.js"); require("Simple-YouTube-Age-Restriction-Bypass/Simple-YouTube-Age-Restriction-Bypass.user.js");
}; };

View File

@ -10,7 +10,15 @@ const { promisify } = require("util");
*/ */
const generatePackageJson = async packageName => { const generatePackageJson = async packageName => {
var filepath = join("node_modules", packageName, "package.json"); const packageFolder = join("node_modules", packageName)
if (!existsSync(packageFolder )) {
console.log(
`${packageName} module not found, exiting…`
);
return
}
const filepath = join(packageFolder, "package.json");
if (!existsSync(filepath)) { if (!existsSync(filepath)) {
console.log( console.log(
`No package.json found for ${packageName} module, generating one…` `No package.json found for ${packageName} module, generating one…`