Skip to content

Commit

Permalink
Merge pull request #14 from iDigitalFlame/patch-1
Browse files Browse the repository at this point in the history
Remove the string replacement of the bind address/port
  • Loading branch information
gen2brain committed Nov 30, 2018
2 parents 09932a9 + 13385ba commit 4d73010
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions handlers/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@ type HTML struct {
// NewHTML returns new HTML handler.
func NewHTML(bind string, width, height float64, nogl bool) *HTML {
h := &HTML{}

b := strings.Split(bind, ":")
if b[0] == "" {
bind = "127.0.0.1" + bind
}


tpl := htmlWebGL
if nogl {
tpl = html
}

tpl = strings.Replace(tpl, "{BIND}", bind, -1)
tpl = strings.Replace(tpl, "{WIDTH}", fmt.Sprintf("%.0f", width), -1)
tpl = strings.Replace(tpl, "{HEIGHT}", fmt.Sprintf("%.0f", height), -1)

Expand All @@ -52,7 +45,7 @@ var html = `<html>
<meta charset="utf-8"/>
<title>cam2ip</title>
<script>
ws = new WebSocket("ws://{BIND}/socket");
ws = new WebSocket("ws://" + window.location.host + "/socket");
var image = new Image();
ws.onopen = function() {
Expand Down Expand Up @@ -85,7 +78,7 @@ var htmlWebGL = `<html>
<script>
var texture, vloc, tloc, vertexBuff, textureBuff;
ws = new WebSocket("ws://{BIND}/socket");
ws = new WebSocket("ws://" + window.location.host "/socket");
var image = new Image();
ws.onopen = function() {
Expand Down

0 comments on commit 4d73010

Please sign in to comment.