29 lines
No EOL
730 B
TypeScript
29 lines
No EOL
730 B
TypeScript
import type { FirmwareManifest } from '~/types/manifest';
|
|
|
|
export const useManifest = () => {
|
|
const getManifest = async(
|
|
deviceType: string,
|
|
customize: boolean,
|
|
hasFrontlight: boolean,
|
|
displayColors: string
|
|
): FirmwareManifest => {
|
|
|
|
const response = await fetch(`/${deviceType}.json`);
|
|
const baseManifest: FirmwareManifest = await response.json();
|
|
|
|
if (customize) {
|
|
// Add NVS partition based on settings
|
|
const nvsVariant = `${hasFrontlight ? 'frontlight_' : ''}${displayColors}`;
|
|
baseManifest.builds[0].parts.push({
|
|
path: `firmware_v3/nvs/${nvsVariant}.bin`,
|
|
offset: "0x9000"
|
|
});
|
|
}
|
|
|
|
return baseManifest;
|
|
};
|
|
|
|
return {
|
|
getManifest
|
|
};
|
|
}; |