mirror of
https://github.com/cucumber-sp/yandex-music-linux.git
synced 2025-03-13 22:03:43 +03:00
Merge pull request #11 from ein-shved/main
Some fixes after shipping to asar package
This commit is contained in:
commit
39358d959a
@ -56,13 +56,13 @@
|
|||||||
"ymExe": {
|
"ymExe": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"narHash": "sha256-JEtqtRkBhbUN7+rcVzTrf2DjaIgr4MwSpunQPDV9/O0=",
|
"narHash": "sha256-HeqFJ+hY/8TjViz6SjfklMoVpX6+54pL0Vl1cI1Qlkw=",
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.7.exe"
|
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.8.exe"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.7.exe"
|
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.8.exe"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
description = "Native Yandex Music desktop client";
|
description = "Native Yandex Music desktop client";
|
||||||
inputs = {
|
inputs = {
|
||||||
ymExe = {
|
ymExe = {
|
||||||
url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.7.exe;
|
url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.8.exe;
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -20,6 +20,9 @@
|
|||||||
{
|
{
|
||||||
packages = rec {
|
packages = rec {
|
||||||
yandex-music = yandex-music-with pkgs;
|
yandex-music = yandex-music-with pkgs;
|
||||||
|
yandex-music-backgroud = yandex-music.override {
|
||||||
|
fixQuit = false;
|
||||||
|
};
|
||||||
default = yandex-music;
|
default = yandex-music;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mkdir -p ./tmp
|
set -e
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
rm -rf "$TEMPDIR"
|
||||||
|
}
|
||||||
|
TEMPDIR="$(mktemp -d)"
|
||||||
|
trap clear EXIT
|
||||||
|
|
||||||
# loading json from file https://music-desktop-application.s3.yandex.net/stable/download.json
|
# loading json from file https://music-desktop-application.s3.yandex.net/stable/download.json
|
||||||
curl -s https://music-desktop-application.s3.yandex.net/stable/download.json > ./tmp/download.json
|
curl -s https://music-desktop-application.s3.yandex.net/stable/download.json > "$TEMPDIR"/download.json
|
||||||
|
|
||||||
exe_link=$(jq -r '.windows' ./tmp/download.json)
|
exe_link=$(jq -r '.windows' "$TEMPDIR"/download.json)
|
||||||
version=$(echo $exe_link | grep -oP '(?<=x64_).*(?=.exe)')
|
version="$(echo "$exe_link" | grep -oP '(?<=x64_).*(?=.exe)')"
|
||||||
exe_name=$(basename $exe_link)
|
exe_name="$(basename "$exe_link")"
|
||||||
|
|
||||||
echo "Windows url: $exe_link"
|
echo "Windows url: $exe_link"
|
||||||
echo "Version: $version"
|
echo "Version: $version"
|
||||||
echo "Exe name: $exe_name"
|
echo "Exe name: $exe_name"
|
||||||
|
|
||||||
curl $exe_link > ./tmp/$exe_name
|
curl "$exe_link" > "$TEMPDIR/$exe_name"
|
||||||
|
|
||||||
exe_sha256=$(sha256sum ./tmp/$exe_name | awk '{print $1}')
|
exe_sha256="$(sha256sum "$TEMPDIR/$exe_name" | awk '{print $1}')"
|
||||||
|
|
||||||
echo "Exe sha256: $exe_sha256"
|
echo "Exe sha256: $exe_sha256"
|
||||||
|
|
||||||
@ -36,5 +42,3 @@ sed -i "s#%release%#1#g" ./PKGBUILD
|
|||||||
sed -i "s#%exe_name%#$exe_name#g" ./PKGBUILD
|
sed -i "s#%exe_name%#$exe_name#g" ./PKGBUILD
|
||||||
sed -i "s#%exe_link%#$exe_link#g" ./PKGBUILD
|
sed -i "s#%exe_link%#$exe_link#g" ./PKGBUILD
|
||||||
sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD
|
sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD
|
||||||
|
|
||||||
rm -rf ./tmp
|
|
@ -10,6 +10,7 @@
|
|||||||
, jq
|
, jq
|
||||||
|
|
||||||
, ymExe
|
, ymExe
|
||||||
|
, fixQuit ? true
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
app = runCommand "yandex-music-app"
|
app = runCommand "yandex-music-app"
|
||||||
@ -18,14 +19,13 @@ let
|
|||||||
repack = ./../repack.sh;
|
repack = ./../repack.sh;
|
||||||
src = ymExe;
|
src = ymExe;
|
||||||
} ''
|
} ''
|
||||||
bash "$repack" -x "$src"
|
bash "$repack" ${if !fixQuit then "-q" else ""} -o "$out" "$src"
|
||||||
mv ./app "$out"
|
|
||||||
'';
|
'';
|
||||||
launcher = writeShellApplication {
|
launcher = writeShellApplication {
|
||||||
name = "yandex-music";
|
name = "yandex-music";
|
||||||
runtimeInputs = [ electron ];
|
runtimeInputs = [ electron ];
|
||||||
text = ''
|
text = ''
|
||||||
electron ${app} "$@"
|
electron ${app}/yandexmusic.asar "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
desktopItem = makeDesktopItem {
|
desktopItem = makeDesktopItem {
|
||||||
@ -34,7 +34,7 @@ let
|
|||||||
comment = "Yandex Music - we collect music for you";
|
comment = "Yandex Music - we collect music for you";
|
||||||
exec = "${launcher}/bin/yandex-music";
|
exec = "${launcher}/bin/yandex-music";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
icon = "${app}/build/next-desktop/favicon.svg";
|
icon = "${app}/favicon.svg";
|
||||||
categories = [ "Audio" "Music" "Player" "AudioVideo" ];
|
categories = [ "Audio" "Music" "Player" "AudioVideo" ];
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
"Name[ru]" = "Яндекс Музыка";
|
"Name[ru]" = "Яндекс Музыка";
|
||||||
|
85
repack.sh
85
repack.sh
@ -1,38 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
prompt_yes_no() {
|
|
||||||
local question="$1"
|
|
||||||
local response
|
|
||||||
while true; do
|
|
||||||
read -rp "$question (y/n): " response
|
|
||||||
case $response in
|
|
||||||
[Yy]*)
|
|
||||||
return 0 # Returning success status code
|
|
||||||
;;
|
|
||||||
[Nn]*)
|
|
||||||
return 1 # Returning failure status code
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Please enter 'y' (yes) or 'n' (no)."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $(basename "$0") [-xh] YANDEX_MUSIC_EXE"
|
echo "Usage: $(basename "$0") [-xqh] [ -o DIR] YANDEX_MUSIC_EXE"
|
||||||
echo
|
echo
|
||||||
echo " Options:"
|
echo " Options:"
|
||||||
echo " -x Extract and fix only to ./app folder"
|
echo " -o DIR Path to destination folder"
|
||||||
|
echo " -x Extract and fix only to destination folder"
|
||||||
|
echo " -q Do not apply application quit fix"
|
||||||
echo " -h Show this help and exit"
|
echo " -h Show this help and exit"
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_only=
|
|
||||||
exe_location=
|
exe_location=
|
||||||
while getopts :xh name; do
|
dst="$PWD/app"
|
||||||
|
fix_quit=1
|
||||||
|
while getopts :xo:qh name; do
|
||||||
case $name in
|
case $name in
|
||||||
x) extract_only=1 ;;
|
x) extract_only=1 ;;
|
||||||
|
o) dst="$OPTARG" ;;
|
||||||
|
q) fix_quit=0 ;;
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
@ -56,18 +43,27 @@ if [ -z "$exe_location" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# unpacking
|
clear() {
|
||||||
7z x "$exe_location" -oExtracted
|
rm -rf "$TEMPDIR"
|
||||||
cp "./Extracted/\$PLUGINSDIR/app-64.7z" "./app-64.7z"
|
}
|
||||||
rm -rf ./Extracted
|
TEMPDIR="$(mktemp -d)"
|
||||||
7z x "./app-64.7z" -oExtracted
|
trap clear EXIT
|
||||||
cp "./Extracted/resources/app.asar" "./app.asar"
|
|
||||||
rm -rf ./Extracted
|
|
||||||
rm ./app-64.7z
|
|
||||||
asar extract "./app.asar" "./app"
|
|
||||||
rm "./app.asar"
|
|
||||||
|
|
||||||
cd ./app
|
|
||||||
|
EXTRACTED="$TEMPDIR/Extracted"
|
||||||
|
# unpacking
|
||||||
|
7z x "$exe_location" -o"$EXTRACTED"
|
||||||
|
mv "$EXTRACTED/\$PLUGINSDIR/app-64.7z" "$TEMPDIR/app-64.7z"
|
||||||
|
rm -rf "$EXTRACTED"
|
||||||
|
7z x "$TEMPDIR/app-64.7z" -o"$EXTRACTED"
|
||||||
|
mv "$EXTRACTED/resources/app.asar" "$TEMPDIR/app.asar"
|
||||||
|
rm -rf "$EXTRACTED"
|
||||||
|
rm "$TEMPDIR/app-64.7z"
|
||||||
|
asar extract "$TEMPDIR/app.asar" "$TEMPDIR/app"
|
||||||
|
rm "$TEMPDIR/app.asar"
|
||||||
|
|
||||||
|
curdir="$PWD"
|
||||||
|
cd "$TEMPDIR/app"
|
||||||
|
|
||||||
# fixing secretKey issue
|
# fixing secretKey issue
|
||||||
echo "Fixing SecretKey"
|
echo "Fixing SecretKey"
|
||||||
@ -86,8 +82,11 @@ find "./" -type f -name "*.html" -print0 | while IFS= read -r -d $'\0' file; do
|
|||||||
done
|
done
|
||||||
echo "Title Fixed"
|
echo "Title Fixed"
|
||||||
|
|
||||||
echo "Fixing App Quiting"
|
if [ "$fix_quit" == "1" ]; then
|
||||||
sed -i "s/window.on('close', (event) => {/window.on('close', (event) => {electron_1.app.quit();/g" "./main/lib/handlers/handleWindowLifecycleEvents.js"
|
echo "Fixing App Quiting"
|
||||||
|
sed -i "s/window.on('close', (event) => {/window.on('close', (event) => {electron_1.app.quit();/g" \
|
||||||
|
"./main/lib/handlers/handleWindowLifecycleEvents.js"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! command -v jq &>/dev/null; then
|
if ! command -v jq &>/dev/null; then
|
||||||
echo "Error: jq is not installed. Please install jq to proceed." >&2
|
echo "Error: jq is not installed. Please install jq to proceed." >&2
|
||||||
@ -97,22 +96,24 @@ fi
|
|||||||
jq --arg license "UNLICENSED" '. + {license: $license}' package.json > tmp_package.json
|
jq --arg license "UNLICENSED" '. + {license: $license}' package.json > tmp_package.json
|
||||||
mv tmp_package.json package.json
|
mv tmp_package.json package.json
|
||||||
echo "Updated license field in package.json"
|
echo "Updated license field in package.json"
|
||||||
version=$(jq -r .version package.json)
|
|
||||||
|
|
||||||
jq '. + {icon: {"48x48": "build/next-desktop/favicon.png", "scalable": "build/next-desktop/favicon.svg"}}' package.json > tmp_package.json
|
jq '. + {icon: {"48x48": "build/next-desktop/favicon.png", "scalable": "build/next-desktop/favicon.svg"}}' package.json > tmp_package.json
|
||||||
mv tmp_package.json package.json
|
mv tmp_package.json package.json
|
||||||
echo "Updated icon field in package.json"
|
echo "Updated icon field in package.json"
|
||||||
|
|
||||||
if [ -n "$extract_only" ]; then
|
if [ -n "$extract_only" ]; then
|
||||||
|
mkdir -p "$(dirname "$dst")"
|
||||||
|
mv "$TEMPDIR/app" "$dst"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ../
|
mkdir -p "$dst"
|
||||||
mkdir -p out
|
|
||||||
|
|
||||||
echo "Packing"
|
echo "Packing"
|
||||||
asar pack "./app" "./out/yandexmusic.asar"
|
cd "$curdir"
|
||||||
|
asar pack "$TEMPDIR/app" "$dst/yandexmusic.asar"
|
||||||
|
for ext in png svg; do
|
||||||
|
mv "$TEMPDIR/app/build/next-desktop/favicon.$ext" "$dst"
|
||||||
|
done
|
||||||
|
|
||||||
rm -rf ./app
|
echo "Done"
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
|
@ -27,12 +27,12 @@ package() {
|
|||||||
mkdir -p "$pkgdir/usr/bin"
|
mkdir -p "$pkgdir/usr/bin"
|
||||||
|
|
||||||
install -Dm644 "$srcdir/out/yandexmusic.asar" "$pkgdir/usr/lib/yandexmusic/yandexmusic.asar"
|
install -Dm644 "$srcdir/out/yandexmusic.asar" "$pkgdir/usr/lib/yandexmusic/yandexmusic.asar"
|
||||||
|
install -Dm644 "$srcdir/out/favicon.png" "$pkgdir/usr/share/pixmaps/yandexmusic.png"
|
||||||
install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandexmusic.desktop"
|
install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandexmusic.desktop"
|
||||||
install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||||
install -Dm644 "$srcdir/yandex-music-linux/templates/icon.png" "$pkgdir/usr/share/pixmaps/yandexmusic.png"
|
|
||||||
|
|
||||||
# Create a script to launch the app with Electron
|
# Create a script to launch the app with Electron
|
||||||
echo "#!/bin/sh" > "$pkgdir/usr/bin/yandexmusic"
|
echo "#!/bin/sh" > "$pkgdir/usr/bin/yandexmusic"
|
||||||
echo "electron /usr/lib/yandexmusic/yandexmusic.asar" >> "$pkgdir/usr/bin/yandexmusic"
|
echo 'exec electron /usr/lib/yandexmusic/yandexmusic.asar "$@"' >> "$pkgdir/usr/bin/yandexmusic"
|
||||||
chmod 755 "$pkgdir/usr/bin/yandexmusic"
|
chmod 755 "$pkgdir/usr/bin/yandexmusic"
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 544 B |
Loading…
Reference in New Issue
Block a user