mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-30 00:06:43 -06:00
27c6ebebc0
Closes #35
15 lines
435 B
TypeScript
15 lines
435 B
TypeScript
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;
|
|
}
|