Added link checking
This commit is contained in:
parent
288269be8f
commit
5f50c62a89
1 changed files with 3 additions and 0 deletions
3
index.js
3
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);
|
||||
|
|
Reference in a new issue