blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Use this button to install the val:
sqliteExplorerAppREADME.md1 match
3View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stevekrouse/sqlite_admin?v=46) val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by [LibSQL Studio](https://github.com/invisal/libsql-studio) by [invisal](https://github.com/invisal). This is now more an SPA, with tables, queries and results showing up on the same page.
45
67## Install
92appName: 'ValPush',
93appIconUrl: '${iconURL}',
94assetUrl: 'https://cdn.jsdelivr.net/gh/philfung/add-to-homescreen@1.9/dist/assets/img/', // Link to directory of library image assets.
95maxModalDisplayCount: -1
96});
3View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stevekrouse/sqlite_admin?v=46) val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by [LibSQL Studio](https://github.com/invisal/libsql-studio) by [invisal](https://github.com/invisal). This is now more an SPA, with tables, queries and results showing up on the same page.
45
67## Install
23- `node-emoji` [github here](https://github.com/omnidan/node-emoji) - replaces all emojis with spans
4- emoji images for replacement are hosted at netlify (sourced from private repo)
1export async function replaceEmojisWithImages(
2req: express.Request,
3res: express.Response,
generateRAdioDjRssmain.tsx2 matches
5export const generateRAdioDjRss = async () => {
6const rssItems = previousDjs.map((dj) => {
7const djImgSrc = `https://r-a-d.io/api/dj-image/${
8encodeURIComponent(
9dj.djimage,
10)
11}`
hiraganaWordBuildermain.tsx18 matches
60const [isComplete, setIsComplete] = useState(false);
61const [inputStatus, setInputStatus] = useState([]);
62const [imageData, setImageData] = useState("");
63const [isLoading, setIsLoading] = useState(false);
64const [isTransitioning, setIsTransitioning] = useState(false);
88};
8990const fetchImage = async (romaji) => {
91setIsLoading(true);
92try {
93const response = await fetch(`/api/image/${romaji}`);
94if (!response.ok) {
95throw new Error("Failed to fetch image");
96}
97const data = await response.json();
98if (data && data.image) {
99const dataUrl = `data:image/png;base64,${data.image}`;
100setImageData(dataUrl);
101} else {
102throw new Error("Invalid image data received");
103}
104} catch (error) {
105console.error("Error fetching image:", error);
106setImageData("");
107} finally {
108setIsLoading(false);
119setInputStatus([]);
120setIsComplete(false);
121fetchImage(newWord.romaji);
122setIsTransitioning(false);
123}, 300);
178</div>
179)
180: imageData
181? <img src={imageData} alt="Vocabulary word" className="w-40 h-40 object-cover rounded-lg shadow-md" />
182: (
183<div className="w-40 h-40 flex items-center justify-center bg-gray-200 rounded-lg">
184<span className="text-gray-500">No image available</span>
185</div>
186)}
264const url = new URL(request.url);
265266if (url.pathname.startsWith("/api/image/")) {
267const romaji = url.pathname.split("/").pop();
268try {
269// This is a placeholder for the actual image retrieval from Val Town blob storage
270// You'll need to implement the actual retrieval logic here
271const vocabularyJson = await blob.getJSON(romaji);
275});
276} catch (error) {
277console.error("Error fetching image:", error);
278return new Response("Image not found", { status: 404 });
279}
280}
getJsonAndRenderAsImagemain.tsx16 matches
56function App() {
7const [imageData, setImageData] = useState<string | null>(null);
8const [error, setError] = useState<string | null>(null);
910useEffect(() => {
11async function fetchImage() {
12try {
13const response = await fetch("/image");
14if (!response.ok) {
15throw new Error(`HTTP error! status: ${response.status}`);
16}
17const data = await response.json();
18if (data && data.image) {
19setImageData(`data:image/png;base64,${data.image}`);
20} else {
21throw new Error("Invalid image data received");
22}
23} catch (error) {
24console.error("Error fetching image:", error);
25setError(error instanceof Error ? error.message : "Error loading image");
26}
27}
28fetchImage();
29}, []);
3031return (
32<div>
33<h1>Image from Blob Storage</h1>
34{imageData
35? (
36<img
37src={imageData}
38alt="Fetched from blob storage"
39style={{ maxWidth: "100%" }}
42: error
43? <p>Error: {error}</p>
44: <p>Loading image...</p>}
45</div>
46);
5657export default async function server(request: Request): Promise<Response> {
58if (request.url.endsWith("/image")) {
59try {
60const jsonData = await blob.getJSON("image-test");
61return new Response(JSON.stringify(jsonData), {
62headers: { "Content-Type": "application/json" },
76<html>
77<head>
78<title>Image from Blob Storage</title>
79<style>${css}</style>
80</head>
getBlobAndRenderAsImagemain.tsx14 matches
56function App() {
7const [imageData, setImageData] = useState<string | null>(null);
8const [error, setError] = useState<string | null>(null);
910useEffect(() => {
11async function fetchImage() {
12try {
13const response = await fetch("/image");
14if (!response.ok) {
15throw new Error(`HTTP error! status: ${response.status}`);
22});
2324setImageData(dataUrl);
25} catch (error) {
26console.error("Error fetching image:", error);
27setError(error instanceof Error ? error.message : "Error loading image");
28}
29}
30fetchImage();
31}, []);
3233return (
34<div>
35<h1>Image from Blob Storage</h1>
36{imageData
37? (
38<img
39src={imageData}
40alt="Fetched from blob storage"
41style={{ maxWidth: "100%" }}
44: error
45? <p>Error: {error}</p>
46: <p>Loading image...</p>}
47</div>
48);
5859export default async function server(request: Request): Promise<Response> {
60if (request.url.endsWith("/image")) {
61try {
62const response = await blob.get("test.png");
6364return new Response(response.body, {
65headers: { "Content-Type": "image/png" },
66});
67} catch (error) {
79<html>
80<head>
81<title>Image from Blob Storage</title>
82<style>${css}</style>
83</head>