Skip to content

Commit

Permalink
Updated main to remove debug statement
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfonso-directnic committed Jul 1, 2019
1 parent cbd2d5a commit f4f260e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func deviceHandler(w http.ResponseWriter, r *http.Request) {

device := parts[2]

fmt.Fprintln(w,device)
// fmt.Fprintln(w,device)

ids := broadlink.DeviceIds()

Expand Down
6 changes: 3 additions & 3 deletions cmd/rice-box.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ func init() {
}
file1d := &embedded.EmbeddedFile{
Filename: "tmpl/index.html",
FileModTime: time.Unix(1561908065, 0),
FileModTime: time.Unix(1561909482, 0),

Content: string("\n<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n <meta name=\"description\" content=\"\">\n <meta name=\"author\" content=\"\">\n <link rel=\"icon\" href=\"/assets/img/favicons/favicon.ico\">\n\n <title>Broadlink Control</title>\n\n\n <!-- Bootstrap core CSS -->\n <link href=\"/assets/css/bootstrap.min.css\" rel=\"stylesheet\">\n\n <!-- Custom styles for this template -->\n <link href=\"/assets/css/sticky-footer-navbar.css\" rel=\"stylesheet\">\n <link href=\"/assets/css/open-iconic-bootstrap.css\" rel=\"stylesheet\">\n </head>\n\n <body>\n\n <header>\n <!-- Fixed navbar -->\n <nav class=\"navbar navbar-expand-md navbar-dark fixed-top bg-dark\">\n <a class=\"navbar-brand\" href=\"/\">Broadlink Control</a>\n <button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarCollapse\" aria-controls=\"navbarCollapse\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n <span class=\"navbar-toggler-icon\"></span>\n </button>\n <div class=\"collapse navbar-collapse\" id=\"navbarCollapse\">\n <ul class=\"navbar-nav mr-auto\">\n <li class=\"nav-item active\">\n <a class=\"nav-link\" href=\"/\">Home <span class=\"sr-only\">(current)</span></a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link\" href=\"/learn\">Learn</a>\n </li>\n \n </ul>\n \n </div>\n </nav>\n </header>\n\n <!-- Begin page content -->\n <main role=\"main\" class=\"container\">\n\t <div style='display:none' class=\"alert alert-success\">\n\t\t <a href=\"#\" class=\"close\" data-hide=\"alert\" aria-label=\"close\" title=\"close\">×</a>\n\t\t <span id=\"message\"> </span>\n\t\t</div> \n <h2 class=\"mt-5\">Application Status: <span id='device_ct' >{{.DevicesCT}}</span> devices online</h2>\n\n\n\t <form>\n\t\t <div id=\"form-group\">\n\t\t\t <label>Send Command to:</label>\n\t\t <select id=\"active_device\"> \n\t\t\t <option value=\"\">All Devices</option>\n\t\t </select>\n\t\t </div>\n\t </form>\n \n <p id=\"dev\"> </p>\n \n <p id=\"cmds\"> </p>\n </main>\n\n <footer class=\"footer\">\n <div class=\"container\">\n <span class=\"text-muted\"><a href=\"https://github.com/rob121/broadlinkgo\" >Github</a></span>\n </div>\n </footer>\n \n\n <!-- Bootstrap core JavaScript\n ================================================== -->\n <!-- Placed at the end of the document so the pages load faster -->\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js\" crossorigin=\"anonymous\"></script>\n <script>window.jQuery || document.write('<script src=\"/assets/js/vendor/jquery.min.js\"><\\/script>')</script>\n \n <script src=\"/assets/js/bootstrap.min.js\"></script>\n \n <script>\n\t\n\t\n\t$(function(){\n\t\t\n\t $(\"[data-hide]\").on(\"click\", function(){\n $(\".\" + $(this).attr(\"data-hide\")).hide();\n \n });\t\n\t\n\t $(document).on(\"click\",\"[data-url]\",function(e){\n\t\t \n\t\t e.preventDefault();\n\t\t \n\t\t typ = $(this).attr(\"data-method\");\n\t\t \n\t\t console.log(this.href);\n\t\t \n\t\t if(this.href.includes(\"/remove\")){\n\t\t\t \n\t\t\t if(!confirm(\"Are you sure you want to remove this learned code?\")){\n\t\t\t\t \n\t\t\t\t return;\n\t\t\t }\n\t\t\t \n\t\t }\n\t\t \n\t\t //send to specific device if necessary\n\t\t if(this.href.includes(\"/cmd\")){ \n\t\t\t \n\t\t\t dev_val = $(\"#active_device\").val();\n\t\t\t \n\t\t\t if(dev_val!=\"\"){\n\t\t\t\t \n\t\t\t\tthis.href = this.href.replace(\"/cmd/\",\"/device/\"+dev_val+\"/cmd/\");\n\t\t\t\tconsole.log(this.href);\n\t\t\t }\n\t\t\t \n\t\t }\n\t\t \n\t\t $.ajax({\n\t\t\t url:this.href, \n\t\t\t cache: false,\n\t\t\t type: (typ==\"post\" ? \"post\" : \"get\"),\n\t\t\t success: function(resp){\n \n \t\t\t $(\".alert\").fadeIn(function(){\n \t\t\t \t$(\"#message\").html(resp.message);\n \t\t\t });\n \t\t\t getStatus();\n\n \t\t }});\n \t\t \n \t\t \n\t\t\n\t\t \n\t });\n\t \n\t getStatus();\n\t \n\t setInterval(function(){\n\t\t getStatus();\n\t},5000);\n\t\t\n\t});\n\t\n\tfunction getStatus(){\n\t\t\n\t\t $.get(\"/status\",function(resp){\n\t\n\n\t\t \n\t\t \n\t\t ht=\"<tr><th>Devices</td></tr>\";\n\t\t \n\t\t \n\t\t \n\n\t\t d = Object.keys(resp.payload.devices).length;\n\t\t \n\t\t\n\t\t \n\t\t \n\t\t if(2>1){\n\t\n\t\t \n\t\t for (var key in resp.payload.devices){\n\t\t\t \n\t\t\t kk = resp.payload.devices[key];\n\t\t\t \n\t\t\t opt = \"<option value='\"+kk+\"' >\"+kk+\"</option>\";\n\n\t\t\t len = $('#active_device option[value=\"' + kk + '\"]').length;\n\t\t\t \n\t\t\t if(len<1){\n\t\t\t\t \n\t\t\t\t $(\"#active_device\").append(opt);\n\t\t\t }\n\t\t }\n\t\n\t\t \n\t\t }\n\t\t \n\t\t for (var key in resp.payload.devices){ \n\t\t\t\n\t\t\t \n\t\t\t \n\t\t\t// console.log(resp.payload.commands[key]);\n\t\t\t \n\t\t\t ht+=\"<tr><td>\"+resp.payload.devices[key]+\"</td></tr>\"\n\t\t\t\t\t\t \n\t\t\t \n\t\t\t \n\t\t\t \n\t\t }\n\t\t \n\n\t\t \n\t\t $(\"#device_ct\").html(d);\n\t\t \n\t\t\n\t\t \n\t\t $(\"#dev\").html(\"<table class='table'>\"+ht+\"</table>\");\n\t\t \n\t\t \n\t\t \n\t\t ht=\"<tr><th width='60%'>Commands</td> <th></th> <th></th></tr>\"\n\t\t for (var key in resp.payload.commands){ \n\t\t\t \n\t\t\t// console.log(resp.payload.commands[key]);\n\t\t\t \n\t\t\t ht+=\"<tr><td>\"+resp.payload.commands[key]+\"</td>\";\n\n\t\t\t ht+=\"<td>\";\n\t\t\t ht+=\"<a data-url='true' href='/cmd/\"+resp.payload.commands[key]+\"' class='btn btn-success' role='button' ><span class='oi oi-play-circle' title='icon name' aria-hidden='true'></span> Execute</a></td>\";\n\t\t\t ht+=\"<td><a data-url='true' data-method='post' href='/remove/\"+resp.payload.commands[key]+\"' class='btn btn-danger' role='button' ><span class='oi oi-circle-x' title='icon name' aria-hidden='true'></span> Remove</a></td>\";\n\t\t\t ht+=\"</tr>\";\n\t\t\t \n\t\t }\n\t\t \n\t\t $(\"#cmds\").html(\"<table class='table'>\"+ht+\"</table>\");\n\t\t \n\t\t \n\t },\"json\");\t\n\t\t\n\t}\n\t\n\t</script>\n </body>\n</html>\n\n"),
Content: string("\n<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n <meta name=\"description\" content=\"\">\n <meta name=\"author\" content=\"\">\n <link rel=\"icon\" href=\"/assets/img/favicons/favicon.ico\">\n\n <title>Broadlink Control</title>\n\n\n <!-- Bootstrap core CSS -->\n <link href=\"/assets/css/bootstrap.min.css\" rel=\"stylesheet\">\n\n <!-- Custom styles for this template -->\n <link href=\"/assets/css/sticky-footer-navbar.css\" rel=\"stylesheet\">\n <link href=\"/assets/css/open-iconic-bootstrap.css\" rel=\"stylesheet\">\n </head>\n\n <body>\n\n <header>\n <!-- Fixed navbar -->\n <nav class=\"navbar navbar-expand-md navbar-dark fixed-top bg-dark\">\n <a class=\"navbar-brand\" href=\"/\">Broadlink Control</a>\n <button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarCollapse\" aria-controls=\"navbarCollapse\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n <span class=\"navbar-toggler-icon\"></span>\n </button>\n <div class=\"collapse navbar-collapse\" id=\"navbarCollapse\">\n <ul class=\"navbar-nav mr-auto\">\n <li class=\"nav-item active\">\n <a class=\"nav-link\" href=\"/\">Home <span class=\"sr-only\">(current)</span></a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link\" href=\"/learn\">Learn</a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link\" target=\"_blank\" href=\" https://github.com/rob121/broadlinkgo/blob/master/README.md\">Docs</a>\n </li>\n \n \n </ul>\n \n </div>\n </nav>\n </header>\n\n <!-- Begin page content -->\n <main role=\"main\" class=\"container\">\n\t <div style='display:none' class=\"alert alert-success\">\n\t\t <a href=\"#\" class=\"close\" data-hide=\"alert\" aria-label=\"close\" title=\"close\">×</a>\n\t\t <span id=\"message\"> </span>\n\t\t</div> \n <h2 class=\"mt-5\">Application Status: <span id='device_ct' >{{.DevicesCT}}</span> devices online</h2>\n\n\n\t <form>\n\t\t <div id=\"form-group\">\n\t\t\t <label>Send Command to:</label>\n\t\t <select id=\"active_device\"> \n\t\t\t <option value=\"\">All Devices</option>\n\t\t </select>\n\t\t </div>\n\t </form>\n \n <p id=\"dev\"> </p>\n \n <p id=\"cmds\"> </p>\n </main>\n\n <footer class=\"footer\">\n <div class=\"container\">\n <span class=\"text-muted\"><a href=\"https://github.com/rob121/broadlinkgo\" >Github</a></span>\n </div>\n </footer>\n \n\n <!-- Bootstrap core JavaScript\n ================================================== -->\n <!-- Placed at the end of the document so the pages load faster -->\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js\" crossorigin=\"anonymous\"></script>\n <script>window.jQuery || document.write('<script src=\"/assets/js/vendor/jquery.min.js\"><\\/script>')</script>\n \n <script src=\"/assets/js/bootstrap.min.js\"></script>\n \n <script>\n\t\n\t\n\t$(function(){\n\t\t\n\t $(\"[data-hide]\").on(\"click\", function(){\n $(\".\" + $(this).attr(\"data-hide\")).hide();\n \n });\t\n\t\n\t $(document).on(\"click\",\"[data-url]\",function(e){\n\t\t \n\t\t e.preventDefault();\n\t\t \n\t\t typ = $(this).attr(\"data-method\");\n\t\t \n\t\t console.log(this.href);\n\t\t \n\t\t if(this.href.includes(\"/remove\")){\n\t\t\t \n\t\t\t if(!confirm(\"Are you sure you want to remove this learned code?\")){\n\t\t\t\t \n\t\t\t\t return;\n\t\t\t }\n\t\t\t \n\t\t }\n\t\t \n\t\t //send to specific device if necessary\n\t\t if(this.href.includes(\"/cmd\")){ \n\t\t\t \n\t\t\t dev_val = $(\"#active_device\").val();\n\t\t\t \n\t\t\t if(dev_val!=\"\"){\n\t\t\t\t \n\t\t\t\tthis.href = this.href.replace(\"/cmd/\",\"/device/\"+dev_val+\"/cmd/\");\n\t\t\t\tconsole.log(this.href);\n\t\t\t }\n\t\t\t \n\t\t }\n\t\t \n\t\t $.ajax({\n\t\t\t url:this.href, \n\t\t\t cache: false,\n\t\t\t type: (typ==\"post\" ? \"post\" : \"get\"),\n\t\t\t success: function(resp){\n \n \t\t\t $(\".alert\").fadeIn(function(){\n \t\t\t \t$(\"#message\").html(resp.message);\n \t\t\t });\n \t\t\t getStatus();\n\n \t\t }});\n \t\t \n \t\t \n\t\t\n\t\t \n\t });\n\t \n\t getStatus();\n\t \n\t setInterval(function(){\n\t\t getStatus();\n\t},5000);\n\t\t\n\t});\n\t\n\tfunction getStatus(){\n\t\t\n\t\t $.get(\"/status\",function(resp){\n\t\n\n\t\t \n\t\t \n\t\t ht=\"<tr><th>Devices</td></tr>\";\n\t\t \n\t\t \n\t\t \n\n\t\t d = Object.keys(resp.payload.devices).length;\n\t\t \n\t\t\n\t\t \n\t\t \n\t\t if(2>1){\n\t\n\t\t \n\t\t for (var key in resp.payload.devices){\n\t\t\t \n\t\t\t kk = resp.payload.devices[key];\n\t\t\t \n\t\t\t opt = \"<option value='\"+kk+\"' >\"+kk+\"</option>\";\n\n\t\t\t len = $('#active_device option[value=\"' + kk + '\"]').length;\n\t\t\t \n\t\t\t if(len<1){\n\t\t\t\t \n\t\t\t\t $(\"#active_device\").append(opt);\n\t\t\t }\n\t\t }\n\t\n\t\t \n\t\t }\n\t\t \n\t\t for (var key in resp.payload.devices){ \n\t\t\t\n\t\t\t \n\t\t\t \n\t\t\t// console.log(resp.payload.commands[key]);\n\t\t\t \n\t\t\t ht+=\"<tr><td>\"+resp.payload.devices[key]+\"</td></tr>\"\n\t\t\t\t\t\t \n\t\t\t \n\t\t\t \n\t\t\t \n\t\t }\n\t\t \n\n\t\t \n\t\t $(\"#device_ct\").html(d);\n\t\t \n\t\t\n\t\t \n\t\t $(\"#dev\").html(\"<table class='table'>\"+ht+\"</table>\");\n\t\t \n\t\t \n\t\t \n\t\t ht=\"<tr><th width='60%'>Commands</td> <th></th> <th></th></tr>\"\n\t\t for (var key in resp.payload.commands){ \n\t\t\t \n\t\t\t// console.log(resp.payload.commands[key]);\n\t\t\t \n\t\t\t ht+=\"<tr><td>\"+resp.payload.commands[key]+\"</td>\";\n\n\t\t\t ht+=\"<td>\";\n\t\t\t ht+=\"<a data-url='true' href='/cmd/\"+resp.payload.commands[key]+\"' class='btn btn-success' role='button' ><span class='oi oi-play-circle' title='icon name' aria-hidden='true'></span> Execute</a></td>\";\n\t\t\t ht+=\"<td><a data-url='true' data-method='post' href='/remove/\"+resp.payload.commands[key]+\"' class='btn btn-danger' role='button' ><span class='oi oi-circle-x' title='icon name' aria-hidden='true'></span> Remove</a></td>\";\n\t\t\t ht+=\"</tr>\";\n\t\t\t \n\t\t }\n\t\t \n\t\t $(\"#cmds\").html(\"<table class='table'>\"+ht+\"</table>\");\n\t\t \n\t\t \n\t },\"json\");\t\n\t\t\n\t}\n\t\n\t</script>\n </body>\n</html>\n\n"),
}
file1e := &embedded.EmbeddedFile{
Filename: "tmpl/learn.html",
Expand Down Expand Up @@ -352,7 +352,7 @@ func init() {
}
dir1c := &embedded.EmbeddedDir{
Filename: "tmpl",
DirModTime: time.Unix(1561908463, 0),
DirModTime: time.Unix(1561909482, 0),
ChildFiles: []*embedded.EmbeddedFile{
file1d, // "tmpl/index.html"
file1e, // "tmpl/learn.html"
Expand Down

0 comments on commit f4f260e

Please sign in to comment.