Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
john-tornblom committed Oct 10, 2024
1 parent cb82c5d commit eb50740
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions assets/elfldr.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ <h1>Payload launcher</h1>
form.append('args', args);
form.append('pipe', '1');

let response = await fetch('/elfldr', {
body: form,
method: "post"
});

const term = new Terminal({
convertEol: true,
altClickMovesCursor: false,
Expand All @@ -259,28 +254,30 @@ <h1>Payload launcher</h1>
cols: 132,
rows: 26
});
term.open(stdout);
term.write("$ " + args + "\n");

const launcher = document.getElementById('launcher');
launcher.style.display = 'none';

let response = await fetch('/elfldr', {
body: form,
method: "post"
});

try {
const reader = response.body.getReader();
const stdout = document.getElementById('stdout');
const launcher = document.getElementById('launcher');
const decoder = new TextDecoder();

launcher.style.display = 'none';
document.title = selectedFile.name;
term.open(stdout);

while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
let decodedValue = decoder.decode(value);
console.log(decodedValue);
term.write(decodedValue);
}
} catch (error) {
console.log(error);
}
}
</script>
Expand Down

0 comments on commit eb50740

Please sign in to comment.