mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix: bugs
This commit is contained in:
parent
fa9f2d9785
commit
95f22f47fe
11 changed files with 50 additions and 56 deletions
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
if (e.target.tagName === 'INPUT') return false;
|
if (e.target.tagName === 'INPUT') return false;
|
||||||
if (this.$route.name === 'mv') return false;
|
if (this.$route.name === 'mv') return false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.player.play();
|
this.player.playOrPause();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchData() {
|
fetchData() {
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,12 @@ export function getPlaylistDetail(id, noCache = false) {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
data.playlist.tracks = mapTrackPlayableStatus(
|
if (data.playlist) {
|
||||||
data.playlist.tracks,
|
data.playlist.tracks = mapTrackPlayableStatus(
|
||||||
data.privileges || []
|
data.playlist.tracks,
|
||||||
);
|
data.privileges || []
|
||||||
|
);
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,16 @@ class Background {
|
||||||
expressApp.use('/', express.static(__dirname + '/'));
|
expressApp.use('/', express.static(__dirname + '/'));
|
||||||
expressApp.use('/api', expressProxy('http://127.0.0.1:10754'));
|
expressApp.use('/api', expressProxy('http://127.0.0.1:10754'));
|
||||||
expressApp.use('/player', (req, res) => {
|
expressApp.use('/player', (req, res) => {
|
||||||
res.send(this.store.get('playerInfo'));
|
this.window.webContents
|
||||||
|
.executeJavaScript('window.yesplaymusic.player')
|
||||||
|
.then(result => {
|
||||||
|
res.send({
|
||||||
|
currentTrack: result._isPersonalFM
|
||||||
|
? result._personalFMTrack
|
||||||
|
: result._currentTrack,
|
||||||
|
progress: result._progress,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.expressApp = expressApp.listen(27232);
|
this.expressApp = expressApp.listen(27232);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,4 @@ export function initIpcMain(win, store) {
|
||||||
console.log('removeProxy');
|
console.log('removeProxy');
|
||||||
win.webContents.session.setProxy({});
|
win.webContents.session.setProxy({});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('playerInfo', (event, info) => {
|
|
||||||
store.set('playerInfo', info);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,33 @@
|
||||||
|
|
||||||
import { register } from 'register-service-worker';
|
import { register } from 'register-service-worker';
|
||||||
|
|
||||||
register(`${process.env.BASE_URL}service-worker.js`, {
|
if (!process.env.IS_ELECTRON) {
|
||||||
ready() {
|
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||||
// console.log(
|
ready() {
|
||||||
// "App is being served from cache by a service worker.\n" +
|
// console.log(
|
||||||
// "For more details, visit https://goo.gl/AFskqB"
|
// "App is being served from cache by a service worker.\n" +
|
||||||
// );
|
// "For more details, visit https://goo.gl/AFskqB"
|
||||||
},
|
// );
|
||||||
registered() {
|
},
|
||||||
// console.log("Service worker has been registered.");
|
registered() {
|
||||||
},
|
// console.log("Service worker has been registered.");
|
||||||
cached() {
|
},
|
||||||
// console.log("Content has been cached for offline use.");
|
cached() {
|
||||||
},
|
// console.log("Content has been cached for offline use.");
|
||||||
updatefound() {
|
},
|
||||||
// console.log("New content is downloading.");
|
updatefound() {
|
||||||
},
|
// console.log("New content is downloading.");
|
||||||
updated() {
|
},
|
||||||
// console.log("New content is available; please refresh.");
|
updated() {
|
||||||
},
|
// console.log("New content is available; please refresh.");
|
||||||
offline() {
|
},
|
||||||
// console.log(
|
offline() {
|
||||||
// "No internet connection found. App is running in offline mode."
|
// console.log(
|
||||||
// );
|
// "No internet connection found. App is running in offline mode."
|
||||||
},
|
// );
|
||||||
error(error) {
|
},
|
||||||
console.error('Error during service worker registration:', error);
|
error(error) {
|
||||||
},
|
console.error('Error during service worker registration:', error);
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { playlistCategories } from '@/utils/staticData';
|
import { playlistCategories } from '@/utils/staticData';
|
||||||
|
|
||||||
console.log('[debug][initLocalStorage.js]');
|
console.debug('[debug][initLocalStorage.js]');
|
||||||
const enabledPlaylistCategories = playlistCategories
|
const enabledPlaylistCategories = playlistCategories
|
||||||
.filter(c => c.enable)
|
.filter(c => c.enable)
|
||||||
.map(c => c.name);
|
.map(c => c.name);
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,8 @@ export default class {
|
||||||
// init
|
// init
|
||||||
this._init();
|
this._init();
|
||||||
|
|
||||||
// for debug
|
window.yesplaymusic = {};
|
||||||
if (process.env.NODE_ENV === 'development') {
|
window.yesplaymusic.player = this;
|
||||||
window.player = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get repeatMode() {
|
get repeatMode() {
|
||||||
|
|
@ -177,14 +175,6 @@ export default class {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this._progress = this._howler === null ? 0 : this._howler.seek();
|
this._progress = this._howler === null ? 0 : this._howler.seek();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
// 发送正在播放的信息给主进程
|
|
||||||
setInterval(() => {
|
|
||||||
ipcRenderer.send('playerInfo', {
|
|
||||||
currentTrack: this.currentTrack,
|
|
||||||
progress: this._progress,
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
_getNextTrack() {
|
_getNextTrack() {
|
||||||
if (this._playNextList.length > 0) {
|
if (this._playNextList.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,5 @@ export function setCookies(string) {
|
||||||
const cookies = string.split(';;');
|
const cookies = string.split(';;');
|
||||||
cookies.map(cookie => {
|
cookies.map(cookie => {
|
||||||
document.cookie = cookie;
|
document.cookie = cookie;
|
||||||
console.log(cookie);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,6 @@ export default {
|
||||||
this.dynamicDetail.isSub ? '已保存到音乐库' : '已从音乐库删除'
|
this.dynamicDetail.isSub ? '已保存到音乐库' : '已从音乐库删除'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log(data);
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.showToast(`${error.response.data.message || error}`);
|
this.showToast(`${error.response.data.message || error}`);
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,7 @@ export default {
|
||||||
this.done = true;
|
this.done = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(token);
|
|
||||||
authGetSession(token).then(result => {
|
authGetSession(token).then(result => {
|
||||||
console.log(result);
|
|
||||||
if (!result.data.session) {
|
if (!result.data.session) {
|
||||||
this.message = '连接失败,请重试或联系开发者(无Session)';
|
this.message = '连接失败,请重试或联系开发者(无Session)';
|
||||||
this.done = true;
|
this.done = true;
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,6 @@ export default {
|
||||||
this.$router.push({ path: '/library' });
|
this.$router.push({ path: '/library' });
|
||||||
} else {
|
} else {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
console.log(data.msg);
|
|
||||||
nativeAlert(data.msg ?? data.message ?? '账号或密码错误,请检查');
|
nativeAlert(data.msg ?? data.message ?? '账号或密码错误,请检查');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue