AlwaysHereindex.ts2 matches
33});
3435// ✅ Export fetch handler
36export default app.fetch;
AlwaysHeregoogleOAuth.ts3 matches
1516// Exchange code for tokens
17const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
18method: "POST",
19headers: { "Content-Type": "application/x-www-form-urlencoded" },
29const { access_token, id_token } = await tokenResponse.json();
3031// Fetch user info
32const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
33headers: { Authorization: `Bearer ${access_token}` },
34});
AlwaysHererecordings.ts1 match
21});
2223// 🎙️ GET /api/recordings?uid={uid} - Fetch user recordings
24recordings.get("/", async (c) => {
25const uid = c.req.query("uid");
AlwaysHerefriends.ts1 match
28});
2930// ✅ Fetch a user's friends list
31friends.get("/", async (c) => {
32const uid = c.req.query("uid");
AlwaysHerechat.ts1 match
26});
2728// 📜 Fetch chat history for a user
29chat.get("/history", async (c) => {
30try {
frontierScannersite.http.tsx1 match
9394useEffect(() => {
95fetch(API_URL)
96.then((response) => response.json())
97.then((data) => {
forky_1742582577934App.tsx1 match
25}
2627const response = await fetch(`/fork?url=${encodeURIComponent(projectUrl)}`, {
28method: "POST",
29headers: {
forky_1742582577934index.ts2 matches
232});
233234// HTTP vals expect an exported "fetch handler"
235// This is how you "run the server" in Val Town with Hono
236export default app.fetch;
import_from_githubindex.ts15 matches
6263// Get all files from GitHub repo
64console.log("Fetching files from GitHub");
65try {
66const files = await fetchGitHubRepoContents(owner, repo);
67console.log("Files fetched:", files.length);
6869// Create files in Val.town project
122}
123124// Fetch all files and their content from a GitHub repository
125async function fetchGitHubRepoContents(owner: string, repo: string, path: string = "") {
126const files: Array<{
127path: string;
134// GitHub API URL for repo contents
135const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
136console.log(`Fetching from: ${apiUrl}`);
137138const response = await fetch(apiUrl, {
139headers: {
140"Accept": "application/vnd.github.v3+json",
154for (const item of items) {
155if (item.type === "file") {
156// Fetch file content
157let content;
158if (item.download_url) {
159const contentResponse = await fetch(item.download_url);
160if (contentResponse.ok) {
161content = await contentResponse.text();
162} else {
163console.error(`Failed to fetch content for ${item.path}: ${contentResponse.status}`);
164content = "";
165}
178});
179} else if (item.type === "dir") {
180// Recursively fetch contents of subdirectories
181const subFiles = await fetchGitHubRepoContents(owner, repo, item.path);
182files.push(...subFiles);
183}
186return files;
187} catch (error) {
188console.error(`Error fetching GitHub contents for ${owner}/${repo}/${path}:`, error);
189throw error;
190}
388});
389390// HTTP vals expect an exported "fetch handler"
391// This is how you "run the server" in Val Town with Hono
392export default app.fetch;
forky_1742579787862App.tsx1 match
25}
2627const response = await fetch(`/fork?url=${encodeURIComponent(projectUrl)}`, {
28method: "POST",
29headers: {