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 // Web command
case dj.conf.Aliases.WebAlias: case dj.conf.Aliases.WebAlias:
if dj.HasPermission(username, dj.conf.Permissions.AdminWeb) { if dj.HasPermission(username, dj.conf.Permissions.AdminWeb) {
GetWebAddress(user) web.GetWebAddress(user)
} else { } else {
dj.SendPrivateMessage(user, NO_PERMISSION_MSG) dj.SendPrivateMessage(user, NO_PERMISSION_MSG)
} }

View file

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

3
web.go
View file

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"html" "html"
"html/template"
"io/ioutil" "io/ioutil"
"math/rand" "math/rand"
"net/http" "net/http"
@ -43,7 +44,7 @@ func (web WebServer) homepage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Invalid Token") fmt.Fprintf(w, "Invalid Token")
} else { } else {
t, _ := template.ParseFiles("index.html") 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:]})
} }
} }