mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-25 09:02:56 +08:00
fix: bugs
This commit is contained in:
parent
8cc8ed9273
commit
72c23654c9
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "YesPlayMusic",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"private": true,
|
||||
"description": "A third party music application for Netease Cloud Music",
|
||||
"author": "hawtim<hawtimzhang@gmail.com>",
|
||||
|
|
|
@ -6,8 +6,10 @@ import localforage from "localforage";
|
|||
import store from "@/store";
|
||||
import { cacheTrack } from "@/utils/db";
|
||||
|
||||
const electron = window.require("electron");
|
||||
const ipcRenderer = electron.ipcRenderer;
|
||||
const electron =
|
||||
process.env.IS_ELECTRON === true ? window.require("electron") : null;
|
||||
const ipcRenderer =
|
||||
process.env.IS_ELECTRON === true ? electron.ipcRenderer : null;
|
||||
|
||||
export default {
|
||||
switchTrack({ state, dispatch, commit }, basicTrack) {
|
||||
|
@ -39,7 +41,10 @@ export default {
|
|||
document.title = `${track.name} · ${track.ar[0].name} - YesPlayMusic`;
|
||||
|
||||
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) {
|
||||
commitMP3(res.url);
|
||||
} else {
|
||||
|
|
|
@ -1,50 +1,26 @@
|
|||
import pack from "../../package.json";
|
||||
import initLocalStorage from "@/store/initLocalStorage.js";
|
||||
import pkg from "../../package.json";
|
||||
|
||||
// function exampleFunction() {
|
||||
// console.log("update to vx.x.x");
|
||||
// // 0.2.0 to 0.2.1
|
||||
// localStorage.setItem("appVersion", "x.x.x");
|
||||
// window.location.reload();
|
||||
// }
|
||||
|
||||
function updateTo_0_2_0() {
|
||||
// 0.1 to 0.2.0
|
||||
// 移动 settings 内的 user 数据到 data
|
||||
let settings = JSON.parse(localStorage.getItem("settings"));
|
||||
let data = {
|
||||
likedSongPlaylistID: settings.user.likedSongPlaylistID,
|
||||
lastRefreshCookieDate: settings.lastRefreshCookieDate,
|
||||
const updateSetting = () => {
|
||||
const parsedSettings = JSON.parse(localStorage.getItem("settings"));
|
||||
const setting = {
|
||||
playlistCategories: initLocalStorage?.settings?.playlistCategories,
|
||||
...parsedSettings,
|
||||
};
|
||||
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("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();
|
||||
}
|
||||
localStorage.setItem("setting", JSON.stringify(setting));
|
||||
};
|
||||
|
||||
const updateData = () => {
|
||||
const parsedData = JSON.parse(localStorage.getItem("data"));
|
||||
const data = {
|
||||
...parsedData,
|
||||
};
|
||||
localStorage.setItem("data", JSON.stringify(data));
|
||||
};
|
||||
|
||||
export default function () {
|
||||
while (localStorage.getItem("appVersion") !== pack.version) {
|
||||
let currentVersion = localStorage.getItem("appVersion");
|
||||
if (currentVersion === "0.1") {
|
||||
updateTo_0_2_0();
|
||||
}
|
||||
if (currentVersion === "0.2.0") {
|
||||
updateTo_0_2_1();
|
||||
}
|
||||
}
|
||||
updateSetting();
|
||||
updateData();
|
||||
localStorage.setItem("appVersion", JSON.stringify(pkg.version));
|
||||
}
|
||||
|
|
|
@ -48,8 +48,11 @@
|
|||
:iconClass="dynamicDetail.isSub ? 'heart-solid' : 'heart'"
|
||||
:iconButton="true"
|
||||
:horizontalPadding="0"
|
||||
color="grey"
|
||||
:color="dynamicDetail.isSub ? 'blue' : 'grey'"
|
||||
:textColor="dynamicDetail.isSub ? '#335eea' : ''"
|
||||
:backgroundColor="
|
||||
dynamicDetail.isSub ? 'var(--color-secondary-bg)' : ''
|
||||
"
|
||||
@click.native="likeAlbum"
|
||||
>
|
||||
</ButtonTwoTone>
|
||||
|
|
|
@ -56,8 +56,11 @@
|
|||
:iconClass="playlist.subscribed ? 'heart-solid' : 'heart'"
|
||||
:iconButton="true"
|
||||
:horizontalPadding="0"
|
||||
color="grey"
|
||||
:color="playlist.subscribed ? 'blue' : 'grey'"
|
||||
:textColor="playlist.subscribed ? '#335eea' : ''"
|
||||
:backgroundColor="
|
||||
playlist.subscribed ? 'var(--color-secondary-bg)' : ''
|
||||
"
|
||||
@click.native="likePlaylist"
|
||||
>
|
||||
</ButtonTwoTone>
|
||||
|
|
Loading…
Reference in New Issue
Block a user