newsnow/server/api/proxy/img.png.ts

15 lines
433 B
TypeScript
Raw Normal View History

2024-10-25 18:00:37 +08:00
export default defineEventHandler(async (event) => {
2024-10-31 14:21:11 +08:00
const img = getQuery(event).url
2024-10-25 18:00:37 +08:00
if (img) {
2024-10-31 14:21:11 +08:00
const url = decodeBase64URL(img as string)
2024-10-25 18:00:37 +08:00
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": "*",
},
})
}
})