mirror of
https://github.com/Koenkk/zigbee-OTA.git
synced 2026-10-02 17:31:27 +00:00
fix: cleanup customParseLogic no longer needed (#1038)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {getJson, readCacheJson, writeCacheJson} from "../common.js";
|
||||
import {processFirmwareImage} from "../process_firmware_image.js";
|
||||
import type {ExtraMetas} from "../types.js";
|
||||
|
||||
type DeviceImageJson = {
|
||||
fw_binary_url: string;
|
||||
@@ -16,7 +15,6 @@ type ImagesJson = DeviceImageJson[];
|
||||
const NAME = "Sonoff";
|
||||
const LOG_PREFIX = `[${NAME}]`;
|
||||
const FIRMWARE_URL = "https://zigbee-ota.sonoff.tech/releases/upgrade.json";
|
||||
const TELINK_ENCRYPTED = ["SNZB-02DR2", "SNZB-02LWD"];
|
||||
|
||||
function findInCache(image: DeviceImageJson, cachedData?: ImagesJson): DeviceImageJson | undefined {
|
||||
return cachedData?.find((d) => d.fw_image_type === image.fw_image_type && d.fw_manufacturer_id === image.fw_manufacturer_id) as
|
||||
@@ -53,9 +51,7 @@ export async function download(): Promise<void> {
|
||||
continue;
|
||||
}
|
||||
|
||||
const extraMetas: ExtraMetas = TELINK_ENCRYPTED.includes(image.model_id) ? {customParseLogic: "telinkEncrypted"} : {};
|
||||
|
||||
await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, extraMetas);
|
||||
await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {});
|
||||
}
|
||||
|
||||
writeCacheJson(NAME, images);
|
||||
|
||||
@@ -309,14 +309,6 @@ export function getValidMetas(metas: Partial<ExtraMetas & ExtraMetasWithFileName
|
||||
validMetas.maxFileVersion = metas.maxFileVersion;
|
||||
}
|
||||
|
||||
if (metas.customParseLogic != null) {
|
||||
if (metas.customParseLogic !== "telinkEncrypted") {
|
||||
throw new Error(`Invalid value for 'customParseLogic', expected 'telinkEncrypted' value.`);
|
||||
}
|
||||
|
||||
validMetas.customParseLogic = metas.customParseLogic;
|
||||
}
|
||||
|
||||
if (metas.minFileVersion != null) {
|
||||
if (typeof metas.minFileVersion !== "number") {
|
||||
throw new Error(`Invalid format for 'minFileVersion', expected 'number' type.`);
|
||||
|
||||
@@ -61,7 +61,6 @@ export interface RepoImageMeta extends ImageInfo, ImageMeta {
|
||||
maxFileVersion?: number;
|
||||
originalUrl?: string;
|
||||
releaseNotes?: string;
|
||||
customParseLogic?: string;
|
||||
}
|
||||
|
||||
export type ExtraMetas = Omit<
|
||||
|
||||
Reference in New Issue
Block a user