Start work on automatically updating script

This commit is contained in:
noirscape 2020-02-12 15:00:28 +01:00
parent 969165a779
commit 7b4aa1c608
No known key found for this signature in database
GPG Key ID: 38216818B8894B9F
2 changed files with 35 additions and 4 deletions

View File

@ -2,7 +2,4 @@
Fusee Launcher, in a browser!
# Description
This is a port of [fusee-launcher](https://github.com/reswitched/fusee-launcher) to JavaScript using WebUSB. This has been mildly tested and appears to work on Linux, Android (unrooted), OSX and ChromeOS. Today, this only works on Chrome because only Chrome implements WebUSB. It also does NOT work on Windows because the WebUSB Windows implementation does not allow sending the required USB packet.
# Try it out
Either use a web server to host the files (must be on https!) or you can try the [demo](https://atlas44.s3-us-west-2.amazonaws.com/web-fusee-launcher/index.html).
This is a fork of [web-fusee-launcher](https://github.com/atlas44/web-fusee-launcher), which is a port of [fusee-launcher](https://github.com/reswitched/fusee-launcher) to JavaScript using WebUSB. This has been mildly tested and appears to work on Linux, Android (unrooted), OSX and ChromeOS. Today, this only works on Chrome because only Chrome implements WebUSB. It also does NOT work on Windows because the WebUSB Windows implementation does not allow sending the required USB packet.

34
gen_bin_js.py Normal file
View File

@ -0,0 +1,34 @@
import requests
import io
API_URL = "https://api.github.com/repos/CTCaer/hekate/releases/latest"
SERIALIZED_FILENAME = "hekate.bin.js"
## Script that downloads the latest bin from hekate and serializes it as a .bin.js file.
def download_file_to_bytes_io(url) -> io.BytesIO:
r = requests.get(url)
filedata = io.BytesIO()
if r.status_code == 200:
filedata.write(r.content)
filedata.seek(0)
return filedata
def extract_specific_file_from_zip():
pass
def fetch_hekate_zip() -> io.BytesIO:
r = requests.get(API_URL)
jdata = r.json()
return download_file_to_bytes_io([d for d in hekate_json["assets"] if d["name"].startswith("hekate_ctcaer")][0]["browser_download_url"])
def get_hekate_payload(hekate_zip: io.BytesIO) -> io.BytesIO:
pass
def serialize_to_js(hekate_payload: io.BytesIO, filename: str):
pass
if __name__ == "__main__":
api_response = fetch_hekate_zip()
payload = get_hekate_payload(api_response)
serialize_to_js(payload, SERIALIZED_FILENAME)