Commit 2db4f097 by Sebastián Collado Montañez

Merge branch 'develop' of http://gitlab.ujaen.es/yotta/pictogram into develop

parents a2d9960e eebed528
@reboot /home/ubuntu/pictogram/sails/bootstrap.sh @reboot /home/ubuntu/pictogram/sails/bootstrap.sh
# Let's encrypt certs autorenew # Let's encrypt certs autorenew
@monthly /home/ubuntu/cron/renewcerts.sh @monthly /home/ubuntu/pictogram/sails/cron/renewcerts.sh
# AWS Volume backups # AWS Volume backups
@daily /home/ubuntu/cron/aws-missing-tools/ec2-automate-backup/ec2-automate-backup.sh -c /home/ubuntu/cron/cron-primer.sh -v vol-0cd5c496 -k 30 -p -u -r "eu-central-1" #@daily /home/ubuntu/pictogram/sails/cron/aws-missing-tools/ec2-automate-backup/ec2-automate-backup.sh -c /home/ubuntu/pictogram/sails/cron/cron-primer.sh -v vol-0cd5c496 -k 30 -p -u -r "eu-central-1"
# Log rotation
@daily /usr/sbin/logrotate /home/ubuntu/pictogram/sails/cron/logrotate.conf
/home/ubuntu/pictogram/sails/logs/access.json /home/ubuntu/pictogram/sails/logs/error.json /home/ubuntu/pictogram/sails/logs/debug.json /home/ubuntu/pictogram/sails/logs/silly.json /home/ubuntu/pictogram/sails/logs/info.json {
size 4M
rotate 7
dateext
mail amontejo@ujaen.es
compress
create 700 ubuntu ubuntu
postrotate
/home/ubuntu/pictogram/sails/cron/report.sh
endscript
}
#! /bin/bash
cd /home/ubuntu/pictogram/sails/logs
SUP_LOGIN_ATTEMPTS=`egrep "\/sup\/login" access.json | wc -l`
SUP_LOGIN_VALIDS=`egrep "\/sup\/login" access.json | grep "'status': 200" | wc -l`
STU_LOGIN_ATTEMPTS=`egrep "\/stu\/login" access.json | wc -l`
STU_LOGIN_VALIDS=`egrep "\/stu\/login" access.json | grep "'status': 200" | wc -l`
SHOW_GRIDS=`egrep "/stu/[0-9]+/grids" access.json | wc -l`
STUDENTS_ACCESSED=`egrep "/stu/[0-9]+/grids" access.json | sed "s/.*\/stu\/\([0-9]\+\)\/.*/\1/g"|uniq |wc -l`
mail amontejo@ujaen.es <<END
Subject: Informe de Pictogram sobre $HOSTNAME
Nº de intentos de login de supervisor: $SUP_LOGIN_ATTEMPTS
Nº de logins válidos de supervisor: $SUP_LOGIN_VALIDS
Nº de intentos de login de estudiante: $STU_LOGIN_ATTEMPTS
Nº de logins válidos de estudiante: $STU_LOGIN_VALIDS
Nº de accesos a la pestaña de colección: $SHOW_GRIDS
Nº de estudiantes activos: $STUDENTS_ACCESSED
END
...@@ -511,7 +511,7 @@ ...@@ -511,7 +511,7 @@
"username_default": "Account identifier (don't use spaces)", "username_default": "Account identifier (don't use spaces)",
"username_exists": "There is already an account with name '{{username}}'", "username_exists": "There is already an account with name '{{username}}'",
"user_created": "Account created!", "user_created": "Account created!",
"user_created_text": "An email with instructions to activate the account has been sent to {{email}}. If you do not find it in your mailbox, please, review the SPAM folder", "user_created_text": "An email with instructions to activate the account has been sent to {{email}}. If you do not find it in your inbox, please, review the SPAM folder",
"user_exists": "User with email {{email}} already exists", "user_exists": "User with email {{email}} already exists",
"validate_fail": "The user account couldn't be validated", "validate_fail": "The user account couldn't be validated",
"validate_success": "The user account has been validated. Now, you can login from the link below", "validate_success": "The user account has been validated. Now, you can login from the link below",
......
...@@ -596,6 +596,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -596,6 +596,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
ngToast.success($translate.instant('grid_added')); ngToast.success($translate.instant('grid_added'));
$scope.loadGridsList(); $scope.loadGridsList();
$scope.showGrid(grid.id, 'menu');
}).error(function () {}); }).error(function () {});
}); });
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
<!-- chat tab--> <!-- chat tab-->
<div class="panel panel-default student_tab_panel"> <div class="panel panel-default student_tab_panel">
<div class="row">
<div class="col-md-12">
<legend>&nbsp; {{ 'chat' | translate }}</legend>
</div>
</div>
<div class="chat-panel-body" scroll-glue> <div class="chat-panel-body" scroll-glue>
<div ng-if="messages.length == 0"> <div ng-if="messages.length == 0">
<span class="label label-info" translate>empty_chat</label> <span class="label label-info" translate>empty_chat</label>
......
...@@ -21,11 +21,11 @@ module.exports.http = { ...@@ -21,11 +21,11 @@ module.exports.http = {
* * * *
****************************************************************************/ ****************************************************************************/
timeout: function(req, res, next) { timeout: function(req, res, next) {
var timeout = require('connect-timeout'); var timeout = require('connect-timeout');
timeout('300s'); timeout('300s');
next(); next();
}, },
/*************************************************************************** /***************************************************************************
* * * *
...@@ -34,7 +34,7 @@ module.exports.http = { ...@@ -34,7 +34,7 @@ module.exports.http = {
* * * *
***************************************************************************/ ***************************************************************************/
order: ['timeout'] order: ['timeout',
// 'startRequestTimer', // 'startRequestTimer',
// 'cookieParser', // 'cookieParser',
// 'session', // 'session',
...@@ -51,7 +51,7 @@ module.exports.http = { ...@@ -51,7 +51,7 @@ module.exports.http = {
// 'favicon', // 'favicon',
// '404', // '404',
// '500' // '500'
// ], ],
/**************************************************************************** /****************************************************************************
* * * *
...@@ -59,10 +59,8 @@ module.exports.http = { ...@@ -59,10 +59,8 @@ module.exports.http = {
* * * *
****************************************************************************/ ****************************************************************************/
// myRequestLogger: function (req, res, next) { // myRequestLogger: function (req, res, next) {
// console.log("Requested :: ", req.method, req.url); // },
// return next();
// }
......
...@@ -55,6 +55,19 @@ customLogger.add(winston.transports.File, { ...@@ -55,6 +55,19 @@ customLogger.add(winston.transports.File, {
filename: path.resolve(__dirname, '../..', 'logs', 'error.json') filename: path.resolve(__dirname, '../..', 'logs', 'error.json')
}); });
customLogger.add(winston.transports.File, {
name: 'info-json',
silent: false,
colorize: false,
level: 'info',
showLevel: true,
timestamp: true,
json: true,
tailable: true,
maxsize: 20 * 1024 * 1024, // 20 MegaByte
filename: path.resolve(__dirname, '../..', 'logs', 'info.json')
});
module.exports.log = { module.exports.log = {
level: 'silly', level: 'silly',
inspect: false, inspect: false,
......
const path = require('path');
module.exports.requestloggerfile = {
//see: https://github.com/expressjs/morgan#predefined-formats for more formats
format: "{'address': ':remote-addr', 'timestamp': ':date[clf]', 'method': ':method', 'url': ':url', 'status': :status, 'response_time': ':response-time ms', 'user_agent': ':user-agent'}",
logLocation: 'file',
fileLocation: path.resolve(__dirname, '../..', 'logs', 'access.json'),
inDevelopment: true,
inProduction: true
};
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
* http://sailsjs.org/#/documentation/concepts/Routes/RouteTargetSyntax.html * http://sailsjs.org/#/documentation/concepts/Routes/RouteTargetSyntax.html
*/ */
module.exports.routes = { module.exports.routes = {
// This is to log to info every access
// '/*': function(req, res, next) {
// sails.log.info(req.method, req.url, req.allParams());
// next();
// },
// Grouped by API url (/a, /b, ...) // Grouped by API url (/a, /b, ...)
// Sorted by HTTP method (GET, PUT, POST and DELETE) // Sorted by HTTP method (GET, PUT, POST and DELETE)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
"sails": "^0.12.3", "sails": "^0.12.3",
"sails-disk": "~0.10.0", "sails-disk": "~0.10.0",
"sails-generate-auth": "^0.2.0", "sails-generate-auth": "^0.2.0",
"sails-hook-requestlogger-file": "^2.0.5",
"sails-mysql": "^0.12", "sails-mysql": "^0.12",
"sails-service-mailer": "^3.2.1", "sails-service-mailer": "^3.2.1",
"sails-test-helper": "^0.3.5", "sails-test-helper": "^0.3.5",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment