Commit 16dd6417 authored by Donald Chen's avatar Donald Chen
Browse files

wip: add node red url

parent e151c112
......@@ -252,7 +252,15 @@
<div class="submit_section">
<input class="submit_button" type="submit" value="Submit">
</div>
<div class="warning">
<div class="section" align="center">
This IoT Gateway includes Node-RED, a web-based tool for building Node.js applications.
<br>
The Node-RED web application is accessible at:
<a href="http://params_hostname:80">http://params_hostname:80</a>
</div>
<div class="warning">
<body>
This application does not require or manage Passwords and you are responsible for securing your Gateway.
<br>
......
......@@ -234,9 +234,12 @@ function submitForm(params, res, req) {
}
}
var nameobj;
// no errors occurred. Do success response.
exec (BIN_DIR+'/configure_gateway --showNames', function (error, stdout, stderr) {
var nameobj = {hostname: "unknown", ssid: "unknown", default_ssid: "unknown"};
nameobj = {hostname: "unknown", ssid: "unknown", default_ssid: "unknown"};
try {
nameobj = JSON.parse(stdout);
} catch (ex) {
......@@ -327,7 +330,7 @@ function requestHandler(req, res) {
if ((result.code != 0) || ((typeof result.output !== 'undefined') && (result.output.trim() != "Master"))) {
var res_str = fs.readFileSync(site + '/status.html', {encoding: 'utf8'});
var myhostname, myipaddr;
var myipaddr;
exec(BIN_DIR+'/configure_gateway --showWiFiIP', function (error, stdout, stderr) {
if (error) {
console.log("Error occurred:");
......@@ -338,7 +341,9 @@ function requestHandler(req, res) {
}
});
} else {
res.end(getStateBasedIndexPage());
var res_str = getStateBasedIndexPage();
res_str.replace(/params_hostname/g, nameobj.hostname + ".local");
res.end(res_str);
}
} else if (urlobj.pathname === '/wifiNetworks') {
if (fs.existsSync(NETWORKS_FILE)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment