Fixing build issues

This commit is contained in:
MichaelOultram 2015-07-30 17:50:49 +01:00
parent 425885ae55
commit 6b8aa41691
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
function api(type) {
return "{{.Site}}" + type + "?token={{.Token}}";
return "http://{{.Site}}/" + type + "?token={{.Token}}";
}
function addURL() {

4
web.go
View file

@ -31,6 +31,7 @@ type Page struct {
var external_ip = ""
func NewWebServer(port int) *WebServer {
rand.Seed(time.Now().UnixNano())
return &WebServer{
port: port,
client_token: make(map[*gumble.User]string),
@ -44,7 +45,6 @@ func (web *WebServer) makeWeb() {
http.HandleFunc("/volume", web.volume)
http.HandleFunc("/skip", web.skip)
http.ListenAndServe(":"+strconv.Itoa(web.port), nil)
rand.Seed(time.Now().UnixNano())
}
func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {
@ -59,7 +59,7 @@ func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {
return
}
err = t.Execute(w, Page{"http://" + getIP() + ":" + strconv.Itoa(web.port) + "/", r.URL.Path[1:], uname.Name})
err = t.Execute(w, Page{getIP() + ":" + strconv.Itoa(web.port), r.URL.Path[1:], uname.Name})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}