From 44b4222bc02f102480d1afe05d940612ff6cb983 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 27 Mar 2022 17:56:40 +0200 Subject: WIP Alicorn port (abandonned, To be removed) --- hooks/update.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'hooks/update.js') diff --git a/hooks/update.js b/hooks/update.js index e2d4b8a..f89f5c1 100644 --- a/hooks/update.js +++ b/hooks/update.js @@ -34,9 +34,12 @@ module.exports = async () => { let list = (await axios.get("https://twipkg.cdn.minteck.org/packages.json")).data; if (fs.existsSync(home + "/repository")) { - fs.rmSync(home + "/repository", { recursive: true }); + for (let item of fs.readdirSync(home + "/repository")) { + fs.rmSync(home + "/repository/" + item, { recursive: true }); + } + } else { + fs.mkdirSync(home + "/repository"); } - fs.mkdirSync(home + "/repository"); fs.writeFileSync(home + "/repository/list.json", JSON.stringify(list)); @@ -50,12 +53,12 @@ module.exports = async () => { } if (eta > 1) { if (eta > 60) { - spinner.text = "Fetching package lists... " + Math.round((index / list.length) * 100) + "%, " + Math.round(eta / 60) + " minute" + (Math.round(eta / 60) > 1 ? "s" : ""); + spinner.text = "Fetching package lists...\n " + Math.round((index / list.length) * 100) + "% completed\n about " + Math.round(eta / 60) + " minute" + (Math.round(eta / 60) > 1 ? "s" : "") + " remaining"; } else { - spinner.text = "Fetching package lists... " + Math.round((index / list.length) * 100) + "%, " + Math.round(eta) + " second" + (Math.round(eta) > 1 ? "s" : ""); + spinner.text = "Fetching package lists...\n " + Math.round((index / list.length) * 100) + "% completed\n about " + Math.round(eta) + " second" + (Math.round(eta) > 1 ? "s" : "") + " remaining"; } } else { - spinner.text = "Fetching package lists... " + Math.round((index / list.length) * 100) + "%"; + spinner.text = "Fetching package lists...\n " + Math.round((index / list.length) * 100) + "% completed\n calculating remaining time..."; } let dir = pkg.substring(0, 1).replace(/[^a-zA-Z0-9]/gm, "#"); try { -- cgit