A fast, local-first "redirection engine" for !bang users with a few extra features ^-^
1import rawBangs from "./bangs.json" with { type: "json" };
2
3// Developer script that converts ./bang.ts' array to hashmap.
4
5const hashbang: {
6 [key: string]: {
7 c?: string;
8 d: string;
9 r: number;
10 s: string;
11 sc?: string;
12 t: string;
13 u: string;
14 };
15} = {
16 t3: {
17 c: "AI",
18 d: "www.t3.chat",
19 r: 0,
20 s: "T3 Chat",
21 sc: "AI",
22 t: "t3",
23 u: "https://www.t3.chat/new?q={{{s}}}",
24 },
25 m2: {
26 c: "Online Services",
27 d: "meta.dunkirk.sh",
28 r: 0,
29 s: "metasearch2",
30 sc: "Search",
31 t: "m2",
32 u: "https://meta.dunkirk.sh/search?q={{{s}}}",
33 },
34 tiktok: {
35 c: "Multimedia",
36 sc: "Video",
37 d: "www.tiktok.com",
38 r: 0,
39 s: "TikTok",
40 t: "tiktok",
41 u: "https://www.tiktok.com/search?q={{{s}}}",
42 },
43};
44for (const bang of rawBangs) {
45 hashbang[bang.t] = bang;
46}
47
48Bun.write(
49 "./src/hashbang.ts",
50 `export const bangs: {[key: string]: ({c?:string, d: string, r: number, s:string, sc?: string, t: string, u: string })} = ${JSON.stringify(hashbang)};`,
51);