49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`
1import { blob } from "https://esm.town/v/std/blob?v=11";
2
3export async function deleteBlobs(prefix: string) {
4 (await blob.list(prefix)).forEach(({ key }) => blob.delete(key));
5}
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function fetchBrightDataBalance(
4 token: string,
5): Promise<number> {
8const USERNAME = extractValInfo(import.meta.url).author;
9
10export async function createInjectMyFooterStream(logo = valTownLogoAuto) {
11 const footer = await MyFooter(logo);
12 return new InjectHTMLElementStream(footer.toString());
13}
14
15export async function MyFooter(logo = valTownLogoAuto) {
16 const recommendation = rootValRef().handle === USERNAME
17 ? html`<span class="recommends">${await recommends()}</span>`
41}
42
43export default async function(req) {
44 const { Layout } = await import("https://esm.town/v/postpostscript/Layout");
45 return htmlResponse`${Layout`
1let currentNumber = 0; // Assuming starting point, but this could be loaded/stored elsewhere.
2
3// This function increments the number and returns the new value.
4function incrementNumber() {
5 currentNumber += 1;
6 // Here, you would ideally persist the current number to a database or file for long-term storage.
2import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
3
4export default function(req: Request) {
5 const { author, name } = extractValInfo(import.meta.url);
6 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);
4import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
5
6export default function(req: Request) {
7 const { author, name } = extractValInfo(import.meta.url);
8 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);
4const query = "\"val.town\" OR \"val town\" -_ValTown_";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,
54export default app.fetch;
55
56async function createPage(c: Context<HonoEnvOptional>) {
57 const auth = c.get("auth");
58
1import { email as sendEmail } from "https://esm.town/v/std/email?v=11";
2
3export default async function(email: Email) {
4 await sendEmail({
5 subject: email.subject,
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.