diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2016-12-29 07:49:51 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2016-12-29 07:49:51 +0900 |
| commit | b3f42e62af698a67c2250533c437569559f1fdf9 (patch) | |
| tree | cdf6937576e99cccf85e6fa3aa8860a1173c7cfb /src/web/service/url-preview.ts | |
| download | misskey-b3f42e62af698a67c2250533c437569559f1fdf9.tar.gz misskey-b3f42e62af698a67c2250533c437569559f1fdf9.tar.bz2 misskey-b3f42e62af698a67c2250533c437569559f1fdf9.zip | |
Initial commit :four_leaf_clover:
Diffstat (limited to 'src/web/service/url-preview.ts')
| -rw-r--r-- | src/web/service/url-preview.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/web/service/url-preview.ts b/src/web/service/url-preview.ts new file mode 100644 index 0000000000..d1a345ef17 --- /dev/null +++ b/src/web/service/url-preview.ts @@ -0,0 +1,13 @@ +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}`; +} |