raven/multimedia/yaamp/yaamp-disable-discord.patch
2024-02-27 15:54:20 +06:00

103 lines
3.5 KiB
Diff

diff -Naur a/main.js b/main.js
--- a/main.js 2024-01-29 22:04:04.000000000 +0600
+++ b/main.js 2024-02-27 11:16:45.506897863 +0600
@@ -3,7 +3,7 @@
const url = require('url')
const { ipcMain, webContents, session, remote } = require('electron')
const crypto = require("crypto");
-const DiscordRPC = require('discord-rpc');
+//const DiscordRPC = require('discord-rpc');
const checkForUpdatesAndNotify = require('./src/node/updates.js')
const interceptStreamProtocol = require('./src/node/protocol.js')
@@ -39,11 +39,11 @@
const sessionId = crypto.randomBytes(20).toString('hex');
const clientId = '1161295534770892860';
-DiscordRPC.register(clientId);
+//DiscordRPC.register(clientId);
-const rpc = new DiscordRPC.Client({ transport: 'ipc' });
+//const rpc = new DiscordRPC.Client({ transport: 'ipc' });
-rpc.login({ clientId }).catch(console.error);
+//rpc.login({ clientId }).catch(console.error);
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@@ -321,40 +321,40 @@
return data;
})
- // Discord Integration
-
- // Check on uploaded track
- if (!/^.*-.*-.*-.*-.*$/.test(trackid)) {
- await client.tracks.getTracks({"track-ids": [trackid]}).then((data) => {
- const element = data.result[0];
- const startTimestamp = new Date();
-
- let artist = [];
-
- element.artists.forEach((a) => {
- artist.push(a.name);
- });
-
- const presObj = {
- details: `${element.title}`,
- state: `${artist.join(', ')}`,
- largeImageKey: 'https://' + element.coverUri.replace("%%", "200x200"),
- largeImageText: `${artist.join(', ')} - ${element.title}`,
- smallImageKey: 'https://yaamp.ru/icon.png',
- smallImageText: 'Yaamp.ru',
- buttons: [
- {
- label: 'Listen this track',
- url: `https://music.yandex.ru/track/${element.id}`,
- },
- ],
- };
-
- rpc.setActivity(presObj);
-
- return data;
- })
- }
+// // Discord Integration
+//
+// // Check on uploaded track
+// if (!/^.*-.*-.*-.*-.*$/.test(trackid)) {
+// await client.tracks.getTracks({"track-ids": [trackid]}).then((data) => {
+// const element = data.result[0];
+// const startTimestamp = new Date();
+//
+// let artist = [];
+//
+// element.artists.forEach((a) => {
+// artist.push(a.name);
+// });
+//
+// const presObj = {
+// details: `${element.title}`,
+// state: `${artist.join(', ')}`,
+// largeImageKey: 'https://' + element.coverUri.replace("%%", "200x200"),
+// largeImageText: `${artist.join(', ')} - ${element.title}`,
+// smallImageKey: 'https://yaamp.ru/icon.png',
+// smallImageText: 'Yaamp.ru',
+// buttons: [
+// {
+// label: 'Listen this track',
+// url: `https://music.yandex.ru/track/${element.id}`,
+// },
+// ],
+// };
+//
+// rpc.setActivity(presObj);
+//
+// return data;
+// })
+// }
return data;
} else {