Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme
  • Modify manually generate access token to work with Val Town web app
  • Rewrite Python script to generate a unique code verifier and code challenge pair to Nodejs (Typescript)
  • Create button open auth URL in new tab
  • Create a redirect URL to handle oauth
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
/** @jsxImportSource npm:hono/jsx **/
import { html, raw } from "npm:hono/html";
import { Hono } from "npm:hono@4.2.6";
const app = new Hono();
const title = "Click Button Demo";
const View = () => {
return (
<html>
<head>
{html`
<script src="https://unpkg.com/htmx.org@1.9.12/dist/htmx.js" integrity="sha384-qbtR4rS9RrUMECUWDWM2+YGgN3U4V4ZncZ0BvUcg9FGct0jqXz3PUdVpU1p0yrXS" crossorigin="anonymous"></script>
`}
</head>
<body>
<h1>{title}</h1>
<div hx-target="this" hx-swap="outerHTML">
<h3 id="parent-div">Start Demo</h3>
<button hx-post="/clicked" hx-trigger="click" hx-target="#parent-div" hx-swap="outerHTML">
Click Me!
</button>
</div>
</body>
</html>
);
};
app.get("/", (c) => {
return c.html(<View />);
});
const Clicked = () => {
return <h3 id="parent-div">Finish Demo</h3>;
};
app.post("/clicked", (c) => {
return c.html(<Clicked />);
});
export default app.fetch;
tfayyaz-honodatabricksu2mauth.web.val.run
June 23, 2024