Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: localslack...@packages.debian.org, tipos...@tiscali.it
Control: affects -1 + src:localslackirc

Slack now requires some headers to connect to the websocket, that were not
needed before.

This patch is to backport the sending of those headers, so that localslackirc
can connect to it.

[ Reason ]

I am backporting this so that localslackirc can be used by users on stable.

It is caused by slack doing changes on what they accept.

[ Impact ]

localslackirc is currently useless for most users on stable. Without
the fix it will remain useless.

[ Tests ]

I tried manually, there is no automated tests for this, since the slack
server is not open source.

[ Risks ]

The patch is fairly simple, I ran the code, I ran mypy for safety and all
seemed ok.

[ Checklist ]
  [*] *all* changes are documented in the d/changelog
  [*] I reviewed all changes and I approve them
  [*] attach debdiff against the package in (old)stable
  [*] the issue is verified as fixed in unstable

[ Changes ]

Send http headers to websocket connection.

[ Other info ]

There is no debian bug tracking this, because I just noticed the issue myself
and immediately fixed it upstream.

But I think it's worthy to backport it.
diff -Nru localslackirc-1.17/debian/changelog 
localslackirc-1.17/debian/changelog
--- localslackirc-1.17/debian/changelog 2022-10-15 12:17:10.000000000 +0200
+++ localslackirc-1.17/debian/changelog 2023-10-24 10:09:34.000000000 +0200
@@ -1,3 +1,9 @@
+localslackirc (1.17-1.1+deb12u1) bookworm; urgency=medium
+
+  * Backport patch to send authorization and cookie headers to the websocket
+
+ -- Salvo 'LtWorf' Tomaselli <tipos...@tiscali.it>  Tue, 24 Oct 2023 10:09:34 
+0200
+
 localslackirc (1.17-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru localslackirc-1.17/debian/patches/authenticate_websocket.patch 
localslackirc-1.17/debian/patches/authenticate_websocket.patch
--- localslackirc-1.17/debian/patches/authenticate_websocket.patch      
1970-01-01 01:00:00.000000000 +0100
+++ localslackirc-1.17/debian/patches/authenticate_websocket.patch      
2023-10-24 10:09:34.000000000 +0200
@@ -0,0 +1,33 @@
+Description: Send token and cookie when connecting to the websocket as well
+ Now slack is requiring those headers to be set on the websocket as well.
+ .
+ They used to be needed just on the normal REST API calls.
+ .
+ The patch is a backport from upstream.
+ .
+ localslackirc (1.17-1.1+deb12u1) bookworm; urgency=medium
+ .
+   * Backport patch to send authorization and cookie headers to the websocket
+Author: Salvo 'LtWorf' Tomaselli <tipos...@tiscali.it>
+Origin: upstream
+Forwarded: not-needed
+Applied-Upstream: 1.19, 
https://github.com/ltworf/localslackirc/pull/426/commits/6a7eafb6d33b997ed61331e4f26264e6d4ddf66c
+Last-Update: 2023-10-24
+
+--- localslackirc-1.17.orig/slackclient/client.py
++++ localslackirc-1.17/slackclient/client.py
+@@ -124,7 +124,13 @@ class SlackClient:
+             timeout: in seconds
+         """
+         r = await self.login()
+-        self._websocket = await wsconnect(r.url, close_timeout=0.2)
++        headers = {
++            'user-agent': 'localslackirc',
++            'Authorization': f'Bearer {self._token}',
++        }
++        if self._cookie:
++            headers['cookie'] = self._cookie
++        self._websocket = await wsconnect(r.url, close_timeout=0.2, 
extra_headers=headers)
+         return r
+ 
+ 
diff -Nru localslackirc-1.17/debian/patches/series 
localslackirc-1.17/debian/patches/series
--- localslackirc-1.17/debian/patches/series    1970-01-01 01:00:00.000000000 
+0100
+++ localslackirc-1.17/debian/patches/series    2023-10-24 10:09:34.000000000 
+0200
@@ -0,0 +1 @@
+authenticate_websocket.patch

Reply via email to