mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-15 17:46:55 +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"
|
"../../internal/server"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func commandLineConsole() {
|
func commandLineConsole() {
|
||||||
|
@ -69,4 +69,3 @@ func commandLineConsole() {
|
||||||
|
|
||||||
shell.Start()
|
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,
|
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 {
|
if err != nil {
|
||||||
log.Fatal("Could not create logfile: ", err)
|
log.Fatal("Could not create logfile: ", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr s
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendAggregatedData(sealedForm url.Values) (error) {
|
func SendAggregatedData(sealedForm url.Values) error {
|
||||||
resp, err := backendHttpClient.PostForm(postStatisticsUrl, sealedForm)
|
resp, err := backendHttpClient.PostForm(postStatisticsUrl, sealedForm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -196,21 +196,6 @@ func GenerateKeys(outputFile, serverId, theirPublicStr string) {
|
||||||
ListenAddr: "0.0.0.0:8001",
|
ListenAddr: "0.0.0.0:8001",
|
||||||
SocketOrigin: "localhost:8001",
|
SocketOrigin: "localhost:8001",
|
||||||
BackendUrl: "http://localhost:8002/ffz",
|
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)
|
output.ServerId, err = strconv.Atoi(serverId)
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/satori/go.uuid"
|
"github.com/satori/go.uuid"
|
||||||
"log"
|
"log"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"net/url"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ResponseSuccess = ClientMessage{Command: SuccessCommand}
|
var ResponseSuccess = ClientMessage{Command: SuccessCommand}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -74,6 +75,8 @@ var ExpectedStringAndIntGotFloat = errors.New("Error: Second argument was a floa
|
||||||
|
|
||||||
var gconfig *ConfigFile
|
var gconfig *ConfigFile
|
||||||
|
|
||||||
|
var BannerHTML []byte
|
||||||
|
|
||||||
// Set up a websocket listener and register it on /.
|
// Set up a websocket listener and register it on /.
|
||||||
// (Uses http.DefaultServeMux .)
|
// (Uses http.DefaultServeMux .)
|
||||||
func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
||||||
|
@ -85,6 +88,12 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
||||||
serveMux = http.DefaultServeMux
|
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("/", ServeWebsocketOrCatbag)
|
||||||
serveMux.HandleFunc("/pub_msg", HBackendPublishRequest)
|
serveMux.HandleFunc("/pub_msg", HBackendPublishRequest)
|
||||||
serveMux.HandleFunc("/dump_backlog", HBackendDumpBacklog)
|
serveMux.HandleFunc("/dump_backlog", HBackendDumpBacklog)
|
||||||
|
@ -106,7 +115,7 @@ func ServeWebsocketOrCatbag(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
w.Write([]byte(gconfig.BannerHTML))
|
w.Write(BannerHTML)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ type ConfigFile struct {
|
||||||
SocketOrigin string
|
SocketOrigin string
|
||||||
// URL to the backend server
|
// URL to the backend server
|
||||||
BackendUrl string
|
BackendUrl string
|
||||||
// Memes go here
|
|
||||||
BannerHTML string
|
|
||||||
|
|
||||||
// SSL/TLS
|
// SSL/TLS
|
||||||
UseSSL bool
|
UseSSL bool
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue