1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export async function reportErrorAndExit(source: string, message: string) {
4 let content = "# Error from " + source;
5 const append = (text: string) => {
1import { email } from "https://esm.town/v/std/email?v=9";
2async function fetchRandomJoke() {
3 const response = await fetch(
4 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
1import { email } from "https://esm.town/v/std/email?v=9";
2
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 async function fetchRandomJoke() {
6 const response = await fetch(
7 "https://official-joke-api.appspot.com/random_joke",
2import { JSDOM } from "npm:jsdom";
3
4export default async function(req: Request) {
5 let resp = await fetch(`https://${new URL(req.url).pathname.replace(/^https?:\/\//, '')}`, req);
6 let body = await resp.text();
5
6// Existing uptime check logic
7async function uptimeCheck(url: string) {
8 let reason: string, status: number, end: number;
9 let ok = true;
40
41// Run uptime checks on startup
42async function runUptimeChecks() {
43 ["https://students.kpfu.ru", "https://media.kpfu.ru"].forEach(uptimeCheck);
44}
46
47// React Frontend Component
48function UptimeDashboard() {
49 const [uptimeData, setUptimeData] = useState([]);
50 const [loading, setLoading] = useState(true);
51
52 useEffect(() => {
53 async function fetchUptimeData() {
54 try {
55 const response = await fetch('/uptime-data');
111
112// Client-side rendering
113function client() {
114 createRoot(document.getElementById("root")).render(<UptimeDashboard />);
115}
117
118// Server-side handler
119export default async function server(request: Request): Promise<Response> {
120 const url = new URL(request.url);
121
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function createTypewriterMachine() {
7 const messages = ["The bsky has you...", "Follow the blue butterfly", "made with val.town"];
8
89}
90
91function MatrixBlueskyStream() {
92 const [posts, setPosts] = useState([]);
93 const canvasRef = useRef(null);
102 const [machineState, setMachineState] = useState(typewriterMachine.current.initialState);
103
104 // Wrapper function to update state
105 const updateMachineState = useCallback((event) => {
106 const newState = typewriterMachine.current.transition(machineState, event);
135 const agent = new BskyAgent({ service: "https://bsky.social" });
136
137 async function streamPosts() {
138 try {
139 await agent.login({
208 }));
209
210 function draw() {
211 try {
212 ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
248 const animationFrame = setInterval(draw, 33);
249
250 // Cleanup function
251 return () => {
252 clearInterval(animationFrame);
355}
356
357function App() {
358 return <MatrixBlueskyStream />;
359}
360
361function client() {
362 createRoot(document.getElementById("root")).render(<App />);
363}
365if (typeof document !== "undefined") { client(); }
366
367export default async function server(request: Request): Promise<Response> {
368 return new Response(
369 `
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
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.