From 5f50c62a89da9808101ffae54023c65eabb1e025 Mon Sep 17 00:00:00 2001 From: benni Date: Fri, 9 Feb 2018 13:23:38 +0100 Subject: [PATCH] Added link checking --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index dcb3f45..a87a906 100644 --- a/index.js +++ b/index.js @@ -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);