mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2026-04-23 00:37:20 -05:00
fixed screenshot crash, added support for displaying screenshot posts
This commit is contained in:
parent
e1c5228562
commit
df3eb4201d
|
|
@ -11,6 +11,7 @@
|
|||
"author": "Jemma",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"colors": "^1.4.0",
|
||||
"express": "^4.17.1",
|
||||
"express-session": "^1.17.0",
|
||||
|
|
|
|||
|
|
@ -12451,7 +12451,7 @@
|
|||
<a href="#" class="button eshop-button test-eshop-button" data-dst-title-id="0005000010101d00" data-src-title-id="0005003010016100" data-sound="SE_WAVE_OK_SUB" data-community-id="14866558073038702637" data-url-id="" data-track-label="community" data-title-id="14866558072985245728" data-track-action="openShopJumpModal" data-track-category="shopJump">More Info</a>
|
||||
<a href="#" data-modal-open="#title-settings-page" class="button setting-button" data-sound="SE_WAVE_OK_SUB"></a>
|
||||
<a href="#" class="favorite-button favorite-button-mini button checked" data-action-favorite="/titles/14866558072985245728/14866558073038702637/favorite.json" data-action-unfavorite="/titles/14866558072985245728/14866558073038702637/unfavorite.json" data-sound="SE_WAVE_CHECKBOX_UNCHECK" data-community-id="14866558073038702637" data-url-id="" data-track-label="community" data-title-id="14866558072985245728" data-track-action="cancelFavorite" data-track-category="favorite"></a>
|
||||
<span class="title">New Super Luigi U Community</span>
|
||||
<span id="community-title" class="title">New Super Luigi U Community</span>
|
||||
<form action="" id="communitySelection"></form>
|
||||
</div>
|
||||
<menu class="tab-header">
|
||||
|
|
@ -12687,13 +12687,16 @@
|
|||
' <span class="spoiler-status">Spoilers</span>\n' +
|
||||
' </header>\n' +
|
||||
' <div class="post-content">\n';
|
||||
if(posts[i].painting_uri !== undefined)
|
||||
if(posts[i].screenshot !== undefined && posts[i].screenshot !== '')
|
||||
postBody += '<p class="post-content-text">' + posts[i].body + '</p>'+
|
||||
'<p class="post-content-memo"><img src="data:image/png;base64,' + posts[i].screenshot +'" class="post-memo"></p>';
|
||||
else if(posts[i].painting_uri !== undefined || posts[i].painting_uri === '')
|
||||
postBody += '<p class="post-content-memo"><img src="' + posts[i].painting_uri +'" class="post-memo"></p>';
|
||||
else
|
||||
postBody += '<p class="post-content-text">' + posts[i].body + '</p>';
|
||||
postBody += '</div>\n' +
|
||||
' <div class="post-meta">\n' +
|
||||
' <button type="button" class="submit miitoo-button" data-feeling="normal" data-action="/posts/' + posts[i].id + '/empathies" data-sound="SE_WAVE_MII_ADD" data-community-id="" data-url-id="" data-track-label="default" data-title-id="" data-track-action="yeah" data-track-category="empathy">Yeah!</button>\n' +
|
||||
' <button type="button" class="submit miitoo-button" onclick="console.log(\'testing\')" data-feeling="normal" data-action="/posts/' + posts[i].id + '/empathies" data-sound="SE_WAVE_MII_ADD" data-community-id="" data-url-id="" data-track-label="default" data-title-id="" data-track-action="yeah" data-track-category="empathy">Yeah!</button>\n' +
|
||||
' <a href="/posts/' + posts[i].id + '" class="to-permalink-button" data-pjax="#body">\n' +
|
||||
' <span class="feeling">' + posts[i].feeling_id + '</span>\n' +
|
||||
' <span class="reply">0</span><span class="played">Played</span>\n' +
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
const express = require('express');
|
||||
const subdomain = require('express-subdomain');
|
||||
const sessionMiddleware = require('../../middleware/session');
|
||||
const pnidMiddleware = require('../../middleware/pnid');
|
||||
const logger = require('../../logger');
|
||||
const routes = require('./routes');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
// Main router for endpointsindex.js
|
||||
const router = express.Router();
|
||||
|
|
@ -25,6 +24,7 @@ portal.use('/titles/', routes.PORTAL);
|
|||
portal.use('/v1/communities/', routes.COMMUNITY);
|
||||
portal.use('/v1/posts/', routes.POST);
|
||||
portal.use('/posts', routes.NEWPOST);
|
||||
portal.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
|
||||
api.use('/v1/communities/', routes.COMMUNITY);
|
||||
api.use('/v1/posts/', routes.POST);
|
||||
api.use('/posts/', routes.POST);
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ router.post('/', upload.none(), async function (req, res, next) {
|
|||
if (req.body.app_data) {
|
||||
appData = req.body.app_data.replace(/\0/g, "").trim();
|
||||
}
|
||||
let painting = "";
|
||||
let painting;
|
||||
if (req.body.painting) {
|
||||
painting = req.body.painting.replace(/\0/g, "").trim();
|
||||
}
|
||||
let paintingURI = "";
|
||||
let paintingURI;
|
||||
if (req.body.painting) {
|
||||
paintingURI = await util.data.processPainting(painting);
|
||||
}
|
||||
let screenshot = "";
|
||||
let screenshot;
|
||||
if (req.body.screenshot) {
|
||||
screenshot = req.body.screenshot.replace(/\0/g, "").trim();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user