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
devtools
Script
Devtools shortcuts Add useful shortcuts to a val website. Usage /_edit -> go to the val editor /_raw -> view val source /_logs -> view val logs Example import { devtools } from "https://esm.town/v/pomdtr/devtools";
export default devtools((_req: Request) => {
return new Response("hello world");
});
4
pomdtr
freeformServer
HTTP
Freeform Brings a taste of Observable to Val Town. This val was adapted from @tmcw obsidian plugin . Instead of using the display function, this port use export default . https://pomdtr-freeformServer.web.val.run/v/<author>/<name> or https://freeform.pomdtr.me/v/<author>/<name> Examples Bar Chart ( View Source )
1
pomdtr
lastlogin
Script
Lastlogin Authentication for val.town Looking for an hono integration ? See @pomdtr/lastloginHono Support login in trough: Email Link QR Code Google Oauth Github Oauth Gitlab Oauth Facebook Oauth Demo You can try a demo at https://pomdtr-lastloginhonoexample.web.val.run (see @pomdtr/lastLoginHonoExample for code) Usage Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account). If you want to be the only one able to access your val, you can use @pomdtr/verifyUserEmail. import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
// check that the user email match your val town email
verifyEmail: verifyUserEmail
}); If you want to customize how is allowed to signup, you can set the verifyEmail option: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
verifyEmail: (email) => { email == "steve@valtown" }
}); You can allow anyone to signup by returning a boolean from the verifyEmail function: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
verifyEmail: (_email) => true
}); Public Routes import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail";
export default lastlogin(() => {
return new Response("Hi!");
}, {
verifyEmail: verifyUserEmail,
public_routes: ["/", "/public/*"],
}); See the URLPattern API for reference. Logout Just redirect the user to /auth/logout
10