1import { blob } from "https://esm.town/v/std/blob?v=10";
2
3function isJSON(input: string | null | undefined) {
4 if (!input || input === null) return false;
5 try {
11}
12
13function processInputHtml(html: string) {
14 let output = html;
15
21}
22
23function formatPage(key: string, data: string) {
24 return `
25 ${data}
20let cachedUint8Memory0 = null;
21
22function getUint8Memory0() {
23 if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
24 cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
27}
28
29function getStringFromWasm0(ptr, len) {
30 ptr = ptr >>> 0;
31 return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
32}
33/** */
34export const say_hello = (imports.say_hello = function() {
35 wasm.say_hello();
36});
41 * @returns {number}
42 */
43export const add = (imports.add = function(x, y) {
44 const ret = wasm.add(x, y);
45 return ret;
46});
47
48export const __wbg_log_08850d6d4d91f4c9 = (imports.__wbg_log_08850d6d4d91f4c9 = function(arg0, arg1) {
49 console.log(getStringFromWasm0(arg0, arg1));
50});
2import { YouTube } from 'https://deno.land/x/youtube@v0.3.0/mod.ts';
3
4export async function fetchVideoDetails(req) {
5 const url = new URL(req.url);
6 let yturl = url.searchParams.get("yturl") || "";
94 break;
95 case 'transcript':
96 async function fetchcaptions(videoId) {
97 const WATCH_URL = `https://www.youtube.com/watch?v=${videoId}`;
98
135}
136
137function parseISO8601Duration(duration) {
138 const regex = /PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/;
139 const matches = duration.match(regex);
1export async function getDetailsPlaystore(request: Request): Promise<Response> {
2 const searchParams = new URL(request.url).searchParams;
3 const bundleId = searchParams.get("bundleId");
2import process from "node:process";
3
4export async function checkTensorArtWebStatus() {
5 async function sendLarkMessage(message) {
6 return fetch(process.env.larkTensorRobotUrl, {
7 method: "POST",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3Enables Opentelemetry tracing for vals.
4Exports two functions, `init` and `traced_handler`.
5`init` will set up opentelemetry.
6
10In the future we can add more export targets for other services. I'm also thinking about making a val to display them.
11
12`traced_handler` is a wrapper for your handler you can use on an HTTP val. Just pass it your HTTP function and export it as the default and it'll trace every request.
13
14Here's a screenshot of what the honeycomb view of a trace from my [connect playing val](https://www.val.town/v/saolsen/connect4_site) looks like.
13const app = new Hono();
14
15function main(children: Child): JSX.Element {
16 return (
17 <main id="main">
21}
22
23function page(children: Child): JSX.Element {
24 return (
25 <html>
33 {html`
34 <script>
35 async function loadClerk() {
36 await window.Clerk.load()
37 if (window.Clerk.user) {
12};
13
14export async function migrate(migrations) {
15 console.log("Running Migrations");
16 await sqlite.execute(`
52}
53
54export async function undo(migrations) {
55 console.log("Undoing Migrations");
56 await sqlite.execute(`
6const query = "buttondown";
7
8export async function twitterSearch({
9 query,
10 start_time,
52}
53
54export default async function twitterAlert({ lastRunAt }: Interval) {
55 const results = await twitterSearch({
56 query,
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",