...
 
Commits (2)
......@@ -147,7 +147,8 @@ def step1_post():
#XXX Handle errors here, and signal back to the client.
def step1_handler(ssid, wifi_pw, mount):
if "ZIPFILE" not in os.environ:
r = requests.get(CENTRAL_URL + "/static/images/rpi3.zip", stream=True)
url = CENTRAL_URL + "/static/images/%s.zip" % os.environ.get('ZIPFILE_NAME', 'rpi3')
r = requests.get(url, stream=True)
bio = io.BytesIO()
zip_length = r.headers.get('content-length')
if zip_length is None:
......@@ -176,11 +177,6 @@ def step1_handler(ssid, wifi_pw, mount):
step1_thread.cur = 50 + (bytes_written / num_bytes) * 50
bio.close()
with open(os.path.join(mount, "pairingkey"), 'wb') as f:
get_subkey("throwaway") #Make sure the key is loaded.
f.write(standard_b64decode(get_from_datadir("pairingkey")))
step1_thread.cur += 1
if len(ssid) > 0:
with open(os.path.join(mount, "wifi.txt"), 'w') as f:
#XXX Verify that no-pw wifi networks work.
......@@ -198,6 +194,11 @@ def step1_handler(ssid, wifi_pw, mount):
pass
step1_thread.cur += 1
with open(os.path.join(mount, "pairingkey"), 'wb') as f:
get_subkey("throwaway") #Make sure the key is loaded.
f.write(standard_b64decode(get_from_datadir("pairingkey")))
step1_thread.cur += 1
@get('/step1_post_api1')
def step1_post_api2():
global step1_thread
......