forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
22 lines (18 loc) · 736 Bytes
/
Copy pathindex.ts
File metadata and controls
22 lines (18 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// src/lib/image-hosting/index.ts
//
// Functions: getImageHostAdapter
import { imgbbAdapter } from "@/lib/image-hosting/imgbb"
import { onlyimageAdapter } from "@/lib/image-hosting/onlyimage"
import { ptpimgAdapter } from "@/lib/image-hosting/ptpimg"
import type { ImageHostAdapter, ImageHostId } from "@/lib/image-hosting/types"
const adapters: Record<ImageHostId, ImageHostAdapter> = {
ptpimg: ptpimgAdapter,
onlyimage: onlyimageAdapter,
imgbb: imgbbAdapter,
}
export function getImageHostAdapter(host: ImageHostId): ImageHostAdapter {
const adapter = adapters[host]
if (!adapter) throw new Error(`Unknown image host: ${host}`)
return adapter
}
export type { ImageHostId, UploadOptions, UploadResult } from "./types"