Stop running DOMPurify on reader server
This commit is contained in:
parent
c1a81a4d8c
commit
82074eb8aa
3
readerserver/.gitignore
vendored
3
readerserver/.gitignore
vendored
|
@ -87,3 +87,6 @@ typings/
|
||||||
# DynamoDB Local files
|
# DynamoDB Local files
|
||||||
.dynamodb/
|
.dynamodb/
|
||||||
|
|
||||||
|
# Editor
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
|
@ -17,11 +17,8 @@ const requestCallback = (url, res) => (error, response, body) => {
|
||||||
if (!error && response.statusCode == 200) {
|
if (!error && response.statusCode == 200) {
|
||||||
console.log('Response OK.');
|
console.log('Response OK.');
|
||||||
|
|
||||||
const doc = new JSDOM('', {url: url});
|
const doc = new JSDOM(body, {url: url});
|
||||||
const DOMPurify = createDOMPurify(doc.window);
|
const reader = new Readability(doc.window.document);
|
||||||
const clean = DOMPurify.sanitize(body);
|
|
||||||
const cleanDoc = new JSDOM(clean, {url: url});
|
|
||||||
const reader = new Readability(cleanDoc.window.document);
|
|
||||||
const article = reader.parse();
|
const article = reader.parse();
|
||||||
|
|
||||||
if (article && article.content) {
|
if (article && article.content) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user