blob: 0c5fd8a78e77a7ef4ecf6bda8897d00414ab4fa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import * as express from 'express';
import summaly from 'summaly';
module.exports = async (req: express.Request, res: express.Response) => {
const summary = await summaly(req.query.url);
summary.icon = wrap(summary.icon);
summary.thumbnail = wrap(summary.thumbnail);
res.send(summary);
};
function wrap(url: string): string {
return url != null
? `https://images.weserv.nl/?url=${url.replace(/^https?:\/\//, '')}`
: null;
}
|