1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import type * as popcorn from "https://esm.town/v/pomdtr/popcorn_types";
import { blob } from "https://esm.town/v/std/blob?v=12";
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/", (c) => {
const list: popcorn.List = [];
list.push({
title: "List Blobs",
icon: "BeakerIcon",
actions: [{
title: "List Blobs",
type: "push",
page: "/blobs",
}],
});
return c.json(list);
});
const { htmlUrl } = extractValInfo(import.meta.url);
app.get("/blobs", async (c) => {
const blobs = await blob.list();
const list: popcorn.List = blobs.map(b => ({
title: b.key,
actions: [{
title: "Copy Key",
type: "copy",
text: b.key,
}],
}));
return c.json(list);
});
export default app.fetch;