master
qier222 4 years ago
parent fa9f2d9785
commit 95f22f47fe
No known key found for this signature in database
GPG Key ID: 9C85007ED905F14D

@ -80,7 +80,7 @@ export default {
if (e.target.tagName === 'INPUT') return false;
if (this.$route.name === 'mv') return false;
e.preventDefault();
this.player.play();
this.player.playOrPause();
}
},
fetchData() {

@ -47,10 +47,12 @@ export function getPlaylistDetail(id, noCache = false) {
method: 'get',
params,
}).then(data => {
if (data.playlist) {
data.playlist.tracks = mapTrackPlayableStatus(
data.playlist.tracks,
data.privileges || []
);
}
return data;
});
}

@ -89,7 +89,16 @@ class Background {
expressApp.use('/', express.static(__dirname + '/'));
expressApp.use('/api', expressProxy('http://127.0.0.1:10754'));
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);
}

@ -121,8 +121,4 @@ export function initIpcMain(win, store) {
console.log('removeProxy');
win.webContents.session.setProxy({});
});
ipcMain.on('playerInfo', (event, info) => {
store.set('playerInfo', info);
});
}

@ -2,6 +2,7 @@
import { register } from 'register-service-worker';
if (!process.env.IS_ELECTRON) {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
// console.log(
@ -30,3 +31,4 @@ register(`${process.env.BASE_URL}service-worker.js`, {
console.error('Error during service worker registration:', error);
},
});
}

@ -1,6 +1,6 @@
import { playlistCategories } from '@/utils/staticData';
console.log('[debug][initLocalStorage.js]');
console.debug('[debug][initLocalStorage.js]');
const enabledPlaylistCategories = playlistCategories
.filter(c => c.enable)
.map(c => c.name);

@ -47,10 +47,8 @@ export default class {
// init
this._init();
// for debug
if (process.env.NODE_ENV === 'development') {
window.player = this;
}
window.yesplaymusic = {};
window.yesplaymusic.player = this;
}
get repeatMode() {
@ -177,14 +175,6 @@ export default class {
setInterval(() => {
this._progress = this._howler === null ? 0 : this._howler.seek();
}, 1000);
// 发送正在播放的信息给主进程
setInterval(() => {
ipcRenderer.send('playerInfo', {
currentTrack: this.currentTrack,
progress: this._progress,
});
}, 1000);
}
_getNextTrack() {
if (this._playNextList.length > 0) {

@ -57,6 +57,5 @@ export function setCookies(string) {
const cookies = string.split(';;');
cookies.map(cookie => {
document.cookie = cookie;
console.log(cookie);
});
}

@ -226,7 +226,6 @@ export default {
this.dynamicDetail.isSub ? '已保存到音乐库' : '已从音乐库删除'
);
}
console.log(data);
})
.catch(error => {
this.showToast(`${error.response.data.message || error}`);

@ -25,9 +25,7 @@ export default {
this.done = true;
return;
}
console.log(token);
authGetSession(token).then(result => {
console.log(result);
if (!result.data.session) {
this.message = '连接失败请重试或联系开发者无Session';
this.done = true;

@ -191,7 +191,6 @@ export default {
this.$router.push({ path: '/library' });
} else {
this.processing = false;
console.log(data.msg);
nativeAlert(data.msg ?? data.message ?? '账号或密码错误,请检查');
}
},

Loading…
Cancel
Save