From 6d4eee4a9adda08fd111a6aee65434649ae22e53 Mon Sep 17 00:00:00 2001 From: Ari Archer Date: Thu, 20 Oct 2022 23:11:27 +0300 Subject: [PATCH] Remove the `fac` command Signed-off-by: Ari Archer --- TODO.md | 1 + content/js/shell/commands.js | 10 -------- content/js/shell/func.js | 49 ------------------------------------ 3 files changed, 1 insertion(+), 59 deletions(-) diff --git a/TODO.md b/TODO.md index 6bb461c..c7bbf64 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,5 @@ - [x] Fac command: POST to https://elijah-dev.tk/fa.php with the fa parameter being some code +- - Used to have it, removed it on 2022/10/20 - [ ] Chat subdomain using WebRTC - [ ] Store files in IndexedDB - [x] Export/Import diff --git a/content/js/shell/commands.js b/content/js/shell/commands.js index f61c135..067aa56 100644 --- a/content/js/shell/commands.js +++ b/content/js/shell/commands.js @@ -180,14 +180,4 @@ var commands = { examples: ["download file", "download file1 file"], }, }, - - fac: { - func: fac, - root_only: false, - help: { - desc: 'Compile fa code', - short_desc: "Fa compiler", - examples: ["fac file"], - }, - }, }; diff --git a/content/js/shell/func.js b/content/js/shell/func.js index e8deac2..9c4af48 100644 --- a/content/js/shell/func.js +++ b/content/js/shell/func.js @@ -383,52 +383,3 @@ function download(argv) { return "File(s) downloaded"; } - -function fac(argv) { - if (!argv.length) return "No file supplied"; - if (!file_exists(argv[0])) return "File does not exists"; - - let fac_container = document.createElement("div"); - let fac_output = document.createElement("code"); - let fac_id = `fac_${document.getElementsByTagName("div").length}`; - let fac_script = document.createElement("img"); - - fac_output.id = `out_${fac_id}`; - fac_container.id = fac_id; - - fac_script.src = `fake_${fac_id}.gif`; - fac_script.setAttribute( - "onerror", - `document.getElementById("${fac_container.id}").dispatchEvent(new Event("load"));` - ); - fac_script.style.display = "none"; - - fac_output.innerText = "Compiling..."; - - fac_container.setAttribute( - "onload", - ` -async function fn_${fac_id}() { - let res = await fetch("https://elijah-dev.tk/fa.php", - { - method: "POST", - body: "fa=${encodeURIComponent(get_file(argv[0]))}", - headers: {"Content-type": "application/x-www-form-urlencoded"} - } - ); - let res_data = await res.text(); - - return res_data; -} - -fn_${fac_id}().then((data) => { - document.getElementById("${fac_output.id}").innerText = data; -}); -` - ); - - fac_container.appendChild(fac_output); - fac_container.appendChild(fac_script); - - return fac_container.outerHTML; -}