Skip to content

Commit

Permalink
1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
JustYuuto committed Aug 28, 2024
1 parent 2d7ea4c commit 81d0f74
Show file tree
Hide file tree
Showing 70 changed files with 138 additions and 196,791 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.2.8

* Fixed the app not working because of Deezer and Discord changes
* Made the "Listening to" mode not needing your token anymore
* Fixed the "Don't close to tray" option not making the RPC disconnect when closing the app

## 1.2.7

* Added back and forward buttons (#53)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deezer-discord-rpc",
"version": "1.2.7",
"version": "1.2.8",
"description": "A Discord RPC for Deezer",
"main": "./build/src/index.js",
"scripts": {
Expand All @@ -10,13 +10,13 @@
"run": "yarn build:ts && yarn run copy-assets && yarn start",
"postinstall": "electron-builder install-app-deps",
"lint": "eslint --fix --ext .ts ./src",
"copy-assets": "cpy ./src/img/* ./build/src/img/ && cpy ./src/prompt.html ./build/"
"copy-assets": "cpy ./src/img/* ./build/src/img/"
},
"dependencies": {
"@cliqz/adblocker-electron": "^1.27.1",
"@xhayper/discord-rpc": "^1.2.0",
"axios": "^1.6.8",
"chalk": "4.1.2",
"discord-rpc": "^4.0.1",
"discord.js-selfbot-v13": "^2.14.9"
},
"devDependencies": {
Expand Down
39 changes: 1 addition & 38 deletions src/functions.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,8 @@
import { BrowserWindow, shell, ipcMain } from 'electron';
import { join } from 'path';
import * as Config from './utils/Config';
import * as DiscordWebSocket from './utils/DiscordWebSocket';
import { win } from './utils/Window';

export const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export async function prompt(message: string, app: Electron.App, options?: {
closable?: boolean
}) {
const win = new BrowserWindow({
resizable: false,
minimizable: false,
maximizable: false,
closable: typeof options?.closable !== 'undefined' ? options?.closable : true,
webPreferences: {
preload: join(__dirname, 'prompt.js')
}
});

ipcMain.on('autocomplete-token', async () => {
if (Config.get(app, 'discord_token')) {
await runJs(`document.querySelector('input#discord-token').value = '${Config.get(app, 'discord_token')}'`);
}
});

ipcMain.on('token-received', async (e, data) => {
Config.set(app, 'discord_token', data);
Config.set(app, 'use_listening_to', true);
win.close();
DiscordWebSocket.connect(data, app).catch(console.error);
});

win.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url);
return { action: 'deny' };
});
win.setMenuBarVisibility(false);
await win.loadFile(join(__dirname, 'prompt.html'), { hash: message });
}

export async function runJs(code: string) {
// return code;
return win.webContents.executeJavaScript(code);
}
17 changes: 3 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { app, BrowserWindow, session } from 'electron';
import { app, BrowserWindow } from 'electron';
import { log } from './utils/Log';
import * as Config from './utils/Config';
import * as Tray from './utils/Tray';
import updater from './utils/Updater';
import * as DiscordWebSocket from './utils/DiscordWebSocket';
import * as RPC from './utils/RPC';
import * as Window from './utils/Window';
import { join } from 'path';
import { version } from '../package.json';
import {showWindow} from './utils/Window';
import { showWindow } from './utils/Window';

log('App', 'Deezer Discord RPC version', version, process.argv0.includes('node') ? '(debug)' : '');

app.whenReady().then(async () => {

const gotTheLock = app.requestSingleInstanceLock();

if (!gotTheLock) {
Expand All @@ -26,17 +22,10 @@ app.whenReady().then(async () => {
}

await Tray.init(app, RPC.client);
if (process.argv0.includes('node')) {
await session.defaultSession.loadExtension(join(process.cwd(), 'src', 'react-devtools'));
}
await Window.load(app);
await updater(true);

if (Config.get(app, 'use_listening_to')) {
DiscordWebSocket.connect(Config.get(app, 'discord_token'), app).catch((e) => log('WebSocket', e.toString()));
} else {
RPC.connect();
}
RPC.connect();

app.on('activate', async () => {
if (BrowserWindow.getAllWindows().length > 0) {
Expand Down
97 changes: 0 additions & 97 deletions src/prompt.html

This file was deleted.

5 changes: 0 additions & 5 deletions src/prompt.js

This file was deleted.

Loading

0 comments on commit 81d0f74

Please sign in to comment.