mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
removed the other api_method routes
This commit is contained in:
@@ -51,7 +51,6 @@ var user = require('./../user.js'),
|
||||
|
||||
}());
|
||||
|
||||
//todo consolidate.
|
||||
app.get('/admin', Admin.isAdmin, function(req, res) {
|
||||
res.send(Admin.build_header(res) + app.create_route('admin/index') + templates['admin/footer']);
|
||||
});
|
||||
@@ -60,64 +59,66 @@ var user = require('./../user.js'),
|
||||
res.send(Admin.build_header(res) + app.create_route('admin/index') + templates['admin/footer']);
|
||||
});
|
||||
|
||||
|
||||
function api_method(req, res) {
|
||||
switch(req.params.method) {
|
||||
case 'index':
|
||||
app.get('/api/admin/index', function(req, res) {
|
||||
res.json({version:pkg.version});
|
||||
break;
|
||||
case 'users' :
|
||||
if (req.params.tab == 'search') {
|
||||
});
|
||||
|
||||
app.get('/api/admin/users/search', function(req, res) {
|
||||
res.json({search_display: 'block', users: []});
|
||||
}
|
||||
else if(req.params.tab == 'latest') {
|
||||
});
|
||||
|
||||
app.get('/api/admin/users/latest', function(req, res) {
|
||||
user.getUserList(function(data) {
|
||||
data = data.sort(function(a, b) {
|
||||
return b.joindate - a.joindate;
|
||||
});
|
||||
res.json({search_display: 'none', users:data, yourid:req.user.uid});
|
||||
});
|
||||
}
|
||||
else if(req.params.tab == 'sort-posts') {
|
||||
});
|
||||
|
||||
app.get('/api/admin/users/sort-posts', function(req, res) {
|
||||
user.getUserList(function(data) {
|
||||
data = data.sort(function(a, b) {
|
||||
return b.postcount - a.postcount;
|
||||
});
|
||||
res.json({search_display: 'none', users:data, yourid:req.user.uid});
|
||||
});
|
||||
}
|
||||
else if(req.params.tab == 'sort-reputation') {
|
||||
});
|
||||
|
||||
app.get('/api/admin/users/sort-reputation', function(req, res) {
|
||||
user.getUserList(function(data) {
|
||||
data = data.sort(function(a, b) {
|
||||
return b.reputation - a.reputation;
|
||||
});
|
||||
res.json({search_display: 'none', users:data, yourid:req.user.uid});
|
||||
});
|
||||
}
|
||||
else {
|
||||
});
|
||||
|
||||
app.get('/api/admin/users', function(req, res) {
|
||||
user.getUserList(function(data) {
|
||||
res.json({search_display: 'none', users:data, yourid:req.user.uid});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case 'categories':
|
||||
if (req.params.tab == 'disabled') {
|
||||
res.json({categories: []});
|
||||
} else {
|
||||
app.get('/api/admin/categories', function(req, res) {
|
||||
categories.getAllCategories(function(data) {
|
||||
res.json(data);
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'topics':
|
||||
});
|
||||
|
||||
app.get('/api/admin/categories/disabled', function(req, res) {
|
||||
res.json({categories: []});
|
||||
});
|
||||
|
||||
app.get('/api/admin/topics', function(req, res) {
|
||||
topics.getAllTopics(10, null, function(topics) {
|
||||
res.json({
|
||||
topics: topics
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'redis':
|
||||
});
|
||||
|
||||
app.get('/api/admin/redis', function(req, res) {
|
||||
RDB.info(function(err, data) {
|
||||
data = data.split("\r\n");
|
||||
var finalData = {};
|
||||
@@ -132,16 +133,16 @@ var user = require('./../user.js'),
|
||||
for(var key in jsonObject) {
|
||||
finalData[key] = jsonObject[key];
|
||||
}
|
||||
}catch(err){
|
||||
|
||||
} catch(err){
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res.json(finalData);
|
||||
});
|
||||
break;
|
||||
case 'plugins':
|
||||
});
|
||||
|
||||
app.get('/api/admin/plugins', function(req, res) {
|
||||
plugins.showInstalled(function(err, plugins) {
|
||||
if (err || !Array.isArray(plugins)) plugins = [];
|
||||
|
||||
@@ -149,17 +150,35 @@ var user = require('./../user.js'),
|
||||
plugins: plugins
|
||||
});
|
||||
});
|
||||
break;
|
||||
default :
|
||||
res.json({});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/admin/:method/:tab?*', api_method);
|
||||
app.get('/api/admin/:method*', api_method);
|
||||
app.get('/api/admin/settings', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/motd', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/themes', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/twitter', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/facebook', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/gplus', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
app.get('/api/admin/testing/categories', function(req, res) {
|
||||
res.json(200, {});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,20 +24,13 @@ var RDB = require('../redis.js');
|
||||
res.send(templates['install/header'] + app.create_route('install/basic') + templates['install/footer']);
|
||||
});
|
||||
|
||||
|
||||
function api_method(req, res) {
|
||||
switch(req.params.method) {
|
||||
case 'basic' :
|
||||
app.get('/api/install/basic', function(req, res) {
|
||||
res.send('{}');
|
||||
break;
|
||||
});
|
||||
|
||||
default :
|
||||
app.get('/api/install', function(req, res) {
|
||||
res.send('{}');
|
||||
}
|
||||
}
|
||||
|
||||
app.get('/api/install/:method/:tab?*', api_method);
|
||||
app.get('/api/install/:method*', api_method);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user