2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server/";
4import GetNews from "../api/news.ts";
5import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
6
1import fetchWithCache from "./cache.ts";
2
3const GUARDIAN_API_KEY = Deno.env.get("GUARDIAN_API_KEY");
4
5export default async function(req: Request): Promise<Response> {
21 };
22
23 const address = `https://content.guardianapis.com/search?api-key=${GUARDIAN_API_KEY}&page-size=${size}`;
24 const apiUrl = address + `&${new URLSearchParams(searchParameters).toString()}`;
25 const cacheKey = `guardian_headlines_${size}`;
26
27 const data = await fetchWithCache(apiUrl, cacheKey).then((res) => res.json());
28 return new Response(JSON.stringify(data), {
29 headers: {
6async function getLogs() {
7 // TODO: use fetchWithCache
8 const url = "https://hemolog.com/api/recent-treatments?alertid=mike29";
9 try {
10 const response = await fetch(url);
11 if (!response.ok) {
12 throw new Error(`API responded with status: ${response.status}`);
13 }
14 const data = await response.json();
8 <meta charSet="UTF-8" />
9 <title>{title}</title>
10 <link rel="preconnect" href="https://fonts.googleapis.com" />
11 {/* Getting a type error here */}
12 {/* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> */}
13 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet" />
14 <link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet" />
15 <link href="https://fonts.googleapis.com/css2?family=Rancho&display=swap" rel="stylesheet" />
16 <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet" />
17 <link
18 href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
19 rel="stylesheet"
20 />
7
8export default async function fetchWithCache(
9 apiUrl: string,
10 cacheKey: string,
11 cacheMinutes: number = 5,
37
38 // Fetch new data if no valid cache exists
39 const response = await fetch(apiUrl);
40 if (!response.ok) {
41 throw new Error(`API responded with status: ${response.status}`);
42 }
43 const data = await response.json();
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server/";
4import { type APOD, GetAPOD } from "../api/apod.ts";
5import { BodyWrapper, Header } from "../components.tsx";
6
11};
12
13const NASA_API_KEY = Deno.env.get("NASA_API_KEY");
14
15export async function GetAPOD(req: Request): Promise<Response> {
16 const url = `https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}&thumbs=true`;
17 const cacheKey = "nasa_apod";
18 const cacheMinutes = 60;
21
22 if (!data) {
23 return new Response("No data from Nasa API", { status: 404 });
24 }
25
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
2import { fetchProjectFiles } from "../utils/api.ts";
3
4interface UseProjectFilesProps {
6 project: any;
7 branchId: string | undefined;
8 anthropicApiKey: string;
9 bearerToken: string;
10 selectedFiles: string[];
16 project,
17 branchId,
18 anthropicApiKey,
19 bearerToken,
20 selectedFiles,
35 status,
36 } = useChat({
37 api: "/api/send-message",
38 body: {
39 project,
40 branchId,
41 anthropicApiKey,
42 selectedFiles,
43 images: images
6- [ ] Rebuild as React Router?
7- [ ] opentownie as a pr bot
8- [ ] give it the ability to see its own client-side and server-side logs by building a middleware that shoves them into a SQL light database date and then give it a tool to access them or use our trpc API in that tool
9- [ ] do a browser use or screenshot thing to give it access to its own visual output
10- [ ] Have it default to creating a new branch off main and then embedding and iframe to the resulting http val and give you a link to a pr opening url