stevensDemoassets.ts6 matches
2// Background
3BACKGROUND:
4"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/8b501664-722e-4be8-cf71-83aab7756e00/public",
56// Stevens
7STEVENS_FRONT:
8"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/8b8432bb-add2-44ad-bb12-44b8ea215500/public",
9STEVENS_BACK:
10"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/e28da8ab-7710-4b82-8e32-8fdf65c2ed00/public",
11STEVENS_WALKING:
12"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/bd7b9997-09b2-4b35-6eb9-9975a85bb700/public",
1314// Mailman
15MAILMAN_STANDING:
16"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/20a6493d-cc31-475e-aa83-ac97d317e400/public",
17MAILMAN_WALKING:
18"https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/61604576-8a83-4d85-d5e4-8e8e26641700/public",
19};
20
stevensDemoApp.tsx25 matches
82const [cookieAndTeaMode, setCookieAndTeaMode] = useState(false);
8384// Fetch images from backend instead of blob storage directly
85useEffect(() => {
86// Set default background color in case image doesn't load
87if (document.body) {
88document.body.style.backgroundColor = "#2D1700"; // Dark brown leather color
89}
9091// Fetch avatar image
92fetch("/api/images/stevens.jpg")
93.then((response) => {
94if (response.ok) return response.blob();
95throw new Error("Failed to load avatar image");
96})
97.then((imageBlob) => {
98const url = URL.createObjectURL(imageBlob);
99setAvatarUrl(url);
100})
104105// Fetch wood background
106fetch("/api/images/wood.jpg")
107.then((response) => {
108if (response.ok) return response.blob();
109throw new Error("Failed to load wood background");
110})
111.then((imageBlob) => {
112const url = URL.createObjectURL(imageBlob);
113setWoodUrl(url);
114115// Apply wood background to body
116if (document.body) {
117document.body.style.backgroundImage = `url(${url})`;
118}
119})
362return {
363position: SCENE_ELEMENTS.DESK_SITTING,
364image: ASSETS.STEVENS_FRONT,
365highlightElement: SCENE_ELEMENTS.DESK,
366animationClass: "no-animation",
372return {
373position: SCENE_ELEMENTS.DESK_SITTING,
374image: ASSETS.STEVENS_FRONT,
375highlightElement: null,
376animationClass: "no-animation",
387y: SCENE_ELEMENTS.MAILBOX.y - 20,
388},
389image: ASSETS.STEVENS_BACK,
390highlightElement: SCENE_ELEMENTS.MAILBOX,
391animationClass: "walk-to-mailbox",
398y: SCENE_ELEMENTS.CALENDAR.y + 30,
399},
400image: ASSETS.STEVENS_BACK,
401highlightElement: SCENE_ELEMENTS.CALENDAR,
402animationClass: "walk-to-calendar",
409y: SCENE_ELEMENTS.TELEGRAM.y + 10,
410},
411image: ASSETS.STEVENS_BACK,
412highlightElement: SCENE_ELEMENTS.TELEGRAM,
413animationClass: "walk-to-telegram",
417return {
418position: SCENE_ELEMENTS.OUTSIDE,
419image: ASSETS.STEVENS_FRONT,
420highlightElement: null,
421animationClass: "walk-to-outside",
425return {
426position: SCENE_ELEMENTS.DESK_SITTING,
427image: ASSETS.STEVENS_FRONT,
428highlightElement: SCENE_ELEMENTS.DESK,
429animationClass: "walk-to-desk",
623box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.4),
6240 3px 8px rgba(0, 0, 0, 0.5);
625image-rendering: pixelated;
626cursor: pointer;
627transition: transform 0.2s;
634.notebook-pages {
635background-color: #f8f1e0;
636background-image: linear-gradient(#d6c6a5 1px, transparent 1px);
637background-size: 100% 16px;
638box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
639image-rendering: pixelated;
640}
641652653.pixel-character {
654image-rendering: pixelated;
655position: absolute;
656transition: left 0.7s ease-in-out, top 0.7s ease-in-out;
763className="w-[512px] h-[512px] mx-auto relative"
764style={{
765backgroundImage: `url(${ASSETS.BACKGROUND})`,
766backgroundSize: "cover",
767backgroundPosition: "center",
768imageRendering: "pixelated",
769}}
770>
799{/* Stevens character */}
800<img
801src={stevensState.image}
802alt="Stevens"
803className={`pixel-character ${
spagindex.html30 matches
17<br />
1819Replace <code>name</code> with the name you gave the image.
20</p>
2199<audio controls style="display: none" id="preview-audio"></audio>
100</div>
101<input type="file" id="file" accept="audio/*, image/*" required />
102</label>
103<label for="singing">
138const nameInput = document.getElementById("name");
139const fileInput = document.getElementById("file");
140const previewImage = document.getElementById("preview");
141const previewAudio = document.getElementById("preview-audio");
142const uploadButton = document.getElementById("upload-button");
153reader.onload = () => {
154const dataUrl = reader.result;
155previewImage.src = dataUrl; // the form just grabs whatever is here and uploads this, which may even be audio
156previewAudio.src = dataUrl;
157};
166});
167168previewImage.addEventListener("load", () => {
169previewImage.style.display = "block";
170});
171174});
175176previewImage.addEventListener("error", () => {
177previewImage.style.display = "none";
178});
179226event.preventDefault();
227const name = encodeURIComponent(nameInput.value);
228const dataUrl = previewImage.src;
229const body = JSON.stringify({ name, dataUrl });
230uploadButton.disabled = true;
238nameInput.value = "";
239fileInput.value = "";
240previewImage.src = "";
241previewAudio.src = "";
242} else {
320321const contentType = response.headers.get("content-type");
322if (contentType.startsWith("image")) {
323const imageElement = document.createElement("img");
324imageElement.loading = "lazy";
325imageElement.style.width = "100%";
326imageElement.style.objectFit = "contain";
327imageElement.style.height = "300px";
328// src the response
329const blob = await response.blob();
330imageElement.src = URL.createObjectURL(blob);
331imageElement.onerror = () => {
332imageElement.remove();
333};
334previewContainer.appendChild(imageElement);
335} else if (contentType.startsWith("audio")) {
336const audioElement = document.createElement("audio");
368});
369370// const imageElement = document.createElement("img");
371// imageElement.loading = "lazy";
372// imageElement.src = `https://tode.party?${upload.name}`;
373// imageElement.style.width = "100%";
374// imageElement.style.objectFit = "contain";
375// imageElement.style.border = "1px solid rgb(159, 174, 238)";
376// imageElement.style.backgroundColor = "rgb(55, 67, 98)";
377// imageElement.style.height = "300px";
378// imageElement.onerror = () => {
379// imageElement.remove();
380// };
381
eink-frameindex.tsx9 matches
4import { Header } from "./components.tsx";
5import hemolog from "./frames/hemolog.tsx";
6import generateImageFromHtml from "./generateImageFromHtml.ts";
78export default async function(req: Request) {
9const url = new URL(req.url);
10const isImageRequest = url.searchParams.get("generate") === "image";
11const isListRequest = url.searchParams.get("generate") === "list";
12const frameId = url.searchParams.get("frame");
69}
7071// get ?&generate=image&frame=S0mth1ingKrAzy
72if (frameId && !frame_list.includes(frameId)) {
73const html = renderToString(
85const generateUrl = frames[frameId as keyof typeof frames];
8687// get ?&generate=image&frame=weather
88if (isImageRequest) {
89const width = 800;
90const height = 480;
9192const imageResponse = await generateImageFromHtml(generateUrl, width, height);
93return new Response(imageResponse.body, {
94status: imageResponse.status,
95headers: {
96"Content-Type": "image/png",
97},
98});
eink-framegenerateImageFromHtml.ts4 matches
2// API key required
34// TODO: Add caching of image
5export default async function generateImageFromHtml(
6valUrl: string,
7width: number = 800,
13const apiKey = Deno.env.get("API_FLASH_KEY");
14const generateUrl =
15`https://api.apiflash.com/v1/urltoimage?access_key=${apiKey}&url=${valUrl}&width=${width}&height=${height}&format=png&fresh=true`;
1617try {
22return response;
23} catch (error) {
24return new Response("Failed to generate image", { status: 500 });
25}
26}
eink-frameapod.ts1 match
8service_version: string;
9title: string;
10url: string; // image to display
11};
12
SampleTwitterAlertREADME.md3 matches
9## Example
10This val tracks mentions of "Val Town" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.
11<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/85912106-f625-443e-5321-6e2699453200/public" width="500"/>
12To see exactly how we use this template at Val Town: https://www.val.town/x/stevekrouse/twitterAlert
1316### 1. Fork this Val
17To use this template, fork this val on the top right corner of this page.
18
1920### 2. View Source Code
21<em>The `CODE` box shows you the the full source code of this val, you may need to scroll down to see it.</em>
22
2324### 3. Customize Query
templateTwitterAlertREADME.md3 matches
9## Example
10This val tracks mentions of "Val Town" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.
11<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/85912106-f625-443e-5321-6e2699453200/public" width="500"/>
12To see exactly how we use this template at Val Town: https://www.val.town/x/stevekrouse/twitterAlert
1316### 1. Fork this Val
17To use this template, fork this val on the top right corner of this page.
18
1920### 2. View Source Code
21<em>The `CODE` box shows you the the full source code of this val, you may need to scroll down to see it.</em>
22
2324### 3. Customize Query
templateTwitterAlertREADME.md3 matches
9## Example
10This val tracks mentions of "Val Town" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.
11<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/85912106-f625-443e-5321-6e2699453200/public" width="500"/>
12To see exactly how we use this template at Val Town: https://www.val.town/x/stevekrouse/twitterAlert
1316### 1. Fork this Val
17To use this template, fork this val on the top right corner of this page.
18
1920### 2. View Source Code
21<em>The `CODE` box shows you the the full source code of this val, you may need to scroll down to see it.</em>
22
2324### 3. Customize Query
Townieuser-summary.ts2 matches
18SUM(cache_write_tokens) as total_cache_write_tokens,
19SUM(price) as total_price,
20SUM(num_images) as total_images
21FROM ${USAGE_TABLE}
22WHERE our_api_token = 1
101total_cache_write_tokens: userData.cache_write_tokens,
102total_price: userData.price,
103total_images: 0,
104used_inference_data: true
105});