commit 088f583d2b45f329a8d0ee148f0e642f4734c997
parent d13d2fcd1070778c29d36b15ba584c00895c5968
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 15 Jun 2023 04:40:53 -0700
fix graph change for all users
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go
@@ -245,6 +245,7 @@ func ChessGameAnalyseHandler(c echo.Context) error {
func ChessGameStatsHandler(c echo.Context) error {
key := c.Param("key")
+ authUser := c.Get("authUser").(*database.User)
g, err := interceptors.ChessInstance.GetGame(key)
if err != nil {
return c.NoContent(http.StatusOK)
@@ -317,7 +318,7 @@ func ChessGameStatsHandler(c echo.Context) error {
}
}
}
- interceptors.ChessPubSub.Pub(key, interceptors.ChessMove{MoveIdx: moveIdx, BestMove: bestMove})
+ interceptors.ChessPubSub.Pub(key+"_"+authUser.Username.String(), interceptors.ChessMove{MoveIdx: moveIdx, BestMove: bestMove})
data := map[string]any{
"Key": key,
@@ -564,6 +565,7 @@ func ChessGameHandler(c echo.Context) error {
authorizedChannels := make([]string, 0)
authorizedChannels = append(authorizedChannels, key)
+ authorizedChannels = append(authorizedChannels, key+"_"+authUser.Username.String())
sub := interceptors.ChessPubSub.Subscribe(authorizedChannels)
defer sub.Close()
@@ -795,7 +797,7 @@ func renderHideAllPieces(styles *StylesBuilder) {
func renderBestMove(styles *StylesBuilder, bestMove *chess.Move) {
if bestMove != nil {
- styles.Append("#arrow { display: block !important; }")
+ //styles.Append("#arrow { display: block !important; }")
//s1 := bestMove.S1()
//s2 := bestMove.S2()
//cx1, cy1 := squareCoord(s1, false)