General code cleanup

This commit is contained in:
CaramelKat
2021-05-21 06:49:17 -05:00
committed by jay.poff@outlook.com
parent 2748ccd515
commit 31921839b3
42 changed files with 7265 additions and 2225 deletions

2315
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,7 @@
"node-snowflake": "0.0.1",
"pako": "^2.0.2",
"pngjs": "^6.0.0",
"sharp": "^0.28.1",
"tga": "^1.0.4",
"xmlbuilder": "^15.1.1",
"xmlbuilder2": "^2.4.0"

View File

@@ -232,6 +232,14 @@ let methods = {
},
getCommunityHash: function() {
return communityMap;
},
resizeImage: function (file, width, height) {
sharp(file)
.resize({ height: height, width: width })
.toBuffer()
.then(data => {
return data;
});
}
};
exports.data = methods;

View File

@@ -183,7 +183,7 @@ async function getPostsByCommunityKey(community, numberOfPosts, search_key) {
async function getNewPostsByCommunity(community, numberOfPosts) {
verifyConnected();
return POST.find({
title_id: community.title_id
community_id: community.community_id
}).sort({ created_at: -1 }).limit(numberOfPosts);
}

View File

@@ -1,6 +1,30 @@
const { Schema, model } = require('mongoose');
const CommunitySchema = new Schema({
platform_id: Number,
name: String,
description: String,
open: {
type: Boolean,
default: true
},
/**
* 0: Main Community
* 1: Sub-Community
* 2: Announcement Community
*/
type: {
type: Number,
default: 0
},
parent: {
type: Number,
default: null
},
admins: {
type: [String],
default: undefined
},
created_at: {
type: Date,
default: new Date(),
@@ -35,17 +59,10 @@ const CommunitySchema = new Schema({
type: Number,
default: 0
},
platform_id: Number,
name: String,
browser_icon: String,
browser_thumbnail: String,
CTR_browser_header: String,
WiiU_browser_header: String,
description: String,
parent: {
type: Number,
default: null
}
WiiU_browser_header: String
});
CommunitySchema.methods.upEmpathy = async function() {

View File

@@ -36,6 +36,7 @@ portal.use('/', routes.PORTAL_WEB);
ctr.use('/titles/show', routes.CTR_SHOW);
ctr.use('/communities', routes.CTR_COMMUNITIES);
ctr.use('/users', routes.CTR_USER);
ctr.use('/posts', routes.CTR_POST);
ctr.use('/', routes.CTR_WEB);
admin.use('/', routes.WEB_ADMIN);

View File

@@ -7,6 +7,7 @@ const { COMMUNITY } = require('../../../../models/communities');
var router = express.Router();
const moment = require('moment');
var multer = require('multer');
const sharp = require("sharp");
const snowflake = require('node-snowflake').Snowflake;
var storage = multer.memoryStorage();
var upload = multer({ storage: storage });
@@ -156,14 +157,15 @@ router.post('/communities/:communityID/update', upload.fields([{name: 'browserIc
if(req.body.icon && community.icon !== req.body.icon)
community.icon = req.body.icon;
if(req.files.browserIcon)
community.browser_icon = `data:image/png;base64,${req.files.browserIcon[0].buffer.toString('base64')}`;
if(req.files.browserIcon) {
community.browser_icon = `data:image/png;base64,${await sharp(req.files.browserIcon[0].buffer).resize({ height: 128, width: 128 }).toBuffer().toString('base64')}`;
community.browser_thumbnail = `data:image/png;base64,${await sharp(req.files.browserIcon[0].buffer).resize({ height: 128, width: 128 }).toBuffer().toString('base64')}`;
}
if(req.files.CTRbrowserHeader)
community.CTR_browser_header = `data:image/png;base64,${req.files.CTRbrowserHeader[0].buffer.toString('base64')}`;
community.CTR_browser_header = `data:image/png;base64,${await sharp(req.files.CTRbrowserHeader[0].buffer).resize({ height: 220, width: 400 }).toBuffer().toString('base64')}`;
if(req.files.WiiUbrowserHeader)
community.WiiU_browser_header = `data:image/png;base64,${req.files.WiiUbrowserHeader[0].buffer.toString('base64')}`;
community.WiiU_browser_header = `data:image/png;base64,${await sharp(req.files.WiiUbrowserHeader[0].buffer).resize({ height: 328, width: 1498 }).toBuffer().toString('base64')}`;
if(req.body.is_recommended)
community.is_recommended = req.body.is_recommended;
@@ -210,8 +212,16 @@ router.post('/communities/new', upload.fields([{name: 'browserIcon', maxCount: 1
logger.audit('[' + user.user_id + ' - ' + user.pid + '] attempted to create a community and is not authorized');
throw new Error('Invalid credentials supplied');
}
JSON.parse(JSON.stringify(req.files));
let browserIcon, CTRHeader, WiiUHeader, thumb;
if(req.files.browserIcon) {
browserIcon = await sharp(req.files.browserIcon[0].buffer).resize({ height: 128, width: 128 }).toBuffer();
thumb = await sharp(req.files.browserIcon[0].buffer).resize({ height: 75, width: 75 }).toBuffer();
}
if(req.files.CTRbrowserHeader)
CTRHeader = await sharp(req.files.CTRbrowserHeader[0].buffer).resize({ height: 220, width: 400 }).toBuffer();
if(req.files.WiiUbrowserHeader)
WiiUHeader = await sharp(req.files.WiiUbrowserHeader[0].buffer).resize({ height: 328, width: 1498 }).toBuffer();
const document = {
empathy_count: 0,
id: snowflake.nextId(),
@@ -224,9 +234,10 @@ router.post('/communities/new', upload.fields([{name: 'browserIcon', maxCount: 1
community_id: snowflake.nextId(),
is_recommended: req.body.is_recommended,
name: req.body.name,
browser_icon: `data:image/png;base64,${req.files.browserIcon[0].buffer.toString('base64')}`,
CTR_browser_header: `data:image/png;base64,${req.files.CTRbrowserHeader[0].buffer.toString('base64')}`,
WiiU_browser_header: `data:image/png;base64,${req.files.WiiUbrowserHeader[0].buffer.toString('base64')}`,
browser_icon: `data:image/png;base64,${browserIcon.toString('base64')}`,
CTR_browser_header: `data:image/png;base64,${CTRHeader.toString('base64')}`,
WiiU_browser_header: `data:image/png;base64,${WiiUHeader.toString('base64')}`,
browser_thumbnail: `data:image/png;base64,${thumb.toString('base64')}`,
description: req.body.description,
};
const newCommunity = new COMMUNITY(document);
@@ -248,6 +259,84 @@ router.post('/communities/new', upload.fields([{name: 'browserIcon', maxCount: 1
});
});
router.post('/communities/:communityID/sub/new', upload.fields([{name: 'browserIcon', maxCount: 1}, { name: 'CTRbrowserHeader', maxCount: 1}, { name: 'WiiUbrowserHeader', maxCount: 1}]), function (req, res) {
database.connect().then(async e => {
if(req.cookies.token === null)
throw new Error('No service token supplied');
let pid = util.data.processServiceToken(req.cookies.token);
if(pid === null)
throw new Error('Invalid credentials supplied');
let user = await database.getUserByPID(pid);
if(user !== null)
{
if(config.authorized_PNIDs.indexOf(user.pid) === -1) {
logger.audit('[' + user.user_id + ' - ' + user.pid + '] attempted to create a community and is not authorized');
throw new Error('Invalid credentials supplied');
}
const community = await database.getCommunityByID(req.params.communityID);
let browserIcon, CTRHeader, WiiUHeader, thumb;
if(req.files.browserIcon) {
browserIcon = `data:image/png;base64,${req.files.browserIcon[0].buffer.toString('base64')}`;
thumb = await sharp(req.files.browserIcon[0].buffer)
.resize({ height: 75, width: 75 })
.toBuffer();
}
else {
browserIcon = community.browser_icon;
thumb = community.browser_thumbnail;
}
if(req.files.CTRbrowserHeader)
CTRHeader = `data:image/png;base64,${req.files.CTRbrowserHeader[0].buffer.toString('base64')}`;
else
CTRHeader = community.CTR_browser_header;
if(req.files.WiiUbrowserHeader)
WiiUHeader = `data:image/png;base64,${req.files.WiiUbrowserHeader[0].buffer.toString('base64')}`;
else
WiiUHeader = community.WiiU_browser_header;
JSON.parse(JSON.stringify(req.files));
const document = {
name: req.body.name,
description: req.body.description,
parent: req.body.parent,
type: req.body.type,
empathy_count: 0,
id: snowflake.nextId(),
has_shop_page: req.body.has_shop_page,
platform_id: req.body.platform_ID,
icon: req.body.icon,
created_at: moment(new Date()),
title_ids: req.body.title_ids,
title_id: req.body.title_ids,
community_id: snowflake.nextId(),
is_recommended: req.body.is_recommended,
browser_icon: browserIcon,
browser_thumbnail: `data:image/png;base64,${thumb.toString('base64')}`,
CTR_browser_header: CTRHeader,
WiiU_browser_header: WiiUHeader,
};
const newCommunity = new COMMUNITY(document);
newCommunity.save();
res.sendStatus(200);
logger.audit('[' + user.user_id + ' - ' + user.pid + '] created community ' + newCommunity.name);
}
else
throw new Error('Invalid account ID or password');
}).catch(error =>
{
res.statusCode = 400;
let response = {
error_code: 400,
message: error.message
};
res.send(response);
});
});
router.post('/discovery/update', upload.none(), function (req, res) {
database.connect().then(async e => {
if(req.cookies.token === null)

View File

@@ -217,7 +217,7 @@ router.get('/audit', upload.none(), function (req, res) {
});
router.get('/communities/new', upload.none(), function (req, res) {
var communityID = req.query.CID;
database.connect().then(async e => {
if(req.cookies.token === null)
{
@@ -233,6 +233,7 @@ router.get('/communities/new', upload.none(), function (req, res) {
let user = await database.getUserByPID(pid);
res.render('admin/admin_new_community.ejs', {
user: user,
communityID: communityID
});
}).catch(error => {
@@ -250,7 +251,6 @@ router.get('/communities/new', upload.none(), function (req, res) {
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/communities/:communityID', upload.none(), function (req, res) {
@@ -298,7 +298,6 @@ router.get('/communities/:communityID', upload.none(), function (req, res) {
});
router.get('/communities/:communityID/edit', upload.none(), function (req, res) {
database.connect().then(async e => {
if(req.cookies.token === null)
{
@@ -333,7 +332,85 @@ router.get('/communities/:communityID/edit', upload.none(), function (req, res)
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/communities/:communityID/sub', upload.none(), function (req, res) {
database.connect().then(async e => {
if(req.cookies.token === null)
{
res.redirect('/login');
return;
}
let pid = util.data.processServiceToken(req.cookies.token);
if(pid === null)
{
res.redirect('/login');
return;
}
let user = await database.getUserByPID(pid);
let communities = await database.getSubCommunities(req.params.communityID.toString());
res.render('admin/admin_sub_communities.ejs', {
user: user,
communities: communities,
moment: moment,
communityID: req.params.communityID.toString()
});
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/communities/:communityID/sub/new', upload.none(), function (req, res) {
database.connect().then(async e => {
if(req.cookies.token === null)
{
res.redirect('/login');
return;
}
let pid = util.data.processServiceToken(req.cookies.token);
if(pid === null)
{
res.redirect('/login');
return;
}
let user = await database.getUserByPID(pid);
let community = await database.getCommunityByID(req.params.communityID.toString());
res.render('admin/admin_edit_sub_community.ejs', {
user: user,
community: community,
});
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/users', upload.none(), function (req, res) {

View File

@@ -1,32 +1,22 @@
var express = require('express');
var xml = require('object-to-xml');
const database = require('../../../../database');
//const util = require('../../../../util/authentication');
const ejs = require('ejs');
const util = require('../../../../authentication');
var multer = require('multer');
var moment = require('moment');
var upload = multer({ dest: 'uploads/' });
var router = express.Router();
/* GET discovery server. */
router.get('/', 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');
var isAJAX = ((req.query.ajax+'').toLowerCase() === 'true')
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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let popularCommunities = await database.getMostPopularCommunities(6);
let newCommunities = await database.getNewCommunities(3);
if(isAJAX) {
res.render('ctr/ctr_communities_ajax.ejs', {
// EJS variable and server-side variable
popularCommunities: popularCommunities,
newCommunities: newCommunities
});
}
else {
res.render('ctr/ctr_communities.ejs', {
// EJS variable and server-side variable
popularCommunities: popularCommunities,
newCommunities: newCommunities
});
}
let popularCommunities = await database.getMostPopularCommunities(9);
let newCommunities = await database.getNewCommunities(6);
res.render('ctr/communities.ejs', {
// EJS variable and server-side variable
popularCommunities: popularCommunities,
newCommunities: newCommunities
});
}).catch(error => {
res.set("Content-Type", "application/xml");
res.statusCode = 400;
@@ -43,32 +33,46 @@ router.get('/', function (req, res) {
});
});
router.get('/*/new', 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');
let community_id = req.originalUrl.replace('/communities/', '').replace('/new','').trim();
var isAJAX = ((req.query.ajax+'').toLowerCase() === 'true')
if(isAJAX)
community_id = community_id.substring(0, community_id.indexOf('?'));
router.get('/all', 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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let community = await database.getCommunityByID(community_id.substring(0, community_id));
let newPosts = await database.getNewPostsByCommunity(community, 100);
let totalNumPosts = await database.getNumberPostsByCommunity(community);
if(isAJAX) {
res.render('ctr/ctr_community_ajax.ejs', {
// EJS variable and server-side variable
community: community,
newPosts: newPosts,
totalNumPosts: totalNumPosts
});
}
else {
res.render('ctr/ctr_community.ejs', {
// EJS variable and server-side variable
community: community,
newPosts: newPosts,
totalNumPosts: totalNumPosts
});
}
let communities = await database.getCommunities(90);
res.render('ctr/all_communities.ejs', {
communities: communities,
});
}).catch(error => {
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/announcements', 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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
let community = await database.getCommunityByID('announcements');
let newPosts = await database.getNumberNewCommunityPostsByID(community, 25);
let totalNumPosts = await database.getTotalPostsByCommunity(community);
res.render('ctr/announcements.ejs', {
moment: moment,
community: community,
newPosts: newPosts,
user: user,
totalNumPosts: totalNumPosts
});
}).catch(error => {
console.error(error);
res.set("Content-Type", "application/xml");
@@ -86,4 +90,137 @@ router.get('/*/new', function (req, res) {
});
});
router.get('/:communityID/:type', 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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
let community = await database.getCommunityByID(req.params.communityID.toString());
let newPosts = await database.getNumberNewCommunityPostsByID(community, 1);
let totalNumPosts = await database.getTotalPostsByCommunity(community)
res.render('ctr/community.ejs', {
moment: moment,
community: community,
newPosts: newPosts,
totalNumPosts: totalNumPosts,
user: user
});
}).catch(error => {
console.error(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/:communityID/:type/loadPosts', 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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
let post = await database.getPostByID(req.query.postID);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
let communityMap = await util.data.getCommunityHash();
let posts;
if(post !== null)
posts = await database.getCommunityPostsAfterTimestamp(post, 1);
else {
let community = await database.getCommunityByID(req.params.communityID)
switch (req.params.type) {
case 'popular':
posts = await database.getNumberPopularCommunityPostsByID(community, 10);
break;
case 'verified':
posts = await database.getNumberVerifiedCommunityPostsByID(community, 10);
break;
default:
posts = await database.getNewPostsByCommunity(community, 10);
break;
}
}
if(posts.length > 0)
{
res.render('ctr/more_posts.ejs', {
communityMap: communityMap,
moment: moment,
database: database,
user: user,
newPosts: posts,
});
}
else
{
res.sendStatus(204);
}
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.post('/follow', upload.none(), function (req, res) {
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
let community = await database.getCommunityByID(req.body.communityID);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
if(req.body.type === 'true' && user !== null && user.followed_communities.indexOf(community.id) === -1)
{
console.log('following!')
community.upFollower();
user.addToCommunities(community.id);
res.sendStatus(200);
}
else if(req.body.type === 'false' && user !== null && user.followed_communities.indexOf(community.id) !== -1)
{
console.log('unfollowing!')
community.downFollower();
user.removeFromCommunities(community.id);
res.sendStatus(200);
}
else
res.sendStatus(423);
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 423;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
module.exports = router;

View File

@@ -0,0 +1,129 @@
var express = require('express');
var xml = require('object-to-xml');
const database = require('../../../../database');
const util = require('../../../../authentication');
const { POST } = require('../../../../models/post');
var multer = require('multer');
var upload = multer({ dest: 'uploads/' });
const snowflake = require('node-snowflake').Snowflake;
var router = express.Router();
router.post('/empathy', function (req, res) {
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
let post = await database.getPostByID(req.body.postID);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
if(req.body.type === 'up' && user !== null && user.likes.indexOf(post.id) === -1 && user.id !== post.pid)
{
post.upEmpathy();
user.addToLikes(post.id)
res.sendStatus(200);
}
else if(req.body.type === 'down' && user !== null && user.likes.indexOf(post.id) !== -1 && user.id !== post.pid)
{
post.downEmpathy();
user.removeFromLike(post.id);
res.sendStatus(200);
}
else
res.sendStatus(423);
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 423;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.post('/new', upload.none(), async function (req, res, next) {
try
{
let paramPackData = util.data.decodeParamPack(req.headers["x-nintendo-parampack"]);
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
if(pid === null)
{
throw new Error('The User token was not valid');
}
else
{
let usrObj = await database.getUserByPID(pid);
if(usrObj.account_status !== 0) {
throw new Error('User not allowed to post')
}
let community = await database.getCommunityByID(req.body.olive_community_id);
let appData = "";
if (req.body.app_data) {
appData = req.body.app_data.replace(/\0/g, "").trim();
}
let painting = "";
if (req.body.painting) {
painting = req.body.painting.replace(/\0/g, "").trim();
}
let paintingURI = "";
if (req.body.painting) {
paintingURI = await util.data.processPainting(painting);
}
let screenshot = "";
if (req.body.screenshot) {
screenshot = req.body.screenshot.replace(/\0/g, "").trim();
}
const document = {
title_id: community.title_id[0],
community_id: community.community_id,
screen_name: usrObj.user_id,
body: req.body.body,
app_data: appData,
painting: painting,
painting_uri: paintingURI,
screenshot: screenshot,
country_id: paramPackData.country_id,
created_at: new Date(),
feeling_id: req.body.feeling_id,
id: snowflake.nextId(),
is_autopost: req.body.is_autopost,
is_spoiler: req.body.is_spoiler,
is_app_jumpable: req.body.is_app_jumpable,
language_id: req.body.language_id,
mii: usrObj.mii,
mii_face_url: usrObj.pfp_uri,
pid: pid,
platform_id: paramPackData.platform_id,
region_id: paramPackData.region_id,
};
const newPost = new POST(document);
newPost.save();
res.redirect('/communities/' + community.community_id);
}
}
catch (e)
{
console.error(e);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 7,
message: "POSTING_FROM_NNID"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
}
});
module.exports = router;

View File

@@ -2,36 +2,48 @@ var express = require('express');
var xml = require('object-to-xml');
const database = require('../../../../database');
const util = require('../../../../authentication');
const ejs = require('ejs');
var moment = require('moment');
var router = express.Router();
/* GET discovery server. */
router.get('/', 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');
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|https,www.googletagmanager.com,,2');
database.connect().then(async e => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
let user = null;
if(pid === null)
{
pid = 1000000000;
user = await database.getUserByPID(pid);
let popularCommunities = await database.getMostPopularCommunities(9);
let newCommunities = await database.getNewCommunities(6);
res.render('ctr/ctr_guest_notice.ejs', {});
res.render('ctr/guest_notice.ejs', {});
}
else
{
user = await database.getUserByPID(pid);
if(user === null)
{
res.render('ctr/ctr_first_run.ejs', {});
res.render('ctr/first_run.ejs', {});
}
if(moment(user.ban_lift_date).format('YYYY-MM-DD') <= moment().format('YYYY-MM-DD') && user.account_status !== 3) {
user.account_status = 0;
user.save()
}
/**
* Account Status
* 0 - Fine
* 1 - Limited from Posting
* 2 - Temporary Ban
* 3 - Forever Ban
*/
if(user.account_status !== 0)
{
res.render('ctr/ban_notification.ejs', {
user: user,
moment: moment
});
}
else
{
let popularCommunities = await database.getMostPopularCommunities(9);
let newCommunities = await database.getNewCommunities(6);
res.render('ctr/ctr_show.ejs', {
// EJS variable and server-side variable
res.render('ctr/communities.ejs', {
popularCommunities: popularCommunities,
newCommunities: newCommunities
});
@@ -55,25 +67,24 @@ router.get('/', function (req, res) {
});
router.get('/first', 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');
res.render('ctr/ctr_first_run.ejs', {});
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|https,www.googletagmanager.com,,2');
res.render('ctr/first_run.ejs', {});
});
router.post('/newUser', 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 => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
let user = null;
if(pid === null)
{
res.sendStatus(501);
res.sendStatus(401);
}
else
{
user = await database.getUserByPID(pid);
if(user === null)
{
await util.data.create_user(pid, req.body.experience, req.body.notifications);
await util.data.create_user(pid, req.body.experience, req.body.notifications, req.body.region);
if(await database.getUserByPID(pid) !== null)
res.sendStatus(200);
else

View File

@@ -6,6 +6,35 @@ const ejs = require('ejs');
var router = express.Router();
/* GET discovery server. */
router.get('/menu', 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 => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
res.render('ctr/user_menu.ejs', {
user: user,
});
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
router.get('/me', 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');
var isAJAX = ((req.query.ajax+'').toLowerCase() === 'true')
@@ -20,7 +49,7 @@ router.get('/me', function (req, res) {
let newPosts = await database.getPostsByUserID(pid);
let numPosts = await database.getNumberUserPostsByID(pid);
if(isAJAX) {
res.render('ctr/ctr_user_page_ajax.ejs', {
res.render('ctr/user_page.ejs', {
// EJS variable and server-side variable
user: user,
newPosts: newPosts,

View File

@@ -1,26 +1,137 @@
var express = require('express');
var router = express.Router();
const database = require('../../../../database');
const util = require('../../../../authentication');
var path = require('path');
/* GET discovery server. */
router.get('/css/juxt.css', function (req, res) {
res.set("Content-Type", "text/css");
res.sendFile('css/juxt.css', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
});
router.get('/js/juxt.js', function (req, res) {
res.set("Content-Type", "application/javascript; charset=utf-8");
res.sendFile('js/juxt.js', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
});
router.get('/icons/Icon-feather-search.svg', function (req, res) {
res.sendFile('icons/Icon-feather-search.svg', {root: path.join(__dirname, '../../../../webfiles/ctr/')})
router.get('/js/pjax.js', function (req, res) {
res.set("Content-Type", "application/javascript; charset=utf-8");
res.sendFile('js/pjax.js', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
});
router.get('/icons/mario-kart.jpg', function (req, res) {
res.sendFile('icons/mario-kart.jpg', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
router.get('/fonts/Poppins-Light.woff', function (req, res) {
res.set("Content-Type", "font/woff");
res.sendFile('fonts/Poppins-Light.woff', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
});
router.get('/fonts/Poppins-Light.ttf', function (req, res) {
res.set("Content-Type", "font/ttf");
res.sendFile('fonts/Poppins-Light.ttf', {root: path.join(__dirname, '../../../../webfiles/ctr/')});
});
router.get('/favicon.ico', function (req, res) {
res.set("Content-Type", "image/x-icon");
res.sendFile('css/favicon.ico', {root: path.join(__dirname, '../../../../webfiles/portal/')});
});
router.get('/icons/:image_id.png', function (req, res) {
res.set("Content-Type", "image/png");
database.connect().then(async e => {
let community = await database.getCommunityByID(req.params.image_id.toString());
if(community !== null) {
if(community.browser_icon.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(community.browser_icon.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(community.browser_icon, 'base64'));
}
else {
let user = await database.getUserByPID(req.params.image_id.toString());
if(user !== null)
if(user.pfp_uri.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(user.pfp_uri.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(user.pfp_uri, 'base64'));
else
res.sendStatus(404);
}
}).catch(error => {
console.error(error);
res.sendStatus(404)
});
});
router.get('/tip/:image_id.png', function (req, res) {
res.set("Content-Type", "image/png");
database.connect().then(async e => {
let community = await database.getCommunityByID(req.params.image_id.toString());
if(community !== null) {
if(community.browser_thumbnail.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(community.browser_thumbnail.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(community.browser_thumbnail, 'base64'));
}
else {
let user = await database.getUserByPID(req.params.image_id.toString());
if(user !== null)
if(user.pfp_uri.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(user.pfp_uri.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(user.pfp_uri, 'base64'));
else
res.sendStatus(404);
}
}).catch(error => {
console.error(error);
res.sendStatus(404)
});
});
router.get('/banner/:image_id.png', function (req, res) {
res.set("Content-Type", "image/png");
database.connect().then(async e => {
let community = await database.getCommunityByID(req.params.image_id.toString());
if(community !== null)
if(community.WiiU_browser_header.indexOf('data:image/png;base64,') !== -1)
res.send(Buffer.from(community.WiiU_browser_header.replace('data:image/png;base64,',''), 'base64'));
else
res.send(Buffer.from(community.WiiU_browser_header, '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 => {
let pid = util.data.processServiceToken(req.headers["x-nintendo-servicetoken"]);
if(pid === null)
pid = 1000000000;
let user = await database.getUserByPID(pid);
res.send(
{
messages: 0,
news: user.notification_list.filter(notification => notification.read === false).length,
}
)
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
res.statusCode = 400;
response = {
result: {
has_error: 1,
version: 1,
code: 400,
error_code: 15,
message: "SERVER_ERROR"
}
};
res.send("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml(response));
});
});
module.exports = router;

View File

@@ -11,6 +11,7 @@ module.exports = {
CTR_WEB: require('./ctr/web'),
CTR_COMMUNITIES: require('./ctr/communities'),
CTR_USER: require('./ctr/userpage'),
CTR_POST: require('./ctr/posts'),
WEB_ADMIN: require('./admin/home'),
WEB_API: require('./admin/api'),
};

View File

@@ -81,13 +81,13 @@ router.post('/new', upload.none(), async function (req, res, next) {
}
const document = {
title_id: community.title_id[0],
community_id: community.community_id,
screen_name: usrObj.user_id,
body: req.body.body,
app_data: appData,
painting: painting,
painting_uri: paintingURI,
screenshot: screenshot,
community_id: req.body.community_id,
country_id: paramPackData.country_id,
created_at: new Date(),
feeling_id: req.body.feeling_id,

View File

@@ -96,7 +96,6 @@ router.post('/me', upload.none(), function (req, res) {
router.get('/show', 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|https,www.googletagmanager.com,,2');
var isAJAX = ((req.query.ajax+'').toLowerCase() === 'true')
var userID = req.query.pid;
if(userID === 'me') {
res.sendStatus(504);

View File

@@ -55,7 +55,7 @@
</tr>
<% for(var i = 0; i < communities.length; i++) { %>
<tr id="<%= communities[i].community_id %>" onclick="location.assign('/communities/' + this.id)">
<td><img style="width: 80px " src="/icons/<%= communities[i].community_id %>.png"></img></td>
<td><img style="width: 80px " src="/icons/<%= communities[i].community_id %>.png"></td>
<td><a><%= communities[i].name %></a></td>
<td><%= moment(communities[i].created_at).fromNow() %></td>
<td><%= communities[i].title_ids %></td>

View File

@@ -35,6 +35,7 @@
</tr>
</tbody>
</table>
<button type="button" style="margin-left: 20px; width: 760px; <%if(community.type === 1){%>display: none;<%}%>" onclick="window.location='/communities/<%= community.community_id %>/sub'">Sub-Communities</button>
<button type="button" style="margin-left: 20px; width: 760px" onclick="window.location='/communities/<%= community.community_id %>/edit'">Edit</button>
<div class="community-page-margin-line"></div>
<table class="community-page-table-wrapper">

View File

@@ -71,11 +71,11 @@
<div class="section-inputs">
<div class="input-div choices-inputs do-input-cols">
<div>
Browser Icon (512px x 512px)
Browser Icon (128px x 128px)
<input type="file" id="browserIcon" accept="image/png" name="browserIcon">
</div>
<div>
<img src="<%=community.browser_icon%>">
<img src="/icons/<%= community.community_id %>.png">
</div>
</div>
@@ -126,6 +126,21 @@
<input type="radio" id="Both" name="platform_id" value="2" <%if(community.platform_id === 2) {%> checked <%}%>>
<label for="platform_id">Both</label>
</div>
<div class="input-div choices-inputs">
Type
<input type="radio" id="main" name="type" value="0" <%if(community.type === 0) {%> checked <%}%>>
<label for="type">Main</label>
<input type="radio" id="sub" name="type" value="1" <%if(community.type === 1) {%> checked <%}%>>
<label for="type">Sub</label>
<input type="radio" id="admin" name="type" value="2" <%if(community.type === 2) {%> checked <%}%>>
<label for="type">Announcement</label>
</div>
<div class="input-div">
<label for="parent">Parent Community</label>
<input type="text" id="parent" name="parent" value="<%=community.parent%>">
</div>
</div>
</div>

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit - <%= community.name %></title>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
</head>
<body>
<h2 style="display: inline-block; margin-left: 20px">Juxt Admin Panel - <%= user.user_id %></h2> <img style="width: 57px; display: inline-block; position: absolute; right: 8px;" src="<%= user.pfp_uri %>">
<div class="row">
<div class="left" style="background-color:#bbb;max-width: 10%;">
<ul id="myMenu">
<li><a href="/">Home</a></li>
<li><a href="/communities">Communities</a></li>
<li><a href="/audit">Audit Log</a></li>
<li><a href="/users">Users</a></li>
<li><a href="/discovery">Discovery</a></li>
</ul>
</div>
<div class="right" style="background-color:#ddd;">
<h2>New <%=community.name%> Sub-Community</h2>
<form action="/v1/communities/<%=community.community_id%>/sub/new" enctype="multipart/form-data" target="formSubmitFrame" method="post">
<div class="form-section">
<div class="section-info">
<h2>Meta information</h2>
<p>Update the name, description, system icon, and title ID's of the community</p>
</div>
<div class="section-inputs">
<div class="input-div">
<label for="name">Community Name:</label>
<input type="text" id="name" name="name" value="<%=community.name%>">
</div>
<div class="input-div">
<label for="description">Description:</label>
<textarea type="text" id="description" name="description"><%=community.description%></textarea>
</div>
<div class="input-grid">
<div class="input-div">
<label for="title_ids">Title ID 1:</label>
<input type="text" id="title_ids" name="title_ids[]" value="<%=community.title_ids[0]%>">
</div>
<div class="input-div">
<label for="title_ids">Title ID 2:</label>
<input type="text" id="title_ids" name="title_ids[]" value="<%=community.title_ids[1]%>">
</div>
<div class="input-div">
<label for="title_ids">Title ID 3:</label>
<input type="text" id="title_ids" name="title_ids[]" value="<%=community.title_ids[2]%>">
</div>
<div class="input-div">
<label for="icon">System Icon (B64 TGA):</label>
<input type="text" id="icon" name="icon" value="<%=community.icon%>">
</div>
</div>
</div>
</div>
<div class="form-section">
<div class="section-info">
<h2>Browser Icons and Meta Data</h2>
<p>Update the browser icons for the Miiverse Applets, as well as setting the platform, and other settings</p>
</div>
<div class="section-inputs">
<div class="input-div choices-inputs do-input-cols">
<div>
Browser Icon (128px x 128px)
<input type="file" id="browserIcon" accept="image/png" name="browserIcon">
</div>
<div>
<img src="/icons/<%= community.community_id %>.png">
</div>
</div>
<hr>
<div class="input-div choices-inputs do-input-cols">
<div>
3DS Browser Banner (400px x 220px)
<input type="file" id="CTRbrowserHeader" accept="image/png" name="CTRbrowserHeader">
</div>
<div>
<img src="<%=community.CTR_browser_header%>">
</div>
</div>
<hr>
<div class="input-div choices-inputs">
Wii U Browser Banner (1498px x 328px)
<input type="file" id="WiiUbrowserHeader" accept="image/png" name="WiiUbrowserHeader">
<img src="<%=community.WiiU_browser_header%>">
</div>
<hr>
<div class="input-div choices-inputs">
Is Recommended?
<input type="radio" id="isRecomended" name="is_recommended" value="1" <%if(community.is_recommended === 1) {%> checked <%}%>>
<label for="isRecomended">True</label>
<input type="radio" id="isNotRecomended" name="is_recommended" value="0" <%if(community.is_recommended === 0) {%> checked <%}%>>
<label for="isNotRecomended">False</label>
</div>
<div class="input-div choices-inputs">
Has Shop Page?
<input type="radio" id="hasShopPage" name="has_shop_page" value="1" <%if(community.has_shop_page === 1) {%> checked <%}%>>
<label for="hasShopPage">True</label>
<input type="radio" id="noShopPage" name="has_shop_page" value="0" <%if(community.has_shop_page === 0) {%> checked <%}%>>
<label for="noShopPage">False</label>
</div>
<div class="input-div choices-inputs">
Platform
<input type="radio" id="WiiU" name="platform_id" value="0" <%if(community.platform_id === 0) {%> checked <%}%>>
<label for="platform_id">Wii U</label>
<input type="radio" id="3DS" name="platform_id" value="1" <%if(community.platform_id === 1) {%> checked <%}%>>
<label for="platform_id">3DS</label>
<input type="radio" id="Both" name="platform_id" value="2" <%if(community.platform_id === 2) {%> checked <%}%>>
<label for="platform_id">Both</label>
</div>
<div class="input-div choices-inputs">
Type
<input type="radio" id="main" name="type" value="0">
<label for="type">Main</label>
<input type="radio" id="sub" name="type" value="1" checked>
<label for="type">Sub</label>
<input type="radio" id="admin" name="type" value="2">
<label for="type">Announcement</label>
</div>
<div class="input-div">
<label for="parent">Parent Community</label>
<input type="text" id="parent" name="parent" value="<%=community.community_id%>">
</div>
</div>
</div>
<div class="form-section">
<div class="section-info">
<h2>Submit or Delete Community</h2>
<p></p>
</div>
<div class="section-inputs">
<div>
<button type="submit" class="btn">Submit</button>
<button type="button" class="btn" onclick="deleteCommunity()">Delete Community</button>
</div>
<iframe name="formSubmitFrame"></iframe>
</div>
</div>
</form>
</div>
</div>
<script>
function deleteCommunity() {
var confirm = prompt('Type the name of the community in to confirm you want to delete it.');
if (confirm === '<%=community.name%>') {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
alert('Community has been deleted');
window.location.replace("/communities");
}
else if (this.readyState === 4){
alert("Unable to delete community.")
}
};
xhttp.open("POST", "/v1/communities/<%=community.community_id%>/delete", true);
xhttp.send();
}
}
</script>
</body>
</html>

View File

@@ -119,6 +119,21 @@
<input type="radio" id="Both" name="platform_id" value="2" required>
<label for="platform_id">Both</label>
</div>
<div class="input-div choices-inputs">
Type
<input type="radio" id="main" name="type" value="0" checked>
<label for="type">Main</label>
<input type="radio" id="sub" name="type" value="1" <%if(communityID){%>checked<%}%>>
<label for="type">Sub</label>
<input type="radio" id="admin" name="type" value="2">
<label for="type">Announcement</label>
</div>
<div class="input-div">
<label for="parent">Parent Community</label>
<input type="text" id="parent" name="parent" value="<%=communityID%>">
</div>
</div>
</div>

View File

@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Juxt Admin Panel</title>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 60%;
}
th {
cursor: pointer;
}
th, td {
text-align: left;
padding: 16px;
}
tr {
border: black;
border-width: 2px;
border-style: groove;
}
</style>
</head>
<body>
<h2 style="display: inline-block; margin-left: 20px">Juxt Admin Panel - <%= user.user_id %></h2> <img style="width: 57px; display: inline-block; position: absolute; right: 8px;" src="<%= user.pfp_uri %>">
<div class="row">
<div class="left" style="background-color:#bbb;max-width: 10%;">
<ul id="myMenu">
<li><a href="/">Home</a></li>
<li><a href="/communities">Communities</a></li>
<li><a href="/audit">Audit Log</a></li>
<li><a href="/users">Users</a></li>
<li><a href="/discovery">Discovery</a></li>
</ul>
</div>
<div class="right" style="background-color:#ddd;">
<h2>Communities</h2>
<button onclick="location.assign('/communities/<%=communityID%>/sub/new')">New</button>
<input type="text" id="search" onkeyup="search()" placeholder="Search..">
<table id="community-list">
<tbody id="search-list">
<tbody>
<tr>
<th>Icon</th>
<th onClick="sortTable(0)">Name</th>
<th onClick="sortTable(1)">Created At</th>
<th onClick="sortTable(1)">Title ID's</th>
<th onClick="sortTable(2)">Followers</th>
</tr>
<% for(var i = 0; i < communities.length; i++) { %>
<tr id="<%= communities[i].community_id %>" onclick="location.assign('/communities/' + this.id)">
<td><img style="width: 80px " src="/icons/<%= communities[i].community_id %>.png"></td>
<td><a><%= communities[i].name %></a></td>
<td><%= moment(communities[i].created_at).fromNow() %></td>
<td><%= communities[i].title_ids %></td>
<td><%= communities[i].followers %></td>
</tr>
<%}%>
</tbody>
</table>
</div>
</div>
<script>
/**
* Removes row from table
* @param id
*/
function removeRow(id) {
var row = document.getElementById(id);
row.parentNode.removeChild(row);
}
/**
* Sorts table by selected column
* @param n
*/
function sortTable(n) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("community-list");
switching = true;
dir = "asc";
while (switching) {
switching = false;
rows = table.rows;
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("TD")[n];
y = rows[i + 1].getElementsByTagName("TD")[n];
if (dir === "asc") {
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
} else if (dir === "desc") {
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
switchcount ++;
} else {
if (switchcount === 0 && dir === "asc") {
dir = "desc";
switching = true;
}
}
}
}
function search() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("search");
filter = input.value.toUpperCase();
table = document.getElementById("community-list");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
</body>
</html>

View File

@@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8">
<title>3DS Testing</title>
<script src="/js/pjax.js"></script>
<script src="/js/juxt.js"></script>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap" rel="stylesheet">
</head>
<body>
<div id="main">
@@ -31,8 +31,8 @@
<% if(i === popularCommunities.length - 1) { %>
<tr>
<td>
<div class="community-list-wrapper bottom" id="<%= popularCommunities[i].id %>">
<img class="community-list-icon bottom" src="<%= popularCommunities[i].browser_icon %>">
<div class="community-list-wrapper bottom" data-pjax="/communities/<%= popularCommunities[i].community_id %>/new">
<img class="community-list-icon" src="<%= popularCommunities[i].browser_thumbnail %>">
<h2 class="community-list-title"><%= popularCommunities[i].name %></h2>
<h4><%= popularCommunities[i].followers %> followers</h4>
</div>
@@ -41,8 +41,8 @@
<% } else { %>
<tr>
<td>
<div class="community-list-wrapper" id="<%= popularCommunities[i].id %>">
<img class="community-list-icon" src="<%= popularCommunities[i].browser_icon %>">
<div class="community-list-wrapper" data-pjax="/communities/<%= popularCommunities[i].community_id %>/new">
<img class="community-list-icon" src="<%= popularCommunities[i].browser_thumbnail %>">
<h2 class="community-list-title"><%= popularCommunities[i].name %></h2>
<h4><%= popularCommunities[i].followers %> followers</h4>
</div>
@@ -56,24 +56,24 @@
<h1 class="communities-header">New Communities</h1>
<table>
<tbody>
<% for(var j = 0; j < newCommunities.length; j++) {%>
<% if(j === newCommunities.length - 1) { %>
<% for(var i = 0; i < newCommunities.length; i++) {%>
<% if(i === newCommunities.length - 1) { %>
<tr>
<td>
<div class="community-list-wrapper bottom" id="<%= newCommunities[i] %>">
<img class="community-list-icon bottom" src="<%= newCommunities[j].browser_icon %>">
<h2 class="community-list-title"><%= newCommunities[j].name %></h2>
<h4><%= newCommunities[j].followers %> followers</h4>
<div class="community-list-wrapper bottom" data-pjax="/communities/<%= newCommunities[i].community_id %>/new">
<img class="community-list-icon" src="<%= newCommunities[i].browser_thumbnail %>">
<h2 class="community-list-title"><%= newCommunities[i].name %></h2>
<h4><%= newCommunities[i].followers %> followers</h4>
</div>
</td>
</tr>
<% } else { %>
<tr>
<td>
<div class="community-list-wrapper" id="<%= newCommunities[i] %>">
<img class="community-list-icon" src="<%= newCommunities[j].browser_icon %>">
<h2 class="community-list-title"><%= newCommunities[j].name %></h2>
<h4><%= newCommunities[j].followers %> followers</h4>
<div class="community-list-wrapper" data-pjax="/communities/<%= newCommunities[i].community_id %>/new">
<img class="community-list-icon" src="<%= newCommunities[i].browser_thumbnail %>">
<h2 class="community-list-title"><%= newCommunities[i].name %></h2>
<h4><%= newCommunities[i].followers %> followers</h4>
</div>
</td>
</tr>

View File

@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3DS Testing</title>
<script src="/js/pjax.js"></script>
<script src="/js/juxt.js"></script>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
</head>
<body>
<div id="main">
<div class="top-screen" <%if(community.CTR_browser_header) {%>style="background: url('<%=community.CTR_browser_header%>')"<%}%>>
<div class="header-description">
<p>
</p>
</div>
<div id="" class="header-icon"><img class="community-page-info-icon" src="<%= community.browser_thumbnail %>"></div>
<h2 class="header-title"><%= community.name %></h2>
</div>
<div class="bottom-screen">
<div id="community-related-wrapper">
<div class="related-button-text">
Related
</div>
</div>
<%if(user.followed_communities.indexOf(community.id) !== -1){ %>
<div class="community-page-follow-button selected" id="<%= community.community_id %>" onclick="followCommunity(this)">
<p class="community-page-follow-button-text" style="color: #FFFFFF">Following</p>
</div>
<%} else {%>
<div class="community-page-follow-button" id="<%= community.community_id %>" onclick="followCommunity(this)" <%if(user.pid === 1000000000) {%> style="display: none" <%}%>>
<p class="community-page-follow-button-text">Follow</p>
</div>
<%}%>
<button class="community-page-new-post-button">New Post</button>
<div class="community-page-posts-wrapper">
<table class="community-page-posts-header">
<tbody>
<tr>
<td>
<h4 id="recent-tab" onclick="loadPosts(0)" class="community-page-posts-header-tab active">Recent posts</h4>
</td>
<td>
<h4 id="popular-tab" onclick="loadPosts(1)" class="community-page-posts-header-tab">Popular posts</h4>
</td>
<td>
<h4 id="verified-tab" onclick="loadPosts(2)" class="community-page-posts-header-tab">Verified posts</h4>
</td>
</tr>
</tbody>
</table>
<div id="community-posts-inner-body">
<% if(totalNumPosts === 0) {%>
<p class="no-posts-text">No Posts</p>
<%} else { %>
<button id="load-more-posts-button" onclick="loadCommunityPosts()">Load More Posts</button>
<% newPosts.forEach(function(post) { %>
<div class="post-user-info-wrapper" id="<%= post.id %>">
<%if(post.verified) {%>
<img class="community-page-post-user-icon verified" src="<%= post.mii_face_url %>" data-pjax="/users/show?pid=<%= post.pid %>">
<span class="community-page-verified-user-badge community-page-verified" style="" data-pjax="/users/show?pid=<%= post.pid %>"></span>
<%} else {%>
<img class="community-page-post-user-icon" src="<%= post.mii_face_url %>" data-pjax="/users/show?pid=<%= post.pid %>">
<span class="community-page-verified-user-badge community-page-verified" style="display: none;" data-pjax="/users/show?pid=<%= post.pid %>"></span>
<%}%>
<h2 class="community-page-post-username" data-pjax="/users/show?pid=<%= post.pid %>"><%= post.screen_name %></h2>
<h4 class="community-page-post-time-stamp"><%= moment(post.created_at).fromNow() %></h4>
<div class="community-page-post-yeah-button-wrapper <%if(user.likes.indexOf(post.id) !== -1){ %> selected <%}%>">
<div class="community-page-post-yeah-button" onclick="yeah(this.parentNode, '<%= post.id %>')"></div>
</div>
<div id="yeah-<%= post.id %>" class="community-page-post-yeah-count"><%= post.empathy_count %> Yeahs</div>
</div>
<div class="community-page-post-wrapper">
<% if(post.body !== '' && post.painting === '' && post.screenshot === '' && !post.url) { %>
<h3><%= post.body %></h3>
<%} else { %>
<% if(post.screenshot !== '') { %>
<img id="<%= post.id %>" class="community-page-post-screenshot" src="data:image/png;base64,<%= post.screenshot %>">
<%}%>
<% if(post.painting !== '') { %>
<img id="<%= post.id%>" class="community-page-post-painting" src="<%= post.painting_uri %>">
<%}%>
<% if(post.url) { %>
<h3 style="font-weight: bolder; color: #4F279B">Video Playback is not yet supported on the 3DS</h3>
<%}%>
<% if(post.body) { %>
<div class="community-page-post-text-overlay">
<h3><%= post.body %></h3>
</div>
<%}%>
<%}%>
</div>
<% }); %>
<%}%>
</div>
</div>
<div class="toolbar-padding"></div>
</div>
<body onload="onStart()"></body>
</body>
</html>

View File

@@ -38,12 +38,12 @@ h4 {
height: 30px;
}
.header-title {
margin: 165px 0 0;
position: absolute;
width: 350px;
height: 40px;
height: 44px;
z-index: 2;
padding-top: 11px;
margin: 167px 0 0;
padding-top: 9px;
padding-left: 50px;
white-space: nowrap;
text-align: left;
@@ -51,7 +51,7 @@ h4 {
font-weight: bolder;
font-size: 25px;
color: rgb(0 0 0);
background-color: rgba(0,0,0,0);
background-color: rgba(255, 255, 255, 0.6)
}
.header-icon {
@@ -163,12 +163,9 @@ h4 {
background-size: 50px 50px !important;
width: 50px;
height: 50px;
border-radius: 10px;
margin-top: 5px;
margin-right: 10px;
margin-left: 5px;
border-radius: 6px;
float: left;
margin-bottom: 15px;
margin: 5px 10px 15px 5px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TaqVUHOwg4pChdrIgKuIoVSyChdJWaNXB5NIvaGJIUlwcBdeCgx+LVQcXZ10dXAVB8APEydFJ0UVK/F9SaBHjwXE/3t173L0DhGaNqWZgHFA1y8gkE2K+sCIGXxFCAH7E0CsxU09lF3LwHF/38PH1Ls6zvM/9OfqVoskAn0g8y3TDIl4nnt60dM77xBFWkRTic+Ixgy5I/Mh12eU3zmWHBZ4ZMXKZOeIIsVjuYrmLWcVQiaeIo4qqUb6Qd1nhvMVZrdVZ+578heGitpzlOs0RJLGIFNIQIaOOKmqwEKdVI8VEhvYTHv5hx58ml0yuKhg55rEBFZLjB/+D392apckJNymcAHpebPtjFAjuAq2GbX8f23brBPA/A1dax7/RBGY+SW90tOgRMLANXFx3NHkPuNwBhp50yZAcyU9TKJWA9zP6pgIweAuEVt3e2vs4fQBy1NXSDXBwCMTKlL3m8e6+7t7+PdPu7wciuXKHjJUaWAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+QKBAMtDK8J1F8AAADsSURBVGje7dvNDYMwDIZhYmWtLsAizMQiXYDB2nsEEkj4J/brY3vpIzvkw1Lb9vn+lkIlS7ECDDhZ9bMP92NtGXBnD2RGGjBgwIABAwYMGLBmlrbMttbZvXtCx+8t4KINfbJCslg3hTvD2miJ+MM10S4d3o+1eS0ZxLK7I9QD7X6Gr9BaYy1WiCh7sm7dufLR0jp9SURsmiztCXXr8B2s5vmXSthwWXr6t6W7IMuoKZ5d9MjUPevoTvM+DHj2kR6vJuvxDpulywSP9PdwuZFO/9DyXgxwDwMGDBgwYMCAAQN+qRp/4wEMGPBM9Qf3C2DK9iBTlQAAAABJRU5ErkJggg==');
}
.community-list-icon.bottom {
@@ -474,15 +471,9 @@ h4 {
text-align: center;
width: 350px;
height: 640px;
/*margin: 40px 190px;*/
/*background-color: rgba(255,255,255,1);
border: 1.5px solid #d6d2d2;
border-radius: 10px;*/
}
.about-header {
/*margin-top: -420px;
margin-left: 175px;*/
text-align: center;
font-size: 20px;
padding-top: 180px;
@@ -514,7 +505,7 @@ h4 {
.community-page-info-icon {
width: 40px;
height: 40px;
border-radius: 10px;
border-radius: 6px;
}
.user-page-tab-table {
@@ -570,22 +561,285 @@ h4 {
display: inline-block;
}
.user-menu-button {
height: 37px;
width: 290px;
margin: 2px;
background: #673DB6;
color: white;
font-size: large;
border-width: 0;
border-radius: 6px;
}
.community-page-table-wrapper {
border-top: #D6D2D2;
border-width: 5px;
position: absolute;
padding-top: 115px;
margin-left: 17px;
position: relative;
margin-left: 10px;
margin-top: 10px;
margin-bottom: 10px;
line-height: 20px;
background-color: rgba(255,255,255,1);
border: 1.5px solid #d6d2d2;
border-radius: 10px;
}
.community-page-table-label {
color: #673DB6;
padding-left: 15px;
margin-top: 0;
}
.community-page-table-text {
color: black;
padding-left: 15px;
margin-top: -15px
margin-top: -20px;
}
.community-page-shaded-info-container {
z-index: 3;
width: 139px;
height: 36px;
background-color: rgb(233, 233, 233);
border: 1.5px solid #e9e9e9;
border-radius: 5px;
margin: 2px;
}
.community-page-follow-button {
width: 115px;
height: 25px;
position: relative;
margin-bottom: 10px;
margin-left: 239px;
background-color: white;
border-color: #1F8A42;
border-style: solid;
border-bottom-left-radius: 4px;
}
.community-page-follow-button.selected {
background-color: #1F8A42;
}
.community-page-follow-button > .community-page-follow-button-text {
color: #1F8A42;
font-size: 11px;
margin-top: 6px;
margin-left: 20px;
}
.community-page-follow-button.selected > .community-page-follow-button-text {
color: white;
font-size: 11px;
margin-top: 5px;
margin-left: 12px;
}
#community-related-wrapper {
width: 75px;
height: 25px;
position: absolute;
margin-bottom: 10px;
margin-left: -40px;
padding-left: 40px;
background-color: #1F8A42;
border-color: #1F8A42;
border-style: solid;
border-bottom-right-radius: 4px;
}
.related-button-text {
color: white;
font-size: 11px;
margin-top: 5px;
margin-left: 20px;
}
.community-page-posts-wrapper {
position: relative;
z-index: 3;
background-color: rgba(255,255,255,1);
border: 1.5px solid #d6d2d2;
border-radius: 10px;
margin-top: 15px;
margin-bottom: 30px;
min-height: 190px;
}
.community-page-posts-header {
margin-top: 25px;
}
.community-page-posts-header-tab {
padding-left: 14px;
padding-right: 10px;
font-size: 11px;
cursor: pointer;
}
.community-page-posts-header-tab.active {
color: #673DB6;
}
.community-page-post-wrapper {
padding-top: 10px;
}
.community-page-post-screenshot {
width: 280px;
border: 1.5px solid #d6d2d2;
border-radius: 6px;
margin-left: 15px;
}
.community-page-post-painting {
margin-left: 15px;
max-width: 280px;
}
.community-page-post-time-stamp {
margin-top: 5px;
}
.community-page-post-yeah-button-wrapper {
padding-bottom: 0;
margin-left: 244px;
margin-top: -46px;
background-repeat: no-repeat !important;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAA8CAYAAADSfGxZAAAABHNCSVQICAgIfAhkiAAABHpJREFUaEPtm8Fu20YQhv+hpAQ51X2CKIfIvVW5FW2M2sc4sK08QSSgZNJTmieo8gR2T02kAlaeIJQMO0czSFr0FudWKQXqPkGlU5BI4hRLiDQpU/LS4lKCQp4EaZfc/9uZ2eFol+C7jO9e3ifiMhMXCbTi/21ZPjO4S0wnzNSo/X7nuauLxIfy+vHK1cGHFyCsL4tgKR0M62P22r2GtdF1QDy4fXT82UFwSTGsZ282N+jh2mGZQftSBJe0EYErZNw+sojw/ZlGbtpDVOt/3D1ZRt0Pv3mZ55y9B9COZxSMV2SsHf7nD4zUpxtP/7xzuowQXE36t4dFLUNvz7yDu/Rg7Yj9op+93nTixrJf47pTEKMZT0GkIIIhIbWI1CJSi3BsIF01Rq6QgkhBBFPEuVhE6atf88NB5nqG0DPfG1LvMKX8/sow2/9aDD8zyL0zTyvdOLPdxEBsFX4racSPgNAah8Vgs9U2fvGLE8DYzuyCUAQoHxTOp2CckDZ8bP7148zvQspBiJnkK/19EJUkZtAiGlSEsO3V2iNiqoIwvTLG6NqgykHnB1Pi/hObKAVRulkrMpEo8siX+RhdgE9BVIwkjLnR7BiVSH18jZWC2CnU3k4Q9C8LsYwVInL8/sKLuccEJ54QowiiL8b72MDjg7a+d+G9QhooA7FdqFeJ8LP/mQx+pX3MlfyBTriOfbVfJZCIH+cv5p4NrTxu+k7Mgd0IAGF0SRvcukzMUALCCXKc/ScAgfG81dHLk2Zr62atrGnBEiEzv9M+5dYnrRCj+CPcyLMOZjRbHV0mHgWGogTEuCghqNUxLvR5f7+LILgqRqvRC08Vo9vs6F9GdQ8lILZXa3t+U4/iu8KaMMjmzb91S1bMzmpdLJ/X3fZEgxtR3UMVCItAXgGYhtiIIkwWgNtuu1A3ieAVX22me1GX0xTEiKYaEIV6gwj33Rmzba4cvDcaUWdatv34Mk0235JN3d1nKAGxtVr/SQN2fUKsZlvfkBUWpZ2TtGlnpXjRt9nWI1felYAIG1yUgCkLYrR8HvuTNpGrtNpG5P9slYAQQsYDmPgubhfZKdTEO0wgN7mMW4ixKQMRluzECSMMAjOetDp6Vdai/O2UgRAPOZfsjJ48q2WEQ5BL2iZBUgrCgRGSOs9iGZMgTEvFZSxEOYg4YaiCoDRGjM/CrJahEkKiIGaxDNUQEgdxGRhJQJgLiCgwkoIwNxAyMJKEMFcQ02AAELWIQJosW6iRWSrD2iSyfE4b3KTVxN9HNYS5W4QrdhqMJCAsDIhJbpIUhIUCMQ4jSQgLB0IMSNQyhkAx08+Zcf/ROy1WzT1YXjbKx90vBTEimoJIQQSdK7WI1CJSiwhdcFLXmOQaxtqRONjl7Tf4PA+uoHfuKBMzTLb5yTIfZbKzvEsEb3MJi6NM6eE2wDncJlzm/AG3uBPaxb2fsIbam8117wDslcEHsfnCd9pvcQcf18gEhE/ZayXvAKx7Y+EmNlNZ7Hz1B9C4HrwI92GgJ3bwasSNp6/vens4/gcrH5FO7PvkhAAAAABJRU5ErkJggg==');
background-size: 35px;
width: 50px;
height: 40px;
position: absolute;
}
.community-page-post-yeah-button-wrapper.selected {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAA8CAYAAADSfGxZAAAABHNCSVQICAgIfAhkiAAABBNJREFUaEPtmztMFEEYx78hEAOihRb4QEMBKAWKFCq5O0MwvgATTIROCRheBRDpgNaD7hK1ECFK0E4KNeHpKyYcQSl4FiZAYRSUK6BAlAJkzLfeHrvL3u3u7dxuOOZLLrmwM7Pz/eb/PdjLEpBYhbP3VgxAEQVynhA4Ir0WLd8phR8E6KdNgFcd3oLnol8Ev1Q63h6HmPUOAnA5WhzW4wcFeAObcRXtw5e+CSCqnH1eIODQMznaxlAK3nZvvotUOXvLgJCn0eagIX8oLSdVrr4BALhiaGL0DR4klc7eRUJIUvT5pt8jSqkPFUH1T4nekRyE/2w5CA5CHuZcEVwRXBGqpY+HBg8NHhr2hcbBQ/GAn7XfG/B9dkVXe5qQGAfJqfuEsfNzv+DP6rqueeEOiliOyHIlQd7NFEg/c2Db3mbGl2HC64MP3V9l1xBWcW0GHEvbL4CT2tLimgCx++EXwO+sjTkIPMnbjZmAILQMgXS1TgmO5RWnQGFZKuD8UIbKeNY6DRNDPq3lDV1nCgJP8u79s5rOSHeIji39XBNUYMRG+uehq3XayJSQY5mCaH7iUHUITxw/CYmxkJyqz2FpPkFI8XtjtzmCYfJeEV7hkmEGAmVdWJYm28fMxDK0NY3JEh1KH8diKKgZAuhqmdomfQy10qZTMiCoJnf5MJOcwQQEJjb3i1yZXyMDC4JDwSznWjKUNmbKLs/PrYCnbjRohUCI7u5cGYxJrw8eNY2FK4TAPCYglE6hQ/fKhzU3J52nBUFcDJVR7c4OrI2qaMh/p3kvrQFMQJTUZsikbiR2hR7jcALMjC9p7TVwHdUnLa/NJR9NhwcTEA0PzkF61la/4KkfNeSYbgL+gTUt2XDauVWe25rHTJdTDsIPlwkIzOY5V48GDhbrO9b5SJmyTLvvDOtu3YPtiQmIi8UpQmssGnaMnvrPEeGAPQWCkFr1hX7T92ICQm1zRhKmES+UasBexVNnHjoTEOiIMoHh31iHCPYdWHKlxiIscD1mINSaHZYw1CD0dM5CT+ecEUEFHcsMBN5B2eyIdzWrDDUIeps2vZSYgsCbqrXOZpQRDEKoVlyv89JxzEGwhGEVBKY5QnkKZpVhJYSIgjCjDKshRBxEODDsgGAJCCMw7IJgGQg9MOyEYCmIUDDwfxPlY3+9D2rCKZVqcyJSPkNtLlg1kc6xGoLlihCdDQXDDgi2gQgWJnZBsBWEEoadEGwHgRvAZxn4o8/kkC/iP/SGyl2WJ0tWWZ71OhyEnygHwUHIg4srgiuCK0K14PDQEEODv7gCIL64wl9lAhgkla6+IgLwknWntpPWowA3/r/uuKtfcKOvHw8VoBgAahz9JzZj6CQA7NlJJ8lgr6tk4+/JtpHrCwII0XbzK9H/AA3nZQ9WdEU6AAAAAElFTkSuQmCC');
background-size: 35px;
background-repeat: no-repeat !important;
}
.community-page-post-yeah-button {
cursor: pointer;
position: absolute;
height: 32px;
width: 36px;
margin-bottom: 0;
padding-bottom: 0;
}
.community-page-post-yeah-count {
color: #673DB6;
margin-top: -40px;
font-weight: bold;
font-size: small;
position: absolute;
text-align: right;
height: 33px;
width: 240px;
}
.community-page-post-user-info-wrapper {
background-color: rgba(255,255,255,1);
margin-bottom: 15px;
margin-left: 80px;
min-width: 520px;
}
.community-page-post-user-icon {
width: 50px;
border-radius: 4px;
margin-right: 5px;
float: left;
}
.community-page-verified-user-badge {
position: absolute;
min-width: 1px;
height: 1px;
margin-left: 40px;
margin-top: -6px;
padding: 6px 5px 4px 5px;
border: 3px solid #673DB6;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAALCAYAAABPhbxiAAAABHNCSVQICAgIfAhkiAAAAI5JREFUKFOV0lERgzAQRdH7FBQpSKgTpgrQgIPioE7AAg4qAQfLLE0YyBBC+cgH2TObt4n44zOzCmiBXnddQANQA90tmKAJeBbhKZJmhY1GUp8eO4e8zuE7BP5IekV8hSL0sCPwAFZcQiv0xcwOOEzO//0GIc1pjG04Cfa6LNo67nLFzt9cp1hbvI7cA1kA5mlGowbMjrkAAAAASUVORK5CYII=');
background-color: #673DB6;
background-position: 1.5px 3px;
background-size: 79%;
background-repeat: no-repeat !important;
font-size: 20px;
font-weight: bold;
text-align: center;
line-height: 18px;
-webkit-border-radius: 20px;
}
.community-page-post-username {
padding-top: 5px;
font-size: small;
margin-bottom: 0;
}
.community-page-post-text-overlay {
position: relative;
z-index: 5;
width: 280px;
margin-top: -10px;
}
.no-posts-text {
margin-left: 40%;
color: rgba(113,141,148,1);
padding-top: 24px;
}
h3 {
padding-left: 20px;
}
iframe {
border: 1.5px solid #d6d2d2;
border-radius: 10px;
background-color: black;
margin-left: 15px;
}
#load-more-posts-button {
position: absolute;
height: 25px;
width: 175px;
background: #673DB6;
color: white;
font-size: small;
border-width: 0;
border-radius: 15px;
bottom: -30px;
left: 70px;
}
.community-page-new-post-button {
position: absolute;
margin-left: 100px;
margin-top: -41px;
height: 31px;
width: 120px;
background: #1F8A42;
color: white;
border-width: 0;
border-radius: 0 0 4px 4px;
}
.post-user-info-wrapper {
margin-left: 15px
}
.community-page-post-wrapper > h3 {
font-size: small;
font-weight: normal;
margin-top: -5px;
}
.community-page-post-text-overlay > h3 {
font-size: small;
font-weight: normal;
}

View File

@@ -1,74 +0,0 @@
<div class="top-screen">
<div class="header-description">
<p>
Check out the communities for the games that you play or games that you're curious about!
</p>
</div>
<div id="headers-communities-icon" class="header-icon"></div>
<h2 class="header-title">Communities</h2>
</div>
<div class="bottom-screen">
<div class="search-container">
<div id="search-icon"></div>
<input id="search-bar" type="text" placeholder="Search communities..." name="search" onclick="searchCommunities(this)" readonly>
</div>
<div class="communities-wrapper" id="popular-communities">
<h1 class="communities-header">Popular Places</h1>
<table>
<tbody>
<% for(var i = 0; i < popularCommunities.length; i++) {%>
<% if(i === popularCommunities.length - 1) { %>
<tr>
<td>
<div class="community-list-wrapper bottom" id="<%= popularCommunities[i].id %>">
<img class="community-list-icon bottom" src="<%= popularCommunities[i].browser_icon %>">
<h2 class="community-list-title"><%= popularCommunities[i].name %></h2>
<h4><%= popularCommunities[i].followers %> followers</h4>
</div>
</td>
</tr>
<% } else { %>
<tr>
<td>
<div class="community-list-wrapper" id="<%= popularCommunities[i].id %>">
<img class="community-list-icon" src="<%= popularCommunities[i].browser_icon %>">
<h2 class="community-list-title"><%= popularCommunities[i].name %></h2>
<h4><%= popularCommunities[i].followers %> followers</h4>
</div>
</td>
</tr>
<% }} %>
</tbody>
</table>
</div>
<div class="communities-wrapper" id="new-communities">
<h1 class="communities-header">New Communities</h1>
<table>
<tbody>
<% for(var j = 0; j < newCommunities.length; j++) {%>
<% if(j === newCommunities.length - 1) { %>
<tr>
<td>
<div class="community-list-wrapper bottom" id="<%= newCommunities[i] %>">
<img class="community-list-icon bottom" src="<%= newCommunities[j].browser_icon %>">
<h2 class="community-list-title"><%= newCommunities[j].name %></h2>
<h4><%= newCommunities[j].followers %> followers</h4>
</div>
</td>
</tr>
<% } else { %>
<tr>
<td>
<div class="community-list-wrapper" id="<%= newCommunities[i] %>">
<img class="community-list-icon" src="<%= newCommunities[j].browser_icon %>">
<h2 class="community-list-title"><%= newCommunities[j].name %></h2>
<h4><%= newCommunities[j].followers %> followers</h4>
</div>
</td>
</tr>
<% }} %>
</tbody>
</table>
</div>
<div class="toolbar-padding"></div>
</div>

View File

@@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8">
<title>3DS Testing</title>
<script src="/js/pjax.js"></script>
<script src="/js/juxt.js"></script>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap" rel="stylesheet">
</head>
<body>
<div id="main">

View File

@@ -1,59 +0,0 @@
<div class="top-screen">
<div class="header-description">
<p>
</p>
</div>
<div id="" class="header-icon"><img class="community-page-info-icon" src="<%= user.mii_face_url %>"></div>
<h2 class="header-title"><%= user.user_id %></h2>
</div>
<div class="bottom-screen">
<table class="community-page-table-wrapper">
<tbody>
<tr>
</tr>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Country</h4>
<h4 class="community-page-table-text">N/A</h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Birthday</h4>
<h4 class="community-page-table-text">N/A</h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Game experience</h4>
<h4 class="community-page-table-text">
<%if(user.game_skill === 0) {%>
Beginner
<%} else if(user.game_skill === 1) {%>
Intermediate
<%} else if(user.game_skill === 2) {%>
Expert
<%} else {%>
N/A
<%}%>
</h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Yeahs</h4>
<h4 class="community-page-table-text">N/A</h4>
</div>
</td>
</tr>
</tbody>
</table>
<div class="communities-wrapper" id="popular-communities">
<h1 class="communities-header">Popular Places</h1>
</div>
<div class="communities-wrapper" id="new-communities">
<h1 class="communities-header">New Communities</h1>
</div>
<div class="toolbar-padding"></div>
</div>

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 835 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
/* pjax CTR
Written By: Jemma
*/
var hist = [window.location];
window.pjax = {
loadUrl: function(url) {
cave.transition_begin();
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
hist.push(url);
document.getElementById("main").innerHTML = this.responseText;
cave.transition_end();
onPageLoad();
}
else if(this.readyState === 4) {
cave.error_callFreeErrorViewer(5983000 + this.status, 'Error: "' + this.statusText + '"\nPlease send code to Jemma on Discord with what you were doing ' + this.readyState);
cave.transition_end();
}
};
xhttp.open("GET", url, true);
xhttp.send();
},
back: function() {
if(!this.canGoBack())
return;
cave.transition_begin();
hist.pop();
var url = hist[hist.length - 1]
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
document.getElementById("main").innerHTML = this.responseText;
cave.transition_end();
onPageLoad();
}
else if(this.readyState === 4) {
cave.error_callFreeErrorViewer(5983000 + this.status, 'Error: "' + this.statusText + '"\nPlease send code to Jemma on Discord with what you were doing ' + this.readyState);
cave.transition_end();
}
};
xhttp.open("GET", url, true);
xhttp.send();
},
canGoBack: function () {
//alert(hist.length);
if(hist.length <= 1) {
cave.toolbar_setButtonType(0);
return false;
}
else {
cave.toolbar_setButtonType(1);
return true;
}
}
};

View File

@@ -0,0 +1,38 @@
<% newPosts.forEach(function(post) { %>
<div class="post-user-info-wrapper" id="<%= post.id %>">
<%if(post.verified) {%>
<img class="community-page-post-user-icon verified" src="<%= post.mii_face_url %>" data-pjax="/users/show?pid=<%= post.pid %>">
<span class="community-page-verified-user-badge community-page-verified" style="" data-pjax="/users/show?pid=<%= post.pid %>"></span>
<%} else {%>
<img class="community-page-post-user-icon" src="<%= post.mii_face_url %>" data-pjax="/users/show?pid=<%= post.pid %>">
<span class="community-page-verified-user-badge community-page-verified" style="display: none;" data-pjax="/users/show?pid=<%= post.pid %>"></span>
<%}%>
<h2 class="community-page-post-username" data-pjax="/users/show?pid=<%= post.pid %>"><%= post.screen_name %></h2>
<h4 class="community-page-post-time-stamp"><%= moment(post.created_at).fromNow() %></h4>
<div class="community-page-post-yeah-button-wrapper <%if(user.likes.indexOf(post.id) !== -1){ %> selected <%}%>">
<div class="community-page-post-yeah-button" onclick="yeah(this.parentNode, '<%= post.id %>')"></div>
</div>
<div id="yeah-<%= post.id %>" class="community-page-post-yeah-count"><%= post.empathy_count %> Yeahs</div>
</div>
<div class="community-page-post-wrapper">
<% if(post.body !== '' && post.painting === '' && post.screenshot === '' && !post.url) { %>
<h3><%= post.body %></h3>
<%} else { %>
<% if(post.screenshot !== '') { %>
<img id="<%= post.id %>" class="community-page-post-screenshot" src="data:image/png;base64,<%= post.screenshot %>">
<%}%>
<% if(post.painting !== '') { %>
<img id="<%= post.id%>" class="community-page-post-painting" src="<%= post.painting_uri %>">
<%}%>
<% if(post.url) { %>
<h3 style="font-weight: bolder; color: #4F279B">Video Playback is not yet supported on the 3DS</h3>
<%}%>
<% if(post.body) { %>
<div class="community-page-post-text-overlay">
<h3><%= post.body %></h3>
</div>
<%}%>
<%}%>
</div>
<% }); %>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3DS Testing</title>
<script src="/js/pjax.js"></script>
<script src="/js/juxt.js"></script>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
</head>
<body>
<div id="main">
<div class="top-screen">
<div class="header-description">
<p>
Here you can change your profile and settings. You can also search for other users here.
</p>
</div>
<div id="" class="header-icon"><img class="community-page-info-icon" src="<%= user.pfp_uri %>"></div>
<h2 class="header-title">User Menu</h2>
</div>
<div class="bottom-screen">
<div class="communities-wrapper" id="popular-communities" style="margin-top: 15px">
<table>
<tbody>
<tr>
<td>
<button class="user-menu-button" data-pjax="/users/me">Profile</button>
</td>
</tr>
<tr>
<td>
<button class="user-menu-button" data-pjax="/users/me">Search</button>
</td>
</tr>
<tr>
<td>
<button class="user-menu-button" data-pjax="/users/me">Juxt Announcements</button>
</td>
</tr>
<tr>
<td>
<button class="user-menu-button" data-pjax="/users/me">Settings/Other</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="toolbar-padding"></div>
</div>
</div>
<body onload="onStart()"></body>
</body>
</html>

View File

@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3DS Testing</title>
<script src="/js/pjax.js"></script>
<script src="/js/juxt.js"></script>
<link rel="stylesheet" type="text/css" href="/css/juxt.css">
</head>
<body>
<div id="main">
<div class="top-screen">
<div class="header-description">
<p>
</p>
</div>
<div id="" class="header-icon"><img class="community-page-info-icon" src="<%= user.pfp_uri %>"></div>
<h2 class="header-title"><%= user.user_id %></h2>
</div>
<div class="bottom-screen">
<%if(user.profile_comment_visibility && user.profile_comment){%>
<div class="communities-wrapper" id="popular-communities" style="margin-top: 10px">
<p class="communities-header"><%=user.profile_comment%></p>
</div>
<%}%>
<table class="community-page-table-wrapper">
<tbody>
<tr>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Country</h4>
<h4 class="community-page-table-text"><%if(user.country_visibility){%><%=user.country%><%}else {%>Private<%}%></h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Birthday</h4>
<h4 class="community-page-table-text"><%if(user.birthday_visibility){%>N/A<%}else {%>Private<%}%></h4>
</div>
</td>
</tr>
<tr>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Game experience</h4>
<h4 class="community-page-table-text">
<%if(user.game_skill === 0) {%>
Beginner
<%} else if(user.game_skill === 1) {%>
Intermediate
<%} else if(user.game_skill === 2) {%>
Expert
<%} else {%>
N/A
<%}%>
</h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Yeahs</h4>
<h4 class="community-page-table-text">N/A</h4>
</div>
</td>
</tr>
</tbody>
</table>
<div class="communities-wrapper" id="popular-communities">
<h1 class="communities-header">Popular Places</h1>
</div>
<div class="communities-wrapper" id="new-communities">
<h1 class="communities-header">New Communities</h1>
</div>
<div class="toolbar-padding"></div>
</div>
<body onload="onStart()"></body>
</body>
</html>

View File

@@ -226,7 +226,7 @@
<img id="<%= post.id%>" class="community-page-post-painting" src="<%= post.painting_uri %>">
<%}%>
<% if(post.url) { %>
<iframe width="760" height="427.5" src="<%= post.url %>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<h3 style="font-weight: bolder; color: #4F279B">Video Playback is not yet supported on the 3DS</h3>
<%}%>
<% if(post.body) { %>
<div class="community-page-post-text-overlay">

View File

@@ -71,7 +71,7 @@ ul, ol, menu, li {
display: none;
}
#nav-bar span {
#nav-bar span {
display: block;
margin-top: 5px;
}
@@ -1283,9 +1283,6 @@ iframe {
width: 940px;
height: 640px;
margin: 40px 190px;
/*background-color: rgba(255,255,255,1);
border: 1.5px solid #d6d2d2;
border-radius: 10px;*/
}
.about-header {

View File

@@ -724,12 +724,12 @@ var bButtonCheck = setInterval(function() {
}, 250);
/*Debugging*/
if (typeof wiiu === 'undefined') {
window.gamepad = {
update: function () {
return true;
},
hold: function () {
return 0;
window.wiiu = {
gamepad: {
update: function () {
return true;
},
hold: 0
}
};
}

View File

@@ -50,13 +50,13 @@
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Country</h4>
<h4 class="community-page-table-text">N/A</h4>
<h4 class="community-page-table-text"><%if(user.country_visibility){%><%=user.country%><%}else {%>Private<%}%></h4>
</div>
</td>
<td>
<div class="community-page-shaded-info-container">
<h4 class="community-page-table-label">Birthday</h4>
<h4 class="community-page-table-text">N/A</h4>
<h4 class="community-page-table-text"><%if(user.birthday_visibility){%>N/A<%}else {%>Private<%}%></h4>
</div>
</td>
<td>