blob_adminmain.tsx1 match
195});
196197export default lastlogin((request: Request) => app.fetch(request));
blob_adminapp.tsx22 matches
231const [isDragging, setIsDragging] = useState(false);
232233const fetchBlobs = useCallback(async () => {
234setLoading(true);
235try {
236const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
237const data = await response.json();
238setBlobs(data);
239} catch (error) {
240console.error("Error fetching blobs:", error);
241} finally {
242setLoading(false);
245246useEffect(() => {
247fetchBlobs();
248}, [fetchBlobs]);
249250const handleSearch = (e) => {
261setBlobContentLoading(true);
262try {
263const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
264const content = await response.text();
265setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
266setEditContent(content);
267} catch (error) {
268console.error("Error fetching blob content:", error);
269} finally {
270setBlobContentLoading(false);
275const handleSave = async () => {
276try {
277await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
278method: "PUT",
279body: editContent,
287const handleDelete = async (key) => {
288try {
289await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
290setBlobs(blobs.filter(b => b.key !== key));
291if (selectedBlob && selectedBlob.key === key) {
304const key = `${searchPrefix}${file.name}`;
305formData.append("key", encodeKey(key));
306await fetch("/api/blob", { method: "POST", body: formData });
307const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
308setBlobs([newBlob, ...blobs]);
312}
313}
314fetchBlobs();
315};
316326try {
327const fullKey = `${searchPrefix}${key}`;
328await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
329method: "PUT",
330body: "",
341const handleDownload = async (key) => {
342try {
343const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
344const blob = await response.blob();
345const url = window.URL.createObjectURL(blob);
360if (newKey && newKey !== oldKey) {
361try {
362const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
363const content = await response.blob();
364await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
365method: "PUT",
366body: content,
367});
368await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
369setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
370if (selectedBlob && selectedBlob.key === oldKey) {
380const newKey = `__public/${key}`;
381try {
382const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
383const content = await response.blob();
384await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
385method: "PUT",
386body: content,
387});
388await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
389setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
390if (selectedBlob && selectedBlob.key === key) {
399const newKey = key.slice(9); // Remove "__public/" prefix
400try {
401const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
402const content = await response.blob();
403await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
404method: "PUT",
405body: content,
406});
407await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
408setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
409if (selectedBlob && selectedBlob.key === key) {
81const app = new Hono();
82app.get("/", ImOKTheBullIsDead);
83export default app.fetch;
8485{
89const app = new Hono();
10export default app.fetch;
1112const baseUrl = "https://spacex.page";
151152// TODO: refactor to notification sending func
153const res = await fetch(notificationUrl, {
154method: "POST",
155headers: { "Content-Type": "application/json" },
89// -----------------------------------------------------------------------------
10// Helper: fetch previous fun facts so we avoid duplicates
11// -----------------------------------------------------------------------------
12async function getPreviousFunFacts() {
stevens-openaigetWeather.ts1 match
8788/**
89* Main entry. Fetches the forecast, generates concise summaries, and stores them.
90*/
91export default async function getWeatherForecast(interval: number) {
131}
132133// Fetch relevant memories using the utility function
134const memories = await getRelevantMemories();
135console.log(memories);
stevens-openaiNotebookView.tsx12 matches
67const [currentPage, setCurrentPage] = useState(1);
6869const fetchMemories = useCallback(async () => {
70setLoading(true);
71setError(null);
72try {
73const response = await fetch(API_BASE);
74if (!response.ok) {
75throw new Error(`HTTP error! status: ${response.status}`);
78setMemories(data);
79} catch (e) {
80console.error("Failed to fetch memories:", e);
81setError(e.message || "Failed to fetch memories.");
82} finally {
83setLoading(false);
8687useEffect(() => {
88fetchMemories();
89}, [fetchMemories]);
9091const handleAddMemory = async (e: React.FormEvent) => {
100101try {
102const response = await fetch(API_BASE, {
103method: "POST",
104headers: { "Content-Type": "application/json" },
112setNewMemoryTags("");
113setShowAddForm(false);
114await fetchMemories();
115} catch (e) {
116console.error("Failed to add memory:", e);
123124try {
125const response = await fetch(`${API_BASE}/${id}`, {
126method: "DELETE",
127});
129throw new Error(`HTTP error! status: ${response.status}`);
130}
131await fetchMemories();
132} catch (e) {
133console.error("Failed to delete memory:", e);
155156try {
157const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158method: "PUT",
159headers: { "Content-Type": "application/json" },
164}
165setEditingMemory(null);
166await fetchMemories();
167} catch (e) {
168console.error("Failed to update memory:", e);
stevens-openaiindex.ts2 matches
135));
136137// HTTP vals expect an exported "fetch handler"
138export default app.fetch;
stevens-openai.cursorrules5 matches
163```
1641655. **fetchTranspiledJavaScript** - Fetch and transpile TypeScript to JavaScript:
166```ts
167const jsCode = await fetchTranspiledJavaScript("https://esm.town/v/username/project/path/to/file.ts");
168```
169242243// Inject data to avoid extra round-trips
244const initialData = await fetchInitialData();
245const dataScript = `<script>
246window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
3003015. **API Design:**
302- `fetch` handler is the entry point for HTTP vals
303- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
304- Properly handle CORS if needed for external access