@ -0,0 +1,56 @@ | |||
<center><h1>System Controls</h1></center> | |||
<br> | |||
<div class="row"> | |||
<div class="col-md-4 col-12"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<h3>System Status</h3> | |||
</div> | |||
<div class="card-body"> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="col-md-4 col-12"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<h3>Update System Settings</h3> | |||
</div> | |||
<div class="card-body"> | |||
<form action="/system/updateSystem" method ="post" class="p-2"> | |||
<div class="form-group"> | |||
<label> Base URL | |||
<input class="form-control w-100" type="text" name="baseURL" value="{serverURL}" required> | |||
</label> | |||
</div> | |||
<div class="form-group"> | |||
<label>Public Videos Directory | |||
<input class="form-control w-100" type="text" name="publicDirectory" value="{publicDir}" required> | |||
</label> | |||
</div> | |||
<div class="form-group"> | |||
<label>Private Videos Directory | |||
<input class="form-control w-100" type="text" name="privateDirectory" value="{privateDir}"> | |||
</label> | |||
</div> | |||
<div class="text-center"> | |||
<input type="submit" name="add_user" value="Update System" | |||
class="btn btn-lg btn-secondary"/> | |||
</div> | |||
</form> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="col-md-4 col-12"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<h3>Re-Index Video</h3> | |||
</div> | |||
<div class="card-body"> | |||
</div> | |||
</div> | |||
</div> | |||
</div> |
@ -0,0 +1,32 @@ | |||
const routes = require('express').Router(); | |||
const utils = require("../../utils"); | |||
const indexVideos = require('./indexVideos'); | |||
routes.use('/indexVideos', indexVideos); | |||
const updateSystem = require('./updateSystem'); | |||
routes.use('/updateSystem', updateSystem); | |||
const configLoader = require("../../configManager"); | |||
function getSystemInformation(templateContext, request) | |||
{ | |||
templateContext.serverURL = configLoader.getServerURL(); | |||
templateContext.privateDir = configLoader.getRootDirectory(); | |||
templateContext.publicDir = configLoader.getPublicDirectory(); | |||
} | |||
routes.get('/', (request, result) => | |||
{ | |||
if(utils.checkPrivilege(request) >= utils.PRIVILEGE.ADMIN) | |||
{ | |||
utils.renderHTML(request, result, "system.html", getSystemInformation); | |||
} | |||
else | |||
{ | |||
utils.printError(result, "You need to be logged in"); | |||
} | |||
}); | |||
module.exports = routes; |
@ -0,0 +1,20 @@ | |||
const routes = require('express').Router(); | |||
const utils = require("../../utils"); | |||
const videoManager = require("../../videoManager"); | |||
routes.get('/', (request, result) => | |||
{ | |||
if(utils.checkPrivilege(request) === utils.PRIVILEGE.ADMIN) | |||
{ | |||
videoManager.reIndexVideos(); | |||
result.redirect('/system'); | |||
} | |||
else | |||
{ | |||
utils.printError(result, "You need to be logged in"); | |||
} | |||
}); | |||
module.exports = routes; |
@ -0,0 +1,22 @@ | |||
const routes = require('express').Router(); | |||
const utils = require("../../utils"); | |||
const configManager = require("../../configManager"); | |||
routes.post('/', (request, result) => | |||
{ | |||
if(utils.checkPrivilege(request) === utils.PRIVILEGE.ADMIN) | |||
{ | |||
configManager.updateSystem(request.body.baseURL, | |||
request.body.publicDirectory, | |||
request.body.privateDirectory); | |||
result.redirect('/system'); | |||
} | |||
else | |||
{ | |||
utils.printError(result, "You need to be logged in"); | |||
} | |||
}); | |||
module.exports = routes; |