Skip to content

Commit 2e18069

Browse files
committed
Fix macos & linux playback
1 parent da14e65 commit 2e18069

37 files changed

Lines changed: 1819 additions & 491 deletions

.github/workflows/release.yml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
permissions:
1313
contents: write
1414

15+
env:
16+
RELEASE_TAG: ${{ inputs.release_tag || github.event.release.tag_name }}
17+
1518
jobs:
1619
release:
1720
name: Build ${{ matrix.platform.name }}
@@ -47,40 +50,36 @@ jobs:
4750
run: gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY"
4851
env:
4952
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
RELEASE_TAG: ${{ inputs.release_tag }}
5153

52-
- name: Read release notification marker
54+
- name: Read release type
5355
id: release_metadata
5456
shell: bash
5557
run: |
5658
set -euo pipefail
57-
gh release view "$RELEASE_TAG" \
59+
is_prerelease="$(gh release view "$RELEASE_TAG" \
5860
--repo "$GITHUB_REPOSITORY" \
59-
--json body \
60-
--jq .body > "$RUNNER_TEMP/release-body.txt"
61+
--json isPrerelease \
62+
--jq .isPrerelease)"
6163
62-
if grep -Fqi '[notify-update]' "$RUNNER_TEMP/release-body.txt"; then
63-
echo "notify_update=true" >> "$GITHUB_OUTPUT"
64+
if test "$is_prerelease" = "true"; then
65+
echo "publish_update=false" >> "$GITHUB_OUTPUT"
6466
else
65-
echo "notify_update=false" >> "$GITHUB_OUTPUT"
67+
echo "publish_update=true" >> "$GITHUB_OUTPUT"
6668
fi
6769
env:
6870
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
RELEASE_TAG: ${{ inputs.release_tag }}
7071

7172
- name: Check out repository
7273
uses: actions/checkout@v4
7374
with:
74-
ref: ${{ inputs.release_tag }}
75+
ref: ${{ env.RELEASE_TAG }}
7576
fetch-depth: 0
7677

7778
- name: Verify checked out tag
7879
shell: bash
7980
run: |
8081
set -euo pipefail
8182
test "$(git describe --tags --exact-match)" = "$RELEASE_TAG"
82-
env:
83-
RELEASE_TAG: ${{ inputs.release_tag }}
8483
8584
- name: Set up Node.js
8685
uses: actions/setup-node@v4
@@ -130,9 +129,10 @@ jobs:
130129
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
131130
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
132131
with:
133-
tagName: ${{ inputs.release_tag }}
132+
tagName: ${{ env.RELEASE_TAG }}
134133
releaseDraft: false
135-
uploadUpdaterJson: ${{ steps.release_metadata.outputs.notify_update }}
134+
uploadUpdaterJson: ${{ steps.release_metadata.outputs.publish_update }}
135+
uploadUpdaterSignatures: false
136136
updaterJsonPreferNsis: true
137137
args: ${{ matrix.platform.build_args }}
138138

@@ -146,7 +146,6 @@ jobs:
146146
--clobber
147147
env:
148148
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149-
RELEASE_TAG: ${{ inputs.release_tag }}
150149

151150
- name: Verify macOS DMG and app signature
152151
if: startsWith(matrix.platform.name, 'macOS')
@@ -180,30 +179,29 @@ jobs:
180179
- name: Check out repository
181180
uses: actions/checkout@v4
182181
with:
183-
ref: ${{ inputs.release_tag }}
182+
ref: ${{ env.RELEASE_TAG }}
184183
fetch-depth: 0
185184

186-
- name: Read release notification marker
185+
- name: Read release type
187186
id: release_metadata
188187
shell: bash
189188
run: |
190189
set -euo pipefail
191-
gh release view "$RELEASE_TAG" \
190+
is_prerelease="$(gh release view "$RELEASE_TAG" \
192191
--repo "$GITHUB_REPOSITORY" \
193-
--json body \
194-
--jq .body > "$RUNNER_TEMP/release-body.txt"
192+
--json isPrerelease \
193+
--jq .isPrerelease)"
195194
196-
if grep -Fqi '[notify-update]' "$RUNNER_TEMP/release-body.txt"; then
197-
echo "notify_update=true" >> "$GITHUB_OUTPUT"
195+
if test "$is_prerelease" = "true"; then
196+
echo "publish_update=false" >> "$GITHUB_OUTPUT"
198197
else
199-
echo "notify_update=false" >> "$GITHUB_OUTPUT"
198+
echo "publish_update=true" >> "$GITHUB_OUTPUT"
200199
fi
201200
env:
202201
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
203-
RELEASE_TAG: ${{ inputs.release_tag }}
204202

205203
- name: Download generated updater metadata
206-
if: steps.release_metadata.outputs.notify_update == 'true'
204+
if: steps.release_metadata.outputs.publish_update == 'true'
207205
shell: bash
208206
run: |
209207
set -euo pipefail
@@ -214,10 +212,9 @@ jobs:
214212
test -s "$RUNNER_TEMP/updater-channel/latest.json"
215213
env:
216214
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
217-
RELEASE_TAG: ${{ inputs.release_tag }}
218215

219216
- name: Publish updater channel
220-
if: steps.release_metadata.outputs.notify_update == 'true'
217+
if: steps.release_metadata.outputs.publish_update == 'true'
221218
shell: bash
222219
run: |
223220
set -euo pipefail
@@ -243,5 +240,3 @@ jobs:
243240
244241
git commit -m "Offer $RELEASE_TAG through the updater"
245242
git push origin updater-channel
246-
env:
247-
RELEASE_TAG: ${{ inputs.release_tag }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "just-another-music-client",
33
"private": true,
4-
"version": "1.2.32",
4+
"version": "1.2.5",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 57 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "just-another-music-client"
3-
version = "1.2.32"
3+
version = "1.2.5"
44
description = "A desktop music client"
55
authors = ["you"]
66
edition = "2021"
@@ -21,6 +21,8 @@ tauri-build = { version = "2", features = [] }
2121
tauri = { version = "2", features = [] }
2222
tauri-plugin-autostart = "2"
2323
tauri-plugin-opener = "2"
24+
tauri-plugin-localhost = "2"
25+
portpicker = "0.1"
2426
serde = { version = "1", features = ["derive"] }
2527
serde_json = "1"
2628
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "gzip", "brotli", "deflate"] }

src-tauri/capabilities/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626
},
2727
"remote": {
28-
"urls": ["https://**"]
28+
"urls": ["https://**", "http://localhost/**", "http://127.0.0.1/**"]
2929
},
3030
"command": {
3131
"allow": [

src-tauri/src/lib.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
22
use base64::{engine::general_purpose::STANDARD, Engine as _};
3+
#[cfg(not(debug_assertions))]
4+
use portpicker::pick_unused_port;
35
use serde::{Deserialize, Serialize};
46
use std::collections::HashMap;
57
use std::fs;
@@ -8,6 +10,8 @@ use std::path::{Path, PathBuf};
810
use std::sync::Mutex;
911
use std::thread;
1012
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
13+
use tauri::utils::config::FrontendDist;
14+
use tauri::utils::config_v1::WindowUrl;
1115
use tauri::Manager;
1216

1317
#[cfg(target_os = "macos")]
@@ -1693,14 +1697,27 @@ pub fn run() {
16931697
}
16941698
}
16951699

1696-
let builder = tauri::Builder::default()
1700+
let mut context = tauri::generate_context!();
1701+
let mut builder = tauri::Builder::default()
16971702
.manage(CacheLock(Mutex::new(())))
16981703
.manage(discord_manager)
16991704
.plugin(tauri_plugin_autostart::Builder::new().build())
17001705
.plugin(tauri_plugin_updater::Builder::new().build())
17011706
.plugin(tauri_plugin_process::init())
17021707
.plugin(tauri_plugin_opener::init());
17031708

1709+
#[cfg(not(debug_assertions))]
1710+
{
1711+
let port = pick_unused_port().expect("failed to find an unused localhost port");
1712+
let url: url::Url = format!("http://localhost:{}", port)
1713+
.parse()
1714+
.expect("failed to parse localhost url");
1715+
let _window_url = WindowUrl::External(url.clone());
1716+
1717+
context.config_mut().build.frontend_dist = Some(FrontendDist::Url(url));
1718+
builder = builder.plugin(tauri_plugin_localhost::Builder::new(port).build());
1719+
}
1720+
17041721
#[cfg(target_os = "windows")]
17051722
let builder = builder.manage(windows_media::WindowsMediaSession::new());
17061723

@@ -1740,7 +1757,7 @@ pub fn run() {
17401757
#[cfg(target_os = "windows")]
17411758
windows_media::update_windows_media_session
17421759
])
1743-
.run(tauri::generate_context!())
1760+
.run(context)
17441761
.expect("error while running tauri application");
17451762
}
17461763

src-tauri/tauri.conf.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Just Another Music Client",
4-
"version": "1.2.32",
4+
"version": "1.2.5",
55
"identifier": "com.justanothermusicclient.desktop",
66
"build": {
77
"beforeDevCommand": "npm run dev",
@@ -41,6 +41,7 @@
4141
"updater": {
4242
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEQzMDBGRjQ1OEE5RjYzMzMKUldRelk1K0tSZjhBMDZ5Z1QxN2p4RlRsUi83c0c2M2t4WWVuUEdKTS9lNUVaaGJtNG92TTFTdVIK",
4343
"endpoints": [
44+
"https://github.com/2latemc/JustAnotherMusicClient/releases/latest/download/latest.json",
4445
"https://raw.githubusercontent.com/2latemc/JustAnotherMusicClient/updater-channel/latest.json"
4546
]
4647
}

src/datasource/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface Lyrics {
3232

3333
export interface Album {
3434
id: string;
35+
playlistId?: string;
3536
title: string;
3637
artist: string;
3738
artists?: ArtistReference[];

0 commit comments

Comments
 (0)