Avatar

easrng

👩‍💻🏳️‍⚧️ she/her
Joined June 5, 2023
Likes
20
easrng avatar
easrng
uploadImage
Script
uploadImage uploads an image to val.town just like when you paste an image into a readme
5
easrng avatar
easrng
resilientFetch
Script
resilientFetch : faster @std/fetch Try to fetch unproxied first, and fall back to proxied fetch if that fails.
2
easrng avatar
easrng
upgradeExpress
Script
upgradeExpress Upgrade Express vals to the Web API without breaking existing consumers How it works upgradeExpress wraps a Web handler into a function that works as normal when called by the Web API, and redirects to the Web API when called by the Express API. Example I don't have an example for this per se but I used it to upgrade @easrng/button.
2
easrng avatar
easrng
signInWithValTownDemo
HTTP
@easrng/signInWithValTown Demo An example of how to add authentication backed by val.town accounts to a val.
1
easrng avatar
easrng
playground
HTTP
playground edit, run, and embed vals without requiring an account (or even js enabled!) caveats: logs don't stream I haven't set up codemirror only script vals supported everything else should be fully functional. you can prefill the editor with code: https://easrng-playground.web.val.run/?code=console.log(1) a val: https://easrng-playground.web.val.run/?load=easrng/playground some other url: https://easrng-playground.web.val.run/?load=https://any/other/url
4
easrng avatar
easrng
oldstyle
Script
oldstyle bring back the old @​import.syntax usage: import oldstyle from "https://esm.town/v/easrng/oldstyle"; const fn = await oldstyle` export default async () => { // import vals const fetchFns = [@std.fetch, @easrng.moduleFetch]; console.log( await Promise.all( fetchFns.map((fn) => fn("https://icanhazip.com").then((res) => res.text()), ), ), ); // get environment variables with @me.secrets console.log(@me.secrets.FORCE_COLOR); // update vals console.log(@easrng.counter++); }; // you don't have to have an export btw `; fn();
1
easrng avatar
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
valTownTrpc avatar
valTownTrpc
autocomplete
Script
An interactive, runnable TypeScript val by valTownTrpc
1
valTownTrpc avatar
valTownTrpc
getValOutput
Script
An interactive, runnable TypeScript val by valTownTrpc
2
valTownTrpc avatar
valTownTrpc
autocompleteNpm
Script
An interactive, runnable TypeScript val by valTownTrpc
2
valTownTrpc avatar
valTownTrpc
getNpmVersions
Script
An interactive, runnable TypeScript val by valTownTrpc
1
valTownTrpc avatar
valTownTrpc
getScheduledInterval
Script
An interactive, runnable TypeScript val by valTownTrpc
1
valTownTrpc avatar
valTownTrpc
search
Script
An interactive, runnable TypeScript val by valTownTrpc
2
valTownTrpc avatar
valTownTrpc
getValReferenceTypes
Script
An interactive, runnable TypeScript val by valTownTrpc
1
valTownTrpc avatar
valTownTrpc
getValMetadata
Script
An interactive, runnable TypeScript val by valTownTrpc
1
valTownTrpc avatar
valTownTrpc
getVal
Script
An interactive, runnable TypeScript val by valTownTrpc
2