Store the last tab in a cookie so the server can use it for embedding state

This commit is contained in:
Ken-Håvard Lieng 2017-05-21 09:53:47 +02:00
parent 4cad5a0b33
commit 8684e2dea2
8 changed files with 95 additions and 49 deletions

View file

@ -66,10 +66,13 @@ func (h *wsHandler) init(r *http.Request) {
h.session.numWS(), "WebSocket connections")
channels := h.session.user.GetChannels()
params := strings.Split(strings.Trim(r.URL.Query().Get("path"), "/"), "/")
path := r.URL.Query().Get("path")
params := strings.Split(strings.Trim(path, "/"), "/")
tabServer, tabChannel := parseTabCookie(r, path)
for _, channel := range channels {
if len(params) > 1 && channel.Server == params[0] && channel.Name == params[1] {
if (len(params) == 2 && channel.Server == params[0] && channel.Name == params[1]) ||
(channel.Server == tabServer && channel.Name == tabChannel) {
continue
}