127.0.0.1:8000 watch-together / master server / routes / api / log.js
master

Tree @master (Download .tar.gz)

log.js @masterraw · history · blame

const utils = require('../../utils');
const file_dump = require('../../utils/log').file_dump;
const clamscan = require('../../utils/clamscan');

module.exports = {
    post: {
        "upload": function(req, res) {
            utils.validate.keys(req.body, [
                "logs"
            ]).then(function() {
                return file_dump(req.user.user_id, req.body.logs);
            }).then(function(file_path) {
                return clamscan.assert_safe(file_path, {
                    ip: res.locals.ip,
                    user_id: req.user.user_id
                });
            }).then(function() {
                res.send(utils.ok());
            }).catch(utils.handle_err.res(res, "Error uploading logs"))
        }
    }
}