simple list of pds servers with open registration
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354/** * One-time script to upload local assets to Val Town blob storage. * Run with: deno run --allow-read --allow-net --allow-env --allow-import scripts/upload-assets.ts * * Requires VT_API_KEY env var or uses `vt config get apiKey` output. */
const API_BASE = "https://api.val.town/v1/blob";
async function getApiKey(): Promise<string> { const env = Deno.env.get("VT_API_KEY") || Deno.env.get("valtown"); if (env) return env;
// Fall back to vt CLI config const cmd = new Deno.Command("vt", { args: ["config", "get", "apiKey"] }); const output = await cmd.output(); const text = new TextDecoder().decode(output.stdout); const match = text.match(/apiKey:\s*(\S+)/); if (match) return match[1]; throw new Error("No API key found. Set VT_API_KEY env var.");}
const apiKey = await getApiKey();const ASSETS_DIR = new URL("../assets/", import.meta.url).pathname;
const files = [ "openpds-transparent.png", "openpds.png",];
for (const file of files) { const path = `${ASSETS_DIR}${file}`; const data = await Deno.readFile(path); const key = `assets/${file}`;
const resp = await fetch(`${API_BASE}/${encodeURIComponent(key)}`, { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, }, body: data, });
if (!resp.ok) { const body = await resp.text(); console.error(`Failed to upload ${file}: ${resp.status} ${body}`); Deno.exit(1); }
console.log(`Uploaded ${file} → blob:${key} (${data.length} bytes)`);}
console.log("Done!");