Remove the fac command

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-10-20 23:11:27 +03:00
parent 0b3963ca81
commit 6d4eee4a9a
3 changed files with 1 additions and 59 deletions

View file

@ -1,4 +1,5 @@
- [x] Fac command: POST to https://elijah-dev.tk/fa.php with the fa parameter being some code - [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 - [ ] Chat subdomain using WebRTC
- [ ] Store files in IndexedDB - [ ] Store files in IndexedDB
- [x] Export/Import - [x] Export/Import

View file

@ -180,14 +180,4 @@ var commands = {
examples: ["download file", "download file1 file"], examples: ["download file", "download file1 file"],
}, },
}, },
fac: {
func: fac,
root_only: false,
help: {
desc: 'Compile <a href="/gh/fa">fa</a> code',
short_desc: "Fa compiler",
examples: ["fac file"],
},
},
}; };

View file

@ -383,52 +383,3 @@ function download(argv) {
return "File(s) downloaded"; 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;
}