Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Deezer v7 #95

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VERSION_REGEX = ^v$(PKGVER)-[0-9]{1,}$$


install_build_deps:
@npm install --engine-strict asar
@npm install --engine-strict @electron/asar@3.2.18
@npm install [email protected]

prepare: clean install_build_deps
Expand All @@ -27,23 +27,23 @@ prepare: clean install_build_deps
@cd source && 7z x -y -bsp0 -bso0 app-32.7z

@echo "Extract app sources from the app"
@node_modules/asar/bin/asar.js extract source/resources/app.asar app
@node_modules/@electron/asar/bin/asar.js extract source/resources/app.asar app

@echo "Prettier the sources to patch successfully"
@node_modules/prettier/bin-prettier.js --write "app/build/*.js"

@echo "Apply patches from ./patches, default ones:"
@echo "Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)"
@echo "Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)"
@echo "Remove kernel version from User-Agent (https://github.com/aunetx/deezer-linux/pull/9)"
@echo "Avoid to set the text/html mime type (https://github.com/aunetx/deezer-linux/issues/13)"
@echo "Add a better management of MPRIS (https://github.com/aunetx/deezer-linux/pull/61)"
@echo "Apply patches from ./patches:"
@echo "- Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)"
@echo "- Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)"
@echo "- Avoid to set the text/html mime type (https://github.com/aunetx/deezer-linux/issues/13)"
@echo "- Add a better management of MPRIS (https://github.com/aunetx/deezer-linux/pull/61)"
@echo "- Disable auto updater (https://github.com/aunetx/deezer-linux/pull/95)"
@echo "- Remove OS information (https://github.com/aunetx/deezer-linux/pull/95)"
$(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);)

@echo "Append `package-append.json` to the `package.json` of the app"
@echo "Adds electron, elecron-builder dependencies, and build directives"
@head -n -1 app/package.json > tmp.txt && mv tmp.txt app/package.json
@cat package-append.json | tee -a app/package.json
@echo "Adds electron, elecron-builder dependencies, prod and build directives"
@jq -s '.[0] * .[1]' app/package.json package-append.json > app/tmp.json && mv app/tmp.json app/package.json

@echo "Download new packages"
@npm i
Expand Down
4 changes: 2 additions & 2 deletions dev.aunetx.deezer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"sources": [
{
"type": "archive",
"url": "https://e-cdn-content.dzcdn.net/builds/deezer-desktop/8cF2rAuKxLcU1oMDmCYm8Uiqe19Ql0HTySLssdzLkQ9ZWHuDTp2JBtQOvdrFzWPA/win32/x86/6.0.150/DeezerDesktopSetup_6.0.150.exe",
"sha256": "0ecf85dc7988bc1c26bf12f22b800eeb813b943b7453b8ac5fa9a103ccc075f5",
"url": "https://e-cdn-content.dzcdn.net/builds/deezer-desktop/8cF2rAuKxLcU1oMDmCYm8Uiqe19Ql0HTySLssdzLkQ9ZWHuDTp2JBtQOvdrFzWPA/win32/x86/7.0.1/DeezerDesktopSetup_7.0.1.exe",
"sha256": "1ae2de0b55d564da53832cab86eed076132ad1df7420b85b4e6bdfa606a1b195",
"only-arches": ["x86_64"],
"dest": "archive",
"x-checker-data": {
Expand Down
9 changes: 4 additions & 5 deletions package-append.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
,"scripts": {
{
"scripts": {
"copy-resources": "mkdir -p resources/linux && cp ../extra/linux/* ./resources/linux",
"start": "yarn run copy-resources && electron .",
"prepare-flatpak": "electron-builder --linux --dir",
Expand All @@ -15,13 +16,11 @@
"build-appimage-arm64": "electron-builder --arm64 --linux AppImage"
},
"devDependencies": {
"electron": "^13.6.9",
"electron": "^33.2.0",
"electron-builder": "^23.0.3"
},
"build": {
"files": [
"**"
],
"files": ["**"],
"directories": {
"buildResources": "build",
"output": "../artifacts/${arch}"
Expand Down
16 changes: 14 additions & 2 deletions patches/avoid-change-default-texthtml-mime-type.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
From e45c184e8c23aa72f77767c09e6051363806b5f5 Mon Sep 17 00:00:00 2001
From: josselinonduty <[email protected]>
Date: Sun, 19 Jan 2025 23:18:25 +0100
Subject: [PATCH] fix: unset text/html as default mimetype

---
build/main.js | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/build/main.js b/build/main.js
index de51acb..e2c0b9e 100644
index b883a28..60117e3 100644
--- a/build/main.js
+++ b/build/main.js
@@ -2897,12 +2897,7 @@
@@ -2854,12 +2854,7 @@
this.tray.init(),
this.updater.init(),
this.network.watch(),
Expand All @@ -16,3 +25,6 @@ index de51acb..e2c0b9e 100644
const dzrFilter = { urls: ["*://*/*"] },
DOMAINS_WHITELIST = [
"deezer.com",
--
2.43.0

119 changes: 71 additions & 48 deletions patches/better-management-of-MPRIS.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
--- a/build/main.js 2024-05-10 19:00:37.087094880 +0200
+++ b/build/main.js 2024-05-11 17:21:00.996945543 +0200
@@ -72,6 +72,10 @@
var external_url_default = __webpack_require__.n(
external_url_namespaceObject
);
From bbb6b3ccd7f2a0391a4596fbf43d5c81ffec8bc9 Mon Sep 17 00:00:00 2001
From: josselinonduty <[email protected]>
Date: Mon, 20 Jan 2025 16:53:02 +0100
Subject: [PATCH] fix: add better management of MPRIS metadata

---
build/main.js | 72 ++++++++++++++++++++++++++++++++++++++++++---------
package.json | 1 +
2 files changed, 61 insertions(+), 12 deletions(-)

diff --git a/build/main.js b/build/main.js
index 10a80fa..f50c03d 100644
--- a/build/main.js
+++ b/build/main.js
@@ -79,6 +79,10 @@
external_semver_default = __webpack_require__.n(
external_semver_namespaceObject
);
+ const external_electron_mpris_namespaceObject = require("mpris-service");
+ var external_electron_mpris_default = __webpack_require__.n(
+ external_electron_mpris_namespaceObject
+ );
const external_inversify_namespaceObject = require("inversify"),
external_events_namespaceObject = require("events"),
external_semver_namespaceObject =
@@ -1221,8 +1225,9 @@
function isPlatform(platform) {
switch (platform) {
case PLATFORM.WINDOWS:
@@ -1179,8 +1183,9 @@
};
};
let MediaService = class extends external_events_namespaceObject.EventEmitter {
Expand All @@ -22,7 +34,7 @@
(this.smtc = null),
(this.track = {}),
(this.player = {}),
@@ -1230,6 +1235,11 @@
@@ -1188,6 +1193,11 @@
(this.debounceOptions = { leading: !0, maxWait: 500 }),
(this.ipc = ipc),
(this.user = user),
Expand All @@ -34,12 +46,12 @@
isPlatform(PLATFORM.LINUX) &&
(this.user.addListener(UserEvents.LoggedIn, () => {
this.start();
@@ -1237,6 +1247,19 @@
@@ -1195,6 +1205,19 @@
this.user.addListener(UserEvents.LoggedOut, () => {
this.stop();
}));
+ this.initMprisPlayerControls();
+ }
+ this.initMprisPlayerControls();
+ }
+ initMprisPlayerControls() {
+ // Events => ['raise', 'quit', 'next', 'previous', 'pause', 'playpause', 'stop', 'play', 'seek', 'position', 'open', 'volume', 'loopStatus', 'shuffle'];
+ this.mprisPlayer.on('play', this.play.bind(this));
Expand All @@ -50,35 +62,37 @@
+ this.mprisPlayer.on('previous', this.prev.bind(this));
+ this.mprisPlayer.on('shuffle', this.setSuffle.bind(this));
+ this.mprisPlayer.on('loopStatus', this.setRepeatMode.bind(this));
+ this.mprisPlayer.on('raise', () => this.app.getWindow().show());
+ this.mprisPlayer.on('raise', () => this.app.getWindow().show())
}
play() {
this.ipc.send("channel-player-media-control", MediaPlayerControl.Play);
@@ -1264,11 +1287,22 @@
@@ -1222,11 +1245,23 @@
}
setTrackInfo(track) {
(this.track = Object.assign(this.track, track)),
- this.emit(MediaEvents.TrackUpdated, this.track);
+ this.emit(MediaEvents.TrackUpdated, this.track),
+ (this.mprisPlayer.metadata = {
+ 'mpris:trackid': this.mprisPlayer.objectPath('track/0'),
+ 'mpris:artUrl': track.coverUrl,
+ 'xesam:title': track.title,
+ 'xesam:album': track.album,
+ 'xesam:artist': [track.artist]
+ });
+ 'mpris:trackid': this.mprisPlayer.objectPath('track/0'),
+ 'mpris:artUrl': track.coverUrl,
+ 'xesam:title': track.title,
+ 'xesam:album': track.album,
+ 'xesam:artist': [track.artist]
+ });
}
setPlayerInfo(player) {
(this.player = Object.assign(this.player, player)),
this.emit(MediaEvents.PlayerUpdated, this.player);
+ (this.mprisPlayer.playbackStatus =
+ this.player.state === 'playing'
+ ? external_electron_mpris_namespaceObject.PLAYBACK_STATUS_PLAYING
+ : external_electron_mpris_namespaceObject.PLAYBACK_STATUS_PAUSED);
- this.emit(MediaEvents.PlayerUpdated, this.player);
+ this.emit(MediaEvents.PlayerUpdated, this.player),
+ (this.mprisPlayer.playbackStatus =
+ this.player.state === 'playing'
+ ? external_electron_mpris_namespaceObject.PLAYBACK_STATUS_PLAYING
+ : external_electron_mpris_namespaceObject.PLAYBACK_STATUS_PAUSED
+ );
}
getTrackInfo() {
return this.track;
@@ -1328,7 +1362,11 @@
@@ -1286,7 +1321,11 @@
1,
(0, external_inversify_namespaceObject.inject)(SERVICE_USER)
),
Expand All @@ -91,31 +105,36 @@
],
MediaService
);
@@ -2766,14 +2804,18 @@
@@ -2724,14 +2763,20 @@
const PlayerIpc_ipc = main_di.get(SERVICE_IPC),
media = main_di.get(SERVICE_MEDIA),
powerSave = main_di.get(SERVICE_POWER_SAVE);
+ let powerSaveTimoutId;
PlayerIpc_ipc.on(
"channel-player-state-update",
- PlayerIpc_ipc.on(
- "channel-player-state-update",
- external_lodash_debounce_default()((event, state) => {
- media.setPlayerInfo({ state }),
+ (event, state) => {
+ media.setPlayerInfo({ state });
+ clearTimeout(powerSaveTimoutId);
+ powerSaveTimoutId = setTimeout(()=> {
state === MediaPlayerState.Playing
- state === MediaPlayerState.Playing
- ? powerSave.start()
- : powerSave.stop();
- }, 3e3)
+ ? powerSave.start()
+ : powerSave.stop();
+ }, 3e3);
+ }
+ var powerSaveTimeoutId;
+ PlayerIpc_ipc.on(
+ "channel-player-state-update",
+ (event, state) => {
+ media.setPlayerInfo({ state }),
+ clearTimeout(powerSaveTimeoutId),
+ powerSaveTimeoutId = setTimeout(
+ () => {
+ state === MediaPlayerState.Playing
+ ? powerSave.start()
+ : powerSave.stop();
+ }, 3e3
+ );
+ }
),
PlayerIpc_ipc.on(
"channel-player-track-update",
@@ -2865,6 +2907,9 @@
@@ -2819,6 +2864,9 @@
"autoplay-policy",
"no-user-gesture-required"
),
Expand All @@ -125,14 +144,18 @@
external_electron_namespaceObject.app.on(
"second-instance",
(event, argv) => {

--- a/package.json 2024-05-10 19:00:37.091094948 +0200
+++ b/package.json 2024-05-10 21:54:32.411123286 +0200
@@ -25,6 +25,7 @@
diff --git a/package.json b/package.json
index 290f49a..3560ca9 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"lodash.debounce": "^4.0.8",
"lodash.get": "^4.4.2",
"macos-version": "^5.2.1",
+ "mpris-service": "^2.1.2",
"object.assign": "^4.1.2",
"raven": "^2.6.4",
"reflect-metadata": "^0.1.13",
"reflect-metadata": "^0.2.2",
"semver": "^7.6.0",
--
2.43.0

28 changes: 28 additions & 0 deletions patches/disable-auto-updater.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 864e07d4bac769cbc077a4a3d50a431f2158080c Mon Sep 17 00:00:00 2001
From: josselinonduty <[email protected]>
Date: Mon, 20 Jan 2025 00:46:23 +0100
Subject: [PATCH] fix: disable autoupdater for linux

---
build/main.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/build/main.js b/build/main.js
index 9ea7c18..10a80fa 100644
--- a/build/main.js
+++ b/build/main.js
@@ -2322,9 +2322,8 @@
}
}
init() {
- this.arch &&
- ((isPlatform(PLATFORM.LINUX) && !process.env.APPIMAGE) ||
- isWindowsStore() ||
+ this.arch && !isPlatform(PLATFORM.LINUX) && (
+ isWindowsStore() ||
"yes" === process.env.DZ_DISABLE_UPDATE ||
((external_electron_updater_namespaceObject.autoUpdater.autoDownload =
!0),
--
2.43.0

54 changes: 0 additions & 54 deletions patches/fix-isDev-usage.patch

This file was deleted.

Loading
Loading