From 6ecbbff345eed6e252ea8b2567176464873cb531 Mon Sep 17 00:00:00 2001 From: Jonathan Winter <14960780+jhwinter@users.noreply.github.com> Date: Sat, 19 Sep 2020 14:30:27 -0400 Subject: Add LastPass recipe (#290) --- all.json | 11 ++++++ archives/meetfranz-lastpass.tar.gz | Bin 0 -> 45064 bytes uncompressed/meetfranz-lastpass/.gitignore | 40 +++++++++++++++++++++ uncompressed/meetfranz-lastpass/README.md | 17 +++++++++ uncompressed/meetfranz-lastpass/darkmode.css | 6 ++++ uncompressed/meetfranz-lastpass/icon.png | Bin 0 -> 56568 bytes uncompressed/meetfranz-lastpass/icon.svg | 1 + uncompressed/meetfranz-lastpass/index.js | 8 +++++ uncompressed/meetfranz-lastpass/package.json | 14 ++++++++ uncompressed/meetfranz-lastpass/service.css | 5 +++ uncompressed/meetfranz-lastpass/webview.js | 50 +++++++++++++++++++++++++++ 11 files changed, 152 insertions(+) create mode 100644 archives/meetfranz-lastpass.tar.gz create mode 100644 uncompressed/meetfranz-lastpass/.gitignore create mode 100644 uncompressed/meetfranz-lastpass/README.md create mode 100644 uncompressed/meetfranz-lastpass/darkmode.css create mode 100644 uncompressed/meetfranz-lastpass/icon.png create mode 100644 uncompressed/meetfranz-lastpass/icon.svg create mode 100644 uncompressed/meetfranz-lastpass/index.js create mode 100644 uncompressed/meetfranz-lastpass/package.json create mode 100644 uncompressed/meetfranz-lastpass/service.css create mode 100644 uncompressed/meetfranz-lastpass/webview.js diff --git a/all.json b/all.json index 315fe88..91e8713 100644 --- a/all.json +++ b/all.json @@ -593,6 +593,17 @@ "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/mattermost/icon.svg" } }, + { + "author": "Janis Hau , Jonathan Winter ", + "featured": false, + "id": "meetfranz-lastpass", + "name": "LastPass", + "version": "1.0.0", + "icons": { + "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/meetfranz-lastpass/icon.png", + "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/meetfranz-lastpass/icon.svg" + } + }, { "author": "Stefan Malzner ", "featured": true, diff --git a/archives/meetfranz-lastpass.tar.gz b/archives/meetfranz-lastpass.tar.gz new file mode 100644 index 0000000..a4eaeb3 Binary files /dev/null and b/archives/meetfranz-lastpass.tar.gz differ diff --git a/uncompressed/meetfranz-lastpass/.gitignore b/uncompressed/meetfranz-lastpass/.gitignore new file mode 100644 index 0000000..3c678cc --- /dev/null +++ b/uncompressed/meetfranz-lastpass/.gitignore @@ -0,0 +1,40 @@ +# https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +# https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ diff --git a/uncompressed/meetfranz-lastpass/README.md b/uncompressed/meetfranz-lastpass/README.md new file mode 100644 index 0000000..171592c --- /dev/null +++ b/uncompressed/meetfranz-lastpass/README.md @@ -0,0 +1,17 @@ +# meetfranz-lastpass +This recipe allows you to use your lastpass vault in Franz. + +# How do I install this recipe? +To install this new integration create the follow directory: +Mac: ~/Library/Application Support/Franz/recipes/dev/meetfranz-lastpass +Windows: %appdata%/Franz/recipes/dev/meetfranz-lastpass +Linux: ~/.config/Franz/recipes/dev/meetfranz-lastpass + +Clone the repo in the /recipes/ directory (not in dev). + +That's all. + +# Check my-new.me + +# Notice +Unfortunately, on windows can't see the caret. :( \ No newline at end of file diff --git a/uncompressed/meetfranz-lastpass/darkmode.css b/uncompressed/meetfranz-lastpass/darkmode.css new file mode 100644 index 0000000..342b01b --- /dev/null +++ b/uncompressed/meetfranz-lastpass/darkmode.css @@ -0,0 +1,6 @@ +html { + -webkit-filter: invert(100%); + -moz-filter: invert(100%); + -o-filter: invert(100%); + -ms-filter: invert(100%); +} diff --git a/uncompressed/meetfranz-lastpass/icon.png b/uncompressed/meetfranz-lastpass/icon.png new file mode 100644 index 0000000..ae3a9e3 Binary files /dev/null and b/uncompressed/meetfranz-lastpass/icon.png differ diff --git a/uncompressed/meetfranz-lastpass/icon.svg b/uncompressed/meetfranz-lastpass/icon.svg new file mode 100644 index 0000000..7248497 --- /dev/null +++ b/uncompressed/meetfranz-lastpass/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/uncompressed/meetfranz-lastpass/index.js b/uncompressed/meetfranz-lastpass/index.js new file mode 100644 index 0000000..dd10055 --- /dev/null +++ b/uncompressed/meetfranz-lastpass/index.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = Franz => class Messenger extends Franz { + overrideUserAgent() { + return window.navigator.userAgent.replace(/(Franz|Electron)([^\s]+\s)/g, ''); + } + +}; \ No newline at end of file diff --git a/uncompressed/meetfranz-lastpass/package.json b/uncompressed/meetfranz-lastpass/package.json new file mode 100644 index 0000000..bccaa2c --- /dev/null +++ b/uncompressed/meetfranz-lastpass/package.json @@ -0,0 +1,14 @@ +{ + "id": "meetfranz-lastpass", + "name": "LastPass", + "version": "1.0.0", + "description": "LastPass integration", + "main": "index.js", + "author": "Janis Hau , Jonathan Winter ", + "license": "MIT", + "config": { + "serviceURL": "https://lastpass.com/?ac=1&lpnorefresh=1", + "hasNotificationSound": true, + "message": "LastPass" + } +} \ No newline at end of file diff --git a/uncompressed/meetfranz-lastpass/service.css b/uncompressed/meetfranz-lastpass/service.css new file mode 100644 index 0000000..2d8c1a6 --- /dev/null +++ b/uncompressed/meetfranz-lastpass/service.css @@ -0,0 +1,5 @@ +.app-wrapper-web .app { + width: 100% !important; + height: 100% !important; + top: 0 !important; +} diff --git a/uncompressed/meetfranz-lastpass/webview.js b/uncompressed/meetfranz-lastpass/webview.js new file mode 100644 index 0000000..4fdd007 --- /dev/null +++ b/uncompressed/meetfranz-lastpass/webview.js @@ -0,0 +1,50 @@ +"use strict"; + +const { + remote +} = require('electron'); + +const path = require('path'); + +const webContents = remote.getCurrentWebContents(); +const { + session +} = webContents; +setTimeout(() => { + if (document.querySelector('body').innerHTML.includes('Google Chrome 36+')) { + window.location.reload(); + } +}, 1000); +window.addEventListener('beforeunload', async () => { + try { + session.flushStorageData(); + session.clearStorageData({ + storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'] + }); + const registrations = await window.navigator.serviceWorker.getRegistrations(); + registrations.forEach(r => { + r.unregister(); + console.log('ServiceWorker unregistered'); + }); + } catch (err) { + console.err(err); + } +}); + +module.exports = Franz => { + const getMessages = function getMessages() { + const elements = document.querySelectorAll('.CxUIE, .unread'); + let count = 0; + + for (let i = 0; i < elements.length; i += 1) { + if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { + count += 1; + } + } + + Franz.setBadge(count); + }; + + Franz.injectCSS(path.join(__dirname, 'service.css')); + Franz.loop(getMessages); +}; \ No newline at end of file -- cgit v1.2.3-70-g09d2