54This val uses the SocialData API for Twitter data:
55- **Proxies via Val Town's SocialDataProxy**: Limited to 100 calls/day for [**Val Town Pro users**](https://www.val.town/pricing).
56- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function ImportDeck() {
6 const [deckText, setDeckText] = useState("");
7 const [message, setMessage] = useState("");
48}
49
50function ViewDeck() {
51 const [cards, setCards] = useState([]);
52 const [error, setError] = useState("");
59 }, []);
60
61 async function fetchCards() {
62 try {
63 const response = await fetch("/view");
257
258// Rest of the code remains unchanged from the previous implementation
259function RandomCard() {
260 const [randomCard, setRandomCard] = useState<
261 {
321}
322
323function App() {
324 const [view, setView] = useState<"import" | "view" | "random">("import");
325
383}
384
385function client() {
386 createRoot(document.getElementById("root")).render(<App />);
387}
388if (typeof document !== "undefined") { client(); }
389
390export default async function server(request: Request): Promise<Response> {
391 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
392 const { OpenAI } = await import("https://esm.town/v/std/openai");
11});
12
13function getStripeCustomer(customerId: string) {
14 return stripe.customers.retrieve(customerId);
15}
1type Handler = (req: Request) => Response | Promise<Response>;
2
3export function oauth(params: any, next: (req: Request, accessToken: string) => Response | Promise<Response>): Handler {
4 return (req: Request) => {
5 // TODO: go through oauth flow to extract access token
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;
14}
15
16function App() {
17 const [launches, setLaunches] = useState<TokenLaunch[]>([]);
18
67}
68
69function LaunchCard({ launch }: { launch: TokenLaunch }) {
70 return (
71 <div className="launch-card">
82}
83
84function client() {
85 createRoot(document.getElementById("root")).render(<App />);
86}
90}
91
92export default async function server(request: Request): Promise<Response> {
93 const { blob } = await import("https://esm.town/v/std/blob");
94 const KEY = "diplomaticApricotHeron";
9}>;
10
11export function bindAction(actionUrl: string) {
12 bindActionToTrigger(actionUrl, import.meta.url)
13}
20);
21
22export default async function trigger(req: Request): Promise<Response> {
23 const url = new URL(req.url);
24
2import { valUrlToId } from "https://esm.town/v/wolf/valUrlToId?v=73";
3
4function getBlobKey(triggerUrl: string) {
5 const blobPrefix = "demo-webhook-trigger";
6 return `${blobPrefix}:${triggerUrl}`;
7}
8
9export async function bindActionToTrigger(actionUrl: string, triggerUrl: string) {
10 const triggerId = await valUrlToId(triggerUrl);
11 const blobKey = getBlobKey(triggerUrl);
16}
17
18export async function unbindActionFromTrigger(actionUrl: string, triggerUrl: string) {
19 const triggerId = await valUrlToId(triggerUrl);
20 const blobKey = getBlobKey(triggerUrl);
25}
26
27export async function listActionsForTrigger(triggerUrl: string): Promise<string[]> {
28 const triggerId = await valUrlToId(triggerUrl);
29 const blobKey = getBlobKey(triggerUrl);
2const headers = { "User-Agent": "Mozilla/5.0" };
3
4export async function valUrlToId(valUrl: string | undefined) {
5 if (!valUrl) valUrl = import.meta.url;
6 const valTownPage = valUrl.replace("esm.town", "val.town");
5console.log(await valUrlToId(import.meta.url));
6
7export async function bindToHandler(handlerId: string) {
8 const thisValId = await valUrlToId(import.meta.url);
9 return;
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": "*",