From a4dd48007d0de9705c42ca3733f550c17c168cf1 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Thu, 30 Jul 2015 14:01:55 +0100 Subject: [PATCH] Fixing build issues --- commands.go | 2 +- main.go | 4 +++- web.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index d4dc02d..4be4eeb 100644 --- a/commands.go +++ b/commands.go @@ -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) } diff --git a/main.go b/main.go index 8a9d12a..abc1ca0 100644 --- a/main.go +++ b/main.go @@ -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 } diff --git a/web.go b/web.go index c0619c8..8b9fc23 100644 --- a/web.go +++ b/web.go @@ -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:]}) } }