From: Benjamin Auder Date: Thu, 7 May 2020 17:57:34 +0000 (+0200) Subject: Cosmetics, mostly, and a few small bugs fixes X-Git-Url: https://git.auder.net/?p=vchess.git;a=commitdiff_plain;h=0705a80c63aec2c60ee6a674b982f6a11d2d50bd Cosmetics, mostly, and a few small bugs fixes --- diff --git a/client/src/App.vue b/client/src/App.vue index 4b344881..5556ae38 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -142,7 +142,7 @@ input[type="checkbox"]:focus outline: 0 input[type=checkbox]:checked:before - top: -5px; + top: -5px height: 18px table diff --git a/client/src/components/UpsertUser.vue b/client/src/components/UpsertUser.vue index 6fc67742..24e3c410 100644 --- a/client/src/components/UpsertUser.vue +++ b/client/src/components/UpsertUser.vue @@ -163,7 +163,8 @@ export default { if (this.stage == "Login") { const type = this.nameOrEmail.indexOf("@") >= 0 ? "email" : "name"; error = checkNameEmail({ [type]: this.nameOrEmail }); - } else error = checkNameEmail(this.user); + } + else error = checkNameEmail(this.user); if (error) { alert(this.st.tr[error]); return; diff --git a/client/src/data/challengeCheck.js b/client/src/data/challengeCheck.js index a535b886..fbfb445c 100644 --- a/client/src/data/challengeCheck.js +++ b/client/src/data/challengeCheck.js @@ -16,7 +16,8 @@ export function checkChallenge(c) { // Allow custom FEN (and check it) only for individual challenges if (c.fen.length > 0 && !!c.to) { if (!V.IsGoodFen(c.fen)) return "Errors in FEN"; - } else c.fen = ""; + } + else c.fen = ""; return ""; } diff --git a/client/src/router.js b/client/src/router.js index c51c8862..04c8f06c 100644 --- a/client/src/router.js +++ b/client/src/router.js @@ -1,6 +1,5 @@ import Vue from "vue"; import Router from "vue-router"; -import Hall from "./views/Hall.vue"; Vue.use(Router); @@ -14,7 +13,7 @@ const router = new Router({ { path: "/", name: "hall", - component: Hall + component: loadView("Hall") }, { path: "/variants", diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index a29e0e98..13632041 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -112,7 +112,7 @@ export default { }, mounted: function() { const adjustAndSetDisplay = () => { - // showType is the last type viwed by the user (default) + // showType is the last type viewed by the user (default) let showType = localStorage.getItem("type-myGames") || "live"; // Live games, my turn: highest priority: if (this.liveGames.some(g => !!g.myTurn)) showType = "live"; @@ -183,7 +183,7 @@ export default { setDisplay: function(type, e) { this.display = type; localStorage.setItem("type-myGames", type); - let elt = e ? e.target : document.getElementById(type + "Games"); + let elt = (!!e ? e.target : document.getElementById(type + "Games")); elt.classList.add("active"); elt.classList.remove("somethingnew"); //in case of for (let t of ["live","corr","import"]) { @@ -252,7 +252,8 @@ export default { if (thing == "turn") { game.myTurn = !game.myTurn; if (game.myTurn) this.tryShowNewsIndicator(type); - } else game.myTurn = false; + } + else game.myTurn = false; // TODO: forcing refresh like that is ugly and wrong. // How to do it cleanly? this.$refs[type + "games"].$forceUpdate(); @@ -357,7 +358,8 @@ export default { moreGames.forEach(g => g.type = "corr"); this.decorate(moreGames); this.corrGames = this.corrGames.concat(moreGames); - } else this.hasMore["corr"] = false; + } + else this.hasMore["corr"] = false; if (!!cb) cb(); } } @@ -372,7 +374,8 @@ export default { localGames.forEach(g => g.type = "live"); this.decorate(localGames); this.liveGames = this.liveGames.concat(localGames); - } else this.hasMore["live"] = false; + } + else this.hasMore["live"] = false; if (!!cb) cb(); }); } @@ -384,7 +387,8 @@ export default { this.cursor["import"] = importGames[L - 1].created - 1; importGames.forEach(g => g.type = "import"); this.importGames = this.importGames.concat(importGames); - } else this.hasMore["import"] = false; + } + else this.hasMore["import"] = false; if (!!cb) cb(); }); } diff --git a/server/models/Problem.js b/server/models/Problem.js index 9978d76f..eef4270f 100644 --- a/server/models/Problem.js +++ b/server/models/Problem.js @@ -81,7 +81,7 @@ const ProblemModel = { safeRemove: function(id, uid, devs) { db.serialize(function() { - let whereClause = "WHERE id = " + prob.id; + let whereClause = "WHERE id = " + id; if (!devs.includes(uid)) whereClause += " AND uid = " + uid; const query = "DELETE FROM Problems " + diff --git a/server/package.json b/server/package.json index faadbd60..a8c9e44d 100644 --- a/server/package.json +++ b/server/package.json @@ -13,8 +13,6 @@ "morgan": "~1.9.1", "node-cron": "^2.0.3", "nodemailer": "^5.1.1", - "pug": "^2.0.4", - "sanitize-html": "^1.23.0", "serve-favicon": "~2.5.0", "sqlite3": "^4.2.0", "ws": "^6.2.1" diff --git a/server/routes/all.js b/server/routes/all.js index 979b0d9c..b7dcc1ae 100644 --- a/server/routes/all.js +++ b/server/routes/all.js @@ -1,5 +1,4 @@ let router = require("express").Router(); -const access = require("../utils/access"); router.use("/", require("./challenges")); router.use("/", require("./games"));