diff --git a/LICENSE b/LICENSE index 34a96feb..288f7740 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ -@license p3x-onenote v2023.10.214 +@license p3x-onenote v2023.10.220 📚 P3X OneNote Linux diff --git a/README.md b/README.md index 3cbe7eaf..d4894226 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ -# 📚 P3X OneNote Linux v2023.10.215 +# 📚 P3X OneNote Linux v2023.10.220 @@ -240,7 +240,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/artifacts/arm.md b/artifacts/arm.md index dea2ae61..c774ccb5 100644 --- a/artifacts/arm.md +++ b/artifacts/arm.md @@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/artifacts/flavor.md b/artifacts/flavor.md index 043fb710..3d175070 100644 --- a/artifacts/flavor.md +++ b/artifacts/flavor.md @@ -24,7 +24,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/artifacts/new-language.md b/artifacts/new-language.md index d20d3487..fd68b2e4 100644 --- a/artifacts/new-language.md +++ b/artifacts/new-language.md @@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/artifacts/npm.md b/artifacts/npm.md index 8d7e9449..60ad68e2 100644 --- a/artifacts/npm.md +++ b/artifacts/npm.md @@ -38,7 +38,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/change-log.md b/change-log.md index a5a825f2..618b1f05 100644 --- a/change-log.md +++ b/change-log.md @@ -7,6 +7,10 @@ ## Change log +### v2023.10.220 +Relesed on 07/20/2023 +* CHORE: Updated Electron + ### v2023.10.205 Released on 07/19/2022 * TEST: Auto upload with deb and AppImage @@ -370,7 +374,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.215 +[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2023.10.220 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/package.json b/package.json index 8af511ba..4c4d5ad3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p3x-onenote", - "version": "2023.10.216", + "version": "2023.10.220", "description": "📚 P3X OneNote Linux", "main": "src/electron/app.js", "corifeus": { @@ -28,6 +28,7 @@ "postinstall-save": "opencollective postinstall", "start": "node ./node_modules/.bin/electron ./src/electron/app.js", "publish-electron": "rm -rf dist && electron-builder --p onTagOrDraft --linux --armv7l --arm64 --linux AppImage deb rpm --x64", + "publish-electron-deb": "rm -rf dist && electron-builder --p onTagOrDraft --linux --armv7l --arm64 --linux deb --x64", "publish-electron-test": "rm -rf dist && electron-builder --p onTagOrDraft --linux --linux AppImage deb --x64", "publish-electron-snap": "rm -rf dist && electron-builder --linux snap -p never", "publish-electron-yml": "node ./node_modules/corifeus-builder/src/utils/appimage/post-build.js" @@ -59,7 +60,7 @@ "electron-store": "^8.1.0", "electron-updater": "^6.1.2", "semver": "^7.5.4", - "electron": "^25.3.0" + "electron": "^25.3.1" }, "devDependencies": { "corifeus-builder": "^2023.10.128", @@ -69,14 +70,12 @@ "node": ">=12.13.0" }, "build": { - "generateUpdatesFilesForAllChannels": true, "afterAllArtifactBuild": "./node_modules/corifeus-builder/src/utils/appimage/after-all-artifact-build.js", "publish": [ { "provider": "github", "owner": "patrikx3", - "repo": "onenote", - "channel": "latest" + "repo": "onenote" } ], "appId": "p3x.onenote", diff --git a/scripts/start-local.sh b/scripts/start-local.sh index 3a1bc35a..162f5191 100755 --- a/scripts/start-local.sh +++ b/scripts/start-local.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -./node_modules/.bin/electron --no-sandbox $DIR/.. $@ +./node_modules/.bin/electron $DIR/.. $@ diff --git a/src/electron/main/create/window/onenote.js b/src/electron/main/create/window/onenote.js index a4d47e79..e10efde5 100644 --- a/src/electron/main/create/window/onenote.js +++ b/src/electron/main/create/window/onenote.js @@ -22,9 +22,16 @@ function createWindow() { }); global.p3x.onenote.window.onenote.loadURL(`file://${__dirname}/../../../window/onenote/index.html`); - remoteMain.enable(global.p3x.onenote.window.onenote.webContents) + global.p3x.onenote.window.onenote.webContents.on("did-attach-webview", (_, contents) => { + contents.setWindowOpenHandler((details) => { + global.p3x.onenote.window.onenote.webContents.send('p3x-onenote-new-window', details); + return { action: 'deny' } + }) + }) + remoteMain.enable(global.p3x.onenote.window.onenote.webContents) + if (process.env.NODE_ENV === 'debug') { global.p3x.onenote.window.onenote.openDevTools() } @@ -117,7 +124,6 @@ function createWindow() { const {autoUpdater} = require("electron-updater"); - autoUpdater.channel = "latest" autoUpdater.on('checking-for-update', (info) => { console.log('checking-for-update', info) diff --git a/src/electron/window/onenote/event/handler.js b/src/electron/window/onenote/event/handler.js index ca4475bf..5665cce5 100644 --- a/src/electron/window/onenote/event/handler.js +++ b/src/electron/window/onenote/event/handler.js @@ -17,31 +17,12 @@ const handler = (options) => { //const disalledUrl = /^((https?:\/\/))/i + /* let windowInterval - const generateInterval = () => { - windowInterval = setInterval(() => { - //console.log(webview.src, global.p3x.onenote.root.p3x.onenote.location) - - /* - ipc.send('p3x-debug', { - 'new-window': webview.src, - allowed: allowedUrlRegex.test(webview.src) - }) - */ - - /* - if (!allowedUrlRegex.test(webview.src)) { - p3x.onenote.ui.overlay.show({ - message: p3x.onenote.lang.label.disallowedContent - }) - } else { - p3x.onenote.ui.overlay.hide() - } - */ - - + windowInterval = setInterval(() => { if (global.p3x.onenote.root && global.p3x.onenote.root.p3x.onenote.location !== webview.src) { + console.log('changed the url via interval', webview.src) p3x.onenote.wait.angular(() => { global.p3x.onenote.root.p3x.onenote.location = webview.src global.p3x.onenote.data.url = webview.src @@ -61,6 +42,7 @@ const handler = (options) => { generateInterval() } }) + */ /* webview.addEventListener('did-stop-loading', function(event) { @@ -82,25 +64,34 @@ const handler = (options) => { }); */ - webview.addEventListener('did-navigate', function (event, url) { - /* - ipc.send('p3x-debug', { - 'did-navigate': event, - url: url, + for(let eventName of ['did-navigate', 'did-navigate-in-page']) { + webview.addEventListener(eventName, function (event, url) { + /* + ipc.send('p3x-debug', { + 'did-navigate': event, + url: url, + }); + */ + console.log(`changed the url via ${eventName}`, webview.src) + + global.p3x.onenote.data.url = webview.src; + ipc.send('p3x-onenote-save', global.p3x.onenote.data); + + p3x.onenote.wait.angular(() => { + global.p3x.onenote.root.p3x.onenote.location = webview.src + global.p3x.onenote.root.$digest() + }) + }); - */ + + + } - global.p3x.onenote.data.url = webview.src; - ipc.send('p3x-onenote-save', global.p3x.onenote.data); + - p3x.onenote.wait.angular(() => { - global.p3x.onenote.root.p3x.onenote.location = webview.src - global.p3x.onenote.root.$digest() - }) - }); - webview.addEventListener("dom-ready", event => { + webview.addEventListener('dom-ready', event => { //TODO Remove this once https://github.com/electron/electron/issues/14474 is fixed webview.blur(); webview.focus(); @@ -114,8 +105,11 @@ const handler = (options) => { }); + /* webview.addEventListener('new-window', function (event) { + console.log('new-window', event.url) + event.preventDefault() //p3x.onenote.toast.action(p3x.onenote.lang.label.unknownLink) @@ -134,41 +128,30 @@ const handler = (options) => { } }) } - - //; - - /* - ipc.send('p3x-debug', { - 'new-window': event.url, - allowed: allowedUrlRegex.test(event.url) - }) - */ - - //console.log(event.url) - /* - if (allowedUrlRegex2.test(event.url)) { - // https://onedrive.live.com/redir?resid=3B992A1F2BEDFFA7%21955&page=Edit - const urlParts = event.url.match(allowedUrlRegex2) - /* - ipc.send('p3x-debug', { - urlParts: urlParts - }) - */ - /* - p3x.onenote.toast.action(p3x.onenote.lang.redirecting) - webview.src = `https://onedrive.live.com/redir?resid=${urlParts[1]}%21955&page=Edit`; - } else - */ - /* - if (allowedUrlRegex.test(event.url) || allowedUrlRegex2.test(event.url)) { - p3x.onenote.toast.action(p3x.onenote.lang.redirecting) - webview.src = event.url; - } else { - shell.openExternal(event.url); - } - */ }); + */ + /* + for(let event of [ + 'did-finish-load', + 'did-frame-finish-load', + 'did-start-loading', + 'page-title-updated', + 'will-navigate', + 'did-start-navigation', + 'did-redirect-navigation', + 'did-navigate', + 'did-frame-navigate', + 'did-navigate-in-page', + 'update-target-url', + ]) { + webview.addEventListener(event, function(eventData) { + if (eventData.url) { + console.log(event, event.url) + } + }) + } + */ } diff --git a/src/electron/window/onenote/ipc/handler.js b/src/electron/window/onenote/ipc/handler.js index 0ac567cd..4e48bb54 100644 --- a/src/electron/window/onenote/ipc/handler.js +++ b/src/electron/window/onenote/ipc/handler.js @@ -1,4 +1,4 @@ -const {ipcRenderer} = require('electron'); +const {shell, ipcRenderer} = require('electron'); const setProxy = require('../action/set-proxy'); const multiActions = require('../action/multi-actions'); @@ -101,7 +101,23 @@ const handler = (options) => { }) - + ipcRenderer.on('p3x-onenote-new-window', (event, data) => { + if (data.url.trim().startsWith('about:blank')) { + //webview.src = event.url; + return + } + if (global.p3x.onenote.conf.get('option-to-disable-internal-external-popup') === true) { + webview.src = event.url + } else { + global.p3x.onenote.prompt.redirect({url: data.url}).then((answer) => { + if (answer === 'internal') { + webview.src = data.url; + } else { + shell.openExternal(data.url) + } + }) + } + }) } diff --git a/src/electron/window/onenote/load.js b/src/electron/window/onenote/load.js index 375b746b..3b0c67d2 100644 --- a/src/electron/window/onenote/load.js +++ b/src/electron/window/onenote/load.js @@ -1,19 +1,5 @@ const {ipcRenderer} = require('electron'); -/* -const fs = require('fs') - -fs.readFile(__dirname + '/hack.css', 'utf-8', function(err, data) { - if (err) { - ipc.send('p3x-debug', { - 'messsage': 'hack.css is not working', - error: err, - }); - } - p3x.onenote.hackCss = data; -}); -*/ - const Store = require('electron-store'); const conf = new Store(); let translationKey = conf.get('lang')