Fixing build issues
This commit is contained in:
parent
a55ce8a3e0
commit
f15ff8755a
3
main.go
3
main.go
|
@ -244,7 +244,8 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
web = makeWebserver(9563)
|
||||
web = NewWebServer(9563)
|
||||
web.makeWeb()
|
||||
|
||||
if isNil(web) {
|
||||
Verbose("WEB IS NIL")
|
||||
|
|
26
web.go
26
web.go
|
@ -27,21 +27,21 @@ type Page struct {
|
|||
|
||||
var external_ip = ""
|
||||
|
||||
func makeWebserver(port int) *WebServer {
|
||||
webserver := &WebServer{}
|
||||
|
||||
webserver.port = port
|
||||
webserver.client_token = make(map[*gumble.User]string)
|
||||
webserver.token_client = make(map[string]*gumble.User)
|
||||
|
||||
http.HandleFunc("/", webserver.homepage)
|
||||
http.HandleFunc("/add", webserver.add)
|
||||
http.HandleFunc("/volume", webserver.volume)
|
||||
http.HandleFunc("/skip", webserver.skip)
|
||||
http.ListenAndServe(":"+strconv.Itoa(port), nil)
|
||||
func NewWebServer(port int) *WebServer {
|
||||
return &WebServer{
|
||||
port: port,
|
||||
client_token: make(map[*gumble.User]string),
|
||||
token_client: make(map[string]*gumble.User),
|
||||
}
|
||||
}
|
||||
|
||||
func (web *WebServer) makeWeb() {
|
||||
http.HandleFunc("/", web.homepage)
|
||||
http.HandleFunc("/add", web.add)
|
||||
http.HandleFunc("/volume", web.volume)
|
||||
http.HandleFunc("/skip", web.skip)
|
||||
http.ListenAndServe(":"+strconv.Itoa(web.port), nil)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
return webserver
|
||||
}
|
||||
|
||||
func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Reference in a new issue