From 007bd33e11767e7bf20e0fb7f46d8d691ec4074e Mon Sep 17 00:00:00 2001
From: Unknown
Date: Mon, 2 Apr 2018 20:41:27 +0100
Subject: add-repo and rm-repo
---
pkg93.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/pkg93.js b/pkg93.js
index b7e3fd2..1bef15f 100644
--- a/pkg93.js
+++ b/pkg93.js
@@ -60,7 +60,7 @@ le._apps.pkg93 = {
const args = this.arg.arguments;
const version = "v0.1.0";
if (localStorage[".pkg93/config.json"] === undefined) {
- localStorage[".pkg93/config.json"] = '{"sources": ["http://codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}';
+ localStorage[".pkg93/config.json"] = '{"repos": ["http://codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}';
}
if (localStorage[".pkg93/downloaded/"] === undefined) {
localStorage[".pkg93/downloaded/"] = "";
@@ -91,7 +91,7 @@ pkg93 rm kebab
} else if (args[0] == "pull") {
var pkgs = [];
config.pkglist = [];
- config.sources.forEach(function (source) {
+ config.repos.forEach(function (source) {
$log("GET " + source);
request.open('GET', source + "/repo.json", false);
try {
@@ -161,6 +161,20 @@ pkg93 rm kebab
}
}
}
+ } else if (args[0] == "add-repo") {
+ try {
+ config.repos.push(args[1]); // well, that was easy
+ $log("OK Done!");
+ } catch (err) {
+ $log("ERR " + err.message);
+ }
+ } else if (args[0] == "rm-repo") {
+ try {
+ config.repos = config.repos.splice(parseInt(args[1]), 1);
+ $log("OK Done!");
+ } catch (err) {
+ $log("ERR " + err.message);
+ }
} else {
$log("ERR Invalid command. Type \"pkg93\" without any arguments for help.");
}
--
cgit v1.2.3