tasmota-esp-web-tools
Version:
Web tools for ESP devices
18 lines (17 loc) • 728 B
JavaScript
import { corsProxyFetch } from "./cors-proxy";
export const downloadManifest = async (manifestPath) => {
const manifestURL = new URL(manifestPath, location.toString()).toString();
const resp = await corsProxyFetch(manifestURL);
if (!resp.ok) {
throw new Error(`Failed to fetch manifest: ${resp.status}`);
}
const manifest = await resp.json();
if ("new_install_skip_erase" in manifest) {
// eslint-disable-next-line no-console
console.warn('Manifest option "new_install_skip_erase" is deprecated. Use "new_install_prompt_erase" instead.');
if (manifest.new_install_skip_erase) {
manifest.new_install_prompt_erase = true;
}
}
return manifest;
};