Skip to content

Commit e5cd64a

Browse files
authored
Merge pull request #95 from josselinonduty/feat/deezer-v7
Release: Deezer v7
2 parents c65da96 + 5bd7ead commit e5cd64a

20 files changed

+1110
-320
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ flatpak
33
source
44
app
55
package-lock.json
6+
yarn.lock
67
artifacts
78
package.json
89
.vscode/launch.json

CONTRIBUTING.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Contributing to Deezer Linux
2+
3+
Thank you for considering contributing to the unofficial Deezer Linux port! This document provides guidelines for contributing to the project.
4+
5+
## Code of Conduct
6+
7+
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
8+
9+
## How to Contribute
10+
11+
### Reporting Bugs
12+
13+
- Before creating an issue, please check if it hasn't been reported already
14+
- Use the issue template if available
15+
- Include detailed steps to reproduce the bug
16+
- Specify your system information (OS, architecture, package type)
17+
18+
### Suggesting Enhancements
19+
20+
- Use clear and descriptive titles
21+
- Provide a step-by-step description of the suggested enhancement
22+
- Explain why this enhancement would be useful
23+
24+
### Pull Requests
25+
26+
1. Fork the repository
27+
2. Create a new branch (`git checkout -b feature/your-feature`)
28+
3. Make your changes
29+
4. Build one or more packages
30+
5. Commit your changes (`git commit -m 'feat: Add some feature'`)
31+
6. Push to the branch (`git push origin feature/your-feature`)
32+
7. Open a Pull Request
33+
8. Provide information about the changes made and the packages built and manually tested
34+
35+
### Build Requirements
36+
37+
Ensure you have all required dependencies:
38+
39+
- Node.js (20 recommended)
40+
- npm
41+
- 7z
42+
- make
43+
- wget
44+
45+
## Development Setup
46+
47+
```sh
48+
make install_deps
49+
```
50+
51+
## Patching
52+
53+
### Creating a Patch
54+
55+
To create a patch, clone the repository and run:
56+
57+
```sh
58+
make patch-new
59+
```
60+
61+
Edit the files you want to change in the `app` directory.
62+
63+
> [!TIP]
64+
> You do not need to generate a patch file to test your changes. Open the `app` folder after running `make patch-new` and make your changes. Then run `make build_{target}_{arch}` to try your changes.
65+
66+
When you are done, commit your changes, and then generate the patch:
67+
68+
```sh
69+
make patch-gen
70+
```
71+
72+
The patch will be saved in the `patches` directory. Make sure to rename the patch file to something meaningful and follow the naming convention. Add the patch to the echoed list in the `Makefile`.
73+
74+
> [!TIP]
75+
> If possible, you may want to add a switch to allow the users to use the feature you added or not. Do not forget to [mention it](./README.md#usage).
76+
77+
You can now try your patch by building and executing the package:
78+
79+
```sh
80+
make build_{target}_{arch}
81+
```
82+
83+
### Applying a Patch
84+
85+
To manually apply a patch, run:
86+
87+
```sh
88+
apply -p1 -dapp < patches/{name}.patch
89+
```
90+
91+
> [!NOTE]
92+
> Deezer does not provide all the information needed to implement some features.
93+
>
94+
> Deezer provides:
95+
>
96+
> - Player state (playing, paused)
97+
> - Track metadata (title, artist, album, cover URL, duration, and more)
98+
> - Shuffle and repeat state
99+
>
100+
> Deezer does not provide:
101+
>
102+
> - Track position
103+
104+
## Updating
105+
106+
### Updating the Source Executable
107+
108+
_This section is automated via GitHub Actions, but can be done manually._
109+
110+
1. Update the source executable URL:
111+
112+
```sh
113+
curl -Ls -o /dev/null -w %{url_effective} https://www.deezer.com/desktop/download\?platform\=win32\&architecture\=x86
114+
```
115+
116+
2. Update the source executable SHA256:
117+
118+
```sh
119+
curl -Ls https://www.deezer.com/desktop/download\?platform\=win32\&architecture\=x86 | sha256sum
120+
```
121+
122+
### Updating the Electron Version
123+
124+
_This section is not automated via GitHub Actions._
125+
126+
To get the Electron version used, run:
127+
128+
```sh
129+
strings ./source/Deezer.exe | grep '^Chrome/[0-9.]* Electron/[0-9.]*'
130+
```
131+
132+
## Legal Notes
133+
134+
Remember that this is an unofficial port. Any contribution must:
135+
136+
- Respect Deezer's intellectual property
137+
- Not modify core Deezer functionality
138+
- Follow software distribution best practices
139+
140+
## Questions?
141+
142+
Open an issue for any questions not covered by this guide.
143+
144+
Thank you for contributing!

Makefile

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,89 +5,118 @@ BASE_URL = $(shell jq ".modules[0].sources[0].url" dev.aunetx.deezer.json)
55
SHA256 = $(shell jq ".modules[0].sources[0].sha256" dev.aunetx.deezer.json)
66
PKGVER = $(shell echo $(BASE_URL) | grep -Eo "([0-9]+\.[0-9]+\.[0-9]+)" | head -1)
77
VERSION_REGEX = ^v$(PKGVER)-[0-9]{1,}$$
8-
8+
SOURCE_DIR ?= ./source
9+
APP_DIR ?= ./app
10+
PACKAGE_MANAGER ?= npm
11+
PACKAGE_MANAGER_SUBDIR_ARG ?= --prefix
12+
PACKAGE_MANAGER_INSTALL_CMD ?= install
13+
PACKAGE_MANAGER_ADD_CMD ?= install
914

1015
install_build_deps:
11-
@npm install --engine-strict asar
12-
@npm install prettier@2.8.8
16+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_ADD_CMD) @electron/asar@3.2.18 --engine-strict
17+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_ADD_CMD) prettier@2.8.8
1318

1419
prepare: clean install_build_deps
15-
@mkdir -p source
20+
@mkdir -p $(SOURCE_DIR)
1621

1722
@echo "Download installer"
18-
@wget -nv $(BASE_URL) -O source/deezer-setup-$(PKGVER).exe
23+
@wget -nv $(BASE_URL) -O $(SOURCE_DIR)/deezer-setup-$(PKGVER).exe
1924

2025
@echo "Verify installer"
21-
@echo "$(SHA256) source/deezer-setup-$(PKGVER).exe" | sha256sum -c --status || exit 1
26+
@echo "$(SHA256) $(SOURCE_DIR)/deezer-setup-$(PKGVER).exe" | sha256sum -c --status || exit 1
2227

2328
@echo "Extract app archive from installer"
24-
@cd source && 7z x -so deezer-setup-$(PKGVER).exe '$$PLUGINSDIR/app-32.7z' > app-32.7z
29+
@cd $(SOURCE_DIR) && 7z x -so deezer-setup-$(PKGVER).exe '$$PLUGINSDIR/app-32.7z' > app-32.7z
2530

2631
@echo "Extract app from app archive"
27-
@cd source && 7z x -y -bsp0 -bso0 app-32.7z
32+
@cd $(SOURCE_DIR) && 7z x -y -bsp0 -bso0 app-32.7z
2833

2934
@echo "Extract app sources from the app"
30-
@node_modules/asar/bin/asar.js extract source/resources/app.asar app
35+
@node_modules/@electron/asar/bin/asar.js extract $(SOURCE_DIR)/resources/app.asar $(APP_DIR)
3136

3237
@echo "Prettier the sources to patch successfully"
33-
@node_modules/prettier/bin-prettier.js --write "app/build/*.js"
34-
35-
@echo "Apply patches from ./patches, default ones:"
36-
@echo "Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)"
37-
@echo "Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)"
38-
@echo "Remove kernel version from User-Agent (https://github.com/aunetx/deezer-linux/pull/9)"
39-
@echo "Avoid to set the text/html mime type (https://github.com/aunetx/deezer-linux/issues/13)"
40-
@echo "Add a better management of MPRIS (https://github.com/aunetx/deezer-linux/pull/61)"
41-
$(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);)
38+
@node_modules/prettier/bin-prettier.js --write "$(APP_DIR)/build/*.js"
39+
40+
@echo "Apply patches from ./patches:"
41+
@echo "01 - Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)"
42+
@echo "02 - Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)"
43+
@echo "03 - Avoid to set the text/html mime type (https://github.com/aunetx/deezer-linux/issues/13)"
44+
@echo "04 - Disable auto updater (https://github.com/aunetx/deezer-linux/pull/95)"
45+
@echo "05 - Remove OS information (https://github.com/aunetx/deezer-linux/pull/95)"
46+
@echo "06 - Add a better management of MPRIS (https://github.com/aunetx/deezer-linux/pull/61)"
47+
@echo "07 - Add Discord Rich Presence (https://github.com/aunetx/deezer-linux/pull/82)"
48+
@echo "08 - Add option to disable Discord Rich Presence (https://github.com/aunetx/deezer-linux/pull/95)"
49+
@echo "09 - Add environment variable to change log level (https://github.com/aunetx/deezer-linux/pull/95)"
50+
@echo "10 - Add track duration and url, various fixes (https://github.com/aunetx/deezer-linux/pull/95)"
51+
$(foreach p, $(wildcard ./patches/*), patch -p 1 -d $(APP_DIR) < $(p);)
4252

4353
@echo "Append `package-append.json` to the `package.json` of the app"
44-
@echo "Adds electron, elecron-builder dependencies, and build directives"
45-
@head -n -1 app/package.json > tmp.txt && mv tmp.txt app/package.json
46-
@cat package-append.json | tee -a app/package.json
54+
@echo "Adds electron, elecron-builder dependencies, prod and build directives"
55+
@jq -s '.[0] * .[1]' $(APP_DIR)/package.json package-append.json > $(APP_DIR)/tmp.json && mv $(APP_DIR)/tmp.json $(APP_DIR)/package.json
4756

4857
@echo "Download new packages"
49-
@npm i
58+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_INSTALL_CMD)
5059

5160
#! PACKAGES
5261

5362
install_deps: prepare
54-
@echo "Install yarn dependencies to pack them later"
55-
@yarn --cwd=app install
63+
@echo "Install $(PACKAGE_MANAGER) dependencies to pack them later"
64+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) $(PACKAGE_MANAGER_INSTALL_CMD)
5665

5766

5867
build_tar.xz_x64:
5968
@echo "Build tar.xz archive"
60-
@yarn --cwd=app run build-tar.xz-x64
69+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-tar.xz-x64
6170

6271
build_deb_x64:
6372
@echo "Build deb package"
64-
@yarn --cwd=app run build-deb-x64
73+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-deb-x64
6574

6675
build_rpm_x64:
6776
@echo "Build rpm package"
68-
@yarn --cwd=app run build-rpm-x64
77+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-rpm-x64
6978

7079
build_appimage_x64:
7180
@echo "Build AppImage binary"
72-
@yarn --cwd=app run build-appimage-x64
81+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-appimage-x64
82+
83+
build_snap_x64:
84+
@echo "Build Snap package"
85+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-snap-x64
7386

7487

7588
build_tar.xz_arm64:
7689
@echo "Build tar.xz archive"
77-
@yarn --cwd=app run build-tar.xz-arm64
90+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-tar.xz-arm64
7891

7992
build_deb_arm64:
8093
@echo "Build deb package"
81-
@yarn --cwd=app run build-deb-arm64
94+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-deb-arm64
8295

8396
build_rpm_arm64:
8497
@echo "Build rpm package"
85-
@yarn --cwd=app run build-rpm-arm64
98+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-rpm-arm64
8699

87100
build_appimage_arm64:
88101
@echo "Build AppImage binary"
89-
@yarn --cwd=app run build-appimage-arm64
102+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-appimage-arm64
103+
104+
build_snap_arm64:
105+
@echo "Build Snap package"
106+
@$(PACKAGE_MANAGER) $(PACKAGE_MANAGER_SUBDIR_ARG) $(APP_DIR) run build-snap-arm64
107+
108+
#! DEV
109+
110+
patch-new: install_deps
111+
@echo "Setting up the development environment..."
112+
@cd $(APP_DIR) && echo "node_modules\n*.diff\n*.orig" > .gitignore && git init && git add .
113+
@cd $(APP_DIR) && git commit -m "initial commit"
114+
@echo "You can now edit the sources in the $(APP_DIR) directory"
115+
@echo "When you are done, commit your changes, run 'make patch-gen'."
116+
@echo "Don't forget to rename your patch."
90117

118+
patch-gen:
119+
@cd $(APP_DIR) && git format-patch -1 HEAD --stdout > ../patches/$(shell date +%y%m%d-%s).patch
91120

92121
#! UTILS
93122

@@ -107,4 +136,4 @@ release: prepare-release
107136

108137

109138
clean:
110-
@rm -rf app flatpak node_modules source artifacts package-lock.json package.json
139+
@rm -rf ./$(APP_DIR) flatpak node_modules ./$(SOURCE_DIR) artifacts package.json

0 commit comments

Comments
 (0)