aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown2018-04-02 23:13:35 +0100
committerUnknown2018-04-02 23:13:35 +0100
commitc2d6d2bef152fa36db7d5f6db11baeff4de2a4c5 (patch)
tree75a4b3ad60dd000fd442877ca9fa2b72409efc0e
parent3cb84766c1022c19489960bafc53667e44e27065 (diff)
few changes
-rw-r--r--README.md2
-rw-r--r--main-repo/test/delet.js1
-rw-r--r--main-repo/test/package.json5
-rw-r--r--main-repo/test/rmtest.js1
-rw-r--r--main-repo/wget93/package.json1
-rw-r--r--pkg93.js24
6 files changed, 27 insertions, 7 deletions
diff --git a/README.md b/README.md
index 06afeb1..cb1bc1e 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ example-repo
│ │ (package files go here)
│   └── package.json
└── examplepkg3
-│ │ (package files go here)
+ │ (package files go here)
   └── package.json
```
diff --git a/main-repo/test/delet.js b/main-repo/test/delet.js
new file mode 100644
index 0000000..f30b622
--- /dev/null
+++ b/main-repo/test/delet.js
@@ -0,0 +1 @@
+$log("ok y u hat me ok");
diff --git a/main-repo/test/package.json b/main-repo/test/package.json
new file mode 100644
index 0000000..e2164ab
--- /dev/null
+++ b/main-repo/test/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "test",
+ "inject": "test.js",
+ "uninstall": "delet.js"
+}
diff --git a/main-repo/test/rmtest.js b/main-repo/test/rmtest.js
new file mode 100644
index 0000000..81fdb66
--- /dev/null
+++ b/main-repo/test/rmtest.js
@@ -0,0 +1 @@
+$log("ok you just installed the test pacakge ok")
diff --git a/main-repo/wget93/package.json b/main-repo/wget93/package.json
index e3677ec..11a6676 100644
--- a/main-repo/wget93/package.json
+++ b/main-repo/wget93/package.json
@@ -1,4 +1,5 @@
{
"name": "wget93",
+ "version": "0.1.0",
"inject": "wget93.js"
}
diff --git a/pkg93.js b/pkg93.js
index 74476d6..683e847 100644
--- a/pkg93.js
+++ b/pkg93.js
@@ -45,7 +45,7 @@ console.log("[pkg93] Injecting packages...");
try {
var config = JSON.parse(localStorage[".pkg93/config.json"]);
config.installed.forEach(function (pkg) {
- eval(localStorage[".pkg93/downloaded/" + pkg + ".js"]);
+ eval(localStorage[".pkg93/packages/" + pkg + ".js"]);
});
} catch (err) {
console.error("[pkg93] Couldn't load package information.");
@@ -62,8 +62,8 @@ le._apps.pkg93 = {
if (localStorage[".pkg93/config.json"] === undefined) {
localStorage[".pkg93/config.json"] = '{"repos": ["http://codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}';
}
- if (localStorage[".pkg93/downloaded/"] === undefined) {
- localStorage[".pkg93/downloaded/"] = "";
+ if (localStorage[".pkg93/packages/"] === undefined) {
+ 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"]);
@@ -126,9 +126,15 @@ pkg93 <span style='color:#0f0'>rm</span> <span style='color:#77f'>kebab</span>
try {
request.send(null);
var json = JSON.parse(request.responseText);
+ localStorage[".pkg93/packages/" + pkgname + ".json"] = request.responseText;
request.open('GET', pkgsource + "/" + pkgname + "/" + json.inject, false);
request.send(null);
- localStorage[".pkg93/downloaded/" + pkgname + ".js"] = request.responseText;
+ localStorage[".pkg93/packages/" + pkgname + ".js"] = request.responseText;
+ if (!!json.uninstall) {
+ request.open('GET', pkgsource + "/" + pkgname + "/" + json.inject, false);
+ request.send(null);
+ localStorage[".pkg93/packages/" + pkgname + ".rm.js"] = request.responseText;
+ }
eval(request.responseText);
$log("<b><span style='color:#0f0'>OK</span></b> Injected package!");
config.installed.push(pkgname);
@@ -142,8 +148,11 @@ pkg93 <span style='color:#0f0'>rm</span> <span style='color:#77f'>kebab</span>
$log("<b><span style='color:#f00'>ERR</span></b> No package specified.");
} else if (protected.includes(args[1])) {
$log("<b><span style='color:#f00'>ERR</span></b> You're trying to modify a pre-installed Windows93 app.\n <b>Don't do that!</b>");
- } else if (!!localStorage[".pkg93/downloaded/un" + args[1] + ".js"]) {
- eval(localStorage[".pkg93/downloaded/un" + args[1] + ".js"]); // Typing eval makes me feel dirty.
+ } else if (!!localStorage[".pkg93/packages/" + args[1] + ".rm.js"]) {
+ eval(localStorage[".pkg93/packages/" + args[1] + ".rm.js"]); // Typing eval makes me feel dirty.
+ localStorage[".pkg93/packages/" + args[1] + ".rm.js"] = null;
+ localStorage[".pkg93/packages/" + args[1] + ".js"] = null;
+ localStorage[".pkg93/packages/" + args[1] + ".json"] = null;
} else {
var index = config.installed.indexOf(args[1]);
if (index < 0) {
@@ -154,6 +163,9 @@ pkg93 <span style='color:#0f0'>rm</span> <span style='color:#77f'>kebab</span>
$log("<b><span style='color:#f00'>ERR</span></b> Already removed.");
} else {
le._apps[config.installed[index]] = null;
+ localStorage[".pkg93/packages/" + config.installed[index]] + ".rm.js"] = null;
+ localStorage[".pkg93/packages/" + config.installed[index]] + ".js"] = null;
+ localStorage[".pkg93/packages/" + config.installed[index]] + ".json"] = null;
config.installed = config.installed.splice(index, 1);
$log("<b><span style='color:#0f0'>OK</span></b> Removed!");
}