esp8266/scripts/webrepl: Add optional password argument to webrepl.start()

This commit fixes issue #2045
pull/2046/merge
Noah Rosamilia 2016-05-07 14:59:02 -04:00 zatwierdzone przez Paul Sokolovsky
rodzic cea1c621e0
commit 2724bd4a94
1 zmienionych plików z 13 dodań i 8 usunięć

Wyświetl plik

@ -49,14 +49,19 @@ def stop():
listen_s.close()
def start(port=8266):
def start(port=8266, password=None):
stop()
try:
import port_config
_webrepl.password(port_config.WEBREPL_PASS)
if password is None:
try:
import port_config
_webrepl.password(port_config.WEBREPL_PASS)
setup_conn(port, accept_conn)
print("Started webrepl in normal mode")
except:
import webrepl_setup
setup_conn(port, webrepl_setup.handle_conn)
print("Started webrepl in setup mode")
else:
_webrepl.password(password)
setup_conn(port, accept_conn)
print("Started webrepl in normal mode")
except:
import webrepl_setup
setup_conn(port, webrepl_setup.handle_conn)
print("Started webrepl in setup mode")