1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { html } from "https://esm.town/v/stevekrouse/html";
import { alive as alive2 } from "https://esm.town/v/stevekrouse/alive";
export async function living(req: Request) {
let name = decodeURI(new URL(req.url).pathname.replace("/", ""));
let alive, error;
try {
alive = await alive2(name);
}
catch (e) {
error = e;
}
return html(
`<body style="color: white; font-family: sans-serif; background: linear-gradient(to right, #fbc21d 0%, #f79622 30%, #ff6a00 60%, #ff2b04 100%)">
<div style="font-size:2em; padding:0.5em">
Human Uptime Monitor
<span style="font-size:0.5em">(<a href="https://www.val.town/v/stevekrouse.living" style="color:white;" >source</a>)</span>
</div>
<div style="margin-top: 10%; width: 800px; margin-left: auto; margin-right: auto;">
<div style="font-size:5em; text-align:center">
Is ${name} Living?
</div>
<div style="margin-top: 15%;font-size:5em; text-align:center;">
${error ? error : alive ? "Yes 😁" : "No 😢"}
</div>
<div>
<div style="margin-top: 40%;font-size:3em;">
Is...
</div>
<ul style="font-size: 2em">
${
[
"Henry Kissinger",
"Elvis Presley",
"Roman Polanski",
"George Washington",
].map((n) =>
`<a href="/${n}" style="color:white"><li>...${n} living?</li></a>`
).join("")
}
</ul>
<div style="margin-top: 15%;font-size:3em;">
How do you know?
</div>
<div style="font-size:2em; margin-top: 5%">
Wikidata!
<iframe src="https://www.val.town/embed/stevekrouse.alive"
width="100%" height="500px" frameBorder="0"
style="margin-top: 2%"></iframe>
</div>
<div>
</body>`,
{
"cache-control": "public,max-age=3600",
},
);
}