mirror of
https://github.com/Koenkk/zigbee-OTA.git
synced 2026-09-22 04:28:46 +00:00
feat: support for custom CA certificates (#422)
- Adds custom CA certificate for Philips Hue OTA updates - Adds support to use these certificates to `scripts/add.js` - Adds concatenation of CA certs to `scripts/updateall.js` Part of the fixes for https://github.com/Koenkk/zigbee-OTA/issues/420 Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
@@ -2,7 +2,21 @@ const child_process = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const concatCaCerts = (folder = 'cacerts', outputFilename = 'cacerts.pem') => {
|
||||
const files = fs.readdirSync(folder);
|
||||
|
||||
const caCertFiles = files.filter((file) => path.extname(file) === '.pem');
|
||||
const outputFile = fs.openSync(outputFilename, 'w');
|
||||
|
||||
caCertFiles.forEach((caCert) => {
|
||||
const filePath = path.join(folder, caCert);
|
||||
const fileContent = fs.readFileSync(filePath, 'utf8');
|
||||
fs.appendFileSync(outputFile, fileContent + '\n');
|
||||
});
|
||||
};
|
||||
|
||||
const main = async () => {
|
||||
concatCaCerts();
|
||||
const indexJSON = JSON.parse(fs.readFileSync('index.json'));
|
||||
indexJSON.forEach(entry => {
|
||||
const result = child_process.execSync(`node ./scripts/add.js "${entry.path || entry.url}" "${entry.modelId || ''}"`, {
|
||||
|
||||
Reference in New Issue
Block a user