Navigation for Web UI finally available
This commit is contained in:
+16
-10
@@ -89,22 +89,22 @@ func handlePlaySound(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if user != nil && guild != nil && sound != nil && soundCollection != nil {
|
||||
go enqueuePlay(user, guild, soundCollection, sound)
|
||||
}
|
||||
if user != nil && guild != nil && sound == nil && soundCollection != nil {
|
||||
go enqueuePlay(user, guild, soundCollection, soundCollection.Random())
|
||||
if sound != nil {
|
||||
go enqueuePlay(user, guild, soundCollection, sound)
|
||||
} else {
|
||||
go enqueuePlay(user, guild, soundCollection, soundCollection.Random())
|
||||
}
|
||||
http.Error(w, http.StatusText(200), 200)
|
||||
} else {
|
||||
http.Error(w, http.StatusText(500), 500)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func handleMain(w http.ResponseWriter, r *http.Request) {
|
||||
session, _ := store.Get(r, "gidbig-session")
|
||||
if session.Values["discordUsername"] != nil {
|
||||
err := tmpls["internal.html"].ExecuteTemplate(w, "header", map[string]interface{}{})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
var prefixes []string
|
||||
var si []SoundItem
|
||||
for _, sc := range COLLECTIONS {
|
||||
var newSoundItemRandom SoundItem
|
||||
@@ -115,6 +115,7 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
|
||||
Itemtext: "random",
|
||||
Itemshorttext: "random",
|
||||
}
|
||||
prefixes = append(prefixes, sc.Prefix)
|
||||
si = append(si, newSoundItemRandom)
|
||||
for _, snd := range sc.Sounds {
|
||||
var newSoundItem SoundItem
|
||||
@@ -140,6 +141,11 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
|
||||
si = append(si, newSoundItem)
|
||||
}
|
||||
}
|
||||
err := tmpls["internal.html"].ExecuteTemplate(w, "header", prefixes)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
var currentPrefix string = ""
|
||||
var i int = 0
|
||||
|
||||
Reference in New Issue
Block a user