Air quality API examples & templates
Use these vals as a playground to view and fork Air quality API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
stevekrouse
dm
Script
DM Me! Ever wanted to message someone about their val but you couldn't find their contact info? Want to allow folks on Val Town to contact you without exposing your email address? Boy do I have the over-engineered solution for you! This is a userspace, authenticated protocol for Val Town direct messages. Protocol Expose a dm function on your namespace that that accepts messages and some authentication data (described below). The easiest way to accomplish this is to fork this val. What you choose to do with direct messages is totally up to you. At the moment, I email myself your message and save it to a private array val. You could forward it along to yourself some other way, batch up messages to get a daily summary email if you're Mr. Popular, or send them to /dev/null if you're Mr. Antisocial. Authentication This protocol uses my Val Town public key auth scheme , so you'll need to follow the first two steps of that blog post – (1) generate a keypair and (2) publish your public key – to authenticate to this function. Usage You can call this function via the @stevekrouse.runValAPIAuth helper: @stevekrouse.runValAPIAuth({
val: "@stevekrouse.dm",
args: ["hi steve!"],
keys: @me.exportedKeys,
}); Example: https://www.val.town/v/stevekrouseTest.untitled_tealMinnow
0
easrng
valSign
Script
secure signatures with vals setup you'll need to make 2 new vals: generate a keypair (keep this val private) let vsExportedKeys = @easrng.generateKeys(); publish your public key (make this val public) const vsPublicKey = () => @me.exportedKeys.publicKey; usage sign call @easrng.valSign to get a signature. const signature = await @easrng.valSign({ keys: @me.vsExportedKeys, data: {hello: "world"}}) the result will look something like this: @easrng.htVgaVWWtvnz5AK0DnDaNON5gar5qJeaorfsTCiIr7ua_-D4HPmFrIrPMfwmCaMvI0CxKlYCUe9XTGm7r5s5C3siZGF0YSI6eyJoZWxsbyI6IndvcmxkIn0sInVzZXIiOiJlYXNybmciLCJleHByIjpudWxsfQ you can also set an expiration date: const signature = await @easrng.valSign({ keys: @me.vsExportedKeys, data: "this expires in 1 second", expireIn: 1000 }) verify call @easrng.valSignVerify to verify a signature const { data, handle, expiresAt } = await @easrng.valSignVerify(signature) with the example signature from earlier, data would be {hello: "world"} , handle would be easrng , and expiresAt would be null
2
torlanco
shirtGenScript
HTTP
👕 Shirtgen API Endpoint Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between the standard "Flux Schnell" model or the enhanced "Pro" model. Perfect for creating unique custom apparel in seconds! 🚀 💡 How it Works Send a POST request to the endpoint with your design prompt. Toggle between Standard and Pro models using the useProModel flag. The AI generates a high-quality t-shirt design based on your prompt. 📥 Expected POST Data {
"prompt": "A retro sunset with palm trees 🌴🌅",
"useProModel": true
}
0
torlanco
shirtGen
HTTP
👕 Shirtgen Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between Flux Schnell or the Pro model for enhanced results, and watch AI bring your ideas to life in seconds. Perfect for creating custom apparel effortlessly! 🚀 How it Works Enter a prompt describing your design. Toggle between Standard and Pro models. Hit "Generate" to see your AI-crafted t-shirt design appear! Image Generation Sources With Replicate API Key : Uses Replicate Hosted Flux models for high-quality designs. Without Replicate Key : Falls back to a Val.town image generator for quick designs. Requirements Optional Replicate API Key : To use the advanced models, set REPLICATE_API_KEY in your environment.
0