Fixed in-game posts from not displaying. Fixed submitting drawing posts in game. Updated dependencies

This commit is contained in:
Jemma Poffinbarger 2023-03-05 17:15:19 -06:00
parent 2ed94634eb
commit a3799e8a11
6 changed files with 2887 additions and 635 deletions

3490
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"dependencies": {
"aws-sdk": "^2.1204.0",
"bmp-js": "^0.1.0",
"body-parser": "^1.19.0",
"body-parser": "^1.20.2",
"colors": "^1.4.0",
"express": "^4.17.1",
"express-session": "^1.17.0",
@ -21,8 +21,8 @@
"fs-extra": "^9.0.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"mongoose": "^5.9.16",
"mongoose-unique-validator": "^2.0.3",
"mongoose": "^6.10.1",
"mongoose-unique-validator": "^3.1.0",
"morgan": "^1.10.0",
"node-rsa": "^1.0.8",
"node-snowflake": "0.0.1",

View File

@ -187,7 +187,7 @@ async function getNumberVerifiedCommunityPostsByID(community, limit, offset) {
async function getPostsByCommunity(community, numberOfPosts) {
verifyConnected();
return POST.find({
title_id: community.title_id,
community_id: community.community_id,
parent: null,
removed: false
}).limit(numberOfPosts);
@ -196,7 +196,7 @@ async function getPostsByCommunity(community, numberOfPosts) {
async function getPostsByCommunityKey(community, numberOfPosts, search_key) {
verifyConnected();
return POST.find({
title_id: community.title_id,
community_id: community.community_id,
search_key: search_key,
parent: null,
removed: false

View File

@ -50,7 +50,7 @@ router.get('/0/posts', async function (req, res) {
posts = await database.getPostsByCommunityKey(community, parseInt(req.query.limit), req.query.search_key);
else
posts = await database.getPostsByCommunity(community, parseInt(req.query.limit));
console.log(posts);
/* Build formatted response and send it off. */
let response;
if(req.query.with_mii === 1)

View File

@ -55,7 +55,7 @@ router.post('/', upload.none(), async function (req, res, next) {
let body = req.body.body;
if(body)
body = req.body.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}‛¨ƒºª«»“”„¿¡←→↑↓√§¶†‡¦–—⇒⇔¤¢€£¥™©®+×÷=±∞ˇ˘˙¸˛˜′″µ°¹²³♭♪•…¬¯‰¼½¾♡♥●◆■▲▼☆★♀♂,./?;:'"\[\]]/g, "");
if(body.length > 280)
if(body && body.length > 280)
body = body.substring(0,280);
const document = {
title_id: paramPackData.title_id,
@ -69,6 +69,7 @@ router.post('/', upload.none(), async function (req, res, next) {
created_at: new Date(),
feeling_id: req.body.emotion,
id: postID,
search_key: req.body.search_key,
is_autopost: req.body.is_autopost,
is_spoiler: (req.body.spoiler) ? 1 : 0,
is_app_jumpable: req.body.is_app_jumpable,

View File

@ -10,14 +10,14 @@ class CommunityPostGen {
.e("version", "1").up()
.e("request_name", "posts").up()
.e("topic")
.e("community_id", community.community_id).up()
.e("community_id", 0).up()
.up()
.e("posts");
for (let i = 0; i < posts.length; i++) {
xml = xml.e("post")
.e("app_data", posts[i].app_data).up()
.e("body", posts[i].body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "")).up()
.e("community_id", community.id).up()
.e("body", posts[i].body ? posts[i].body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "") : "").up()
.e("community_id", 0).up()
.e("country_id", "254").up()
.e("created_at", moment(posts[i].created_at).format("YYYY-MM-DD hh:mm:ss")).up()
.e("feeling_id", "1").up()
@ -41,7 +41,7 @@ class CommunityPostGen {
.e("platform_id", "1").up()
.e("region_id", "4").up()
.e("reply_count", "0").up()
.e("screen_name", "Placeholder").up()
.e("screen_name", posts[i].screen_name.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "")).up()
.e("title_id", community.title_id[0]).up()
.up();
}
@ -61,7 +61,7 @@ class CommunityPostGen {
for (let i = 0; i < posts.length; i++) {
xml = xml.e("post")
.e("app_data", posts[i].app_data).up()
.e("body", posts[i].body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "")).up()
.e("body", posts[i].body ? posts[i].body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "") : "").up()
.e("community_id", community.community_id).up()
.e("country_id", "254").up()
.e("created_at", moment(posts[i].created_at).format('YYYY-MM-DD HH:MM:SS')).up()
@ -154,7 +154,7 @@ class CommunityPostGen {
if (post.app_data) {
xml = xml.e("app_data", post.app_data).up();
}
xml = xml.e("body", post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "")).up()
xml = xml.e("body", post.body ? post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "") : "").up()
.e("community_id", post.community_id).up()
.e("country_id", "254").up()
.e("created_at", post.created_at).up()
@ -211,13 +211,10 @@ class CommunityPostGen {
.e('name', community.name).up()
.e("people");
for (const post of posts) {
let newBody = '';
if(post.body)
newBody = post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "");
xml = xml.e("person")
.e("posts")
.e("post")
.e("body", newBody).up()
.e("body", post.body ? post.body.replace(/[^A-Za-z\d\s-_!@#$%^&*(){}+=,.<>/?;:'"\[\]]/g, "") : "").up()
.e("community_id", community.community_id).up()
.e("country_id", post.country_id || 0).up()
.e("created_at", moment(post.created_at).format('YYYY-MM-DD HH:MM:SS')).up()