X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Froutes%2Fproblems.js;h=5f4dd401d184acdb16fca9f66252bbbce84689db;hp=746be9aac124faf108ec3b7d5328de901254b701;hb=ad65975c9150ac761c7e7c6696930d4e9e87396c;hpb=094db3db8512585996b39ceb4c161ca596b0efea diff --git a/server/routes/problems.js b/server/routes/problems.js index 746be9aa..5f4dd401 100644 --- a/server/routes/problems.js +++ b/server/routes/problems.js @@ -2,7 +2,16 @@ let router = require("express").Router(); const access = require("../utils/access"); const params = require("../config/parameters"); const ProblemModel = require("../models/Problem"); -const sanitizeHtml = require('sanitize-html'); +const sanitizeHtml_pkg = require('sanitize-html'); + +const allowedTags = [ + 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol', 'li', 'b', + 'i', 'strong', 'em', 'strike', 'code', 'hr', 'br', 'div', 'table', + 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre' +]; +function sanitizeHtml(text) { + return sanitizeHtml_pkg(text, { allowedTags: allowedTags }); +} router.post("/problems", access.logged, access.ajax, (req,res) => { if (ProblemModel.checkProblem(req.body.prob)) {