eink-frame-remixapod.ts1 match
8service_version: string;
9title: string;
10url: string; // image to display
11};
12
pondiversemain3 matches
2import deleteCreation from "./deleteCreation";
3import getCreation from "./getCreation";
4import getCreationImage from "./getCreationImage";
5import getCreations from "./getCreations";
6import updateTable from "./updateTable";
14case "/get-creation":
15return getCreation(req);
16case "/get-creation-image":
17return getCreationImage(req);
18case "/get-creations":
19return getCreations(req);
pondiversegetCreations2 matches
12// Iterate through each one and delete it's blob
13for (const row of res.rows) {
14blob.delete("pondiverse_image" + row.id);
15}
1653// for (let creation of response.rows) {
54// creation.url = `https://pondiverse.val.run/get-creation?id=${creation.id}`;
55// creation.image = `https://pondiverse.val.run/get-creation-image?id=${creation.id}`;
56// }
57
pondiversegetCreationImage1 match
9let response;
10try {
11response = await blob.get("pondiverse_image" + id);
12} catch (e) {
13return new Response(null, { status: 404 });
pondiversegetCreation1 match
14// This makes forking harder sorry
15// creation.uri = `https://pondiverse.val.run/get-creation?id=${creation.id}`;
16// creation.image = `https://pondiverse.val.run/get-creation-image?id=${creation.id}`;
17return Response.json(creation);
18}
pondiversedeleteCreation1 match
4041// Also delete the blob!
42blob.delete("pondiverse_image" + id);
4344return Response.json({ ok: true });
stevensDemoREADME.md1 match
3It's common to have code and types that are needed on both the frontend and the backend. It's important that you write this code in a particularly defensive way because it's limited by what both environments support:
45
67For example, you *cannot* use the `Deno` keyword. For imports, you can't use `npm:` specifiers, so we reccomend `https://esm.sh` because it works on the server & client. You *can* use TypeScript because that is transpiled in `/backend/index.ts` for the frontend. Most code that works on the frontend tends to work in Deno, because Deno is designed to support "web-standards", but there are definitely edge cases to look out for.
stevensDemoREADME.md1 match
21## `favicon.svg`
2223As of this writing Val Town only supports text files, which is why the favicon is an SVG and not an .ico or any other binary image format. If you need binary file storage, check out [Blob Storage](https://docs.val.town/std/blob/).
2425## `components/`
stevensDemoindex.ts15 matches
73});
7475// --- Blob Image Serving Routes ---
7677// GET /api/images/:filename - Serve images from blob storage
78app.get("/api/images/:filename", async (c) => {
79const filename = c.req.param("filename");
8081try {
82// Get image data from blob storage
83const imageData = await blob.get(filename);
8485if (!imageData) {
86return c.json({ error: "Image not found" }, 404);
87}
8890let contentType = "application/octet-stream"; // Default
91if (filename.endsWith(".jpg") || filename.endsWith(".jpeg")) {
92contentType = "image/jpeg";
93} else if (filename.endsWith(".png")) {
94contentType = "image/png";
95} else if (filename.endsWith(".gif")) {
96contentType = "image/gif";
97} else if (filename.endsWith(".svg")) {
98contentType = "image/svg+xml";
99}
100101// Return the image with appropriate headers
102return new Response(imageData, {
103headers: {
104"Content-Type": contentType,
107});
108} catch (error) {
109console.error(`Error serving image ${filename}:`, error);
110return c.json(
111{ error: "Failed to load image", details: error.message },
112500,
113);
stevensDemoindex.html3 matches
10href="/public/favicon.svg"
11sizes="any"
12type="image/svg+xml"
13/>
14<link rel="preconnect" href="https://fonts.googleapis.com" />
36height: 100%;
37font-family: "Pixelify Sans", sans-serif;
38image-rendering: pixelated;
39}
40body::before {
50/* For pixel art aesthetic */
51* {
52image-rendering: pixelated;
53}
54</style>