Added link checking

This commit is contained in:
benni 2018-02-09 13:23:38 +01:00
parent 288269be8f
commit 5f50c62a89
1 changed files with 3 additions and 0 deletions

View File

@ -151,6 +151,9 @@ app.get('/debug/frame/', async (req, res) => {
app.get('/:templateName/', async (req, res) => {
if (!templates[req.params.templateName]) return res.status(404).end();
try {
if(!/^https?:/.test(req.query.url)) {
return res.status(400).end("Invalid url!")
}
const img = new ImageEx(req.query.url);
const canvas = render(templates[req.params.templateName], await img.loaded);
return canvas.export(res);