diff --git a/src/utils/blob.js b/src/utils/blob.js deleted file mode 100644 index af9f750..0000000 --- a/src/utils/blob.js +++ /dev/null @@ -1,23 +0,0 @@ -export async function download(url) { - const response = await fetch(url, { mode: 'cors' }) - const reader = response.body.getReader() - const contentLength = +response.headers.get('Content-Length') - console.debug('[blob] Downloading', url, contentLength) - - const chunks = [] - while (true) { - const { done, value } = await reader.read() - if (done) break - chunks.push(value) - } - - const blob = new Blob(chunks) - console.debug('[blob] Downloaded', url, blob.size) - if (blob.size !== contentLength) console.debug('[blob] Download size mismatch', { - url, - expected: contentLength, - actual: blob.size, - }) - - return blob -} diff --git a/src/utils/flash.js b/src/utils/flash.js index 4af9a0c..7033114 100644 --- a/src/utils/flash.js +++ b/src/utils/flash.js @@ -3,9 +3,8 @@ import { qdlDevice } from '@commaai/qdl' import * as Comlink from 'comlink' import config from '../config' -import { download } from '../utils/blob' import { useImageWorker } from '../utils/image' -import { createManifest } from '../utils/manifest' +import { getManifest } from '../utils/manifest' import { withProgress } from '../utils/progress' /** @@ -124,10 +123,9 @@ export function useQdl() { } imageWorker.current?.init() - .then(() => download(config.manifests['release'])) - .then(blob => blob.text()) - .then(text => { - manifest.current = createManifest(text) + .then(() => getManifest(config.manifests.release)) + .then((images) => { + manifest.current = images // sanity check if (manifest.current.length === 0) {