Implement Cache Songs, Cancel Loading, Admin Panel, Custom Category, Localization

This commit is contained in:
2025-12-28 11:54:47 +08:00
parent 92c1261f6f
commit ae4a0f823e
13 changed files with 375 additions and 27 deletions

View File

@@ -57,6 +57,11 @@ class Settings{
showLyrics: {
type: "toggle",
default: true
},
cacheSongs: {
type: "select",
options: ["none", "cacheAll", "cacheCategory", "cacheSingle"],
default: "none"
}
}
@@ -596,7 +601,13 @@ class SettingsView{
if(current.type === "language"){
value = allStrings[value].name + " (" + value + ")"
}else if(current.type === "select" || current.type === "gamepad"){
if(current.options_lang && current.options_lang[value]){
if(name === "cacheSongs"){
if(value === "none"){
value = strings.none
}else{
value = strings.cache[value]
}
}else if(current.options_lang && current.options_lang[value]){
value = this.getLocalTitle(value, current.options_lang[value])
}else if(!current.getItem){
value = strings.settings[name][value]
@@ -674,6 +685,22 @@ class SettingsView{
}
if(current.type === "language" || current.type === "select"){
value = current.options[this.mod(current.options.length, current.options.indexOf(value) + 1)]
if(name === "cacheSongs" && value !== "none"){
var cacher = new SongCacher()
if(value === "cacheAll"){
cacher.cacheAll()
}else if(value === "cacheCategory"){
var song = assets.songs.find(s => s.id === this.songId)
if(song){
cacher.cacheCategory(song.category_id)
}
}else if(value === "cacheSingle"){
if(this.songId){
cacher.cacheSong(this.songId)
}
}
value = "none"
}
}else if(current.type === "toggle"){
value = !value
}else if(current.type === "keyboard"){