X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=d366bb2d0b27e5ed9b4fb54d15254259f5450f56;hb=5fd5fb22de02ed6c585e86a1c3dda50ff6071d2f;hp=a7096e5259615ff2ea56288584e3ece97ee00365;hpb=77c5096644d83aaae8ab1dd42a5cde524507cf9d;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index a7096e52..d366bb2d 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -223,19 +223,23 @@ export default { break; } case "askgame": - // Send current (live) game if not asked by opponent (!) - if (this.game.players.some(p => p.sid == data.from)) - return; - const myGame = + // Send current (live) game if I play in (not an observer), + // and not asked by opponent (!) + if (this.game.type == "live" + && this.game.players.some(p => p.sid == this.st.user.sid) + && this.game.players.every(p => p.sid != data.from)) { - // Minimal game informations: - id: this.game.id, - players: this.game.players, - vid: this.game.vid, - timeControl: this.game.timeControl, - }; - this.st.conn.send(JSON.stringify({code:"game", - game:myGame, target:data.from})); + const myGame = + { + // Minimal game informations: + id: this.game.id, + players: this.game.players, + vid: this.game.vid, + timeControl: this.game.timeControl, + }; + this.st.conn.send(JSON.stringify({code:"game", + game:myGame, target:data.from})); + } break; case "newmove": if (!!data.move.cancelDrawOffer) //opponent refuses draw