Skip to content
Snippets Groups Projects
Commit 62d17c92 authored by MeiMei's avatar MeiMei Committed by Acid Chicken (硫酸鶏)
Browse files

Optimize url-preview image (#4216)

parent f5b928a5
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment