mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-01 00:08:24 +09:00
Optimize url-preview image (#4216)
This commit is contained in:
parent
f5b928a537
commit
62d17c9266
@ -33,8 +33,8 @@ module.exports = async (ctx: Koa.BaseContext) => {
|
||||
|
||||
function wrap(url: string): string {
|
||||
return url != null
|
||||
? url.startsWith('https://') || url.startsWith('data:')
|
||||
? url
|
||||
: `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}`
|
||||
? url.match(/^https?:\/\//)
|
||||
? `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, '').replace(/^https:\/\//, 'ssl:'))}&w=200&h=200`
|
||||
: url
|
||||
: null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user