Clickable image links in the output

This commit is contained in:
Kuba Orlik 2022-07-08 09:36:08 +02:00
parent 84c9c6a99a
commit 36fd166c99

View File

@ -80,10 +80,14 @@ router.get("/", async (ctx) => {
const { id } = await (await fetch(url, { method: "post" })).json(); const { id } = await (await fetch(url, { method: "post" })).json();
do { do {
response = await (await fetch(\`/api/requests/\${id}\`)).json(); response = await (await fetch(\`/api/requests/\${id}\`)).json();
console.log(response); output.innerHTML = JSON.stringify(response, null, " ").replace(
output.innerHTML = JSON.stringify(response, null, " "); /\\/static\\/.*.png/g,
console.log(response.output); '<a href="$&">$&</a>'
stdout.innerHTML = response.output; );
stdout.innerHTML = response.output.replace(
/\\/static\\/.*.png/g,
'<a href="$&">$&</a>'
);
await sleep(1000); await sleep(1000);
} while (response.status !== "finished"); } while (response.status !== "finished");
} }