aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/discord
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-27 18:13:24 +0530
committerLibravatar GitHub <noreply@github.com>2021-08-27 18:13:24 +0530
commit155c4b832281348c16be1f4ef667e6e23dbf1bd8 (patch)
treed144e2de2e6c7fb2e334246e8a4aecdbeb08ef8d /recipes/discord
parentdocs: fixed template file for creating recipe. (diff)
downloadferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.tar.gz
ferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.tar.zst
ferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.zip
chore: normalized all recipes to ensure compatibility with es6 (#639)
- Removed some calls to set badge with '0' all the time. - Removed all 'sourceMaps' since they are all outdated atm.
Diffstat (limited to 'recipes/discord')
-rw-r--r--recipes/discord/index.js4
-rw-r--r--recipes/discord/package.json2
-rw-r--r--recipes/discord/webview.js19
3 files changed, 14 insertions, 11 deletions
diff --git a/recipes/discord/index.js b/recipes/discord/index.js
index dd2bcf2..9efa7a3 100644
--- a/recipes/discord/index.js
+++ b/recipes/discord/index.js
@@ -1,8 +1,8 @@
1module.exports = Franz => class Discord extends Franz { 1module.exports = Ferdi => class Discord extends Ferdi {
2 overrideUserAgent() { 2 overrideUserAgent() {
3 const useragent = window.navigator.userAgent; 3 const useragent = window.navigator.userAgent;
4 const parts = useragent.split('(KHTML, like Gecko)'); 4 const parts = useragent.split('(KHTML, like Gecko)');
5 5
6 return parts.join('(KHTML, like Gecko) discord/0.0.250').replace('Electron', 'Discord').replace('Franz', 'Discord'); 6 return parts.join('(KHTML, like Gecko) discord/0.0.250').replace('Electron', 'Discord').replace('Ferdi', 'Discord');
7 } 7 }
8}; 8};
diff --git a/recipes/discord/package.json b/recipes/discord/package.json
index d713dfb..85069d9 100644
--- a/recipes/discord/package.json
+++ b/recipes/discord/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "discord", 2 "id": "discord",
3 "name": "Discord", 3 "name": "Discord",
4 "version": "1.2.0", 4 "version": "1.3.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://discordapp.com/login", 7 "serviceURL": "https://discordapp.com/login",
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js
index 8123ced..88a5c50 100644
--- a/recipes/discord/webview.js
+++ b/recipes/discord/webview.js
@@ -1,9 +1,10 @@
1"use strict";
2
3// TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 1// TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5
4 2
5const { desktopCapturer, remote: { BrowserWindow } } = require("electron"); 3const { desktopCapturer, remote: { BrowserWindow } } = require('electron');
6const path = require('path'); 4
5const _path = _interopRequireDefault(require('path'));
6
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7 8
8window.navigator.mediaDevices.getDisplayMedia = () => { 9window.navigator.mediaDevices.getDisplayMedia = () => {
9 return new Promise(async (resolve, reject) => { 10 return new Promise(async (resolve, reject) => {
@@ -61,7 +62,7 @@ window.navigator.mediaDevices.getDisplayMedia = () => {
61 }) 62 })
62} 63}
63 64
64module.exports = (Franz, settings) => { 65module.exports = (Ferdi, settings) => {
65 const getMessages = function getMessages() { 66 const getMessages = function getMessages() {
66 let count = 0; 67 let count = 0;
67 const container = document.querySelector('[role="tablist"] > [title="Chats"] > div'); 68 const container = document.querySelector('[role="tablist"] > [title="Chats"] > div');
@@ -79,11 +80,13 @@ module.exports = (Franz, settings) => {
79 } 80 }
80 } 81 }
81 82
82 Franz.setBadge(count); 83 Ferdi.setBadge(count);
83 }; 84 };
84 85
85 Franz.injectCSS(path.join(__dirname, 'service.css')); 86 Ferdi.loop(getMessages);
86 Franz.loop(getMessages); 87
88 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
89
87 document.addEventListener('click', event => { 90 document.addEventListener('click', event => {
88 const link = event.target.closest('a[href^="http"]'); 91 const link = event.target.closest('a[href^="http"]');
89 const button = event.target.closest('button[title^="http"]'); 92 const button = event.target.closest('button[title^="http"]');