18
19/**
20 * General use function to commit files to GitHub
21 */
22export async function commitFiles({
23 token,
24 owner,
1/**
2 * Use this function along with your valtown webhook secret to create
3 * the x-val-signature header when posting to the /export webhook
4 */
2import { renderToString } from "npm:react-dom/server";
3import { importMap } from "./importMap";
4export default async function(req: Request): Promise<Response> {
5 const u = new URL(req.url);
6
33let hasAnError: string = 10;
34
35function increment(num: number) {
36 return num + 1;
37}
2import { renderToString } from "npm:react-dom/server";
3let counter = 0;
4export default async function(req: Request): Promise<Response> {
5 return new Response(
6 renderToString(
6import { SparklineSVG } from "./sparklineSVG";
7
8function StatusRow({ rows }) {
9 return (
10 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function Counter() {
6 const [count, setCount] = useState(4);
7
15}
16
17function client() {
18 createRoot(document.getElementById("root")).render(<Counter />);
19}
23}
24
25export default function server(request: Request): Response {
26 return new Response(
27 `
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [count, setCount] = useState(4);
7 return (
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;
7);
8
9export async function uptimeCheck(url: string) {
10 let reason: string, status: number, end: number;
11 let ok = true;
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": "*",