diff --git a/app.js b/app.js index 8ba18804..8d254f8b 100644 --- a/app.js +++ b/app.js @@ -12,19 +12,20 @@ const methodOverride = require("method-override"); const dotenv = require("dotenv"); const i18n = require("i18n-express"); const cors = require("cors"); -const compression = require('compression'); -//const helmet = require('helmet'); +const compression = require("compression"); +// Const helmet = require('helmet'); dotenv.config(); const api = require("./routes/api"); const index = require("./routes/index"), app = express();// View engine setup - //to compress all routes - app.use(compression()); - //security headers, commented because it fails with CSP - //TODO, study options and configure accordingly - //app.use(helmet()); + // To compress all routes + +app.use(compression()); +// Security headers, commented because it fails with CSP +// TODO, study options and configure accordingly +// App.use(helmet()); app.set("views", path.join(__dirname, "views")); diff --git a/ecosystem.config.js b/ecosystem.config.js index 94504590..9f769d62 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,23 +1,23 @@ module.exports = { - apps : [{ - name: "ESCAPP", - script: 'bin/www', - watch: false, - instances: 1, - env: { - "NODE_ENV": "production", + "apps": [ + { + "name": "ESCAPP", + "script": "bin/www", + "watch": false, + "instances": 1, + "env": {"NODE_ENV": "production"} + } + ], + "deploy": { + "production": { + "user": "SSH_USERNAME", + "host": "SSH_HOSTMACHINE", + "ref": "origin/master", + "repo": "GIT_REPOSITORY", + "path": "DESTINATION_PATH", + "pre-deploy-local": "", + "post-deploy": "npm install && pm2 reload ecosystem.config.js --env production", + "pre-setup": "" + } } - }], - deploy : { - production : { - user : 'SSH_USERNAME', - host : 'SSH_HOSTMACHINE', - ref : 'origin/master', - repo : 'GIT_REPOSITORY', - path : 'DESTINATION_PATH', - 'pre-deploy-local': '', - 'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production', - 'pre-setup': '' - } - } }; diff --git a/i18n/en.json b/i18n/en.json index 61313b69..bc63aff7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -957,6 +957,11 @@ "activateTurnosBC": "Manage shifts", "resetProgress": "Reset this shift", "status": "Status", + "statuses": { + "active": "Active", + "finished": "Finished", + "pending": "Pending" + }, "noTurnAvailable": "No turn available for this ER", "theres": "There is", "thereare": "There are", diff --git a/i18n/es.json b/i18n/es.json index 85f1c8c5..8191ffd9 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -939,6 +939,11 @@ "areYouSureStart": "¿Seguro que deseas comenzar este turno?", "activateTurnosBC": "Administrar turnos", "status": "Estado", + "statuses": { + "active": "Activo", + "finished": "Finalizado", + "pending": "Pendiente" + }, "fullTurno": "El turno seleccionado está lleno. Elige otro.", "notActive": "Esta escape room no está activa para tu usuario", "selectActivate": "Selecciona el turno que quieres activar/desactivar", diff --git a/package.json b/package.json index 3a52ebb0..10813e34 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "@sendgrid/mail": "^6.4.0", "body-parser": "^1.19.0", "cloudinary": "^1.22.0", - "connect-session-sequelize": "^6.0.0", "compression": "^1.7.4", + "connect-session-sequelize": "^6.0.0", "cookie-parser": "^1.4.3", "cors": "^2.8.5", "debug": "~2.6.9", diff --git a/public/js/play.js b/public/js/play.js index d6f9e53d..1cf99e93 100644 --- a/public/js/play.js +++ b/public/js/play.js @@ -255,8 +255,8 @@ const onHintResponse = async ({code, hintOrder: hintOrderPlus, puzzleOrder: puzz }; -const onInitialInfo = ({code, erState}) => { - if (code && code === "NOK") { +const onInitialInfo = ({code, erState, participation}) => { + if (participation != "AUTHOR" && (code && code === "NOK")) { window.location = `/escapeRooms/${escapeRoomId}/`; } diff --git a/queries/escapeRoom.js b/queries/escapeRoom.js index 0ad53c59..8f9a502b 100644 --- a/queries/escapeRoom.js +++ b/queries/escapeRoom.js @@ -119,7 +119,7 @@ exports.ids = (ids) => { "include": [ { "model": models.turno, - "attributes": ["id","date","status", "capacity", "from", "to"], + "attributes": ["id", "date", "status", "capacity", "from", "to"], "required": true, "include": [ { diff --git a/views/turnos/_indexActivate.ejs b/views/turnos/_indexActivate.ejs index c7748180..f96d3d77 100644 --- a/views/turnos/_indexActivate.ejs +++ b/views/turnos/_indexActivate.ejs @@ -24,7 +24,7 @@
<%= turno.date ? getFullDate(turno.date): i18n.turno.alwaysOpen%> <%if(turno.place){%>(<%= turno.place %>)<%}%>
-
<%=turno.status.toUpperCase()%>
+
<%=i18n.turno.statuses[turno.status]%>