From 6ba500596da875d3836135ee290426b91814596a Mon Sep 17 00:00:00 2001 From: vapormusic Date: Tue, 11 Jan 2022 13:32:36 +0700 Subject: [PATCH] fix #108 --- src/main/cider-base.js | 6 ++++++ src/renderer/index.js | 18 ++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/cider-base.js b/src/main/cider-base.js index cf900b06..0951da33 100644 --- a/src/main/cider-base.js +++ b/src/main/cider-base.js @@ -113,6 +113,12 @@ const CiderBase = { callback({ requestHeaders: details.requestHeaders }) }) + win.webContents.session.webRequest.onHeadersReceived((details, callback) => { + if(details.url.match(/^https:\/\/store-\d{3}\.blobstore\.apple\.com/) || details.url.startsWith("https://store-037.blobstore.apple.com")){ + details.responseHeaders['Access-Control-Allow-Origin'] = '*';} + callback({ responseHeaders: details.responseHeaders }) + }) + let location = `http://localhost:${CiderBase.clientPort}/` win.loadURL(location) win.on("closed", () => { diff --git a/src/renderer/index.js b/src/renderer/index.js index 215705f3..c59afa07 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -2367,10 +2367,9 @@ const app = new Vue({ } let query = app.library.songs.listing.map(item => new MusicKit.MediaItem(item)); - try { - app.mk.stop() - } catch (e) { - } + + + app.mk.stop().then(() => { this.mk.clearQueue().then(function (_) { if (app.mk.shuffleMode == 1){ shuffleArray(query)} app.mk.queue.append(query) @@ -2385,6 +2384,7 @@ const app = new Vue({ app.mk.play() } }) + }) } else { app.mk.stop().then(() => { if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))){ @@ -2392,15 +2392,13 @@ const app = new Vue({ app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1).then(function(){ if ((app.showingPlaylist && app.showingPlaylist.id == id)) { let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (query.length > 100) { - let u = query.slice(100); if (app.mk.shuffleMode == 1) { shuffleArray(u) } - app.mk.queue.append(u)} + let u = query; if (app.mk.shuffleMode == 1) { shuffleArray(u) } + app.mk.queue.append(u) } else { app.getPlaylistFromID(id, true).then(function () { let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (query.length > 100) { - let u = query.slice(100); if (app.mk.shuffleMode == 1) { shuffleArray(u) } - app.mk.queue.append(u)} + let u = query; if (app.mk.shuffleMode == 1) { shuffleArray(u) } + app.mk.queue.append(u) }) } })