Forked from pomdtr/blog
Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import findIdeaLists from "https://esm.town/v/nbbaier/findIdeaLists";
import { ideaList } from "https://esm.town/v/nbbaier/ideaList";
import { api } from "https://esm.town/v/pomdtr/api";
import { extractMetadata } from "https://esm.town/v/pomdtr/extractMetadata";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { gfm } from "https://esm.town/v/pomdtr/gfm";
import { html } from "https://esm.town/v/stevekrouse/html?v=5";
import { Hono } from "npm:hono";
const app = new Hono();
const homepage = extractValInfo(import.meta.url);
const ideaLists = (await findIdeaLists()).map(val => {
const valName = val.name;
const author = val.author.username.replace("@", "");
const title = extractMetadata("title", val.code);
return { valName, author, title };
});
app.get("/", async c => {
const items = ideaLists.map(val => {
const { valName, author, title } = val;
return `- [${title}](/ideas/${author}.${valName}) by [${author}](https://www.val.town/u/${author})`;
});
const reservedVals = ideaLists.map(val => {
const { valName, author, title } = val;
return `[\`${valName}\`](https://www.val.town/v/${author}/${valName})`;
});
const markdown = `# Val Town Idea Aggregator
This val serves as an aggegrator for personal lists of ideas people have for what they
want to build on val town (or anything else having to do with Val Town, I suppose).
## Ideas
${items.join("\n")}
## Starting your own list
To create your own collection and add to this list, do the following:
1. Fork [this template val](https://www.val.town/v/nbbaier/vtIdeasTemplate)
2. Add the following metadata to the top of your freshly forked val's code
\`\`\`
// @vtIdeas
// @title <insert a nice title>
\`\`\`
3. Change your new val's name (see the list below for names already in use)
4. Add your ideas to the readme!
**Note:** Make your val public when you're ready for it to be listed here.
### Reserved Val Names
The following val names are already in use, and therefore should **not** be used: ${reservedVals.join(", ")}
## Feature Wish List
Here's some stuff that could be added to this site (sure there's a lot more!). Feel free to help if you can!
- Pull in the actual lists of ideas from the various aggregated readmes and collect them in a (sortable?) table
- A community list of val ideas, submittable to by form
`;
return c.html(await gfm(markdown, { title: "Val Town Idea Aggregator" }));
});
app.get("/ideas/:name", async (c) => {
const name = c.req.param("name");
return c.html(await ideaList(name.split(".")[0], name.split(".")[1]));
});
app.get("/ideas/:name/edit", async (c) => {
const name = c.req.param("name");
const editURL = `https://val.town/v/${name.split(".")[0]}/${name.split(".")[1]}`;
return c.redirect(editURL);
});
export const blog = app.fetch;