From 006950318f1228af10eeb0cdfb0861af6ecb1e75 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:36:05 +0000 Subject: Add several recipes (#519) The added recipes are as follows: - Mastodeck (fixes https://github.com/ferdium/ferdium-app/issues/959) - Microsoft Planner (fixes https://github.com/ferdium/ferdium-app/issues/955) - Alibaba Chat (fixes https://github.com/ferdium/ferdium-app/issues/1376) - Fiverr (step forward in https://github.com/ferdium/ferdium-app/issues/1377 - missing unread logic) - Draw.io (fixes https://github.com/ferdium/ferdium-app/issues/1429) - Canva (fixes https://github.com/ferdium/ferdium-app/issues/1447) - Penpot (fixes https://github.com/ferdium/ferdium-app/issues/1469) - HackerNews (fixes https://github.com/ferdium/ferdium-app/issues/1505) - Google Maps (fixes https://github.com/ferdium/ferdium-app/issues/1513) - Patreon (fixes https://github.com/ferdium/ferdium-app/issues/1524) - Fandom (fixes https://github.com/ferdium/ferdium-app/issues/1540) - Romeo (fixes https://github.com/ferdium/ferdium-app/issues/1553) - Infomaniak Kdrive (fixes https://github.com/ferdium/ferdium-app/issues/1559) - Notion Calendar (fixes https://github.com/ferdium/ferdium-app/issues/1599) - Superlist (fixes https://github.com/ferdium/ferdium-app/issues/1601) - Purelymail (fixes https://github.com/ferdium/ferdium-app/issues/1624) - SOGo (fixes https://github.com/ferdium/ferdium-app/issues/1472) --- recipes/ms-planner/icon.svg | 15 +++++++++++++++ recipes/ms-planner/index.js | 27 +++++++++++++++++++++++++++ recipes/ms-planner/package.json | 14 ++++++++++++++ recipes/ms-planner/service.css | 15 +++++++++++++++ recipes/ms-planner/webview.js | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 recipes/ms-planner/icon.svg create mode 100644 recipes/ms-planner/index.js create mode 100644 recipes/ms-planner/package.json create mode 100644 recipes/ms-planner/service.css create mode 100644 recipes/ms-planner/webview.js (limited to 'recipes/ms-planner') diff --git a/recipes/ms-planner/icon.svg b/recipes/ms-planner/icon.svg new file mode 100644 index 0000000..43a4cfc --- /dev/null +++ b/recipes/ms-planner/icon.svg @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/recipes/ms-planner/index.js b/recipes/ms-planner/index.js new file mode 100644 index 0000000..cc0b44a --- /dev/null +++ b/recipes/ms-planner/index.js @@ -0,0 +1,27 @@ +module.exports = Ferdium => + class Planner extends Ferdium { + overrideUserAgent() { + return window.navigator.userAgent + .replace(/(Ferdium|Electron)(\S+\s)/g, '') + .replace(/(Chrome\/)([^ ]*)/g, '$163.0.3239.84'); + } + + // https://docs.microsoft.com/en-us/microsoftteams/troubleshoot/teams-sign-in/sign-in-loop#resolution + knownCertificateHosts() { + return ['tasks.office.com']; + } + + // we need to allow all cookies for ms teams + onHeadersReceived(details, callback) { + if ( + details.responseHeaders && + details.responseHeaders['Set-Cookie'] && + details.responseHeaders['Set-Cookie'].length > 0 && + !details.responseHeaders['Set-Cookie'][0].includes('SameSite=none') + ) { + details.responseHeaders['Set-Cookie'][0] = + `${details.responseHeaders['Set-Cookie'][0]}; SameSite=none`; + } + callback({ cancel: false, responseHeaders: details.responseHeaders }); + } + }; diff --git a/recipes/ms-planner/package.json b/recipes/ms-planner/package.json new file mode 100644 index 0000000..ca74458 --- /dev/null +++ b/recipes/ms-planner/package.json @@ -0,0 +1,14 @@ +{ + "id": "ms-planner", + "name": "Microsoft Planner", + "aliases": [ + "office", + "tasks" + ], + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://tasks.office.com/", + "hasNotificationSound": true + } +} diff --git a/recipes/ms-planner/service.css b/recipes/ms-planner/service.css new file mode 100644 index 0000000..d28527c --- /dev/null +++ b/recipes/ms-planner/service.css @@ -0,0 +1,15 @@ +.app-wrapper-web .app, +.app-wrapper-web ._36Q2N, +.app-wrapper-web .h70RQ, +.app-wrapper-web ._3QfZd, +.app-wrapper-web ._1jJ70, +._1XkO3.two { + width: 100% !important; + max-width: 100% !important; + height: 100% !important; + top: 0 !important; +} + +._1Wk6A ._3YewW._31v_P._2Ptrm { + display: none; +} diff --git a/recipes/ms-planner/webview.js b/recipes/ms-planner/webview.js new file mode 100644 index 0000000..4dd73fd --- /dev/null +++ b/recipes/ms-planner/webview.js @@ -0,0 +1,40 @@ +const path = require('path'); + +setTimeout(() => { + const elem = document.querySelector('.landing-title.version-title'); + if (elem && elem.textContent.toLowerCase().includes('google chrome')) { + window.FerdiumAPI.clearCache(); + window.location.reload(); + } +}, 1000); + +const isMutedIcon = element => + element.parentElement.parentElement.querySelectorAll('*[data-icon="muted"]') + .length > 0; + +const isPinnedIcon = element => element.classList.contains('_1EFSv'); + +module.exports = Ferdium => { + const getMessages = function getMessages() { + const elements = document.querySelectorAll( + '.CxUIE, .unread, ._0LqQ, .m61XR .ZKn2B, .VOr2j, ._1V5O7 ._2vfYK, html[dir] ._23LrM, ._1pJ9J:not(._2XH9R)', + ); + let count = 0; + + for (const element of elements) { + try { + // originalLog(isMutedIcon(elements[i]), isPinnedIcon(elements[i])); + if (!isMutedIcon(element) && !isPinnedIcon(element)) { + count += 1; + } + } catch { + // nope; + } + } + + Ferdium.setBadge(count); + }; + + Ferdium.injectCSS(path.join(__dirname, 'service.css')); + Ferdium.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2