Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vesta
iot-gateway-setup
Commits
39606850
Commit
39606850
authored
Aug 16, 2017
by
David Mondou
Browse files
Removed debug messsages.
Renamed server.
parent
6b1f7155
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/configure_gateway
View file @
39606850
...
...
@@ -663,7 +663,7 @@ def enableOneTimeSetup(persist):
subprocess
.
call
(
"/etc/init.d/dnsmasq start &> /dev/null"
,
shell
=
True
)
subprocess
.
call
(
"ifconfig wlan0 192.168.0.50 netmask 255.255.255.0"
,
shell
=
True
)
subprocess
.
call
(
"/usr/rigado/scripts/led_control.sh red solid"
,
shell
=
True
)
subprocess
.
call
(
"/etc/init.d/
oobe_
server start"
,
shell
=
True
)
subprocess
.
call
(
"/etc/init.d/
iot-gateway-setup-
server start"
,
shell
=
True
)
myssid
=
getSSID
()
...
...
@@ -683,7 +683,7 @@ def disableOneTimeSetup(persist):
subprocess
.
call
(
"ifup wlan0"
,
shell
=
True
)
subprocess
.
call
(
"/etc/init.d/dnsmasq stop &> /dev/null"
,
shell
=
True
)
subprocess
.
call
(
"/usr/rigado/scripts/led_control.sh green solid"
,
shell
=
True
)
subprocess
.
call
(
"/etc/init.d/
oobe_
server stop"
,
shell
=
True
)
subprocess
.
call
(
"/etc/init.d/
iot-gateway-setup-
server stop"
,
shell
=
True
)
def
toggleOneTimeSetup
(
persist
):
if
showWiFiMode
()
==
"Master"
:
...
...
server.js
View file @
39606850
...
...
@@ -70,7 +70,7 @@ function getContentType(filename) {
function
injectStatus
(
in_text
,
statusmsg
,
iserr
)
{
var
injectStatusAt
=
in_text
.
indexOf
(
injectStatusAfter
)
+
injectStatusAfter
.
length
;
var
status
=
""
;
console
.
log
(
"
START HERE
"
)
if
(
statusmsg
)
{
if
(
iserr
){
status
=
'
<div id="statusarea" name="statusarea" class="status errmsg">
'
+
'
</div>
'
;
...
...
@@ -124,8 +124,6 @@ function setHost(params) {
}
function
setWiFi
(
params
)
{
console
.
log
(
"
setWiFi
"
);
var
exec_cmd
=
""
,
errmsg
=
"
Unknown error occurred.
"
,
exec_args
=
[];
if
(
!
params
.
newwifi
)
{
...
...
@@ -184,8 +182,6 @@ function doSleep() {
}
function
runCmd
(
i
,
commands
)
{
console
.
log
(
"
Running commands
"
)
console
.
log
(
i
);
if
(
i
===
commands
.
length
)
return
;
...
...
@@ -303,10 +299,8 @@ function inWhiteList(path) {
console
.
log
(
BIN_DIR
+
'
/configure_gateway --showWiFiMode
'
);
if
((
result
.
code
!=
0
)
||
((
typeof
result
.
stdout
!==
'
undefined
'
)
&&
(
result
.
stdout
.
trim
()
===
"
Master
"
)))
{
return
true
;
}
else
{
console
.
log
(
"
Result:
"
);
console
.
log
(
JSON
.
stringify
(
result
,
null
,
2
));
}
}
return
WHITELIST_PATHS
[
path
]
||
WHITELIST_CMDS
[
path
];
}
...
...
@@ -333,7 +327,7 @@ function requestHandler(req, res) {
console
.
log
(
urlobj
.
pathname
);
var
result
=
shell
.
exec
(
BIN_DIR
+
'
/configure_gateway --showWiFiMode
'
,
{
silent
:
true
});
console
.
log
(
BIN_DIR
+
'
/configure_gateway --showWiFiMode
'
)
console
.
log
(
result
);
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment