newsnow/server/utils/proxy.ts

5 lines
269 B
TypeScript
Raw Permalink Normal View History

2024-11-01 19:46:37 +08:00
export function proxyPicture(url: string, type: "encodeURIComponent" | "encodeBase64URL" = "encodeURIComponent") {
const encoded = type === "encodeBase64URL" ? encodeBase64URL(url) : encodeURIComponent(url)
2024-11-01 20:14:11 +08:00
return `/api/proxy/img.png?type=${type}&url=${encoded}`
2024-10-31 14:21:11 +08:00
}