From 9380f1e785e1666cff78c9c0a7efd4b4f11e20dd Mon Sep 17 00:00:00 2001
From: Unknown
Date: Sat, 14 Apr 2018 17:12:22 +0100
Subject: use pkg93.getConfig() for once, remove useless pkgs array
---
pkg93.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pkg93.js b/pkg93.js
index f44153a..3152c43 100644
--- a/pkg93.js
+++ b/pkg93.js
@@ -40,9 +40,9 @@ var pkg93 = {
}
},
pull: function() {
+ var config = pkg93.getConfig();
var request = new XMLHttpRequest();
$log("WARN Windows93 may lag while getting packages.\n This is a normal thing.");
- var pkgs = [];
config.pkglist = [];
config.repos.forEach(function (source) {
$log("GET " + source);
@@ -55,12 +55,11 @@ var pkg93 = {
json.packages.forEach(function(item) {
try {
$log("OK " + item + "@" + source);
- pkgs.push(item + "@" + source);
+ config.pkglist.push(item + "@" + source);
} catch (err) {
$log("ERR " + err.message);
}
});
- config.pkglist = config.pkglist.concat(pkgs);
} catch (err) {
$log("ERR " + err.message);
$log(request.responseText);
@@ -69,6 +68,7 @@ var pkg93 = {
localStorage[".pkg93/config.json"] = JSON.stringify(config);
},
get: function(pkg) {
+ var config = pkg93.getConfig();
var request = new XMLHttpRequest();
$log("SRCH " + pkg);
var index = config.pkglist.findIndex(function(string) {
@@ -91,7 +91,7 @@ var pkg93 = {
try {
$log("DPND Getting dependency \"" + pkg + "\"");
output = pkg93.get(pkg);
- if (output) {throw new Error("Dependency \"" + pkg + "\" failed to install. Current package may not work!");}
+ if (!output) {throw new Error("Dependency \"" + pkg + "\" failed to install. Current package may not work!");}
} catch (err) {
$log("ERR " + err.message);
}
@@ -119,6 +119,7 @@ var pkg93 = {
}
},
rm: function(pkg) {
+ var config = pkg93.getConfig();
var request = new XMLHttpRequest();
var index = config.installed.indexOf(pkg);
if (index < 0) {
@@ -141,7 +142,6 @@ var pkg93 = {
delete le._apps[config.installed[index]];
delete localStorage[".pkg93/packages/" + config.installed[index] + ".js"];
delete localStorage[".pkg93/packages/" + config.installed[index] + ".json"];
-
config.installed.splice(index, 1);
$log("OK Removed!");
}
@@ -184,7 +184,7 @@ pkg93 rm kebab`;
localStorage[".pkg93/packages/"] = "";
}
localStorage[".pkg93/README.txt"] = "WARNING!\nThis folder contains important data about pkg93. Do not edit anything in here unless you want pkg93 to not work!\n\n~1024x2";
- var config = JSON.parse(localStorage[".pkg93/config.json"]);
+ var config = pkg93.getConfig();
if (args.length === 0) {
$log(help);
} else if (args[0] == "pull") {
--
cgit v1.2.3