mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 16:38:31 +00:00
Move BannerHTML to index.html
This commit is contained in:
parent
6c422b8782
commit
cf49f38bf8
7 changed files with 27 additions and 23 deletions
|
@ -4,9 +4,9 @@ import (
|
|||
"../../internal/server"
|
||||
"fmt"
|
||||
"github.com/abiosoft/ishell"
|
||||
"github.com/gorilla/websocket"
|
||||
"runtime"
|
||||
"strings"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
func commandLineConsole() {
|
||||
|
@ -69,4 +69,3 @@ func commandLineConsole() {
|
|||
|
||||
shell.Start()
|
||||
}
|
||||
|
||||
|
|
13
socketserver/cmd/ffzsocketserver/index.html
Normal file
13
socketserver/cmd/ffzsocketserver/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CatBag</title>
|
||||
<link rel="stylesheet" href="//cdn.frankerfacez.com/script/catbag.css">
|
||||
<div id="container">
|
||||
<div id="zf0"></div><div id="zf1"></div><div id="zf2"></div>
|
||||
<div id="zf3"></div><div id="zf4"></div><div id="zf5"></div>
|
||||
<div id="zf6"></div><div id="zf7"></div><div id="zf8"></div>
|
||||
<div id="zf9"></div><div id="catbag"></div>
|
||||
<div id="bottom">
|
||||
A <a href="http://www.frankerfacez.com/">FrankerFaceZ</a> Service
|
||||
— CatBag by <a href="http://www.twitch.tv/wolsk">Wolsk</a>
|
||||
</div>
|
||||
</div>
|
|
@ -44,7 +44,7 @@ func main() {
|
|||
Addr: conf.ListenAddr,
|
||||
}
|
||||
|
||||
logFile, err := os.OpenFile("output.log", os.O_WRONLY | os.O_APPEND | os.O_CREATE, 0644)
|
||||
logFile, err := os.OpenFile("output.log", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
|
||||
if err != nil {
|
||||
log.Fatal("Could not create logfile: ", err)
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr s
|
|||
return
|
||||
}
|
||||
|
||||
func SendAggregatedData(sealedForm url.Values) (error) {
|
||||
func SendAggregatedData(sealedForm url.Values) error {
|
||||
resp, err := backendHttpClient.PostForm(postStatisticsUrl, sealedForm)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -196,21 +196,6 @@ func GenerateKeys(outputFile, serverId, theirPublicStr string) {
|
|||
ListenAddr: "0.0.0.0:8001",
|
||||
SocketOrigin: "localhost:8001",
|
||||
BackendUrl: "http://localhost:8002/ffz",
|
||||
BannerHTML: `
|
||||
<!DOCTYPE html>
|
||||
<title>CatBag</title>
|
||||
<link rel="stylesheet" href="//cdn.frankerfacez.com/script/catbag.css">
|
||||
<div id="container">
|
||||
<div id="zf0"></div><div id="zf1"></div><div id="zf2"></div>
|
||||
<div id="zf3"></div><div id="zf4"></div><div id="zf5"></div>
|
||||
<div id="zf6"></div><div id="zf7"></div><div id="zf8"></div>
|
||||
<div id="zf9"></div><div id="catbag"></div>
|
||||
<div id="bottom">
|
||||
A <a href="http://www.frankerfacez.com/">FrankerFaceZ</a> Service
|
||||
— CatBag by <a href="http://www.twitch.tv/wolsk">Wolsk</a>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
}
|
||||
|
||||
output.ServerId, err = strconv.Atoi(serverId)
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
"github.com/gorilla/websocket"
|
||||
"github.com/satori/go.uuid"
|
||||
"log"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
var ResponseSuccess = ClientMessage{Command: SuccessCommand}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@ type ConfigFile struct {
|
|||
SocketOrigin string
|
||||
// URL to the backend server
|
||||
BackendUrl string
|
||||
// Memes go here
|
||||
BannerHTML string
|
||||
|
||||
// SSL/TLS
|
||||
UseSSL bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue