sachersolindex.html4 matches
2021<!-- Google Fonts: thin, airy vibe -->
22<link rel="preconnect" href="https://fonts.googleapis.com">
23<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
24<link href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@100..900&display=swap" rel="stylesheet">
2526<!-- Tailwind + Alpine -->
246<ul class="mt-6 space-y-2 text-slate-700">
247<li>β’ Goal decomposition and habit stacking</li>
248<li>β’ Asynchronous checkβins and rapid feedback loops</li>
249<li>β’ Parent coaching for calm collaboration</li>
250</ul>
315};
316try {
317const res = await fetch('/api/email',
318{
319method: 'POST',
untitled-8620main.ts7 matches
81/**
82* Main asynchronous process to build the prerequisite graph level-by-level.
83* Tracks processed nodes to avoid redundant API calls and circular dependencies.
84*/
85async function buildTreeInBackground(jobId: string, rootNode: FactNode) {
136});
137138// Wait for all API calls on the current level to complete.
139await Promise.all(processingPromises);
140171<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
172<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
173<link rel="preconnect" href="https://fonts.googleapis.com">
174<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
175<link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=Source+Sans+3:wght@400;600&display=swap" rel="stylesheet">
176<style>
177:root {
344const { useState, useEffect, useCallback } = React;
345346const API_BASE_URL = '${sourceUrl}';
347const POLLING_INTERVAL = 2000;
348419
420try {
421const response = await fetch(\`\${API_BASE_URL}/start\`, {
422method: 'POST',
423headers: { 'Content-Type': 'application/json' },
442const pollJobStatus = async () => {
443try {
444const response = await fetch(\`\${API_BASE_URL}/status?jobId=\${jobId}\`);
445if (!response.ok) throw new Error('Polling failed');
446
2223The following routes are accessible without authentication:
24- `/api/health` - System health status
2526### Protected Routes
30**User Authentication (Google OAuth via LastLogin):**
31- `/` - Main dashboard (shows user info and system status)
32- `/api/*` - API endpoints (except health)
33- `/views/*` - View routes including `/views/glimpse/:id`
34- `/glimpse/*` - Shortcut routes including `/glimpse/:id` (equivalent to `/views/glimpse/:id`)
3536**Webhook Authentication (X-API-KEY header):**
37- `/tasks/*` - Webhook endpoints for external integrations (POST requests only)
38- GET requests to `/tasks/*` are allowed without authentication for debug endpoints
44β βββ controllers/ # Business logic controllers
45β βββ routes/ # Route definitions and HTTP handling
46β β βββ api/ # API endpoints
47β β βββ glimpse/ # Glimpse routes (enhanced with React frontend)
48β β βββ tasks/ # Task-related routes
8485### **Service Layer** (External Integrations)
86- Handles external API calls (Notion, databases)
87- Manages data persistence
88- Returns structured results with success/error information
122- `GET /glimpse/:id` - **Enhanced with React Frontend** - Content negotiation based on Accept header:
123- **Browser requests** (`Accept: text/html`): Returns rich React frontend with interactive Notion content display
124- **API requests** (`Accept: application/json`): Returns raw JSON data (same as before)
125- **Fallback**: If HTML template fails to load, automatically serves JSON
126159**Note:** The glimpse endpoints now provide both programmatic access (JSON) and user-friendly viewing (React frontend) from the same URL, maintaining backward compatibility while adding rich content display capabilities.
160161### Demo API Endpoints
162163API endpoints for accessing Notion page data with different levels of detail:
164165- `GET /api/demo/:id/properties` - Returns page properties only
166- `GET /api/demo/:id` - Returns page properties + all blocks recursively
167- `GET /api/agent/:id` - Returns agent blob data for a specific page ID
168169**Architecture:**
170- **Routes**: Handle HTTP concerns (parameter extraction, response formatting, status codes)
171- **Controllers**: Contain business logic (`getDemoProperties`, `getDemoFull`)
172- **Services**: Handle Notion API integration
173174**Authentication Behavior:**
196```javascript
197// Internal call from within Val (no authentication needed)
198const response = await fetch('/api/demo/page-id/properties');
199const data = await response.json();
200208- Filter out button properties from Notion page data
209- Return standardized JSON responses (except authentication routes which redirect or show HTML)
210- Use the same controller functions as the API endpoints for consistency
211212### New User Registration Flow
259### Webhook Endpoints
260261- `POST /tasks/notion-webhook` - Main webhook endpoint for Notion integrations (requires `X-API-KEY` header)
262- `POST /tasks/url` - Updates Notion page URL property with glimpse URL (requires `X-API-KEY` header)
263- `POST /tasks/assign` - Assigns agents to tasks based on Assigned property matching (requires `X-API-KEY` header)
264- `POST /tasks/test` - Test endpoint for webhook authentication (requires `X-API-KEY` header)
265- `GET /tasks/debug-webhook` - Debug endpoint to check webhook configuration
266366- **Preserves Same-Demo Assignments**: No clearing when reassigning to the same demo
367- **Prevents Multiple Assignments**: Ensures agents are only assigned to one demo at a time
368- **Efficient**: Minimal API calls - only clears when necessary
369- **Reliable**: Handles new agents, existing agents, and reassignments correctly
370396- **Fast Execution**: Blob scanning is faster than database queries
397- **Targeted Processing**: Only processes pages with empty agent arrays
398- **Resource Efficient**: Minimal API calls to Notion
399400**Monitoring Output:**
416### Authentication
417418Webhook endpoints require the `X-API-KEY` header:
419```bash
420curl -X POST https://your-val.web.val.run/tasks/test \
421-H "X-API-KEY: your-secret-key-here"
422```
423437- `GLANCE_INTERACTIONS_DB_ID` - Notion database ID for interactions
438- `GLANCE_AGENTS_DB_ID` - Notion database ID for agents
439- `NOTION_API_KEY` - Notion API key for database access
440- `NOTION_WEBHOOK_SECRET` - Secret key for webhook authentication
441446### **Authorization & Security**
447- **Email-based Access Control**: Viewing analytics are only tracked when the authenticated user's email matches the page's Email property
448- **Frontend Authorization**: Email comparison happens on the frontend before any API calls are made
449- **Zero Unauthorized Calls**: Users without matching emails generate no viewing API requests
450- **Automatic Detection**: System automatically extracts emails from Notion page properties and user authentication
451483### **Viewing Data Flow**
4841. **Authorization Check**: Frontend compares user email with page Email property
4852. **Authorized Users**: Frontend calls `/api/viewing` β Blob updated β **Notion synced immediately**
486- **Session starts** (`null` β `timestamp`): Updates "Session start" and "Viewing start" (first time) properties
487- **Session stops** (`timestamp` β `null`): Clears "Session start" property (preserves "Viewing start")
4893. **User continues viewing**: Frontend updates blob every 4 seconds (no Notion calls)
4904. **User leaves/session stale**: Cron detects stale session β Blob updated β **Notion synced immediately**
4915. **Unauthorized Users**: No API calls made, no viewing analytics tracked
492493### **Notion Property Behavior**
533### **Frontend Integration**
534- **Email Authorization**: Compares authenticated user email with page Email property before tracking
535- **Page Visibility API**: Tracks when users switch tabs or minimize windows
536- **Periodic updates**: Calls viewing API every 4 seconds while page is active (authorized users only)
537- **Session management**: Automatic cleanup handles crashed browsers and network issues
538- **Performance**: Non-blocking API calls don't impact user experience, zero calls for unauthorized users
blob_adminmain.tsx1 match
20// For backwards-compatibility with the old blob-admin
21// TODO - test that more
22app.get("/api/public/:key", (c) => {
23return blob.get("__public/" + c.req.param("key"));
24});
blob_adminREADME.md1 match
12[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
1314It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
1516# TODO
5<meta charset="UTF-8">
6<meta name="viewport" content="width=device-width, initial-scale=1.0">
7<title>NVIDIA API Client</title>
8<style>
9body {
121}
122
123.api-key-group {
124background: #fff3cd;
125border: 1px solid #ffeaa7;
129}
130
131.api-key-group label {
132color: #856404;
133}
137<div class="container">
138<div class="form-panel">
139<h1>NVIDIA API Client</h1>
140
141<form id="apiForm">
142<div class="api-key-group">
143<div class="form-group">
144<label for="apiKey">API Key:</label>
145<input type="password" id="apiKey" name="apiKey" placeholder="Enter your NVIDIA API key">
146</div>
147</div>
205<h2>Response</h2>
206<div id="responseContent" class="response-content">
207Click "Send Request" to see the API response here.
208</div>
209</div>
231// Load saved values
232function loadSavedValues() {
233// Load API key from cookie
234const savedApiKey = getCookie('nvidia_api_key');
235if (savedApiKey) {
236document.getElementById('apiKey').value = savedApiKey;
237}
238262// Save current form values
263function saveCurrentValues() {
264const form = document.getElementById('apiForm');
265const formData = new FormData(form);
266const params = {};
267
268// Save API key to cookie
269const apiKey = formData.get('apiKey');
270if (apiKey) {
271setCookie('nvidia_api_key', apiKey);
272}
273274// Save other parameters to localStorage
275for (const [key, value] of formData.entries()) {
276if (key !== 'apiKey') {
277if (key === 'messages') {
278try {
297}
298299// Make API request
300async function makeApiRequest(requestData, apiKey) {
301const response = await fetch('https://integrate.api.nvidia.com/v1/chat/completions', {
302method: 'POST',
303headers: {
304'Authorization': \`Bearer \${apiKey}\`,
305'Accept': 'application/json',
306'Content-Type': 'application/json'
366367// Form submission handler
368document.getElementById('apiForm').addEventListener('submit', async (e) => {
369e.preventDefault();
370
383// Get form data
384const formData = new FormData(e.target);
385const apiKey = formData.get('apiKey');
386
387if (!apiKey) {
388throw new Error('API Key is required');
389}
390
405saveCurrentValues();
406
407// Make API request
408const response = await makeApiRequest(requestData, apiKey);
409
410// Handle response based on streaming
untitled-7971main.ts1 match
1// Learn more: https://docs.val.town/vals/http/
2const BASE_URL = "https://api.longcat.chat/openai";
34export default async function (req: Request): Promise<Response> {
mcp-registrymain.tsx11 matches
421</div>
422<p style="text-align: start; text-wrap: balance; max-width: 65ch;">
423An open catalog and API for publicly available MCP servers to improve
424discoverability and implementation. This is{" "}
425<a href="https://www.val.town/x/cameronpak/mcp-registry">
427</a>{" "}
428and also serves as a proxy server for the{" "}
429<a href="/docs" target="_blank">MCP Registry API</a>
430</p>
431<wa-button
478<wa-callout variant="neutral">
479<wa-icon slot="icon" name="gear"></wa-icon>
480<strong>The MCP Registry API is down</strong>
481<br />
482I am really sorry about the downtime and will improve caching when the
483official MCP Registry's API resumes. Check back in later.
484</wa-callout>
485<p style="margin-top: 1rem;">
486I imagine the registry API was either spammed or couldn't scale fast
487enough. Not sure and I cannot speak on behalf of MCP. Please pray for
488those working to bring it back up.
520);
521522// Main route with full API support
523app.get("/", async (c) => {
524try {
525const cursor = c.req.query("cursor");
526const limit = parseInt(c.req.query("limit") || "30"); // API default is 30
527const search = c.req.query("search");
528const updatedSince = c.req.query("updated_since");
530const type = c.req.query("type");
531532// Build query parameters according to API spec
533const queryParams: any = {
534limit: Math.min(Math.max(limit, 1), 100), // API requires: β₯1 β€100
535};
536597});
598599// API route for server details (JSON)
600app.get("/api/servers/:id", async (c) => {
601try {
602const serverId = c.req.param("id");
Letterboxd_Blueskymain.ts3 matches
67import Parser from "https://esm.sh/rss-parser@3.13.0";
8import { BskyAgent } from "https://esm.sh/@atproto/api@0.13.17";
910const RSS_URL = "https://letterboxd.com/petezarustica/rss/";
56// 4) Deduplicate by checking your recent posts for the same link
57// (avoids needing KV on Val Town)
58const feedResp = await agent.api.app.bsky.feed.getAuthorFeed({
59actor: did,
60limit: 30,
77};
7879await agent.api.com.atproto.repo.createRecord({
80repo: did,
81collection: "app.bsky.feed.post",
NowPlayingGrabbermain.tsx2 matches
2import querystring from "npm:querystring";
34const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-playing";
5const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";
67const client_id = Deno.env.get("spotify_client_id");