From 7c7cd60b3c485ebc9c86f323658caa92ef1c31f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Oliveira?= Date: Tue, 9 Apr 2024 12:19:55 +0100 Subject: [PATCH] Fix notion calendar login --- recipes/notion-calendar/package.json | 2 +- recipes/notion-calendar/webview-unsafe.js | 7 +++++++ recipes/notion-calendar/webview.js | 8 +------- 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 recipes/notion-calendar/webview-unsafe.js diff --git a/recipes/notion-calendar/package.json b/recipes/notion-calendar/package.json index 672c823ed..1f41789bb 100644 --- a/recipes/notion-calendar/package.json +++ b/recipes/notion-calendar/package.json @@ -1,7 +1,7 @@ { "id": "notion-calendar", "name": "Notion Calendar", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "config": { "serviceURL": "https://calendar.notion.so/", diff --git a/recipes/notion-calendar/webview-unsafe.js b/recipes/notion-calendar/webview-unsafe.js new file mode 100644 index 000000000..f028f4c6b --- /dev/null +++ b/recipes/notion-calendar/webview-unsafe.js @@ -0,0 +1,7 @@ +// Workaround for Notion's login window with Google OAuth +if (window.location.href === 'https://calendar.notion.so/login') { + window.open = function (url) { + const newUrl = url.replace('popup=true', 'popup=false'); + window.location.href = newUrl; + }; +} diff --git a/recipes/notion-calendar/webview.js b/recipes/notion-calendar/webview.js index 2a81dec32..c27c2269a 100644 --- a/recipes/notion-calendar/webview.js +++ b/recipes/notion-calendar/webview.js @@ -5,12 +5,6 @@ function _interopRequireDefault(obj) { const _path = _interopRequireDefault(require('path')); module.exports = Ferdium => { - // TODO: If your SNAME service has unread messages, uncomment these lines to implement the logic for updating the badges - // const getMessages = () => { - // // TODO: Insert your notification-finding code here - // Ferdium.setBadge(0, 0); - // }; - // Ferdium.loop(getMessages); - Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); + Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); };