aboutsummaryrefslogtreecommitdiff
path: root/frontend/query.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/query.ts')
-rw-r--r--frontend/query.ts15
1 files changed, 4 insertions, 11 deletions
diff --git a/frontend/query.ts b/frontend/query.ts
index f3c7e07..8a5ec2e 100644
--- a/frontend/query.ts
+++ b/frontend/query.ts
@@ -2,12 +2,6 @@ import { status } from "./ui.ts"
// TODO embed this information into bangs.js
const ENGINE_PINNED: Set<string> = new Set(["ddg", "qw", "qwl", "g"])
-const ENGINE_NAMES: { [key: string]: string } = {
- "ddg": "DuckDuckGo",
- "qw": "Qwant",
- "qwl": "Qwant Lite",
- "g": "Google",
-}
interface Bangs { [key: string]: { url: string, name?: string, pinned?: boolean } | undefined }
export let bangs: Promise<Bangs>;
@@ -17,15 +11,14 @@ export function load_bangs() {
(async () => {
const bangs_res = await fetch("/bangs.json")
if (!bangs_res.ok) return status("error", "could not download bangs.json")
- const k: { [key: string]: string } = await bangs_res.json()
+ const k: Bangs = await bangs_res.json()
status("info", "Bangs loaded.")
r(Object.fromEntries(Object.entries(k).map(
- ([key, url]) => [key, {
- url,
- name: ENGINE_NAMES[key],
+ ([key, o]) => [key, {
+ ...o,
pinned: ENGINE_PINNED.has(key)
}]
- )))
+ )) as Bangs)
})()
})
}