Fixed bug with getting new posts on the user page

This commit is contained in:
CaramelKat
2021-09-05 22:01:44 -05:00
committed by jay.poff@outlook.com
parent c25ca39ee0
commit eaeb6e9615
4 changed files with 45 additions and 3 deletions

View File

@@ -165,7 +165,7 @@ router.get('/loadPosts', function (req, res) {
}
else
{
res.send('<p class="no-posts-text">' + lang.global.no_posts + '</p>')
res.sendStatus(204)
}
}).catch(error => {
console.log(error);

View File

@@ -104,6 +104,40 @@ router.get('/banner/:image_id.png', function (req, res) {
});
});
router.get('/screenshot/:image_id.png', function (req, res) {
res.set("Content-Type", "image/png");
database.connect().then(async e => {
let post = await database.getPostByID(req.params.image_id.toString());
if(post !== null && post.screenshot !== '')
if(post.screenshot.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(post.screenshot.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(post.screenshot, 'base64'));
else
res.sendStatus(404);
}).catch(error => {
console.error(error);
res.sendStatus(404)
});
});
router.get('/drawing/:image_id.png', function (req, res) {
res.set("Content-Type", "image/png");
database.connect().then(async e => {
let post = await database.getPostByID(req.params.image_id.toString());
if(post !== null && post.painting_uri !== '')
if(post.painting_uri.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(post.painting_uri.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(post.painting_uri, 'base64'));
else
res.sendStatus(404);
}).catch(error => {
console.error(error);
res.sendStatus(404)
});
});
router.get('/notifications.json', function (req, res) {
res.header('X-Nintendo-WhiteList','1|http,youtube.com,,2|https,youtube.com,,2|http,.youtube.com,,2|https,.youtube.com,,2|http,.ytimg.com,,2|https,.ytimg.com,,2|http,.googlevideo.com,,2|https,.googlevideo.com,,2|https,youtube.com,/embed/,6|https,youtube.com,/e/,6|https,youtube.com,/v/,6|https,www.youtube.com,/embed/,6|https,www.youtube.com,/e/,6|https,www.youtube.com,/v/,6|https,youtube.googleapis.com,/e/,6|https,youtube.googleapis.com,/v/,6|http,maps.googleapis.com,/maps/api/streetview,2|https,maps.googleapis.com,/maps/api/streetview,2|http,cbk0.google.com,/cbk,2|https,cbk0.google.com,/cbk,2|http,cbk1.google.com,/cbk,2|https,cbk1.google.com,/cbk,2|http,cbk2.google.com,/cbk,2|https,cbk2.google.com,/cbk,2|http,cbk3.google.com,/cbk,2|https,cbk3.google.com,/cbk,2|https,.cloudfront.net,,2|https,www.google-analytics.com,/,2|https,stats.g.doubleclick.net,,2|https,www.google.com,/ads/,2|https,ssl.google-analytics.com,,2|http,fonts.googleapis.com,,2||fonts.googleapis.com,,2');
database.connect().then(async e => {

View File

@@ -14,7 +14,11 @@
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<meta content="<%= community.name %>" property="og:title" />
<meta content="<%= community.description %>" property="og:description" />
<meta content="https://portal.olv.pretendo.cc/communities/<%= community.community_id %>/new" property="og:url" />
<meta content="https://portal.cdn.pretendo.cc/icons/<%= community.community_id %>.png" property="og:image" />
<meta content="#1F8A42" data-react-helmet="true" name="theme-color" />
</head>
<body>
<%- include('nav_bar', { selection: 2 }); %>

View File

@@ -14,7 +14,11 @@
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<meta content="<%= user.user_id %>" property="og:title" />
<meta content="<%= user.profile_comment %>" property="og:description" />
<meta content="https://portal.olv.pretendo.cc/users/show?pid=<%= user.pid %>" property="og:url" />
<meta content="https://mii-images.cdn.pretendo.cc/<%= user.pid %>/normal_face.png" property="og:image" />
<meta content="#673DB6" data-react-helmet="true" name="theme-color" />
</head>
<body>
<%- include('nav_bar', { selection: -1 }); %>