glifInventorymain.tsx1 match
371<h1>🎒 Inventory Management System</h1>
372
373<h2>API Routes</h2>
374
375<h3 class="route">GET /inventory</h3>
blob_adminmain.tsx25 matches
73const menuRef = useRef(null);
74const isPublic = blob.key.startsWith("__public/");
75const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
7677useEffect(() => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
557onClick={() =>
558copyToClipboard(
559`${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560)}
561className="text-blue-400 hover:text-blue-300 text-sm"
580>
581<img
582src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583alt="Blob content"
584className="max-w-full h-auto"
660661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663const key = `__public/${c.req.param("id")}`;
664const { blob } = await import("https://esm.town/v/std/blob");
765};
766767app.get("/api/blobs", checkAuth, async (c) => {
768const prefix = c.req.query("prefix") || "";
769const limit = parseInt(c.req.query("limit") || "20", 10);
774});
775776app.get("/api/blob", checkAuth, async (c) => {
777const key = c.req.query("key");
778if (!key) return c.text("Missing key parameter", 400);
782});
783784app.put("/api/blob", checkAuth, async (c) => {
785const key = c.req.query("key");
786if (!key) return c.text("Missing key parameter", 400);
791});
792793app.delete("/api/blob", checkAuth, async (c) => {
794const key = c.req.query("key");
795if (!key) return c.text("Missing key parameter", 400);
799});
800801app.post("/api/blob", checkAuth, async (c) => {
802const { file, key } = await c.req.parseBody();
803if (!file || !key) return c.text("Missing file or key", 400);
zanySalmonPorpoisemain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
blob_adminmain.tsx25 matches
73const menuRef = useRef(null);
74const isPublic = blob.key.startsWith("__public/");
75const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
7677useEffect(() => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
557onClick={() =>
558copyToClipboard(
559`${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560)}
561className="text-blue-400 hover:text-blue-300 text-sm"
580>
581<img
582src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583alt="Blob content"
584className="max-w-full h-auto"
660661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663const key = `__public/${c.req.param("id")}`;
664const { blob } = await import("https://esm.town/v/std/blob");
765};
766767app.get("/api/blobs", checkAuth, async (c) => {
768const prefix = c.req.query("prefix") || "";
769const limit = parseInt(c.req.query("limit") || "20", 10);
774});
775776app.get("/api/blob", checkAuth, async (c) => {
777const key = c.req.query("key");
778if (!key) return c.text("Missing key parameter", 400);
782});
783784app.put("/api/blob", checkAuth, async (c) => {
785const key = c.req.query("key");
786if (!key) return c.text("Missing key parameter", 400);
791});
792793app.delete("/api/blob", checkAuth, async (c) => {
794const key = c.req.query("key");
795if (!key) return c.text("Missing key parameter", 400);
799});
800801app.post("/api/blob", checkAuth, async (c) => {
802const { file, key } = await c.req.parseBody();
803if (!file || !key) return c.text("Missing file or key", 400);
1Example of an [Enkaku client](https://enkaku.dev/docs/api/client/) using HTTP.
23[Server code Val](https://www.val.town/v/paul_lecam/EnkakuStatefulHTTPExample)
1Example of an [Enkaku server](https://enkaku.dev/docs/api/server/) over HTTP.
23[Client code Val](https://www.val.town/v/paul_lecam/EnkakuStatefulHTTPExampleClient)
3The app is set up so you can easily have a conversation between two people. The app will translate between the two selected languages, in each voice, as the speakers talk.
45Add your OpenAI API Key, and make sure to open in a separate window for Mic to work.
exaltedAmethystAntelopemain.tsx4 matches
67const app = new Hono();
8const openai = new OpenAI(Deno.env.get("OPENAI_API_KEY_VOICE"));
910class TranscriptionService {
19return transcription;
20} catch (error) {
21console.error("OpenAI API error:", error);
22throw error;
23}
423return c.text(translation);
424} catch (error) {
425console.error("OpenAI API error:", error);
426return c.text("Error occurred during translation", 500);
427}
450});
451} catch (error) {
452console.error("OpenAI API error:", error);
453return c.text("Error occurred during speech generation", 500);
454}
translatorREADME.md1 match
3The app is set up so you can easily have a conversation between two people. The app will translate between the two selected languages, in each voice, as the speakers talk.
45Add your OpenAI API Key, and make sure to open in a separate window for Mic to work.
translatormain.tsx4 matches
56const app = new Hono();
7const openai = new OpenAI(Deno.env.get("OPENAI_API_KEY_VOICE"));
89class TranscriptionService {
18return transcription;
19} catch (error) {
20console.error('OpenAI API error:', error);
21throw error;
22}
368return c.text(translation);
369} catch (error) {
370console.error('OpenAI API error:', error);
371return c.text('Error occurred during translation', 500);
372}
395});
396} catch (error) {
397console.error('OpenAI API error:', error);
398return c.text('Error occurred during speech generation', 500);
399}