Added the ability to view logs from the settings menu

This commit is contained in:
Isaac Grynsztein
2020-06-22 23:15:21 -04:00
parent 09d8ce04d7
commit 2998562655
14 changed files with 94 additions and 6 deletions

View File

@@ -1830,6 +1830,21 @@ app.get('/api/using-encryption', function(req, res) {
res.send(usingEncryption);
});
app.get('/api/logs', function(req, res) {
let logs = null;
logs_path = path.join('appdata', 'logs', 'combined.log')
if (fs.existsSync(logs_path))
logs = fs.readFileSync(logs_path, 'utf8');
else
logger.error(`Failed to find logs file at the expected location: ${logs_path}`)
console.log(logs)
res.send({
logs: logs,
success: !!logs
});
});
app.post('/api/tomp3', optionalJwt, async function(req, res) {
var url = req.body.url;
var options = {