mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
Optimize url-preview image (#4216)
This commit is contained in:
parent
af57b723a9
commit
95bbb190a6
1 changed files with 3 additions and 3 deletions
|
@ -33,8 +33,8 @@ module.exports = async (ctx: Koa.BaseContext) => {
|
||||||
|
|
||||||
function wrap(url: string): string {
|
function wrap(url: string): string {
|
||||||
return url != null
|
return url != null
|
||||||
? url.startsWith('https://') || url.startsWith('data:')
|
? url.match(/^https?:\/\//)
|
||||||
? url
|
? `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, '').replace(/^https:\/\//, 'ssl:'))}&w=200&h=200`
|
||||||
: `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}`
|
: url
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue