From a12d53db90121518f8cde997836fce80a2e42d91 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Tue, 13 Aug 2024 11:23:43 +0100 Subject: [PATCH] Change processjson --- processing/processjson.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/processing/processjson.js b/processing/processjson.js index 30d4612..bb4c675 100644 --- a/processing/processjson.js +++ b/processing/processjson.js @@ -3,9 +3,6 @@ const glob = require("glob"); const { hashElement } = require("folder-hash"); const nextConfig = require("../site/next.config.js") -const jwt = require('jsonwebtoken'), - crypto = require('crypto') - var dir = "./public"; if (!fs.existsSync(dir)) { @@ -15,14 +12,6 @@ if (!fs.existsSync(dir + "/icons")) { fs.mkdirSync(dir + "/icons"); } -function sortKeys(x) { - if (typeof x !== 'object' || !x) - return x; - if (Array.isArray(x)) - return x.map(sortKeys); - return Object.keys(x).sort().reduce((o, k) => ({...o, [k]: sortKeys(x[k])}), {}); -} - glob("**/workspace.json", async function (err, files) { if (err) { console.log( @@ -40,8 +29,6 @@ glob("**/workspace.json", async function (err, files) { encoding: "hex", }; - let channels = new Set() - for (const file of files) { //files.forEach(async function(file) { @@ -81,26 +68,13 @@ glob("**/workspace.json", async function (err, files) { modified: Date.now(), workspaces: workspaces, channels: [...channels], - default_channel: '1.16.0' + default_channel: 'develop' }; if (channels.size === 0) { json.default_channel = null } - let copy_for_signature = JSON.parse(JSON.stringify(json)); - - for(let i = 0; i < copy_for_signature.workspaces.length; i++) { - delete copy_for_signature.workspaces[i]['description'] - delete copy_for_signature.workspaces[i]['notes'] - } - const ordered_json = JSON.stringify(sortKeys(copy_for_signature)); - - const hash = crypto.createHash('sha256').update(ordered_json).digest('hex'); - const payload = { - hash: hash - } - let data = JSON.stringify(json); fs.writeFileSync(dir + "/list.json", data);