diff --git a/src/services/miiverse-api/routes/people.js b/src/services/miiverse-api/routes/people.js index 0054dac..25993df 100644 --- a/src/services/miiverse-api/routes/people.js +++ b/src/services/miiverse-api/routes/people.js @@ -13,7 +13,9 @@ router.get('/', async function (req, res) { let query = { removed: false, + is_spoiler: 0, app_data: { $eq: null }, + parent: { $eq: null }, message_to_pid: { $eq: null } } diff --git a/src/services/miiverse-api/routes/post.js b/src/services/miiverse-api/routes/post.js index 217d68f..df6a45e 100644 --- a/src/services/miiverse-api/routes/post.js +++ b/src/services/miiverse-api/routes/post.js @@ -163,9 +163,11 @@ async function newPost(req, res) { } let body = req.body.body; if(body) - body = req.body.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}‛¨ƒºª«»“”„¿¡←→↑↓√§¶†‡¦–—⇒⇔¤¢€£¥™©®+×÷=±∞ˇ˘˙¸˛˜′″µ°¹²³♭♪•…¬¯‰¼½¾♡♥●◆■▲▼☆★♀♂,./?;:'"\\<>]/g, ""); + body = req.body.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}‛¨ƒºª«»“”„¿¡←→↑↓√§¶†‡¦–—⇒⇔¤¢€£¥™©®+×÷=±∞ˇ˘˙¸˛˜′″µ°¹²³♭♪•…¬¯‰¼½¾♡♥●◆■▲▼☆★♀♂,./?;:'"\\<>]/g, "").trim(); if(body && body.length > 280) body = body.substring(0,280); + if(!body && !painting && !screenshot) + return res.sendStatus(400); const document = { title_id: paramPackData.title_id, community_id: community.app_id ? community.app_id : community.community_id, diff --git a/src/util/xmlResponseGenerator.js b/src/util/xmlResponseGenerator.js index db49b1c..cadef82 100644 --- a/src/util/xmlResponseGenerator.js +++ b/src/util/xmlResponseGenerator.js @@ -154,7 +154,7 @@ class XmlResponseGenerator { for (const post of posts) { xml = xml.e("person") .e("posts") - postObj(xml, post, { with_mii: true }); + postObj(xml, post, { with_mii: true, app_data: false }); xml = xml.up().up(); } xml = xml.up().up() @@ -217,10 +217,10 @@ class XmlResponseGenerator { */ function postObj(xml, post, options) { xml = xml.e("post"); - if (post.app_data) { + if (post.app_data && options.app_data) { xml.e("app_data", post.app_data.replace(/[^A-Za-z0-9+/=]/g, "").replace(/[\n\r]+/gm, '').trim()).up(); } - xml.e("body", post.body ? post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "") : "").up() + xml.e("body", post.body ? post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "").replace(/[\n\r]+/gm, '') : "").up() .e("community_id", post.community_id).up() .e("country_id", post.country_id ? post.country_id : 254).up() .e("created_at", new moment(post.created_at).format('YYYY-MM-DD HH:MM:SS')).up()