Browse Source

Updated system page to display basic information on how many videos and users are in the system.

pull/8/head
jrtechs 5 years ago
parent
commit
18f8a562c0
4 changed files with 25 additions and 1 deletions
  1. +7
    -0
      configManager.js
  2. +3
    -1
      html/system.html
  3. +5
    -0
      routes/system/index.js
  4. +10
    -0
      videoManager.js

+ 7
- 0
configManager.js View File

@ -37,6 +37,13 @@ module.exports=
config.publicDir = publicDir; config.publicDir = publicDir;
module.exports.syncToDisk(); module.exports.syncToDisk();
},
getUserCount: function()
{
return (config.hasOwnProperty('users')) ? config.users.length : 0;
} }
}; };

+ 3
- 1
html/system.html View File

@ -7,7 +7,9 @@
<h3>System Status</h3> <h3>System Status</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<p><b>Public Videos Indexed: </b>{publicVideoCount}</p>
<p><b>Private Videos Indexed: </b>{privateVideoCount}</p>
<p><b>Users: </b>{userCount}</p>
</div> </div>
</div> </div>
</div> </div>

+ 5
- 0
routes/system/index.js View File

@ -10,11 +10,16 @@ routes.use('/updateSystem', updateSystem);
const configLoader = require("../../configManager"); const configLoader = require("../../configManager");
const videoManager = require("../../videoManager");
function getSystemInformation(templateContext, request) function getSystemInformation(templateContext, request)
{ {
templateContext.serverURL = configLoader.getServerURL(); templateContext.serverURL = configLoader.getServerURL();
templateContext.privateDir = configLoader.getRootDirectory(); templateContext.privateDir = configLoader.getRootDirectory();
templateContext.publicDir = configLoader.getPublicDirectory(); templateContext.publicDir = configLoader.getPublicDirectory();
templateContext.publicVideoCount = videoManager.getPublicVideoCount();
templateContext.privateVideoCount = videoManager.getPrivateVideoCount();
templateContext.userCount = configLoader.getUserCount();
} }
routes.get('/', (request, result) => routes.get('/', (request, result) =>

+ 10
- 0
videoManager.js View File

@ -156,5 +156,15 @@ module.exports =
privateVideos = []; privateVideos = [];
module.exports.indexVideos(configManager.getPublicDirectory(), publicVideos, "public"); module.exports.indexVideos(configManager.getPublicDirectory(), publicVideos, "public");
module.exports.indexVideos(configManager.getRootDirectory(), privateVideos, "private"); module.exports.indexVideos(configManager.getRootDirectory(), privateVideos, "private");
},
getPublicVideoCount: function()
{
return (publicVideos === null) ? 0: publicVideos.length;
},
getPrivateVideoCount: function()
{
return (privateVideos === null) ? 0: privateVideos.length;
} }
}; };

Loading…
Cancel
Save