From d153c2b4f0f25b67d1f42874a0a30e1c70816836 Mon Sep 17 00:00:00 2001 From: joeyak Date: Tue, 7 May 2019 19:42:43 -0400 Subject: [PATCH] Fix cookies not staying across browser sessions --- static/js/chat.js | 2 +- wasm/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index ebe70ec..96448c2 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -206,7 +206,7 @@ function sendColor(color) { function setTimestamp(v) { showTimestamp(v) - document.cookie = "timestamp=" + v + document.cookie = "timestamp=" + v + "; expires=Fri, 31 Dec 9999 23:59:59 GMT"; } // Get the websocket setup in a function so it can be recalled diff --git a/wasm/main.go b/wasm/main.go index f355043..3207d8f 100644 --- a/wasm/main.go +++ b/wasm/main.go @@ -86,7 +86,7 @@ func recieve(v []js.Value) { auth = h.Data.(common.CommandLevel) case common.CdColor: color = h.Data.(string) - js.Get("document").Set("cookie", fmt.Sprintf("color=%s;", color)) + js.Get("document").Set("cookie", fmt.Sprintf("color=%s; expires=Fri, 31 Dec 9999 23:59:59 GMT", color)) case common.CdEmote: data := h.Data.(map[string]interface{}) emoteNames = make([]string, 0, len(data))