From 77b6bfbc6f7c751d77f155c40279c39cf181bb93 Mon Sep 17 00:00:00 2001 From: cpq Date: Mon, 11 May 2026 09:23:41 +0100 Subject: [PATCH] Cube pack nits --- resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc | 2 +- resources/html2c.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc b/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc index b6a49aaf..9bf370c0 100644 --- a/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc +++ b/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc @@ -8,7 +8,7 @@ License.txt https://mongoose.ws/contact/ - See https://github.com/cesanta/mongoose/releases/tag/7.21 + See https://github.com/cesanta/mongoose/releases/tag/7.21 See https://github.com/cesanta/mongoose/releases/tag/7.21 See https://github.com/cesanta/mongoose/releases/tag/7.21 See https://github.com/cesanta/mongoose/releases/tag/7.21 diff --git a/resources/html2c.js b/resources/html2c.js index ec2253db..b514cc9a 100644 --- a/resources/html2c.js +++ b/resources/html2c.js @@ -11,6 +11,7 @@ const fs = require('fs'); const path = require('path'); const http = require('http'); const https = require('https'); +const zlib = require('zlib'); const args = process.argv.slice(2); let outputFile = null; @@ -141,14 +142,15 @@ async function processHtml(content) { } function cArray(data) { - return Array.from(Buffer.from(data, 'utf8')).concat(0).join(','); + return Array.from(Buffer.from(data)).concat(0).join(','); } function generateC(data) { - const destination = path.basename(inputFile); + const destination = `${path.basename(inputFile)}.gz`; const stat = fs.statSync(inputFile); const mtime = parseInt(stat.mtimeMs / 1000); - const bytes = cArray(data); + const zipped = zlib.gzipSync(data); + const bytes = cArray(zipped); return `// DO NOT EDIT. This file is generated using this command: // ${process.argv.join(' ')} @@ -158,7 +160,7 @@ function generateC(data) { static const unsigned char v0[] = {${bytes}}; const struct mg_mem_file mg_packed_files[] = { - {"/${destination}", v0, sizeof(v0) - 1, ${mtime}}, + {"/${destination}", v0, sizeof(v0) - 1, ${mtime}}, // size: ${zipped.length} {NULL, NULL, 0, 0} }; `;