aboutsummaryrefslogtreecommitdiff
path: root/hooks/update.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-03-27 17:56:40 +0200
committerMinteck <contact@minteck.org>2022-03-27 17:56:40 +0200
commit44b4222bc02f102480d1afe05d940612ff6cb983 (patch)
tree936e6baf8039e065324cd1c2e453c33ec4cf4122 /hooks/update.js
parent1d8cbd4b6a7b654c77d8cd3793bc67811a39725d (diff)
downloadtwilight-44b4222bc02f102480d1afe05d940612ff6cb983.tar.gz
twilight-44b4222bc02f102480d1afe05d940612ff6cb983.tar.bz2
twilight-44b4222bc02f102480d1afe05d940612ff6cb983.zip
WIP Alicorn port (abandonned, To be removed)
Diffstat (limited to 'hooks/update.js')
-rw-r--r--hooks/update.js13
1 files changed, 8 insertions, 5 deletions
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 {