mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 10:56:23 +08:00
feat: support unblock unplayable music
This commit is contained in:
parent
962b81a628
commit
01e2dc955e
|
@ -25,6 +25,7 @@
|
|||
},
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"@nondanee/unblockneteasemusic": "^0.25.3",
|
||||
"axios": "^0.21.0",
|
||||
"big-integer": "^1.6.48",
|
||||
"core-js": "^3.6.5",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { app, ipcMain } from "electron";
|
||||
import match from "@nondanee/unblockneteasemusic";
|
||||
|
||||
export function initIpcMain(win) {
|
||||
// Make vuex copy for electron.
|
||||
|
@ -8,6 +9,12 @@ export function initIpcMain(win) {
|
|||
global.vuexCopy = state;
|
||||
});
|
||||
|
||||
ipcMain.on("unblock-music", (event, id) => {
|
||||
match(id, ["qq", "kuwo", "migu"]).then((res) => {
|
||||
event.returnValue = res;
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.on("close", () => {
|
||||
win.close();
|
||||
app.quit();
|
||||
|
|
|
@ -6,6 +6,9 @@ import localforage from "localforage";
|
|||
import store from "@/store";
|
||||
import { cacheTrack } from "@/utils/db";
|
||||
|
||||
const electron = window.require("electron");
|
||||
const ipcRenderer = electron.ipcRenderer;
|
||||
|
||||
export default {
|
||||
switchTrack({ state, dispatch, commit }, basicTrack) {
|
||||
getTrackDetail(basicTrack.id).then((data) => {
|
||||
|
@ -36,7 +39,12 @@ export default {
|
|||
document.title = `${track.name} · ${track.ar[0].name} - YesPlayMusic`;
|
||||
|
||||
if (track.playable === false) {
|
||||
dispatch("nextTrack");
|
||||
const res = ipcRenderer.sendSync("unblock-music", track.id);
|
||||
if (res?.url) {
|
||||
commitMP3(res.url);
|
||||
} else {
|
||||
dispatch("nextTrack");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ module.exports = {
|
|||
pluginOptions: {
|
||||
// electron-builder的配置文件
|
||||
electronBuilder: {
|
||||
externals: ["@nondanee/unblockneteasemusic"],
|
||||
builderOptions: {
|
||||
productName: "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"
|
||||
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":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npm.taobao.org/@npmcli/move-file/download/@npmcli/move-file-1.0.1.tgz#de103070dac0f48ce49cf6693c23af59c0f70464"
|
||||
|
|
Loading…
Reference in New Issue
Block a user