home page is now available in non dev environments

This commit is contained in:
booploops 2021-12-29 05:46:49 -08:00
parent 1ad7012e32
commit 7a19de11f7
6 changed files with 219 additions and 33 deletions

View file

@ -206,6 +206,7 @@ const app = new Vue({
id: ""
},
mxmtoken: "",
mkIsReady: false,
playerReady: false,
lyricon: false,
currentTrackID: '',
@ -247,7 +248,7 @@ const app = new Vue({
},
prevButtonBackIndicator: false,
currentSongInfo: {},
page: "browse",
page: "",
pageHistory: [],
songstest: false,
hangtimer: null,
@ -280,6 +281,12 @@ const app = new Vue({
},
},
methods: {
addFavorite(id, type) {
this.cfg.home.favoriteItems.push({
id: id,
type: type
});
},
modularUITest(val = false) {
if (val) {
document.querySelector("#app-main").classList.add("modular-fs")
@ -344,7 +351,9 @@ const app = new Vue({
let self = this
clearTimeout(this.hangtimer)
this.mk = MusicKit.getInstance()
this.mk.authorize()
this.mk.authorize().then(()=>{
self.mkIsReady = true
})
this.$forceUpdate()
if (this.isDev) {
this.mk.privateEnabled = true
@ -493,6 +502,8 @@ const app = new Vue({
document.body.removeAttribute("loading")
if (window.location.hash != "") {
this.appRoute(window.location.hash)
}else{
this.page = "home"
}
setTimeout(() => {
@ -568,6 +579,12 @@ const app = new Vue({
action: () => {
this.deletePlaylist(playlist_id)
}
},
{
name: "Add to favorites",
action: () => {
this.addFavorite(playlist_id, "library-playlists")
}
}
]
}