From f854c94f5ba65f1797fd803416e53f057f29f151 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 12 Feb 2020 18:55:09 +0100 Subject: [PATCH] Fixes --- client/src/views/Hall.vue | 5 ++--- hooks/post-update.dist | 14 ++++++++++++++ server/models/Game.js | 2 -- server/sockets.js | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 16af9c9a..f120ec97 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -4,7 +4,6 @@ main div#infoDiv(role="dialog" data-checkbox="modalInfo") .card.text-center label.modal-close(for="modalInfo") - h3.section p(v-html="infoMessage") input#modalNewgame.modal(type="checkbox") div#newgameDiv(role="dialog" data-checkbox="modalNewgame") @@ -512,7 +511,6 @@ export default { "#/game/" + gameInfo.id + ""; let modalBox = document.getElementById("modalInfo"); modalBox.checked = true; - setTimeout(() => { modalBox.checked = false; }, 3000); } break; } @@ -716,7 +714,8 @@ export default { margin: 10px auto 5px auto #infoDiv > .card - max-width: 370px + padding: 15px 0 + max-width: 430px #newgameDiv > .card max-width: 767px diff --git a/hooks/post-update.dist b/hooks/post-update.dist index 434b38c7..46eff669 100755 --- a/hooks/post-update.dist +++ b/hooks/post-update.dist @@ -1,3 +1,17 @@ +## V1: #!/bin/sh # NOTE: the ssh part is not required if git repo and vchess are on the same server ssh user@server -t 'cd /path/to/vchess/client && git pull && npm run build' + +## V2: +#!/bin/sh +cd /path/to/vchess || exit +# See https://stackoverflow.com/questions/4043609/getting-fatal-not-a-git-repository-when-using-post-update-hook-to-execut +unset GIT_DIR +git pull +clientLines=`git diff-tree --no-commit-id --name-only -r HEAD | grep client | wc -l` +if [ $clientLines -ne 0 ]; then + cd client + npm run build +fi +# TOOD: also should restart the service if server code changes diff --git a/server/models/Game.js b/server/models/Game.js index 70f32be2..9d700826 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -36,8 +36,6 @@ const GameModel = checkGameInfo: function(g) { if (!g.vid.toString().match(/^[0-9]+$/)) return "Wrong variant ID"; - if (!g.vname.match(/^[a-zA-Z0-9]+$/)) - return "Wrong variant name"; if (!g.cadence.match(/^[0-9dhms +]+$/)) return "Wrong characters in time control"; if (!g.fen.match(/^[a-zA-Z0-9, /-]*$/)) diff --git a/server/sockets.js b/server/sockets.js index 9d118b06..f1853b50 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -111,7 +111,7 @@ module.exports = function(wss) { { doKill(pg); disconnectFromOtherConnexion(pg, "disconnect"); - if (pg.indexOf("/game/") >= 0) + if (pg.indexOf("/game/") >= 0 && !!clients["/"]) disconnectFromOtherConnexion("/", "gdisconnect", {page:pg}); } }); -- 2.44.0