Compare commits

...

36 Commits

Author SHA1 Message Date
Barış Soner Uşaklı
6856a5e66b Merge pull request #3657 from davidvuong/v0.7.x
Add API endpoints for topics, categories, and posts
2015-09-23 21:10:34 -04:00
David Vuong
5705012bcd Add API endpoints for topics, categories, and posts
ref: f3b6a5fbb9
discussion: https://community.nodebb.org/topic/6535/how-can-i-read-a-resource-only-by-their-id-cid-uid-tid-etc-rather-than-the-name-or-name-id/8
2015-09-23 16:35:36 +10:00
Julian Lam
6e7a817fa4 Fix upgrade crash if groups have 0 users
@barisusakli
2015-09-01 10:40:22 -04:00
psychobunny
f7648c2ed7 closes #3490 2015-08-27 15:01:05 -04:00
Barış Soner Uşaklı
bb25e2690e https://github.com/NodeBB/NodeBB/issues/3465 2015-08-25 13:53:51 -04:00
Barış Soner Uşaklı
fe11e55c16 fix custom homepage 2015-08-18 18:43:50 -04:00
Julian Lam
4de7529241 Fix ./nodebb upgrade process to not use programmatic npm
- Closes #3451
- Apparently, programmatically invoking npm is like opening Pandora's
box. No thanks.
2015-08-18 16:47:05 -04:00
Julian Lam
944fc6e2f8 0.7.3 2015-08-18 11:48:43 -04:00
Julian Lam
ffa0544036 updated shrinkwrap file 2015-08-18 11:43:06 -04:00
Julian Lam
2a99721d01 Merge branch 'master' into v0.7.x 2015-08-18 11:35:41 -04:00
Julian Lam
6fff745c5c updated shrinkwrap file 2015-08-17 17:12:59 -04:00
Julian Lam
c93781c38a Merge branch 'master' into v0.7.x 2015-08-17 17:10:06 -04:00
Barış Soner Uşaklı
4bcf7792f8 xss fix 2015-07-30 14:39:28 -04:00
Julian Lam
93fb36b99d re-generated shrinkwrap file 2015-07-29 12:36:58 -04:00
Julian Lam
56b79a974a 0.7.2 2015-07-28 10:40:21 -04:00
Julian Lam
418b9bf02f Merge branch 'master' into v0.7.x 2015-07-28 10:37:50 -04:00
Julian Lam
258d562c3e updated shrinkwrap file 2015-07-28 10:34:46 -04:00
Julian Lam
f1b097ded6 Merge branch 'master' into v0.7.x 2015-07-28 10:29:42 -04:00
Julian Lam
ef750e2ebd updated shrinkwrap file 2015-07-21 15:26:24 -04:00
Julian Lam
67d9209b99 fixed regression of pagination caused by changes to ajaxification logic 2015-07-21 15:25:12 -04:00
Julian Lam
98c1390e7f updated theme minvers 2015-07-21 15:25:06 -04:00
Julian Lam
a3d17d14fd 0.7.1 2015-07-21 14:55:29 -04:00
Julian Lam
307eb19d01 updated shrinkwrap file 2015-07-21 14:54:27 -04:00
Julian Lam
f475d6e3b8 switching default theme on installation to Persona, from Lavender 2015-07-21 14:54:14 -04:00
Julian Lam
b4465b7df1 Merge branch 'master' into v0.7.x 2015-07-21 14:45:45 -04:00
Julian Lam
aa001b5926 Merge pull request #3287 from exo-do/v0.7.x
Update user.json
2015-07-02 22:52:48 -04:00
.marty
5c253c1efa Update user.json
fixed some missing translations
2015-07-03 04:42:47 +02:00
Barış Soner Uşaklı
59b14669c4 fix composer on mobile 2015-06-29 13:32:01 -04:00
Barış Soner Uşaklı
3e386e7668 fix xss on website 2015-06-21 02:15:34 -04:00
Julian Lam
43b90c5679 fixed #3218
Conflicts:
	src/database/mongo.js
2015-06-05 13:35:58 -04:00
Barış Soner Uşaklı
58b8c32fe9 crash fix 2015-05-29 00:47:37 -04:00
Julian Lam
1b88a6a523 upped mentions minver 2015-05-28 12:16:59 -04:00
Julian Lam
8ecd90729e latest translations and fallbacks 2015-05-28 12:16:31 -04:00
barisusakli
a5b8a656e9 fix minSchemaDate 2015-05-23 19:30:56 -04:00
Julian Lam
2cae7995e7 0.7.0 2015-05-23 18:56:50 -04:00
Julian Lam
19ca796915 🚀 2015-05-23 18:56:42 -04:00
14 changed files with 3676 additions and 63 deletions

18
nodebb
View File

@@ -5,8 +5,7 @@ var colors = require('colors'),
argv = require('minimist')(process.argv.slice(2)),
fs = require('fs'),
async = require('async'),
touch = require('touch'),
npm = require('npm');
touch = require('touch');
var getRunningPid = function(callback) {
fs.readFile(__dirname + '/pidfile', {
@@ -119,15 +118,12 @@ switch(process.argv[2]) {
case 'upgrade':
async.series([
function(next) {
process.stdout.write('1. '.bold + 'Bringing base dependencies up to date\n'.yellow);
npm.load({
loglevel: 'silent'
}, function() {
npm.commands.install(next);
});
process.stdout.write('1. '.bold + 'Bringing base dependencies up to date... '.yellow);
require('child_process').execFile('/usr/bin/env', ['npm', 'i', '--production'], next);
},
function(next) {
process.stdout.write('2. '.bold + 'Updating NodeBB data store schema\n'.yellow);
process.stdout.write('OK\n'.green);
process.stdout.write('2. '.bold + 'Updating NodeBB data store schema.\n'.yellow);
var upgradeProc = cproc.fork('app.js', ['--upgrade'], {
cwd: __dirname,
silent: false
@@ -136,7 +132,7 @@ switch(process.argv[2]) {
upgradeProc.on('close', next)
},
function(next) {
process.stdout.write('3. '.bold + 'Storing upgrade date in "package.json"\n'.yellow);
process.stdout.write('3. '.bold + 'Storing upgrade date in "package.json"... '.yellow);
touch(__dirname + '/package.json', {}, next);
}
], function(err) {
@@ -145,6 +141,8 @@ switch(process.argv[2]) {
} else {
var message = 'NodeBB Upgrade Complete!',
spaces = new Array(Math.floor(process.stdout.columns / 2) - (message.length / 2) + 1).join(' ');
process.stdout.write('OK\n'.green);
process.stdout.write('\n' + spaces + message.green.bold + '\n\n'.reset);
}
});

3607
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "nodebb",
"license": "GPL-3.0",
"description": "NodeBB Forum",
"version": "0.7.3-dev",
"version": "0.7.3",
"homepage": "http://www.nodebb.org",
"repository": {
"type": "git",

View File

@@ -85,4 +85,4 @@
"follow_topics_you_create": "Seguir publicaciones que creas",
"grouptitle": "Selecciona el título del grupo que deseas visualizar",
"no-group-title": "Sin título de grupo"
}
}

View File

@@ -28,7 +28,7 @@
"header.tags": "话题",
"header.popular": "热门",
"header.users": "会员",
"header.groups": "组",
"header.groups": "组",
"header.chats": "聊天",
"header.notifications": "通知",
"header.search": "搜索",

View File

@@ -25,7 +25,7 @@
"watched": "已订阅",
"followers": "粉丝",
"following": "关注",
"aboutme": "About me",
"aboutme": "关于我",
"signature": "签名档",
"gravatar": "头像",
"birthday": "生日",

View File

@@ -9,7 +9,7 @@
var languages = {},
regexes = {
match: /\[\[\w+:[^\]]+?\]\]/g,
match: /\[\[\w+:.*?\]\]/g,
split: /[,][\s]*/,
replace: /\]+$/
};

View File

@@ -1,12 +1,18 @@
"use strict";
var meta = require('./../meta'),
user = require('./../user'),
plugins = require('./../plugins'),
widgets = require('../widgets'),
var async = require('async'),
validator = require('validator'),
nconf = require('nconf');
nconf = require('nconf'),
meta = require('../meta'),
user = require('../user'),
posts = require('../posts'),
topics = require('../topics'),
categories = require('../categories'),
privileges = require('../privileges'),
plugins = require('../plugins'),
helpers = require('./helpers'),
widgets = require('../widgets');
var apiController = {};
@@ -126,4 +132,37 @@ apiController.renderWidgets = function(req, res, next) {
});
};
apiController.getObject = function(req, res, next) {
var methods = {
post: {
canRead: privileges.posts.can,
data: posts.getPostData
},
topic: {
canRead: privileges.topics.can,
data: topics.getTopicData
},
category: {
canRead: privileges.categories.can,
data: categories.getCategoryData
}
};
if (!methods[req.params.type]) {
return next();
}
async.parallel({
canRead: async.apply(methods[req.params.type].canRead, 'read', req.params.id, req.uid),
data: async.apply(methods[req.params.type].data, req.params.id)
}, function (err, results) {
if (err || !results.data) {
return next(err);
}
if (!results.canRead) {
return helpers.notAllowed(req, res);
}
res.json(results.data);
});
};
module.exports = apiController;

View File

@@ -15,7 +15,6 @@ var async = require('async'),
helpers = require('./helpers');
var Controllers = {
posts: require('./posts'),
topics: require('./topics'),
categories: require('./categories'),
unread: require('./unread'),
@@ -42,9 +41,9 @@ Controllers.home = function(req, res, next) {
if (route === 'categories') {
Controllers.categories.list(req, res, next);
} else if (route === 'recent') {
Controllers.categories.recent(req, res, next);
Controllers.recent.get(req, res, next);
} else if (route === 'popular') {
Controllers.categories.popular(req, res, next);
Controllers.popular.get(req, res, next);
} else {
next();
}

View File

@@ -1,35 +0,0 @@
"use strict";
var async = require('async'),
posts = require('../posts'),
privileges = require('../privileges'),
helpers = require('./helpers'),
postsController = {};
postsController.getPost = function(req, res, next) {
async.parallel({
canRead: function(next) {
privileges.posts.can('read', req.params.pid, req.uid, next);
},
postData: function(next) {
posts.getPostData(req.params.pid, next);
}
}, function(err, results) {
if (err) {
return next(err);
}
if (!results.postData) {
return helpers.notFound(req, res);
}
if (!results.canRead) {
return helpers.notAllowed(req, res);
}
res.json(results.postData);
});
};
module.exports = postsController;

View File

@@ -15,7 +15,10 @@ module.exports = function(app, middleware, controllers) {
router.get('/widgets/render', controllers.api.renderWidgets);
router.get('/user/uid/:uid', middleware.checkGlobalPrivacySettings, controllers.accounts.getUserByUID);
router.get('/post/:pid', controllers.posts.getPost);
router.get('/:type/pid/:id', controllers.api.getObject);
router.get('/:type/tid/:id', controllers.api.getObject);
router.get('/:type/cid/:id', controllers.api.getObject);
router.get('/categories/:cid/moderators', getModerators);
router.get('/recent/posts/:term?', getRecentPosts);
router.get('/unread/total', middleware.authenticate, controllers.unread.unreadTotal);

View File

@@ -118,4 +118,4 @@ module.exports = function(Topics) {
Topics.setTopicField(tid, 'teaserPid', pid, callback);
});
};
};
};

View File

@@ -403,7 +403,7 @@ Upgrade.upgrade = function(callback) {
}
async.parallel([
async.apply(db.sortedSetAdd, 'groups:visible:createtime', groupData.createtime, groupName),
async.apply(db.sortedSetAdd, 'groups:visible:memberCount', groupData.memberCount, groupName),
async.apply(db.sortedSetAdd, 'groups:visible:memberCount', groupData.memberCount || 0, groupName),
async.apply(db.sortedSetAdd, 'groups:visible:name', 0, groupName.toLowerCase() + ':' + groupName)
], next);
});

View File

@@ -136,7 +136,9 @@ module.exports = function(User) {
if (!user) {
return next(null, user);
}
// temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392
user.ip = user.ip.replace('::ffff:', '');
request('http://api.stopforumspam.org/api?ip=' + user.ip + '&email=' + user.email + '&username=' + user.username + '&f=json', function (err, response, body) {
if (err) {
return next(null, user);