Avatar

pomdtr

I mainly enjoy building dev tools: - VS Code integration: https://github.com/pomdtr/valtown-vscode - CLI: https://github.com/pomdtr/vt
Joined June 14, 2023
Public vals
317
pomdtr avatar
pomdtr
tealRattlesnake
HTTP
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
notMyAccount
HTTP
Impersonate another account This val does not expose my own sqlite tables, but the one from the @sqlite account
1
pomdtr avatar
pomdtr
setEnv
Email
Set an env var In val.town, Deno.env.set does nothing. This val fixes it.
3
pomdtr avatar
pomdtr
grayShark
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
turquoiseMinnow
HTTP
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
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 avatar
pomdtr
orangeMite
HTTP
https://pomdtr-orangemite.web.val.run
0
pomdtr avatar
pomdtr
create_smallweb_tables
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
freeform
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
freeformExample
Script
Open Preview
0
pomdtr avatar
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 avatar
pomdtr
sms
HTTP
Send/receive sms from val.town Test sending/receiving sms from SMSHub
0
pomdtr avatar
pomdtr
wasmConcept
Script
package main import ( "fmt" "net/http" ) func hello(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "hello\n") } func main() { http.HandleFunc("/hello", hello) http.ListenAndServe(":8090", nil) }
0
pomdtr avatar
pomdtr
frontmatter
Script
0
pomdtr avatar
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
pomdtr avatar
pomdtr
crimsonSnail
Script
An interactive, runnable TypeScript val by pomdtr
0