mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 01:39:06 +01:00
54f182c08d
Closes #35
16 lines
435 B
TypeScript
16 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;
|
|
}
|