diff --git a/src/controllers/api/channel/listController.js b/src/controllers/api/channel/listController.js
index e55ea61..378df55 100644
--- a/src/controllers/api/channel/listController.js
+++ b/src/controllers/api/channel/listController.js
@@ -21,7 +21,6 @@ const {exceptionHandler, errorHandler} = require('../../../utils/loggerUtils');
//api account functions
module.exports.get = async function(req, res){
try{
- //We pull this from the DB insteada activeChannels because we want to list channels that arent active after server restarts
const chanGuide = await channelModel.getChannelList();
res.status(200);
diff --git a/src/controllers/indexController.js b/src/controllers/indexController.js
index 7c96e82..537656f 100644
--- a/src/controllers/indexController.js
+++ b/src/controllers/indexController.js
@@ -25,7 +25,8 @@ const {exceptionHandler, errorHandler} = require('../utils/loggerUtils');
//root index functions
module.exports.get = async function(req, res){
try{
- return navRender.render(req, res, 'index', {unescape: validator.unescape})
+ const chanGuide = await channelModel.getChannelList();
+ return navRender.render(req, res, 'index', {chanGuide: chanGuide, unescape: validator.unescape})
}catch(err){
return exceptionHandler(res, err);
}
diff --git a/src/routers/api/channelRouter.js b/src/routers/api/channelRouter.js
index 41290ed..0e1a1ed 100644
--- a/src/routers/api/channelRouter.js
+++ b/src/routers/api/channelRouter.js
@@ -66,7 +66,7 @@ router.post('/thumbnail', channelValidator.thumbnail(), thumbnailController.post
router.get('/description', descriptionController.get);
router.post('/description', channelValidator.description(), descriptionController.post);
//list
-router.get('/list', listController.get);
+router.get('/list', channelModel.reqPermCheck("manageChannel"), listController.get);
//settings
router.get('/settings', channelModel.reqPermCheck("manageChannel"), settingsController.get);
router.post('/settings', channelModel.reqPermCheck("changeSettings"), channelValidator.settingsMap(), settingsController.post);
diff --git a/src/schemas/channel/channelSchema.js b/src/schemas/channel/channelSchema.js
index 3976870..bd02fe0 100644
--- a/src/schemas/channel/channelSchema.js
+++ b/src/schemas/channel/channelSchema.js
@@ -284,10 +284,9 @@ channelSchema.statics.register = async function(channelObj, ownerObj){
/**
* Generates Network-Friendly Browser-Digestable list of channels
* @param {Boolean} includeHidden - Whether or not to include hidden channels within the list
- * @param {Date} endDate - Limits amount of scheduled items sent, defaults to 90 minutes
* @returns {Array} List of Network-Friendly Browser-Digestable Objects representing channels on the server
*/
-channelSchema.statics.getChannelList = async function(includeHidden = false, endDate = new Date(Date.now() + (1000 * 60 * 90))){
+channelSchema.statics.getChannelList = async function(includeHidden = false){
const chanDB = await this.find({});
var chanGuide = [];
@@ -295,32 +294,12 @@ channelSchema.statics.getChannelList = async function(includeHidden = false, end
chanDB.forEach((channel) => {
//For each channel, push an object with only the information we need to the channel guide
if(!channel.settings.hidden || includeHidden){
- //Create freeze-dried channel entry object (just add bong water)
- const entry = {
+ chanGuide.push({
id: channel.id,
name: channel.name,
description: channel.description,
- thumbnail: channel.thumbnail,
- schedule: []
- }
-
- //If we're currently playing something
- if(channel.media.nowPlaying != null){
- //Toss the currently playing item on
- entry.schedule.push(channel.media.nowPlaying);
- }
-
- //For every piece of scehduled media for this channel
- for(const media of channel.media.scheduled){
- //If it starts before our cut-off
- if(endDate.getTime() > media.startTime){
- //Add that shit, son!
- entry.schedule.push(media);
- }
- }
-
- //add the channel entry to our return array
- chanGuide.push(entry);
+ thumbnail: channel.thumbnail
+ });
}
});
diff --git a/src/views/index.ejs b/src/views/index.ejs
index 637b545..b2932b1 100644
--- a/src/views/index.ejs
+++ b/src/views/index.ejs
@@ -18,14 +18,25 @@ along with this program. If not, see