Skip to content

Commit

Permalink
Match Autodl metas to ZHC. Remove unneeded metas.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec committed Nov 1, 2024
1 parent 9ef6a71 commit c19bb73
Show file tree
Hide file tree
Showing 221 changed files with 303 additions and 996 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
878 changes: 200 additions & 678 deletions index.json

Large diffs are not rendered by default.

364 changes: 67 additions & 297 deletions index1.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/autodl/gmmts.ts → src/autodl/gammatroniques.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ type ImagesJson = {
builds: ImagesJsonBuild[];
};

const NAME = 'Gmmts';
const NAME = 'GammaTroniques';
// const LOG_PREFIX = `[${NAME}]`;
const BASE_URL = 'https://update.gammatroniques.fr/';
const MANIFEST_URL_PATH = `/manifest.json`;
const MODEL_IDS = ['ticmeter'];
const MODEL_IDS: [urlId: string, modelId: string][] = [['ticmeter', 'TICMeter']];

function isDifferent(newData: ImagesJson, cachedData?: ImagesJson): boolean {
return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.version !== newData.version;
}

export async function writeCache(): Promise<void> {
for (const modelId of MODEL_IDS) {
const url = `${BASE_URL}${modelId}${MANIFEST_URL_PATH}`;
for (const [urlId, modelId] of MODEL_IDS) {
const url = `${BASE_URL}${urlId}${MANIFEST_URL_PATH}`;
const page = await getJson<ImagesJson>(NAME, url);

if (page?.builds?.length) {
Expand All @@ -43,9 +43,9 @@ export async function writeCache(): Promise<void> {
}

export async function download(): Promise<void> {
for (const modelId of MODEL_IDS) {
for (const [urlId, modelId] of MODEL_IDS) {
const logPrefix = `[${NAME}:${modelId}]`;
const url = `${BASE_URL}${modelId}${MANIFEST_URL_PATH}`;
const url = `${BASE_URL}${urlId}${MANIFEST_URL_PATH}`;
const page = await getJson<ImagesJson>(NAME, url);

if (!page?.builds?.length) {
Expand All @@ -71,6 +71,6 @@ export async function download(): Promise<void> {

const firmwareFileName = appUrl.ota.split('/').pop()!;

await processFirmwareImage(NAME, firmwareFileName, appUrl.ota, {manufacturerName: [NAME]});
await processFirmwareImage(NAME, firmwareFileName, appUrl.ota, {modelId});
}
}
11 changes: 9 additions & 2 deletions src/autodl/github.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {ExtraMetas} from '../types.js';

import {getJson, getLatestImage, readCacheJson, writeCacheJson} from '../common.js';
import {processFirmwareImage} from '../process_firmware_image.js';

Expand Down Expand Up @@ -56,7 +58,12 @@ export async function writeCache(manufacturer: string, releasesUrl: string): Pro
}
}

export async function download(manufacturer: string, releasesUrl: string, assetFinders: AssetFindPredicate[]): Promise<void> {
export async function download(
manufacturer: string,
releasesUrl: string,
assetFinders: AssetFindPredicate[],
extraMetas: ExtraMetas,
): Promise<void> {
const logPrefix = `[${manufacturer}]`;
const releases = await getJson<ReleasesJson>(manufacturer, releasesUrl);

Expand All @@ -79,8 +86,8 @@ export async function download(manufacturer: string, releasesUrl: string, assetF
}

await processFirmwareImage(manufacturer, asset.name, asset.browser_download_url, {
manufacturerName: [manufacturer],
releaseNotes: release.html_url,
...extraMetas,
});
} else {
console.error(`${logPrefix} No image found.`);
Expand Down
2 changes: 1 addition & 1 deletion src/autodl/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function download(): Promise<void> {
continue;
}

await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {manufacturerName: [NAME], releaseNotes: RELEASE_NOTES_URL});
await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {releaseNotes: RELEASE_NOTES_URL});
}

writeCacheJson(NAME, images);
Expand Down
2 changes: 1 addition & 1 deletion src/autodl/ikea_new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function download(): Promise<void> {
continue;
}

await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {manufacturerName: [NAME], releaseNotes: RELEASE_NOTES_URL});
await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {releaseNotes: RELEASE_NOTES_URL});
}

writeCacheJson(CACHE_FILENAME, images);
Expand Down
2 changes: 1 addition & 1 deletion src/autodl/inovelli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function download(): Promise<void> {
continue;
}

await processFirmwareImage(NAME, firmwareFileName, image.firmware, {manufacturerName: [NAME]});
await processFirmwareImage(NAME, firmwareFileName, image.firmware);
}

writeCacheJson(NAME, models);
Expand Down
2 changes: 1 addition & 1 deletion src/autodl/jethome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ImageJson = {
};
};

const NAME = 'Jethome';
const NAME = 'JetHome';
const LOG_PREFIX = `[${NAME}]`;
const BASE_URL = 'https://fw.jethome.ru';
const DEVICE_URL = `${BASE_URL}/api/devices/`;
Expand Down
3 changes: 1 addition & 2 deletions src/autodl/ledvance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ImagesJson = {
};
type GroupedImagesJson = Record<string, FirmwareJson[]>;

const NAME = 'Ledvance';
const NAME = 'LEDVANCE';
const LOG_PREFIX = `[${NAME}]`;
const FIRMWARE_URL = 'https://api.update.ledvance.com/v1/zigbee/firmwares/';
// const UPDATE_CHECK_URL = 'https://api.update.ledvance.com/v1/zigbee/firmwares/newer';
Expand Down Expand Up @@ -107,7 +107,6 @@ export async function download(): Promise<void> {

for (let i = 0; i < FETCH_FAILED_RETRIES; i++) {
const status = await processFirmwareImage(NAME, firmwareFileName, firmwareUrl, {
manufacturerName: [NAME],
// workflow automatically computes sha512
// sha256: firmware.shA256,
releaseNotes: firmware.releaseNotes,
Expand Down
9 changes: 7 additions & 2 deletions src/autodl/lixee.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as github from './github.js';

const NAME = 'Lixee';
const NAME = 'LiXee';
const FIRMWARE_URL = 'https://api.github.com/repos/fairecasoimeme/Zlinky_TIC/releases';
/** @see https://github.com/fairecasoimeme/Zlinky_TIC?tab=readme-ov-file#route-or-limited-route-from-v7 */
const FIRMWARE_EXT = '.ota';
Expand All @@ -11,5 +11,10 @@ export async function writeCache(): Promise<void> {
}

export async function download(): Promise<void> {
await github.download(NAME, FIRMWARE_URL, [(a): boolean => a.name.endsWith(FIRMWARE_EXT), (a): boolean => a.name.endsWith(FIRMWARE_LIMITED)]);
await github.download(
NAME,
FIRMWARE_URL,
[(a): boolean => a.name.endsWith(FIRMWARE_EXT), (a): boolean => a.name.endsWith(FIRMWARE_LIMITED)],
{manufacturerName: [NAME]},
);
}
2 changes: 1 addition & 1 deletion src/autodl/salus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type ImagesJson = {
versions: ImageJson[];
};

const NAME = 'Salus';
const NAME = 'SalusControls';
const LOG_PREFIX = `[${NAME}]`;
const FIRMWARE_URL = 'https://eu.salusconnect.io/demo/default/status/firmware?timestamp=0';

Expand Down
1 change: 0 additions & 1 deletion src/autodl/ubisys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function download(): Promise<void> {
const firmwareUrl = url.resolve(FIRMWARE_HTML_URL, image.fileName);

await processFirmwareImage(NAME, image.fileName, firmwareUrl, {
manufacturerName: [NAME],
hardwareVersionMin: image.hardwareVersionMin,
hardwareVersionMax: image.hardwareVersionMax,
});
Expand Down
9 changes: 7 additions & 2 deletions src/autodl/xyzroe.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as github from './github.js';

const NAME = 'Xyzroe';
const NAME = 'xyzroe';
const FIRMWARE_URL = 'https://api.github.com/repos/xyzroe/ZigUSB_C6/releases';
const FIRMWARE_EXT = '.ota';

Expand All @@ -9,5 +9,10 @@ export async function writeCache(): Promise<void> {
}

export async function download(): Promise<void> {
await github.download(NAME, FIRMWARE_URL, [(a): boolean => a.name.endsWith(FIRMWARE_EXT)]);
await github.download(
NAME,
FIRMWARE_URL,
[(a): boolean => a.name.endsWith(FIRMWARE_EXT)],
{modelId: 'ZigUSB_C6'},
);
}

0 comments on commit c19bb73

Please sign in to comment.