diff --git a/configManager.js b/configManager.js index e920f1e..c0c0597 100644 --- a/configManager.js +++ b/configManager.js @@ -37,6 +37,13 @@ module.exports= config.publicDir = publicDir; module.exports.syncToDisk(); + }, + + getUserCount: function() + { + return (config.hasOwnProperty('users')) ? config.users.length : 0; } + + }; \ No newline at end of file diff --git a/html/system.html b/html/system.html index b82c61e..c9e5a3a 100644 --- a/html/system.html +++ b/html/system.html @@ -7,7 +7,9 @@

System Status

- +

Public Videos Indexed: {publicVideoCount}

+

Private Videos Indexed: {privateVideoCount}

+

Users: {userCount}

diff --git a/routes/system/index.js b/routes/system/index.js index e89d8f7..f691faf 100644 --- a/routes/system/index.js +++ b/routes/system/index.js @@ -10,11 +10,16 @@ routes.use('/updateSystem', updateSystem); const configLoader = require("../../configManager"); +const videoManager = require("../../videoManager"); + function getSystemInformation(templateContext, request) { templateContext.serverURL = configLoader.getServerURL(); templateContext.privateDir = configLoader.getRootDirectory(); templateContext.publicDir = configLoader.getPublicDirectory(); + templateContext.publicVideoCount = videoManager.getPublicVideoCount(); + templateContext.privateVideoCount = videoManager.getPrivateVideoCount(); + templateContext.userCount = configLoader.getUserCount(); } routes.get('/', (request, result) => diff --git a/videoManager.js b/videoManager.js index f4e365a..de1e37f 100644 --- a/videoManager.js +++ b/videoManager.js @@ -156,5 +156,15 @@ module.exports = privateVideos = []; module.exports.indexVideos(configManager.getPublicDirectory(), publicVideos, "public"); module.exports.indexVideos(configManager.getRootDirectory(), privateVideos, "private"); + }, + + getPublicVideoCount: function() + { + return (publicVideos === null) ? 0: publicVideos.length; + }, + + getPrivateVideoCount: function() + { + return (privateVideos === null) ? 0: privateVideos.length; } }; \ No newline at end of file