Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Uptime Status Page

This is the status page for the data generated by this uptime cron: @stevekrouse/uptime

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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/** @jsxImportSource npm:preact */
import { sha256 } from "https://esm.sh/@noble/hashes@1.5.0/sha2";
import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
import { html } from "https://esm.town/v/stevekrouse/html";
import { render } from "npm:preact-render-to-string";
await sqlite.execute(
"CREATE TABLE IF NOT EXISTS meter_users (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT, session TEXT, salt TEXT, code TEXT);",
);
function BasicLayout(props) {
return (
<html>
<head>
<title>Mindaugo 12E-22</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.2/css/bulma.min.css" />
</head>
<body>
{props.children}
</body>
</html>
);
}
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
if (req.method === "POST") {
if (url.pathname === "/login") {
const formData = await req.formData();
const list = JSON.stringify(formData.entries());
const email = formData.get("email");
// const password = formData.get("password");
// const token = "crypto.randomBytes(32).toString(\"hex\")";
return html(render(
<BasicLayout>
<div class="block"></div>
<div class="block">Please wait... {list} {email}</div>
</BasicLayout>,
));
}
}
const { rows } = await sqlite.execute(
"select email, session from meter_users limit 1",
);
const urls = [...new Set(rows.map(r => r[0]))];
return html(render(
<BasicLayout>
<div class="my-4"></div>
<form class="container is-max-tablet" method="post" action="/login">
<div class="field">
<p class="control">
<input name="email" class="input" type="email" placeholder="Email" />
</p>
</div>
<div class="field">
<p class="control">
<input name="password" class="input" type="password" placeholder="Password" />
</p>
</div>
<div class="field is-grouped">
<p class="control">
<button id="login" class="button is-info">Login</button>
</p>
<p class="control is-expanded"></p>
<p class="control">
<input id="cookies" type="checkbox" checked />
<label class="checkbox ml-2" for="cookies">
Accept cookies
</label>
</p>
</div>
</form>
<script>
{` var cookies = document.getElementById('cookies');
var login = document.getElementById('login');
cookies.onchange = function () {
login.disabled = !this.checked;
}`}
</script>
</BasicLayout>,
));
}
overengineered-status.web.val.run
September 16, 2024