mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
feat: better image proxy
This commit is contained in:
parent
ac4a7e5d20
commit
d5053d1bcb
@ -22,7 +22,7 @@ export default defineSource(async () => {
|
|||||||
title: k.Title,
|
title: k.Title,
|
||||||
url: `https://www.toutiao.com/trending/${k.ClusterIdStr}/`,
|
url: `https://www.toutiao.com/trending/${k.ClusterIdStr}/`,
|
||||||
extra: {
|
extra: {
|
||||||
icon: k.LabelUri?.url && proxyPicture(k.LabelUri.url),
|
icon: k.LabelUri?.url && proxyPicture(k.LabelUri.url, "encodeBase64URL"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
export function proxyPicture(url: string) {
|
export function proxyPicture(url: string, type: "encodeURIComponent" | "encodeBase64URL" = "encodeURIComponent") {
|
||||||
return `/api/proxy/img.png?url=${encodeBase64URL(url)}`
|
const encoded = type === "encodeBase64URL" ? encodeBase64URL(url) : encodeURIComponent(url)
|
||||||
|
return `/api/proxy/img.png?url=${encoded}`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user