41
42 try {
43 // Send POST request to Feedbin API
44 const response = await fetch("https://api.feedbin.com/v2/pages.json", {
45 method: "POST",
46 headers,
51 if (!response.ok) {
52 const errorBody = await response.text();
53 console.error("Feedbin API error:", response.status, errorBody);
54 return null;
55 }
160});
161
162app.get("/api/bookmarks", async (c) => {
163 var baseUrl = c.req.url;
164 var page = parseInt(c.req.query("page") || "0");
265 <title>Eternal Soul Binding: A Dark Proposition</title>
266 <meta name="viewport" content="width=device-width, initial-scale=1">
267 <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Lora:wght@400;700&display=swap" rel="stylesheet">
268 <style>
269 body {
115
116// Generate a random idea based on parameters
117app.post("/api/generate-idea", async (c) => {
118 try {
119 const body = await c.req.json();
6 <title>The Art of Visual Design</title>
7 <!-- Fonts -->
8 <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
9 <link rel="stylesheet" href="/frontend/style.css">
10 <link rel="icon" href="/frontend/favicon.svg" sizes="any" type="image/svg+xml">
7
8 <!-- Fonts -->
9 <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
10
11 <style>
17});
18
19// API endpoint example
20app.get("/api/status", c => {
21 return c.json({
22 status: "online",
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>✨ Y2K Vibes ✨</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com">
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9 <link href="https://fonts.googleapis.com/css2?family=Bubblegum+Sans&family=VT323&display=swap" rel="stylesheet">
10 <script src="https://cdn.twind.style" crossorigin></script>
11 <style>
1import { search } from "npm:google-sr";
2
3const API_KEY = Deno.env.get("SERP_API_KEY") ?? "";
4const endpoint = "https://serpapi.com/search.json";
5
6async function processResult(result) {
99 const parsedUrl = new URL(url);
100
101 // Handle both github.com URLs and API URLs
102 if (!parsedUrl.hostname.includes("github.com")) {
103 throw new Error("Not a GitHub URL");
132
133 try {
134 // GitHub API URL for repo contents
135 const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
136 console.log(`Fetching from: ${apiUrl}`);
137
138 const response = await fetch(apiUrl, {
139 headers: {
140 "Accept": "application/vnd.github.v3+json",
144
145 if (!response.ok) {
146 throw new Error(`GitHub API error: ${response.status} ${response.statusText}`);
147 }
148
165 }
166 } else if (item.content && item.encoding === "base64") {
167 // Some API responses include base64 encoded content
168 content = Buffer.from(item.content, "base64").toString("utf8");
169 } else {
379app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
380
381// Add your API routes here
382// app.get("/api/data", c => c.json({ hello: "world" }));
383
384// Unwrap and rethrow Hono errors as the original error
4export function App() {
5 const [projectUrl, setProjectUrl] = useState("");
6 const [apiToken, setApiToken] = useState("");
7 const [loading, setLoading] = useState(false);
8 const [message, setMessage] = useState("");
21 }
22
23 if (!apiToken.trim()) {
24 throw new Error("API Token is required");
25 }
26
28 method: "POST",
29 headers: {
30 "Authorization": `Bearer ${apiToken}`,
31 "Content-Type": "application/json",
32 },
69
70 <div>
71 <label htmlFor="apiToken" className="block text-sm font-medium text-gray-700 mb-1">
72 Val Town API Token (project read + write permissions)
73 </label>
74 <input
75 id="apiToken"
76 type="password"
77 value={apiToken}
78 onChange={(e) => setApiToken(e.target.value)}
79 placeholder="Enter your API token"
80 className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-purple-500"
81 />