From c6bf1bc0b36ae8fe9b2a8d554ff6d86c821e3836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Sun, 3 Jan 2021 14:02:04 +0100
Subject: [PATCH] Podpora kompresse, bugfix pocitani anonimous

---
 .gitlab-ci.yml                  | 2 +-
 lib/CF/Controller/Websockets.pm | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47a1efb..2b1113b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,7 @@ image: docker:19.03.1
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
   IMAGE_TAG: $CI_REGISTRY_IMAGE
-  IMAGE_VER: 1.4.0
+  IMAGE_VER: 1.5.0
 
 services:
   - docker:19.03.1-dind
diff --git a/lib/CF/Controller/Websockets.pm b/lib/CF/Controller/Websockets.pm
index a1772d4..8e6a371 100644
--- a/lib/CF/Controller/Websockets.pm
+++ b/lib/CF/Controller/Websockets.pm
@@ -17,6 +17,10 @@ sub main {
 
     $c->inactivity_timeout(SOCKET_INACTIVITY_TIMEOUT);
 
+    if ($c->req->headers->header('Sec-WebSocket-Key') =~ /deflate/) {
+        $c->tx->compressed(1);
+    }
+
     my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg);
 
     $pubsub->listen(notify => sub($pubsub, $payload) {
@@ -51,7 +55,7 @@ sub main {
 
                 $c->pg->db->delete('sockets', [
                     {id      => $key},
-                    {user_id => $message->{payload}},
+                    {user_id => $message->{payload} || undef },
                 ]);
 
                 $c->pg->db->insert('sockets', {
-- 
GitLab