master
qier222 4 years ago
parent 8cc8ed9273
commit 72c23654c9

@ -1,6 +1,6 @@
{ {
"name": "YesPlayMusic", "name": "YesPlayMusic",
"version": "0.2.1", "version": "0.2.2",
"private": true, "private": true,
"description": "A third party music application for Netease Cloud Music", "description": "A third party music application for Netease Cloud Music",
"author": "hawtim<hawtimzhang@gmail.com>", "author": "hawtim<hawtimzhang@gmail.com>",

@ -6,8 +6,10 @@ 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 electron =
const ipcRenderer = electron.ipcRenderer; process.env.IS_ELECTRON === true ? window.require("electron") : null;
const ipcRenderer =
process.env.IS_ELECTRON === true ? electron.ipcRenderer : null;
export default { export default {
switchTrack({ state, dispatch, commit }, basicTrack) { switchTrack({ state, dispatch, commit }, basicTrack) {
@ -39,7 +41,10 @@ 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); let res = undefined;
if (process.env.IS_ELECTRON === true) {
res = ipcRenderer.sendSync("unblock-music", track.id);
}
if (res?.url) { if (res?.url) {
commitMP3(res.url); commitMP3(res.url);
} else { } else {

@ -1,50 +1,26 @@
import pack from "../../package.json";
import initLocalStorage from "@/store/initLocalStorage.js"; import initLocalStorage from "@/store/initLocalStorage.js";
import pkg from "../../package.json";
// function exampleFunction() { const updateSetting = () => {
// console.log("update to vx.x.x"); const parsedSettings = JSON.parse(localStorage.getItem("settings"));
// // 0.2.0 to 0.2.1 const setting = {
// localStorage.setItem("appVersion", "x.x.x"); playlistCategories: initLocalStorage?.settings?.playlistCategories,
// window.location.reload(); ...parsedSettings,
// } };
localStorage.setItem("setting", JSON.stringify(setting));
};
function updateTo_0_2_0() { const updateData = () => {
// 0.1 to 0.2.0 const parsedData = JSON.parse(localStorage.getItem("data"));
// 移动 settings 内的 user 数据到 data const data = {
let settings = JSON.parse(localStorage.getItem("settings")); ...parsedData,
let data = {
likedSongPlaylistID: settings.user.likedSongPlaylistID,
lastRefreshCookieDate: settings.lastRefreshCookieDate,
}; };
delete settings.user.likedSongPlaylistID;
delete settings.lastRefreshCookieDate;
data.user = settings.user;
delete settings.user;
localStorage.setItem("settings", JSON.stringify(settings));
localStorage.setItem("data", JSON.stringify(data)); localStorage.setItem("data", JSON.stringify(data));
localStorage.setItem("appVersion", "0.2.0"); };
window.location.reload();
}
function updateTo_0_2_1() {
console.log("update to v0.2.1");
// 0.2.0 to 0.2.1
// 初始化 playlistCategories
let settings = JSON.parse(localStorage.getItem("settings"));
settings.playlistCategories = initLocalStorage.settings.playlistCategories;
localStorage.setItem("settings", JSON.stringify(settings));
localStorage.setItem("appVersion", "0.2.1");
window.location.reload();
}
export default function () { export default function () {
while (localStorage.getItem("appVersion") !== pack.version) { updateSetting();
let currentVersion = localStorage.getItem("appVersion"); updateData();
if (currentVersion === "0.1") { localStorage.setItem("appVersion", JSON.stringify(pkg.version));
updateTo_0_2_0();
}
if (currentVersion === "0.2.0") {
updateTo_0_2_1();
}
}
} }

@ -48,8 +48,11 @@
:iconClass="dynamicDetail.isSub ? 'heart-solid' : 'heart'" :iconClass="dynamicDetail.isSub ? 'heart-solid' : 'heart'"
:iconButton="true" :iconButton="true"
:horizontalPadding="0" :horizontalPadding="0"
color="grey" :color="dynamicDetail.isSub ? 'blue' : 'grey'"
:textColor="dynamicDetail.isSub ? '#335eea' : ''" :textColor="dynamicDetail.isSub ? '#335eea' : ''"
:backgroundColor="
dynamicDetail.isSub ? 'var(--color-secondary-bg)' : ''
"
@click.native="likeAlbum" @click.native="likeAlbum"
> >
</ButtonTwoTone> </ButtonTwoTone>

@ -56,8 +56,11 @@
:iconClass="playlist.subscribed ? 'heart-solid' : 'heart'" :iconClass="playlist.subscribed ? 'heart-solid' : 'heart'"
:iconButton="true" :iconButton="true"
:horizontalPadding="0" :horizontalPadding="0"
color="grey" :color="playlist.subscribed ? 'blue' : 'grey'"
:textColor="playlist.subscribed ? '#335eea' : ''" :textColor="playlist.subscribed ? '#335eea' : ''"
:backgroundColor="
playlist.subscribed ? 'var(--color-secondary-bg)' : ''
"
@click.native="likePlaylist" @click.native="likePlaylist"
> >
</ButtonTwoTone> </ButtonTwoTone>

Loading…
Cancel
Save