20## Setup Instructions
21221. Set up a `CLAUDE_API_KEY` environment variable in Val Town with your Anthropic API key
232. Configure your Notion integration to send webhooks to this endpoint
243. Ensure your Notion database has the following properties:
861. **Using the Test UI**: Visit the `/test-ui` endpoint to access a simple web interface where you can enter URLs and see the analysis results.
87882. **Direct API Testing**: Send a POST request to the root endpoint with a JSON payload containing a URL:
8990```json
4const app = new Hono();
56// Initialize Claude client with API key from environment variables
7const anthropic = new Anthropic({
8apiKey: Deno.env.get("CLAUDE_API_KEY"),
9});
10232console.error("Error analyzing with Claude:", error);
233
234// Check for specific Claude API errors
235if (error.status === 429) {
236throw new Error("Claude API rate limit exceeded. Please try again later.");
237} else if (error.status === 401) {
238throw new Error("Claude API authentication failed. Check your API key.");
239}
240
359
360// Prepare response for Notion
361// This structure may need to be adjusted based on Notion's API requirements
362const response = {
363properties: {
389status: "OK",
390timestamp: new Date().toISOString(),
391claude_api_key: Deno.env.get("CLAUDE_API_KEY") ? "Configured" : "Missing",
392};
393return c.json(status);
SatrancChessGame.tsx2 matches
45const fetchGame = async () => {
46try {
47const response = await fetch(`/api/games/${gameId}`);
48if (response.ok) {
49const gameData = await response.json();
229
230try {
231const response = await fetch(`/api/games/${gameId}`, {
232method: "PUT",
233headers: {
SatrancDashboard.tsx1 match
45const fetchOpponents = async () => {
46try {
47const response = await fetch("/api/users");
48if (response.ok) {
49const users = await response.json();
83const fetchActiveGames = async () => {
84try {
85const response = await fetch("/api/games/active");
86if (response.ok) {
87const games = await response.json();
96const fetchLeagueStandings = async () => {
97try {
98const response = await fetch("/api/league/standings");
99if (response.ok) {
100const standings = await response.json();
119// In a real app, you would use a proper authentication endpoint
120// For simplicity, we're using the users endpoint with filtering
121const response = await fetch("/api/users");
122if (response.ok) {
123const users = await response.json();
147const handleRegister = async (username: string, password: string) => {
148try {
149const response = await fetch("/api/users", {
150method: "POST",
151headers: {
183
184try {
185const response = await fetch("/api/games", {
186method: "POST",
187headers: {
59});
6061// API Routes
62const api = new Hono();
6364// User routes
65api.get("/users", async c => {
66const users = await getUsers();
67return c.json(users);
68});
6970api.get("/users/:id", async c => {
71const id = c.req.param("id");
72const user = await getUserById(parseInt(id));
77});
7879api.post("/users", async c => {
80const data = await c.req.json();
81const { username, password } = data;
9495// Game routes
96api.post("/games", async c => {
97const data = await c.req.json();
98const { whiteId, blackId } = data;
110});
111112api.get("/games/:id", async c => {
113const id = c.req.param("id");
114const game = await getGame(parseInt(id));
119});
120121api.put("/games/:id", async c => {
122const id = c.req.param("id");
123const data = await c.req.json();
154});
155156api.get("/games/user/:userId", async c => {
157const userId = c.req.param("userId");
158const games = await getUserGames(parseInt(userId));
160});
161162api.get("/games/active", async c => {
163const games = await getActiveGames();
164return c.json(games);
166167// League routes
168api.get("/league/standings", async c => {
169const standings = await getLeagueStandings();
170return c.json(standings);
171});
172173// Mount API routes
174app.route("/api", api);
175176// Export the Hono app
13## Project Structure
1415- `/backend`: Server-side code and API endpoints
16- `/frontend`: Client-side code and UI components
17- `/shared`: Shared types and utilities
Pegasusindex.html9 matches
355try {
356const jsonData = JSON.parse(jsonYamlInput.value);
357const response = await fetch('/api/convert/json-to-yaml', {
358method: 'POST',
359headers: { 'Content-Type': 'application/json' },
434encodeBase64Btn.addEventListener('click', async () => {
435try {
436const response = await fetch('/api/convert/base64', {
437method: 'POST',
438headers: { 'Content-Type': 'application/json' },
453decodeBase64Btn.addEventListener('click', async () => {
454try {
455const response = await fetch('/api/convert/base64', {
456method: 'POST',
457headers: { 'Content-Type': 'application/json' },
477generateUuidBtn.addEventListener('click', async () => {
478try {
479const response = await fetch('/api/generate/uuid');
480const result = await response.json();
481uuidOutput.value = result.uuid;
491
492for (let i = 0; i < 10; i++) {
493const response = await fetch('/api/generate/uuid');
494const result = await response.json();
495uuids.push(result.uuid);
523
524// Конвертация в RGB
525const response = await fetch('/api/convert/color', {
526method: 'POST',
527headers: { 'Content-Type': 'application/json' },
534
535// Конвертация RGB в HSL
536const rgbToHslResponse = await fetch('/api/convert/color', {
537method: 'POST',
538headers: { 'Content-Type': 'application/json' },
559
560// Конвертация в HEX
561const response = await fetch('/api/convert/color', {
562method: 'POST',
563headers: { 'Content-Type': 'application/json' },
571
572// Конвертация в HSL
573const rgbToHslResponse = await fetch('/api/convert/color', {
574method: 'POST',
575headers: { 'Content-Type': 'application/json' },
33```
3435Эти утилиты разработаны для использования как в браузере, так и на сервере, без зависимости от специфичных для платформы API.