mirror of
https://github.com/gen2brain/cam2ip.git
synced 2026-01-09 08:08:33 +00:00
Merge pull request #14 from iDigitalFlame/patch-1
Remove the string replacement of the bind address/port
This commit is contained in:
@@ -15,18 +15,11 @@ type HTML struct {
|
|||||||
// NewHTML returns new HTML handler.
|
// NewHTML returns new HTML handler.
|
||||||
func NewHTML(bind string, width, height float64, nogl bool) *HTML {
|
func NewHTML(bind string, width, height float64, nogl bool) *HTML {
|
||||||
h := &HTML{}
|
h := &HTML{}
|
||||||
|
|
||||||
b := strings.Split(bind, ":")
|
|
||||||
if b[0] == "" {
|
|
||||||
bind = "127.0.0.1" + bind
|
|
||||||
}
|
|
||||||
|
|
||||||
tpl := htmlWebGL
|
tpl := htmlWebGL
|
||||||
if nogl {
|
if nogl {
|
||||||
tpl = html
|
tpl = html
|
||||||
}
|
}
|
||||||
|
|
||||||
tpl = strings.Replace(tpl, "{BIND}", bind, -1)
|
|
||||||
tpl = strings.Replace(tpl, "{WIDTH}", fmt.Sprintf("%.0f", width), -1)
|
tpl = strings.Replace(tpl, "{WIDTH}", fmt.Sprintf("%.0f", width), -1)
|
||||||
tpl = strings.Replace(tpl, "{HEIGHT}", fmt.Sprintf("%.0f", height), -1)
|
tpl = strings.Replace(tpl, "{HEIGHT}", fmt.Sprintf("%.0f", height), -1)
|
||||||
|
|
||||||
@@ -52,7 +45,7 @@ var html = `<html>
|
|||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>cam2ip</title>
|
<title>cam2ip</title>
|
||||||
<script>
|
<script>
|
||||||
ws = new WebSocket("ws://{BIND}/socket");
|
ws = new WebSocket("ws://" + window.location.host + "/socket");
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
|
|
||||||
ws.onopen = function() {
|
ws.onopen = function() {
|
||||||
@@ -85,7 +78,7 @@ var htmlWebGL = `<html>
|
|||||||
<script>
|
<script>
|
||||||
var texture, vloc, tloc, vertexBuff, textureBuff;
|
var texture, vloc, tloc, vertexBuff, textureBuff;
|
||||||
|
|
||||||
ws = new WebSocket("ws://{BIND}/socket");
|
ws = new WebSocket("ws://" + window.location.host "/socket");
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
|
|
||||||
ws.onopen = function() {
|
ws.onopen = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user