aboutsummaryrefslogtreecommitdiffstats
path: root/uncompressed
diff options
context:
space:
mode:
authorLibravatar Amine <amine@mouafik.fr>2020-04-20 09:09:20 +0000
committerLibravatar GitHub <noreply@github.com>2020-04-20 09:09:20 +0000
commit53560dd3d21155285eb2f65b8e1571dbb33b94b1 (patch)
tree101355f0e53bc3bd571f9910db0486c25c307f8c /uncompressed
parentRemove WhatsApp reload attempts (#118) (diff)
downloadferdium-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')
-rw-r--r--uncompressed/instagram/README.md6
-rw-r--r--uncompressed/instagram/index.js9
-rw-r--r--uncompressed/instagram/package.json8
-rw-r--r--uncompressed/instagram/service.css10
-rw-r--r--uncompressed/instagram/webview.js16
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
2This is the official Ferdi recipe for Instagram
2 3
3A 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
3module.exports = Franz => class Instagram extends Franz { 1module.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 @@
1const path = require("path"); 1const path = require("path");
2 2
3module.exports = Franz => { 3module.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};