Merge pull request #69 from njzydark/patch-4

feat: support unblock unplayable music
master
qier222 4 years ago committed by GitHub
commit 8cc8ed9273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,7 @@
}, },
"main": "background.js", "main": "background.js",
"dependencies": { "dependencies": {
"@nondanee/unblockneteasemusic": "^0.25.3",
"axios": "^0.21.0", "axios": "^0.21.0",
"big-integer": "^1.6.48", "big-integer": "^1.6.48",
"core-js": "^3.6.5", "core-js": "^3.6.5",

@ -1,4 +1,5 @@
import { app, ipcMain } from "electron"; import { app, ipcMain } from "electron";
import match from "@nondanee/unblockneteasemusic";
export function initIpcMain(win) { export function initIpcMain(win) {
// Make vuex copy for electron. // Make vuex copy for electron.
@ -8,6 +9,12 @@ export function initIpcMain(win) {
global.vuexCopy = state; global.vuexCopy = state;
}); });
ipcMain.on("unblock-music", (event, id) => {
match(id, ["qq", "kuwo", "migu"]).then((res) => {
event.returnValue = res;
});
});
ipcMain.on("close", () => { ipcMain.on("close", () => {
win.close(); win.close();
app.quit(); app.quit();

@ -6,6 +6,9 @@ import localforage from "localforage";
import store from "@/store"; import store from "@/store";
import { cacheTrack } from "@/utils/db"; import { cacheTrack } from "@/utils/db";
const electron = window.require("electron");
const ipcRenderer = electron.ipcRenderer;
export default { export default {
switchTrack({ state, dispatch, commit }, basicTrack) { switchTrack({ state, dispatch, commit }, basicTrack) {
getTrackDetail(basicTrack.id).then((data) => { getTrackDetail(basicTrack.id).then((data) => {
@ -36,7 +39,12 @@ export default {
document.title = `${track.name} · ${track.ar[0].name} - YesPlayMusic`; document.title = `${track.name} · ${track.ar[0].name} - YesPlayMusic`;
if (track.playable === false) { if (track.playable === false) {
const res = ipcRenderer.sendSync("unblock-music", track.id);
if (res?.url) {
commitMP3(res.url);
} else {
dispatch("nextTrack"); dispatch("nextTrack");
}
return; return;
} }

@ -49,6 +49,7 @@ module.exports = {
pluginOptions: { pluginOptions: {
// electron-builder的配置文件 // electron-builder的配置文件
electronBuilder: { electronBuilder: {
externals: ["@nondanee/unblockneteasemusic"],
builderOptions: { builderOptions: {
productName: "YesPlayMusic", productName: "YesPlayMusic",
copyright: "Copyright © YesPlayMusic", copyright: "Copyright © YesPlayMusic",

@ -1270,6 +1270,11 @@
resolved "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" resolved "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs= integrity sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=
"@nondanee/unblockneteasemusic@^0.25.3":
version "0.25.3"
resolved "https://registry.yarnpkg.com/@nondanee/unblockneteasemusic/-/unblockneteasemusic-0.25.3.tgz#72d936f18f46523a2b929b8eaec8dfd2acf25e7e"
integrity sha512-Fgl0iRvuFCNhyFlovbqqnJQRomaFVjMLosS1hRUd/X47y6HeNlQsxa9c8RtmeLwNnZ27rj0DsUZlECqU7FyNPA==
"@npmcli/move-file@^1.0.1": "@npmcli/move-file@^1.0.1":
version "1.0.1" version "1.0.1"
resolved "https://registry.npm.taobao.org/@npmcli/move-file/download/@npmcli/move-file-1.0.1.tgz#de103070dac0f48ce49cf6693c23af59c0f70464" resolved "https://registry.npm.taobao.org/@npmcli/move-file/download/@npmcli/move-file-1.0.1.tgz#de103070dac0f48ce49cf6693c23af59c0f70464"

Loading…
Cancel
Save