Show More
@@ -35,6 +35,20 b' self: super: {' | |||
|
35 | 35 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
|
36 | 36 | }; |
|
37 | 37 | }; |
|
38 | "apispec" = super.buildPythonPackage { | |
|
39 | name = "apispec-1.0.0"; | |
|
40 | doCheck = false; | |
|
41 | propagatedBuildInputs = [ | |
|
42 | self."PyYAML" | |
|
43 | ]; | |
|
44 | src = fetchurl { | |
|
45 | url = "https://files.pythonhosted.org/packages/67/15/346c04988dd67d36007e28145504c520491930c878b1f484a97b27a8f497/apispec-1.0.0.tar.gz"; | |
|
46 | sha256 = "1712w1anvqrvadjjpvai84vbaygaxabd3zz5lxihdzwzs4gvi9sp"; | |
|
47 | }; | |
|
48 | meta = { | |
|
49 | license = [ pkgs.lib.licenses.mit ]; | |
|
50 | }; | |
|
51 | }; | |
|
38 | 52 | "appenlight-client" = super.buildPythonPackage { |
|
39 | 53 | name = "appenlight-client-0.6.26"; |
|
40 | 54 | doCheck = false; |
@@ -236,20 +250,23 b' self: super: {' | |||
|
236 | 250 | }; |
|
237 | 251 | }; |
|
238 | 252 | "channelstream" = super.buildPythonPackage { |
|
239 |
name = "channelstream-0. |
|
|
253 | name = "channelstream-0.6.14"; | |
|
240 | 254 | doCheck = false; |
|
241 | 255 | propagatedBuildInputs = [ |
|
242 | 256 | self."gevent" |
|
243 | 257 | self."ws4py" |
|
258 | self."marshmallow" | |
|
259 | self."python-dateutil" | |
|
244 | 260 | self."pyramid" |
|
245 | 261 | self."pyramid-jinja2" |
|
262 | self."pyramid-apispec" | |
|
246 | 263 | self."itsdangerous" |
|
247 | 264 | self."requests" |
|
248 | 265 | self."six" |
|
249 | 266 | ]; |
|
250 | 267 | src = fetchurl { |
|
251 |
url = "https://files.pythonhosted.org/packages/ |
|
|
252 | sha256 = "1qbm4xdl5hfkja683x546bncg3rqq8qv79w1m1a1wd48cqqzb6rm"; | |
|
268 | url = "https://files.pythonhosted.org/packages/d4/2d/86d6757ccd06ce673ee224123471da3d45251d061da7c580bfc259bad853/channelstream-0.6.14.tar.gz"; | |
|
269 | sha256 = "0qgy5j3rj6c8cslzidh32glhkrhbbdxjc008y69v8a0y3zyaz2d3"; | |
|
253 | 270 | }; |
|
254 | 271 | meta = { |
|
255 | 272 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
@@ -862,11 +879,11 b' self: super: {' | |||
|
862 | 879 | }; |
|
863 | 880 | }; |
|
864 | 881 | "itsdangerous" = super.buildPythonPackage { |
|
865 |
name = "itsdangerous-0 |
|
|
882 | name = "itsdangerous-1.1.0"; | |
|
866 | 883 | doCheck = false; |
|
867 | 884 | src = fetchurl { |
|
868 |
url = "https://files.pythonhosted.org/packages/dc |
|
|
869 | sha256 = "06856q6x675ly542ig0plbqcyab6ksfzijlyf1hzhgg3sgwgrcyb"; | |
|
885 | url = "https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz"; | |
|
886 | sha256 = "068zpbksq5q2z4dckh2k1zbcq43ay74ylqn77rni797j0wyh66rj"; | |
|
870 | 887 | }; |
|
871 | 888 | meta = { |
|
872 | 889 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
@@ -993,6 +1010,17 b' self: super: {' | |||
|
993 | 1010 | license = [ pkgs.lib.licenses.bsdOriginal pkgs.lib.licenses.bsd3 ]; |
|
994 | 1011 | }; |
|
995 | 1012 | }; |
|
1013 | "marshmallow" = super.buildPythonPackage { | |
|
1014 | name = "marshmallow-2.18.0"; | |
|
1015 | doCheck = false; | |
|
1016 | src = fetchurl { | |
|
1017 | url = "https://files.pythonhosted.org/packages/ad/0b/5799965d1c6d5f608d684e2c0dce8a828e0309a3bfe8327d9418a89f591c/marshmallow-2.18.0.tar.gz"; | |
|
1018 | sha256 = "1g0aafpjn7yaxq06yndy8c7rs9n42adxkqq1ayhlr869pr06d3lm"; | |
|
1019 | }; | |
|
1020 | meta = { | |
|
1021 | license = [ pkgs.lib.licenses.mit ]; | |
|
1022 | }; | |
|
1023 | }; | |
|
996 | 1024 | "mistune" = super.buildPythonPackage { |
|
997 | 1025 | name = "mistune-0.8.4"; |
|
998 | 1026 | doCheck = false; |
@@ -1522,6 +1550,20 b' self: super: {' | |||
|
1522 | 1550 | license = [ { fullName = "Repoze Public License"; } { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; |
|
1523 | 1551 | }; |
|
1524 | 1552 | }; |
|
1553 | "pyramid-apispec" = super.buildPythonPackage { | |
|
1554 | name = "pyramid-apispec-0.3.2"; | |
|
1555 | doCheck = false; | |
|
1556 | propagatedBuildInputs = [ | |
|
1557 | self."apispec" | |
|
1558 | ]; | |
|
1559 | src = fetchurl { | |
|
1560 | url = "https://files.pythonhosted.org/packages/2a/30/1dea5d81ea635449572ba60ec3148310d75ae4530c3c695f54b0991bb8c7/pyramid_apispec-0.3.2.tar.gz"; | |
|
1561 | sha256 = "0ffrcqp9dkykivhfcq0v9lgy6w0qhwl6x78925vfjmayly9r8da0"; | |
|
1562 | }; | |
|
1563 | meta = { | |
|
1564 | license = [ pkgs.lib.licenses.bsdOriginal ]; | |
|
1565 | }; | |
|
1566 | }; | |
|
1525 | 1567 | "pyramid-mailer" = super.buildPythonPackage { |
|
1526 | 1568 | name = "pyramid-mailer-0.15.1"; |
|
1527 | 1569 | doCheck = false; |
@@ -1763,6 +1805,17 b' self: super: {' | |||
|
1763 | 1805 | license = [ pkgs.lib.licenses.bsdOriginal { fullName = "LGPL+BSD"; } { fullName = "GNU Library or Lesser General Public License (LGPL)"; } ]; |
|
1764 | 1806 | }; |
|
1765 | 1807 | }; |
|
1808 | "PyYAML" = super.buildPythonPackage { | |
|
1809 | name = "PyYAML-5.3.1"; | |
|
1810 | doCheck = false; | |
|
1811 | src = fetchurl { | |
|
1812 | url = "https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz"; | |
|
1813 | sha256 = "0pb4zvkfxfijkpgd1b86xjsqql97ssf1knbd1v53wkg1qm9cgsmq"; | |
|
1814 | }; | |
|
1815 | meta = { | |
|
1816 | license = [ pkgs.lib.licenses.mit ]; | |
|
1817 | }; | |
|
1818 | }; | |
|
1766 | 1819 | "redis" = super.buildPythonPackage { |
|
1767 | 1820 | name = "redis-3.4.1"; |
|
1768 | 1821 | doCheck = false; |
@@ -5,7 +5,7 b' babel==1.3' | |||
|
5 | 5 | beaker==1.9.1 |
|
6 | 6 | bleach==3.1.3 |
|
7 | 7 | celery==4.3.0 |
|
8 |
channelstream==0. |
|
|
8 | channelstream==0.6.14 | |
|
9 | 9 | click==7.0 |
|
10 | 10 | colander==1.7.0 |
|
11 | 11 | # our custom configobj |
@@ -22,7 +22,7 b' future==0.14.3' | |||
|
22 | 22 | futures==3.0.2 |
|
23 | 23 | infrae.cache==1.0.1 |
|
24 | 24 | iso8601==0.1.12 |
|
25 |
itsdangerous==0 |
|
|
25 | itsdangerous==1.1.0 | |
|
26 | 26 | kombu==4.6.6 |
|
27 | 27 | lxml==4.2.5 |
|
28 | 28 | mako==1.1.0 |
@@ -18,10 +18,11 b' jsonschema==2.6.0' | |||
|
18 | 18 | pluggy==0.13.1 |
|
19 | 19 | pyasn1-modules==0.2.6 |
|
20 | 20 | pyramid-jinja2==2.7 |
|
21 | pyramid-apispec==0.3.2 | |
|
21 | 22 | scandir==1.10.0 |
|
22 | 23 | setproctitle==1.1.10 |
|
23 | 24 | tempita==0.5.2 |
|
24 | 25 | testpath==0.4.4 |
|
25 | 26 | transaction==2.4.0 |
|
26 | 27 | vine==1.3.0 |
|
27 | wcwidth==0.1.9 | |
|
28 | wcwidth==0.1.9 No newline at end of file |
@@ -34,7 +34,7 b' from rhodecode.lib.channelstream import ' | |||
|
34 | 34 | get_user_data, |
|
35 | 35 | parse_channels_info, |
|
36 | 36 | update_history_from_logs, |
|
37 | STATE_PUBLIC_KEYS) | |
|
37 | USER_STATE_PUBLIC_KEYS) | |
|
38 | 38 | |
|
39 | 39 | from rhodecode.lib.auth import NotAnonymous |
|
40 | 40 | |
@@ -86,14 +86,16 b' class ChannelstreamView(BaseAppView):' | |||
|
86 | 86 | 'display_name': None, |
|
87 | 87 | 'display_link': None, |
|
88 | 88 | } |
|
89 | user_data['permissions'] = self._rhodecode_user.permissions_safe | |
|
89 | ||
|
90 | #user_data['permissions'] = self._rhodecode_user.permissions_safe | |
|
91 | ||
|
90 | 92 | payload = { |
|
91 | 93 | 'username': user.username, |
|
92 | 94 | 'user_state': user_data, |
|
93 | 95 | 'conn_id': str(uuid.uuid4()), |
|
94 | 96 | 'channels': channels, |
|
95 | 97 | 'channel_configs': {}, |
|
96 | 'state_public_keys': STATE_PUBLIC_KEYS, | |
|
98 | 'state_public_keys': USER_STATE_PUBLIC_KEYS, | |
|
97 | 99 | 'info': { |
|
98 | 100 | 'exclude_channels': ['broadcast'] |
|
99 | 101 | } |
@@ -118,10 +120,13 b' class ChannelstreamView(BaseAppView):' | |||
|
118 | 120 | 'Channelstream service at {} is down'.format(channelstream_url)) |
|
119 | 121 | return HTTPBadGateway() |
|
120 | 122 | |
|
123 | channel_info = connect_result.get('channels_info') | |
|
124 | if not channel_info: | |
|
125 | raise HTTPBadRequest() | |
|
126 | ||
|
121 | 127 | connect_result['channels'] = channels |
|
122 | 128 | connect_result['channels_info'] = parse_channels_info( |
|
123 | connect_result['channels_info'], | |
|
124 | include_channel_info=filtered_channels) | |
|
129 | channel_info, include_channel_info=filtered_channels) | |
|
125 | 130 | update_history_from_logs(self.channelstream_config, |
|
126 | 131 | filtered_channels, connect_result) |
|
127 | 132 | return connect_result |
@@ -167,10 +172,15 b' class ChannelstreamView(BaseAppView):' | |||
|
167 | 172 | log.exception( |
|
168 | 173 | 'Channelstream service at {} is down'.format(channelstream_url)) |
|
169 | 174 | return HTTPBadGateway() |
|
175 | ||
|
176 | channel_info = connect_result.get('channels_info') | |
|
177 | if not channel_info: | |
|
178 | raise HTTPBadRequest() | |
|
179 | ||
|
170 | 180 | # include_channel_info will limit history only to new channel |
|
171 | 181 | # to not overwrite histories on other channels in client |
|
172 | 182 | connect_result['channels_info'] = parse_channels_info( |
|
173 |
|
|
|
183 | channel_info, | |
|
174 | 184 | include_channel_info=filtered_channels) |
|
175 | 185 | update_history_from_logs( |
|
176 | 186 | self.channelstream_config, filtered_channels, connect_result) |
@@ -1890,7 +1890,7 b'' | |||
|
1890 | 1890 | "url": "http://spdx.org/licenses/BSD-4-Clause.html" |
|
1891 | 1891 | } |
|
1892 | 1892 | ], |
|
1893 |
"name": "python2.7-channelstream-0. |
|
|
1893 | "name": "python2.7-channelstream-0.6.14" | |
|
1894 | 1894 | }, |
|
1895 | 1895 | { |
|
1896 | 1896 | "license": [ |
@@ -37,7 +37,8 b' log = logging.getLogger(__name__)' | |||
|
37 | 37 | |
|
38 | 38 | LOCK = ReadWriteMutex() |
|
39 | 39 | |
|
40 | STATE_PUBLIC_KEYS = ['id', 'username', 'first_name', 'last_name', | |
|
40 | USER_STATE_PUBLIC_KEYS = [ | |
|
41 | 'id', 'username', 'first_name', 'last_name', | |
|
41 | 42 |
|
|
42 | 43 | |
|
43 | 44 | |
@@ -64,6 +65,8 b' def channelstream_request(config, payloa' | |||
|
64 | 65 | 'x-channelstream-endpoint': endpoint, |
|
65 | 66 | 'Content-Type': 'application/json'} |
|
66 | 67 | req_url = get_channelstream_server_url(config, endpoint) |
|
68 | ||
|
69 | log.debug('Sending a channelstream request to endpoint: `%s`', req_url) | |
|
67 | 70 | response = None |
|
68 | 71 | try: |
|
69 | 72 | response = requests.post(req_url, data=json.dumps(payload), |
@@ -76,6 +79,7 b' def channelstream_request(config, payloa' | |||
|
76 | 79 | log.exception('Exception related to Channelstream happened') |
|
77 | 80 | if raise_exc: |
|
78 | 81 | raise ChannelstreamConnectionException() |
|
82 | log.debug('Got channelstream response: %s', response) | |
|
79 | 83 | return response |
|
80 | 84 | |
|
81 | 85 | |
@@ -154,7 +158,7 b' def parse_channels_info(info_result, inc' | |||
|
154 | 158 | for userinfo in info_result['users']: |
|
155 | 159 | user_state_dict[userinfo['user']] = { |
|
156 | 160 | k: v for k, v in userinfo['state'].items() |
|
157 | if k in STATE_PUBLIC_KEYS | |
|
161 | if k in USER_STATE_PUBLIC_KEYS | |
|
158 | 162 | } |
|
159 | 163 | |
|
160 | 164 | channels_info = {} |
@@ -163,9 +167,9 b' def parse_channels_info(info_result, inc' | |||
|
163 | 167 | if c_name not in include_channel_info: |
|
164 | 168 | continue |
|
165 | 169 | connected_list = [] |
|
166 |
for user |
|
|
170 | for username in c_info['users']: | |
|
167 | 171 | connected_list.append({ |
|
168 |
'user': user |
|
|
172 | 'user': username, | |
|
169 | 173 | 'state': user_state_dict[userinfo['user']] |
|
170 | 174 | }) |
|
171 | 175 | channels_info[c_name] = {'users': connected_list, |
@@ -230,6 +234,14 b' def get_connection_validators(registry):' | |||
|
230 | 234 | |
|
231 | 235 | def post_message(channel, message, username, registry=None): |
|
232 | 236 | |
|
237 | message_obj = message | |
|
238 | if isinstance(message, basestring): | |
|
239 | message_obj = { | |
|
240 | 'message': message, | |
|
241 | 'level': 'success', | |
|
242 | 'topic': '/notifications' | |
|
243 | } | |
|
244 | ||
|
233 | 245 | if not registry: |
|
234 | 246 | registry = get_current_registry() |
|
235 | 247 | |
@@ -243,11 +255,7 b' def post_message(channel, message, usern' | |||
|
243 | 255 | 'user': 'system', |
|
244 | 256 | 'exclude_users': [username], |
|
245 | 257 | 'channel': channel, |
|
246 |
'message': |
|
|
247 | 'message': message, | |
|
248 | 'level': 'success', | |
|
249 | 'topic': '/notifications' | |
|
250 | } | |
|
258 | 'message': message_obj | |
|
251 | 259 | } |
|
252 | 260 | |
|
253 | 261 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now