1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 10:16:57 +00:00

Move BannerHTML to index.html

This commit is contained in:
Kane York 2015-10-28 18:12:20 -07:00
parent 6c422b8782
commit cf49f38bf8
7 changed files with 27 additions and 23 deletions

View file

@ -6,6 +6,7 @@ import (
"fmt"
"github.com/gorilla/websocket"
"io"
"io/ioutil"
"log"
"net/http"
"strconv"
@ -74,6 +75,8 @@ var ExpectedStringAndIntGotFloat = errors.New("Error: Second argument was a floa
var gconfig *ConfigFile
var BannerHTML []byte
// Set up a websocket listener and register it on /.
// (Uses http.DefaultServeMux .)
func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
@ -85,6 +88,12 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
serveMux = http.DefaultServeMux
}
bannerBytes, err := ioutil.ReadFile("index.html")
if err != nil {
log.Fatal("Could not open index.html", err)
}
BannerHTML = bannerBytes
serveMux.HandleFunc("/", ServeWebsocketOrCatbag)
serveMux.HandleFunc("/pub_msg", HBackendPublishRequest)
serveMux.HandleFunc("/dump_backlog", HBackendDumpBacklog)
@ -106,7 +115,7 @@ func ServeWebsocketOrCatbag(w http.ResponseWriter, r *http.Request) {
return
} else {
w.Write([]byte(gconfig.BannerHTML))
w.Write(BannerHTML)
}
}