2024-12-02: atprotobin: upload and exec() with deno via POST

by pdxjohnny
GNU/Linux ◆ xterm-256color ◆ bash 84 views

Deployment: https://paste.chadig.com

GitHub: https://github.com/publicdomainrelay/atprotobin

cat << 'EOF' > backend_github_query.js
let text = "";
const decoder = new TextDecoder();
for await (const chunk of Deno.stdin.readable) {
  text += decoder.decode(chunk);
}
const input = JSON.parse(text);

const resp = await fetch("https://api.github.com/users/" + input["user"], {
  headers: {
    accept: "application/json",
  },
});

console.log(JSON.stringify(await resp.json()));
EOF

id=$(curl -sfX POST -F 'file=@backend_github_query.js' https://paste.chadig.com | jq -r .id)
curl -sfX POST -d '{"user": "publicdomainrelay"}' "https://paste.chadig.com/${id}" | jq