From e2d1d18715a7c5b80cce02a96b09a5d57de38072 Mon Sep 17 00:00:00 2001 From: spv Date: Sun, 4 May 2025 20:12:34 -0400 Subject: flawless victory --- inf/build_payload.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 inf/build_payload.js (limited to 'inf/build_payload.js') diff --git a/inf/build_payload.js b/inf/build_payload.js new file mode 100755 index 0000000..73a2344 --- /dev/null +++ b/inf/build_payload.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node + +const fs = require("fs") +const uglify = require("uglify-js") +const path = require("path") +const zlib = require("zlib"); + +let payload_descriptor = fs.readFileSync(path.resolve(process.argv[2])).toString().split("\n"); + +if (payload_descriptor.includes("")) payload_descriptor.pop(); + +let full_payload = ""; + +for (file in payload_descriptor) { + let fn = payload_descriptor[file]; + let fc = fs.readFileSync(fn, "utf8"); + + full_payload += fc + "\n"; +} + +let minified = uglify.minify( + full_payload, + { + mangle: { + toplevel: true, + properties: {keep_quoted: true} + }, + } +).code; + +let compressed = zlib.brotliCompressSync(minified); + +console.error(`crc32: ${zlib.crc32(compressed)}`) + +fs.writeFileSync(process.argv[3], compressed); +fs.writeFileSync(process.argv[4], minified); \ No newline at end of file -- cgit v1.2.3