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