diff options
author | 2020-04-20 09:09:20 +0000 | |
---|---|---|
committer | 2020-04-20 09:09:20 +0000 | |
commit | 53560dd3d21155285eb2f65b8e1571dbb33b94b1 (patch) | |
tree | 101355f0e53bc3bd571f9910db0486c25c307f8c /uncompressed/instagram | |
parent | Remove WhatsApp reload attempts (#118) (diff) | |
download | ferdium-recipes-53560dd3d21155285eb2f65b8e1571dbb33b94b1.tar.gz ferdium-recipes-53560dd3d21155285eb2f65b8e1571dbb33b94b1.tar.zst ferdium-recipes-53560dd3d21155285eb2f65b8e1571dbb33b94b1.zip |
Update Instagram recipe to use official web service (#111)
* initial commit
# Conflicts:
# README.md
* Adjust recipe to Ferdi
Co-authored-by: Stefan Malzner <stefan@adlk.io>
Diffstat (limited to 'uncompressed/instagram')
-rw-r--r-- | uncompressed/instagram/README.md | 6 | ||||
-rw-r--r-- | uncompressed/instagram/index.js | 9 | ||||
-rw-r--r-- | uncompressed/instagram/package.json | 8 | ||||
-rw-r--r-- | uncompressed/instagram/service.css | 10 | ||||
-rw-r--r-- | uncompressed/instagram/webview.js | 16 |
5 files changed, 34 insertions, 15 deletions
diff --git a/uncompressed/instagram/README.md b/uncompressed/instagram/README.md index b8d10f8..0f54f9e 100644 --- a/uncompressed/instagram/README.md +++ b/uncompressed/instagram/README.md | |||
@@ -1,3 +1,5 @@ | |||
1 | # Franz Instagram recipe | 1 | # Instagram for Ferdi |
2 | This is the official Ferdi recipe for Instagram | ||
2 | 3 | ||
3 | A Franz recipe for Instagram service. | 4 | ### How to create your own Ferdi recipes: |
5 | * [Read the documentation](https://github.com/getferdi/recipes/blob/master/docs/integration.md) \ No newline at end of file | ||
diff --git a/uncompressed/instagram/index.js b/uncompressed/instagram/index.js index b64a3e4..12ff25a 100644 --- a/uncompressed/instagram/index.js +++ b/uncompressed/instagram/index.js | |||
@@ -1,7 +1,8 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | module.exports = Franz => class Instagram extends Franz { | 1 | module.exports = Franz => class Instagram extends Franz { |
4 | overrideUserAgent() { | 2 | overrideUserAgent() { |
5 | return 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1' | 3 | return window.navigator.userAgent.replace( |
4 | /(Ferdi|Electron)\/\S+ \([^)]+\)/g, | ||
5 | "" | ||
6 | ); | ||
6 | } | 7 | } |
7 | } \ No newline at end of file | 8 | }; |
diff --git a/uncompressed/instagram/package.json b/uncompressed/instagram/package.json index 639afdb..d245ec7 100644 --- a/uncompressed/instagram/package.json +++ b/uncompressed/instagram/package.json | |||
@@ -1,15 +1,13 @@ | |||
1 | { | 1 | { |
2 | "id": "instagram", | 2 | "id": "instagram", |
3 | "name": "Instagram", | 3 | "name": "Instagram", |
4 | "version": "1.0.0", | 4 | "version": "2.0.0", |
5 | "description": "Instagram", | 5 | "description": "Instagram", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Amine Mouafik <amine@mouafik.fr>", | 7 | "author": "Amine Mouafik <amine@mouafik.fr>", |
8 | "license": "MIT", | 8 | "license": "MIT", |
9 | "repository": "https://github.com/getferdi/recipes", | ||
10 | "config": { | 9 | "config": { |
11 | "hasNotificationSound": false, | 10 | "serviceURL": "https://instagram.com/direct/inbox", |
12 | "hasIndirectMessages": true, | 11 | "hasNotificationSound": true |
13 | "serviceURL": "https://www.instagram.com/direct/inbox/" | ||
14 | } | 12 | } |
15 | } | 13 | } |
diff --git a/uncompressed/instagram/service.css b/uncompressed/instagram/service.css index 8b13789..2cd727c 100644 --- a/uncompressed/instagram/service.css +++ b/uncompressed/instagram/service.css | |||
@@ -1 +1,11 @@ | |||
1 | .oYYFH { | ||
2 | padding: 0 !important; | ||
3 | } | ||
1 | 4 | ||
5 | .MWDvN, .oYYFH > div { | ||
6 | max-width: 100% !important; | ||
7 | } | ||
8 | |||
9 | ._lz6s { | ||
10 | border-bottom: 0 !important; | ||
11 | } \ No newline at end of file | ||
diff --git a/uncompressed/instagram/webview.js b/uncompressed/instagram/webview.js index aede5a5..f4f7f94 100644 --- a/uncompressed/instagram/webview.js +++ b/uncompressed/instagram/webview.js | |||
@@ -1,7 +1,15 @@ | |||
1 | const path = require("path"); | 1 | const path = require("path"); |
2 | 2 | ||
3 | module.exports = Franz => { | 3 | module.exports = (Franz) => { |
4 | // Apply fixes suggested in | 4 | const getMessages = function getMessages() { |
5 | // https://github.com/getferdi/recipes/issues/1 | 5 | const element = document.querySelector('a[href^="/direct/inbox"]'); |
6 | Franz.injectCSS(path.join(__dirname, "service.css")); | 6 | |
7 | if (element) { | ||
8 | Franz.setBadge(parseInt(element.innerText, 10)); | ||
9 | } | ||
10 | }; | ||
11 | |||
12 | Franz.loop(getMessages); | ||
13 | |||
14 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
7 | }; | 15 | }; |