umbrellaReminder2README.md1 match
13141. Geocodes a free-form description of a location to latitude and longitude using @stevekrouse.nominatimSearch
152. Gets hourly weather forecast from Open-Meteo API (free, no API key required)
163. Filters the forecast for today's remaining hours with ≥30% chance of rain
174. If there are any, it formats them appropriately and sends an email reminder
ProtoShareAuth.tsx2 matches
3738// Start WebAuthn flow
39const startEndpoint = isRegister ? '/api/auth/register-start' : '/api/auth/login-start';
40const startPayload = isRegister ? { email, name } : { email };
41115116// Finish authentication
117const finishEndpoint = isRegister ? '/api/auth/register-finish' : '/api/auth/login-finish';
118const finishResponse = await fetch(finishEndpoint, {
119method: 'POST',
5// Initialize Notion client
6const notion = new Client({
7auth: Deno.env.get("NOTION_API_KEY"),
8});
911return {
12status: "connected",
13message: "Successfully connected to Notion API",
14databases: response.results.map((db) => ({
15title: db.title?.[0]?.plain_text || "Untitled",
Glancer-backup-as-of-5-31root.ts2 matches
6// Initialize Notion client
7const notion = new Client({
8auth: Deno.env.get("NOTION_API_KEY"),
9});
1020{
21status: "error",
22message: "Failed to connect to Notion API",
23error: error.message,
24},
7<title>Your Homepage</title>
8<script src="https://cdn.twind.style" crossorigin></script>
9<link rel="preconnect" href="https://fonts.googleapis.com">
10<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
12<style>
13:root {
Weather_Cardmain.tsx10 matches
56// 处理IP地理位置查询
7if (url.pathname === "/api/location") {
8try {
9// 获取客户端IP地址
11console.log("Client IP:", clientIP);
1213// 使用IP地理定位API
14const locationResponse = await fetch(
15`http://ip-api.com/json/${clientIP}?lang=zh-CN&fields=status,message,country,regionName,city,lat,lon,timezone`,
16);
17const locationData = await locationResponse.json();
50}
51} catch (error) {
52console.error("Location API error:", error);
53return new Response(
54JSON.stringify({
72}
7374// 处理天气API请求
75if (url.pathname === "/api/weather") {
76try {
77const province = url.searchParams.get("province") || "北京";
106});
107} catch (error) {
108console.error("Weather API error:", error);
109return new Response(
110JSON.stringify({
516setLoading(true, '正在获取位置信息...');
517
518const response = await fetch('/api/location');
519const data = await response.json();
520
563refreshBtn.classList.add('loading');
564
565const apiUrl = \`/api/weather?province=\${encodeURIComponent(location.province)}&city=\${encodeURIComponent(location.city)}&county=\${encodeURIComponent(location.county)}\`;
566
567const response = await fetch(apiUrl);
568const data = await response.json();
569
HN-fetch-callmain.tsx1 match
1import { fetchItem, fetchMaxItemId } from "./api.tsx";
2import { spider } from "./fetch.tsx";
3
Glancer-backup-as-of-5-31README.md11 matches
17let html = await readFile("/frontend/index.html", import.meta.url);
1819const response = await fetch(`/api/demo/${id}`);
20const initialData = await response.json();
2187// Client-side event recording
88window.recordClick = function (action) {
89fetch(`/api/setAction`, {
90method: "POST",
91headers: { "Content-Type": "application/json" },
103104```
105├── backend/ # Server-side logic and API routes
106│ ├── controllers/ # Business logic for Notion integration
107│ ├── crons/ # Scheduled tasks for cache management
108│ ├── routes/ # HTTP route handlers
109│ │ ├── api/ # JSON API endpoints
110│ │ ├── tasks/ # Notion webhook handlers
111│ │ └── views/ # HTML page serving
121### Backend (`/backend`)
122123Handles all server-side operations including API routes, Notion integration, and static file serving. Built with Hono for routing and includes authentication middleware.
124125### Frontend (`/frontend`)
134135- **Val Town & Deno**: Serverless runtime environment with TypeScript support
136- **Notion Client**: Official npm library for Notion API integration
137- **Hono**: Lightweight web framework for routing and middleware
138- **Blob Storage**: Val Town's built-in caching solution for performance optimization
170171// Route modules
172app.route("/api", api); // JSON API endpoints
173app.route("/tasks", tasks); // Notion webhook handlers
174app.route("/demo", demo); // Demo page serving
175```
176177#### API Routes (`/api`)
178179Serve JSON data and handle CRUD operations for demo management, cobrowsing status, and user interactions.
241```typescript
242const notion = new Client({
243auth: Deno.env.get("NOTION_API_KEY"),
244});
245249Required environment variables:
250251- `NOTION_API_KEY`: Notion integration token
252- `GLANCE_DEMOS_DB_ID`: Notion database ID for demo pages
253- `GLANCE_INTERACTIONS_DB_ID`: Notion database ID for interaction tracking
289Different route areas serve specific purposes:
290291- `/api/*`: JSON data endpoints for frontend consumption
292- `/demo/*`: Personalized demo page serving with data injection
293- `/tasks/*`: Notion webhook processing and database updates
Glancer3Remixtasks.ts1 match
11// Initialize Notion client
12export const notion = new Client({
13auth: Deno.env.get("NOTION_API_KEY"),
14});
15
Glancer3RemixsetPageID.ts1 match
3// Initialize Notion client
4const notion = new Client({
5auth: Deno.env.get("NOTION_API_KEY"),
6});
7