1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-29 14:08:07 +09:00
hotomoe/src/web/service/url-preview.ts

14 lines
372 B
TypeScript
Raw Normal View History

2016-12-29 07:49:51 +09:00
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 `${config.proxy_url}/${url}`;
}