Fixing build issues

This commit is contained in:
MichaelOultram 2015-07-30 14:01:55 +01:00
parent 921af2f1b0
commit a4dd48007d
3 changed files with 6 additions and 3 deletions

View file

@ -85,7 +85,7 @@ func parseCommand(user *gumble.User, username, command string) {
// Web command
case dj.conf.Aliases.WebAlias:
if dj.HasPermission(username, dj.conf.Permissions.AdminWeb) {
GetWebAddress(user)
web.GetWebAddress(user)
} else {
dj.SendPrivateMessage(user, NO_PERMISSION_MSG)
}

View file

@ -172,6 +172,8 @@ var dj = mumbledj{
cache: NewSongCache(),
}
var web *Webserver
// main primarily performs startup tasks. Grabs and parses commandline
// args, sets up the gumble client and its listeners, and then connects to the server.
func main() {
@ -242,7 +244,7 @@ func main() {
os.Exit(1)
}
Webserver(9563)
web = Webserver(9563)
<-dj.keepAlive
}

3
web.go
View file

@ -3,6 +3,7 @@ package main
import (
"fmt"
"html"
"html/template"
"io/ioutil"
"math/rand"
"net/http"
@ -43,7 +44,7 @@ func (web WebServer) homepage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Invalid Token")
} else {
t, _ := template.ParseFiles("index.html")
t.Execute(w, Page{"http://" + getIp() + ":" + web.port + "/", r.URL.Path[1:]})
t.Execute(w, Page{"http://" + getIP() + ":" + web.port + "/", r.URL.Path[1:]})
}
}