This commit is contained in:
nora 2022-09-28 20:44:42 +02:00
parent 4bcd725fb0
commit e78b5becde
8 changed files with 1614 additions and 54 deletions

View file

@ -1,61 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bisect rustc</title>
<style>
.hidden {
display: none
}
</style>
</head>
<body>
<h1>Bisect rustc</h1>
<textarea id="code">
// Rust code goes here...
</textarea>
<button onclick="bisect()">Bisect!</button>
<div id="status" class="hidden"/>
<div id="result" class="hidden"/>
<script>
let bisecting = false;
async function bisect() {
if (bisecting) {
return;
<head>
<title>Bisect rustc</title>
<style>
html {
font-family: Arial, Helvetica, sans-serif;
}
bisecting = true;
const code = document.getElementById("code");
const status = document.getElementById("status");
const result = document.getElementById("result");
status.classList.remove("hidden");
status.innerText = "Sending request...";
const fetched = await fetch("https://bisect-rustc.nilstrieb.dev/bisect", {
method: "POST",
body: code.value,
});
const { id } = await fetched.json();
function tryFetch() {
const fetched = await fetch(`https://bisect-rustc.nilstrieb.dev/bisect/${id}`);
const { done, output, time } = await fetched.json();
if (done) {
bisecting = false;
result.innerText = output;
status.innerText = `Bisected job ${id} successfully in ${time}ms`;
.hidden {
display: none;
}
#code {
columns: 100;
}
.bisect-btn {
width: 200px;
height: 50px;
}
</style>
</head>
<body>
<h1>Bisect rustc</h1>
<textarea
id="code"
rows="30"
cols="80"
placeholder="// Rust code goes here..."
>
fn uwu() {}
</textarea>
<br />
<button class="bisect-btn" onclick="bisect()">Bisect!</button>
<div id="status" class="hidden" />
<div id="result" class="hidden" />
<script>
let bisecting = false;
async function bisect() {
if (bisecting) {
return;
}
setTimeout(tryFetch, 3000);
bisecting = true;
const code = document.getElementById("code");
const status = document.getElementById("status");
const result = document.getElementById("result");
status.classList.remove("hidden");
status.innerText = "Sending request...";
const fetched = await fetch(
"https://bisect-rustc.nilstrieb.dev/bisect",
{
method: "POST",
body: code.value,
}
);
const { id } = await fetched.json();
async function tryFetch() {
const fetched = await fetch(
`https://bisect-rustc.nilstrieb.dev/bisect/${id}`
);
const { done, output, time } = await fetched.json();
if (done) {
bisecting = false;
result.innerText = output;
status.innerText = `Bisected job ${id} successfully in ${time}ms`;
}
setTimeout(tryFetch, 3000);
}
tryFetch();
status.innerHTML = `Waiting for bisection, job id=${id}`;
}
tryFetch();
status.innerHTML = `Waiting for bisection, job id=${id}`;
}
</script>
</body>
</script>
</body>
</html>