pomdtr
I mainly enjoy building dev tools:
- VS Code integration: https://github.com/pomdtr/valtown-vscode
- CLI: https://github.com/pomdtr/vt
Public vals
317
pomdtr
pwa
Script
Add a pwa manifest to an http val (to open in as an app in iOS). See https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps for available fields. Usage import handler from "https://esm.town/v/maxm/staticChess";
import { pwa } from "https://esm.town/v/pomdtr/pwa";
export default pwa(handler, {
name: "Static Chess",
display: "standalone",
background_color: "#ffffff",
start_url: "/",
});
3
pomdtr
createTursoProxy
Script
Usage Create proxy val for your turso DB (make it private to protect it behind your val town token) import {createTursoProxy} from "https://esm.town/v/pomdtr/createTursoProxy"
export default createTursoProxy("<tursoDatabaseUrl>", "<tursoAuthToken>") Wire any existing val to the proxy val import { setEnv } from "https://esm.town/v/pomdtr/setEnv";
// use my private proxy
setEnv("VALTOWN_API_URL", "<proxy-url>");
// wire sqlite explorer to a turso db !
const { handler } = await import("https://esm.town/v/nbbaier/sqliteExplorerApp");
export default handler;
0
pomdtr
lastloginHono
Script
See @pomdtr/lastlogin for more informations about the middleware Example /** @jsxImportSource npm:hono@3/jsx */
import { lastlogin } from "https://esm.town/v/pomdtr/lastloginHono";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"
import { Hono } from "npm:hono";
const app = new Hono();
const lastloginMiddleware = lastlogin({
verifyEmail: verifyUserEmail
});
// required for the auth pages to work
app.use("/auth/*", lastloginMiddleware);
// this page is public
app.get("/", async (c) => {
return c.html(
<div>
There is a secret message for you if you{" "}<a href="/secret">login</a>
</div>,
);
});
// this page requires the user to signup
app.get("/secret", lastloginMiddleware, async (c) => {
const email = c.req.header("X-User-Email");
return c.html(
<div>
I think {email} is a really silly email address, actually.
</div>,
);
});
export default app.fetch;
1