Avatar

pomdtr

I mainly enjoy tinkering with the val.town api: - VS Code integration: https://github.com/pomdtr/valtown-vscode - CLI: https://github.com/pomdtr/vt
Joined June 14, 2023
Likes
108
pomdtr avatar
devtools
@pomdtr
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"); });
pomdtr avatar
freeformServer
@pomdtr
HTTP (deprecated)
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 )
maxm avatar
imgGenUrl
@maxm
HTTP (deprecated)
Image generated from a path name powered by fal.ai https://maxm-imggenurl.web.val.run/firefly.jpg https://maxm-imggenurl.web.val.run/retro-computer-hacking.jpg https://maxm-imggenurl.web.val.run/100-yoyos-at-once.jpg
easrng avatar
uploadImage
@easrng
Script
uploadImage uploads an image to val.town just like when you paste an image into a readme
pomdtr avatar
lastlogin
@pomdtr
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
cameronpak avatar
homeless
@cameronpak
HTTP (deprecated)
Homeless Services by OurTechnology At OurTechnology , we create technology solutions to empower and equip those who serve the homeless. We have a large data set of available resources in the US to aid in helping those experiencing homelessness find local resources, community, and support. This private ( but public to read ) API is used in our ChatGPT Assistant, Homeless Services . Why a ChatGPT Assistant ? OpenAI announced on May 13, 2024 that free users will soon be able to "discover and use GPTs and the GPT Store ( OpenAI )" There's a larger number of people experiencing homelessness who own a phone than what I imagined. ChatGPT allows for a simple interface, even with voice chat (a more natural way to navigate the tool), to find resources to help those experiencing homelessness. And, it's fast! Technical details The data set has been compiled together over the years and will continue to be updated as new techniques and partnerships make that possible. We use Typesense , a search as a service tool, to provide lightning fast search results for homeless resources near you. This endpoint is created with Hono and is an incredibly easy way to create an API. Contact OurTechnology Visit our website Email us! Find us on LinkedIn While this is on Cameron Pak's ValTown, this code is owned and operated by OurTechnology.
maxm avatar
staticChess
@maxm
HTTP
Check it out here: https://chess.maxmcd.com Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves? Functionality is quite limited, and things might be broken. Please let me know if you find bugs! Inspired by this HN discussion about sites that have all possible game states of tic-tac-toe. I plan on extending this to support real gameplay. I think it could be a nice simple interface for long form games with friends. Might also be fun to add a static AI to play against. Feel free to PR any changes if you'd like to see something added.
iamseeley avatar
HonoHTMX
@iamseeley
HTTP (deprecated)
Forked from mxdvl/vals
pomdtr avatar
val_town_client_example
@pomdtr
Script
Typed Client for the Val Town API Automatically generated using open-api-typescript and openapi-fetch .
pomdtr avatar
serve_blobs
@pomdtr
HTTP (deprecated)
Serve prefixed blobs. Usage import { serveBlobs } from "https://esm.town/v/pomdtr/serve_blobs" export default serveBlobs({ root: "public/" }) All your blobs prefixed by public/ will be publicly accessible. Ex: Go to https://pomdtr-public.web.val.run/example.json to view the blob public/example.json from my account.
saolsen avatar
telemetry
@saolsen
Script
Telemetry For Vals. Telemetry is a library that lets you trace val town executions with opentelemetry. All traces are stored in val.town sqlite and there is an integrated trace viewer to see them. Quickstart Instrument an http val like this. import { init, tracedHandler, } from "https://esm.town/v/saolsen/telemetry"; // Set up tracing by passing in `import.meta.url`. // be sure to await it!!! await init(import.meta.url); async function handler(req: Request): Promise<Response> { // whatever else you do. return } export default tracedHandler(handler); This will instrument the http val and trace every request. Too add additional traces see this widgets example . Then, too see your traces create another http val like this. import { traceViewer } from "https://esm.town/v/saolsen/telemetry"; export default traceViewer; This val will serve a UI that lets you browse traces. For example, you can see my UI here . Tracing By wrapping your http handler in tracedHandler all your val executions will be traced. You can add additional traces by using the helpers. trace lets you trace a block of syncronous code. import { trace } from "https://esm.town/v/saolsen/telemetry"; trace("traced block", () => { // do something }); traceAsync lets you trace a block of async code. import { traceAsync } from "https://esm.town/v/saolsen/telemetry"; await traceAsync("traced block", await () => { // await doSomething(); }); traced wraps an async function in tracing. import { traceAsync } from "https://esm.town/v/saolsen/telemetry"; const myTracedFunction: () => Promise<string> = traced( "myTracedFunction", async () => { // await sleep(100); return "something"; }, ); fetch is a traced version of the builtin fetch function that traces the request. Just import it and use it like you would use fetch . sqlite is a traced version of the val town sqlite client. Just import it and use it like you would use https://www.val.town/v/std/sqlite attribute adds an attribute to the current span, which you can see in the UI. event adds an event to the current span, which you can see in the UI.
pomdtr avatar
valTownSearch
@pomdtr
HTTP (deprecated)
Val Town Search Search for vals using the Github API. Either use the provided UI, or the query param: https://val-town-search.pomdtr.me/search?q=fetchJSON How does it work ? I've wrote about it! Todos [x] Embed the results in the UI [x] Refresh the vals on a cron using a github action [ ] Improve layout on small screens [ ] Support json Accept header [ ] Add pagination params [ ] Allow to filter by authors
dvsj avatar
GetWebsiteMetadata
@dvsj
HTTP (deprecated)
You know how when you paste a URL in Twitter or Slack it shows you a nice preview? This val gives you that data. Given a URL, this will return metadata about the website like title , description , imageURL , image as base64 etc. Sample input - paste this in your URL bar https://dvsj-GetWebsiteMetadata.web.val.run?targetURL=https://dvsj.in https://dvsj-GetWebsiteMetadata.web.val.run?targetURL=<your-target-url-here> Sample output: { status: 200, url: "https://dvsj.in", title: "Dav-is-here ➜", description: "Davis' not-so-secret stash", imgUrl: "https://www.dvsj.in/cover-picture.png", imgData: "data:image/png;base64,qwertyblahblah" } FAQ: Why is imgData sent when imgUrl is already present? Because you shouldn't hotlink images from 3rd parties. Store the base64 image on your server and use it in your app. It's unfair to use their server bandwidth and could be a security issue for you if they change the content of the link later.
easrng avatar
kyselyVtTypes
@easrng
HTTP (deprecated)
Kysely type generator for @std/sqlite Usage Fork to your account. Update allowedTables to expose any tables you'd like to import the schema of. This will make their schemas public! Add import type { DB } from "https://yourusername-kyselyVtTypes.web.val.run/?tables=tables,you,need" to your program. See that QueryParams` type at the top? Add those to your URL to set more options. Demo See @easrng/kyselyVtDemo.
mmcc avatar
honoBasicAuth
@mmcc
Script
Forked from pomdtr/basicAuth
pomdtr avatar
trpc
@pomdtr
Script
trpc Access private Val Town apis. ⚠️ trpc endpoints can change at any time Available Procedures (WIP) Queries search getVal getValMetadata getValLastLogs Mutations deleteVal updateReadme togglePrivacy updateVal toggleLike run updateInterval stopInterval