From 2ba8a94f6f1eaa01e0aa531cd246c9f787e33f19 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 5 Jun 2018 13:57:21 +0100 Subject: fix merge conflict aaaaa --- pkg93.js | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/pkg93.js b/pkg93.js index 2674750..50a3a23 100644 --- a/pkg93.js +++ b/pkg93.js @@ -41,7 +41,7 @@ var pkg93 = { try { return JSON.parse(localStorage[".pkg93/config.json"]); } catch (err) { - return false; + return err; } }, pull: async function(cli) { @@ -65,6 +65,20 @@ var pkg93 = { } } catch (err) { cli.log("ERR " + err.message); + if (request.status !== 200) { + cli.log("ERR Got HTTP Status Code " + request.status + " from the server."); + if (request.status === 404) { + cli.log(" Are you trying to load a non-existant repo?"); + } + } + if (!request.responseText.toLowerCase().includes("")) { + cli.log("INFO Response is HTML, not displaying..."); + } else { + cli.log(request.responseText); + } + if (location.protocol == "https:") { + cli.log("WARN pkg93 doesn't work on HTTPS connections.\n Click here to load Windows93 over HTTP."); + } } } localStorage[".pkg93/config.json"] = JSON.stringify(config); @@ -151,6 +165,9 @@ var pkg93 = { cli.log("ERR " + err.message); return false; } + } catch (err) { + $log("ERR " + err.toString()); + return err; } }, pkgInfo: async function(pkg, onlineOnly) { @@ -174,7 +191,7 @@ var pkg93 = { } } catch (err) { console.error("[pkg93] " + err.stack); - return false; + return err; } }, shutUp: { @@ -206,9 +223,11 @@ async function _pkg93execdonotcallplsusetheapi(cli) { Examples pkg93 get gud pkg93 rm kebab + +If you find my software useful, consider donating here. `; if (localStorage[".pkg93/config.json"] === undefined) { - localStorage[".pkg93/config.json"] = '{"repos": ["http://codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}'; + localStorage[".pkg93/config.json"] = '{"repos": ["//codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}'; } if (localStorage[".pkg93/packages/"] === undefined) { localStorage[".pkg93/packages/"] = ""; @@ -288,6 +307,17 @@ pkg93 rm kebab Description: ${description} Dependencies: ${depends}`); } + } else if (args[0] == "help") { + $log(help); + } else if (args[0] == "wtf") { + // for teh lulz + new Audio("/c/sys/sounds/QUACK.ogg").play(); + wtf = ["mudkipz", "pkg93", "memes", "linux", "javascript", "git", "cpu", + "windows93", "discord", "kirb", "apt93", "delays", "trash", + "kernel panic", "bash", "package manager", "recusion"]; + $log("WTF? " + wtf[Math.floor(Math.random() * wtf.length)] + " + " + wtf[Math.floor(Math.random() * wtf.length)] + " = " + wtf[Math.floor(Math.random() * wtf.length)]); + } else { + $log("ERR Invalid command. Type \"pkg93\" without any arguments for help."); } } else if (args[0] == "help") { cli.log(help); -- cgit v1.2.3