aboutsummaryrefslogtreecommitdiffstats
path: root/main-repo/wget93
diff options
context:
space:
mode:
authorUnknown2018-04-02 14:08:43 +0100
committerUnknown2018-04-02 14:08:43 +0100
commitae2c5fe141a11e598032d1b3ac26aafc4d961799 (patch)
tree2557e1b4b9da2fab3df4c1df9c418272217e1ce7 /main-repo/wget93
parent484a85333c029a80935fe4b1a6b65e7c18e58a71 (diff)
add documentation and main repo
Diffstat (limited to 'main-repo/wget93')
-rw-r--r--main-repo/wget93/package.json6
-rw-r--r--main-repo/wget93/unwget93.js3
-rw-r--r--main-repo/wget93/wget93.js52
3 files changed, 61 insertions, 0 deletions
diff --git a/main-repo/wget93/package.json b/main-repo/wget93/package.json
new file mode 100644
index 0000000..d96a422
--- /dev/null
+++ b/main-repo/wget93/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "wget93",
+ "version": [0, 1, 0],
+ "inject": "wget93.js",
+ "uninstall": "unwget93.js"
+}
diff --git a/main-repo/wget93/unwget93.js b/main-repo/wget93/unwget93.js
new file mode 100644
index 0000000..11e0e00
--- /dev/null
+++ b/main-repo/wget93/unwget93.js
@@ -0,0 +1,3 @@
+$log.succes("Uninstalling wget93...");
+le._apps.wget93 = null;
+$log.succes("✔️ Uninstalled wget93."); \ No newline at end of file
diff --git a/main-repo/wget93/wget93.js b/main-repo/wget93/wget93.js
new file mode 100644
index 0000000..8734730
--- /dev/null
+++ b/main-repo/wget93/wget93.js
@@ -0,0 +1,52 @@
+le._apps.wget93 = {
+ exec: function()
+ {
+ try {
+ if (this.arg.arguments.length == 0) {
+ $log(`wget93 v0.1.0 by 1024x2
+wget93 [url] [output]
+example: wget93 http://tobefa.ir/youhavetoha.ve /a/veryhightounderstand/rickandmor.ty
+
+NOTE: Downloading binary files doesn't work, only text.`);
+ } else if (this.arg.arguments.length != 2) {
+ throw new Error("missing url/destination");
+ } else {
+ $log.info("Downloading...");
+ var url = this.arg.arguments[0];
+ if (this.arg.arguments[1].startsWith("/a/")) {
+ var output = this.arg.arguments[1].substring(3);
+ } else {
+ var output = this.arg.arguments[1];
+ }
+ var request = new XMLHttpRequest();
+ request.addEventListener("load", function () {
+ if (request.status != 200) {
+ $log.error("❌ wget93: " + request.statusText);
+ } else {
+ $log.succes("✔️ Downloaded!");
+ $log.info("Saving...");
+ $store.set(output, request.responseText);
+ $log.succes("✔️ Saved!");
+ $explorer.refresh();
+ }
+ });
+ request.addEventListener("error", function () {
+ $log.error("❌ wget93: couldn't download file");
+ if (!!window.chrome) {
+ $log.info("This may be caused by \"Allow-Control-Allow-Origin\" garbage. <a target=\"_blank\" href=\"https://chrome.google.com/webstore/detail/nlfbmbojpeacfghkpbjhddihlkkiljbi\">Click here to download an extension that fixes this.</a>");
+ } else if (navigator.userAgent.indexOf("Firefox") > 0) {
+ $log.info("This may be caused by \"Allow-Control-Allow-Origin\" garbage. <a target=\"_blank\" href=\"https://addons.mozilla.org/en-US/firefox/addon/cors-everywhere/\">Click here to download an addon that fixes this.</a>");
+ } else {
+ $log.info("This may be caused by \"Allow-Control-Allow-Origin\" garbage.");
+ }
+ });
+ request.open("GET", url);
+ request.send();
+ }
+ } catch(error) {
+ $log.error("❌ wget93: " + error.message);
+ }
+ },
+ hascli: true,
+ terminal: true
+}; \ No newline at end of file