mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
feat(server): proxy icon
This commit is contained in:
parent
7d6ebbb669
commit
7cdfb2ea9d
14
server/api/proxy.ts
Normal file
14
server/api/proxy.ts
Normal file
@ -0,0 +1,14 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const img = getQuery(event).img
|
||||
if (img) {
|
||||
const url = decodeURIComponent(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": "*",
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
@ -36,7 +36,7 @@ export default defineSource(async () => {
|
||||
id: k.num,
|
||||
title: k.word,
|
||||
extra: {
|
||||
icon: k.icon,
|
||||
icon: k.icon && `/api/proxy?img=${encodeURIComponent(k.icon)}`,
|
||||
},
|
||||
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(keyword)}`,
|
||||
mobileUrl: `https://m.weibo.cn/search?containerid=231522type%3D1%26q%3D${encodeURIComponent(keyword)}&_T_WM=16922097837&v_p=42`,
|
||||
|
@ -30,7 +30,7 @@ export default defineSource({
|
||||
id: k.target.id,
|
||||
title: k.target.title,
|
||||
extra: {
|
||||
icon: k.card_label?.night_icon,
|
||||
icon: k.card_label?.night_icon && `/api/proxy?img=${encodeURIComponent(k.card_label?.night_icon)}`,
|
||||
},
|
||||
url: `https://www.zhihu.com/question/${k.target.id}`,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user