mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-12-26 07:59:36 -05:00
Added fallback version URL to rnodeconf updater
This commit is contained in:
parent
42dfee8557
commit
e9ae255f84
@ -881,6 +881,7 @@ class RNode():
|
|||||||
selected_version = None
|
selected_version = None
|
||||||
selected_hash = None
|
selected_hash = None
|
||||||
firmware_version_url = "https://unsigned.io/firmware/latest/?v="+program_version+"&variant="
|
firmware_version_url = "https://unsigned.io/firmware/latest/?v="+program_version+"&variant="
|
||||||
|
fallback_firmware_version_url = "https://github.com/markqvist/rnode_firmware/releases/latest/download/release.json"
|
||||||
def ensure_firmware_file(fw_filename):
|
def ensure_firmware_file(fw_filename):
|
||||||
global selected_version, selected_hash, upd_nocheck
|
global selected_version, selected_hash, upd_nocheck
|
||||||
if fw_filename == "extracted_rnode_firmware.zip":
|
if fw_filename == "extracted_rnode_firmware.zip":
|
||||||
@ -919,7 +920,30 @@ def ensure_firmware_file(fw_filename):
|
|||||||
if selected_version == None:
|
if selected_version == None:
|
||||||
if not upd_nocheck:
|
if not upd_nocheck:
|
||||||
try:
|
try:
|
||||||
urlretrieve(firmware_version_url+fw_filename, UPD_DIR+"/"+fw_filename+".version.latest")
|
try:
|
||||||
|
urlretrieve(firmware_version_url+fw_filename, UPD_DIR+"/"+fw_filename+".version.latest")
|
||||||
|
except Exception as e:
|
||||||
|
RNS.log("")
|
||||||
|
RNS.log("WARNING!")
|
||||||
|
RNS.log("Failed to retrieve latest version information for your board from the default server")
|
||||||
|
RNS.log("Will retry using the following fallback URL: "+fallback_firmware_version_url)
|
||||||
|
RNS.log("")
|
||||||
|
RNS.log("Hit enter if you want to proceed")
|
||||||
|
input()
|
||||||
|
try:
|
||||||
|
urlretrieve(fallback_firmware_version_url, UPD_DIR+"/fallback_release_info.json")
|
||||||
|
import json
|
||||||
|
with open(UPD_DIR+"/fallback_release_info.json", "rb") as rif:
|
||||||
|
rdat = json.loads(rif.read())
|
||||||
|
variant = rdat[fw_filename]
|
||||||
|
with open(UPD_DIR+"/"+fw_filename+".version.latest", "wb") as verf:
|
||||||
|
inf_str = str(variant["version"])+" "+str(variant["hash"])
|
||||||
|
verf.write(inf_str.encode("utf-8"))
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
RNS.log("Error while trying fallback URL: "+str(e))
|
||||||
|
raise e
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Failed to retrive latest version information for your board.")
|
RNS.log("Failed to retrive latest version information for your board.")
|
||||||
RNS.log("Check your internet connection and try again.")
|
RNS.log("Check your internet connection and try again.")
|
||||||
|
Loading…
Reference in New Issue
Block a user