More instant frontpage-loading, and sorting frontpages on the backend for consistency

This commit is contained in:
Kasper Rynning-Tønnesen
2018-08-10 11:51:28 +02:00
parent 7d6a54ae10
commit dfbce195a0
11 changed files with 147 additions and 90 deletions

View File

@@ -117,7 +117,8 @@ router.route('/api/frontpages').get(function(req, res) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header({"Content-Type": "application/json"});
db.collection("frontpage_lists").find({frontpage: true, count: {$gt: 0}}, function(err, docs) {
Frontpage.get_frontpage_lists(function(err, docs) {
//db.collection("frontpage_lists").find({frontpage: true, count: {$gt: 0}}, function(err, docs) {
db.collection("connected_users").find({"_id": "total_users"}, function(err, tot) {
var to_return = error.no_error;
to_return.results = {channels: docs, viewers: tot[0].total_users.length};