mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 19:29:17 +08:00
15 lines
535 B
TypeScript
15 lines
535 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const { url: img, type = "encodeURIComponent" } = getQuery(event)
|
|
if (img) {
|
|
const url = type === "encodeURIComponent" ? decodeURIComponent(img as string) : decodeBase64URL(img as string)
|
|
return sendProxy(event, url, {
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Credentials": "*",
|
|
"Access-Control-Allow-Methods": "GET, HEAD, POST, PUT, OPTIONS",
|
|
"Access-Control-Allow-Headers": "*",
|
|
},
|
|
})
|
|
}
|
|
})
|