1import { API_URL } from "https://esm.town/v/std/API_URL";
23export async function fetchAPI(
4path: string,
5options?: RequestInit & {
11if (options?.paginate) {
12const data = [];
13let url = new URL(`${API_URL}${path}`);
14url.searchParams.set("limit", "100");
1542}
4344return fetch(`${API_URL}${path}`, {
45...options,
46headers: {
uploadImagemain.tsx1 match
24}
25async function getUploadURL(): Promise<string> {
26const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27"headers": {
28"content-type": "application/json",
blob_adminREADME.md1 match
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
1011It 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).
1213# TODO
1## 🖼️ text to image playground using [fal.ai](https://fal.ai) model apis
23Migrated from folder: image_gen/textToImagePlayground
sqliteExplorerAppmain.tsx2 matches
26<head>
27<title>SQLite Explorer</title>
28<link rel="preconnect" href="https://fonts.googleapis.com" />
2930<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
31<link
32href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
33rel="stylesheet"
34/>
sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
uploadThruFileIomain.tsx1 match
1// Function to upload data using Wormhole API and return the URL
2async function uploadToFileIo(file) {
3const formData = new FormData();
convertResumemain.tsx12 matches
86}
8788/* API Key Input Styles */
89#apiKeyInput {
90display: none;
91margin-top: 10px;
108<div class="buttons">
109<div class="hosting">
110<input type="text" id="apiKeyInput" placeholder="Enter your Val Town API Key">
111<button id="hostButton">Host Resume on Val Town</button>
112</div>
122event.preventDefault();
123const resumeContent = document.getElementById('resumeContent').value;
124const apiKey = '${Deno.env.get("OPENAI_API_KEY")}';
125const spinner = document.getElementById('spinner');
126const jsonOutput = document.getElementById('jsonOutput');
127const copyButton = document.getElementById('copyButton');
128const hostButton = document.getElementById('hostButton');
129const apiKeyInput = document.getElementById('apiKeyInput');
130131spinner.style.display = 'block';
133copyButton.style.display = 'none';
134hostButton.style.display = 'none';
135apiKeyInput.style.display = 'none';
136
137try {
138const jsonResume = await convertToResumeJSON(resumeContent, apiKey);
139jsonOutput.textContent = JSON.stringify(JSON.parse(jsonResume), null, 2);
140copyButton.style.display = 'block';
141hostButton.style.display = 'block';
142apiKeyInput.style.display = 'block';
143} catch (error) {
144jsonOutput.textContent = 'An error occurred while converting the resume.';
153document.getElementById('hostButton').addEventListener('click', async function() {
154const jsonOutput = document.querySelector('#jsonOutput').innerText;
155const valTownApiKey = document.getElementById('apiKeyInput').value; // Get the Val Town API key from input
156
157if (!valTownApiKey) {
158alert('Please enter your Val Town API Key.');
159return;
160}
161
162try {
163const hostedUrl = await hostResume(JSON.parse(jsonOutput), valTownApiKey);
164alert('Resume hosted at: ' + hostedUrl);
165window.open(hostedUrl, '_blank');
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
1011It 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).
1213# TODO
hostResumemain.tsx5 matches
1export async function hostResume(jsonResume, apiKey) {
2const userDetailsEndpoint = 'https://api.val.town/v1/me/';
3const createValEndpoint = 'https://api.val.town/v1/vals/';
45// get user details
7method: 'GET',
8headers: {
9'Authorization': `Bearer ${apiKey}`
10}
11});
22method: 'POST',
23headers: {
24'Authorization': `Bearer ${apiKey}`,
25'Content-Type': 'application/json'
26},