Fix entry index

This commit is contained in:
giongto35 2019-04-07 19:22:42 +08:00
parent 7b0738afc6
commit 353042ee73
2 changed files with 18 additions and 18 deletions

28
main.go
View file

@ -24,10 +24,14 @@ import (
"encoding/json"
)
const gameboyIndex = "./static/gameboy.html"
const httpIndex = "./static/index_http.html"
const wsIndex = "./static/index_ws.html"
// var webRTC *webrtc.WebRTC
var width = 256
var height = 240
var indexFN string = "./static/gameboy.html"
var indexFN string = wsIndex
var service string = "http"
type IndexPageData struct {
@ -87,16 +91,20 @@ func main() {
}
func getWeb(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles(indexFN))
data := IndexPageData{
Service: service,
if indexFN != gameboyIndex {
bs, err := ioutil.ReadFile(indexFN)
if err != nil {
log.Fatal(err)
}
w.Write(bs)
} else {
// gameboy index
tmpl := template.Must(template.ParseFiles(indexFN))
data := IndexPageData{
Service: service,
}
tmpl.Execute(w, data)
}
tmpl.Execute(w, data)
// bs, err := ioutil.ReadFile(index)
// if err != nil {
// log.Fatal(err)
// }
// w.Write(bs)
}
// initRoom initilize room returns roomID

View file

@ -9,7 +9,6 @@ function startGame() {
$("#loading-screen").show();
$("#menu-screen").fadeOut();
// end clear
// Register with server the session description
function postSession(session) {
@ -48,13 +47,6 @@ function startGame() {
log("New stream, yay!");
document.getElementById("loading-screen").srcObject = event.streams[0];
// var el = document.createElement(event.track.kind)
// el.srcObject = event.streams[0]
// el.autoplay = true
// el.width = 800;
// el.height = 600;
// el.poster = new URL("https://orig00.deviantart.net/cdcd/f/2017/276/a/a/october_2nd___gameboy_poltergeist_by_wanyo-dbpdmnd.gif");
// document.getElementById('remoteVideos').appendChild(el)
}