Show More
@@ -19,7 +19,6 b'' | |||||
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import os |
|
21 | import os | |
22 | import hashlib |
|
|||
23 | import itsdangerous |
|
22 | import itsdangerous | |
24 | import logging |
|
23 | import logging | |
25 | import requests |
|
24 | import requests | |
@@ -32,6 +31,8 b' import rhodecode.lib.helpers as h' | |||||
32 | from rhodecode.lib.auth import HasRepoPermissionAny |
|
31 | from rhodecode.lib.auth import HasRepoPermissionAny | |
33 | from rhodecode.lib.ext_json import json |
|
32 | from rhodecode.lib.ext_json import json | |
34 | from rhodecode.model.db import User |
|
33 | from rhodecode.model.db import User | |
|
34 | from rhodecode.lib.str_utils import ascii_str | |||
|
35 | from rhodecode.lib.hash_utils import sha1_safe | |||
35 |
|
36 | |||
36 | log = logging.getLogger(__name__) |
|
37 | log = logging.getLogger(__name__) | |
37 |
|
38 | |||
@@ -157,13 +158,13 b' def parse_channels_info(info_result, inc' | |||||
157 | user_state_dict = {} |
|
158 | user_state_dict = {} | |
158 | for userinfo in info_result['users']: |
|
159 | for userinfo in info_result['users']: | |
159 | user_state_dict[userinfo['user']] = { |
|
160 | user_state_dict[userinfo['user']] = { | |
160 | k: v for k, v in userinfo['state'].items() |
|
161 | k: v for k, v in list(userinfo['state'].items()) | |
161 | if k in USER_STATE_PUBLIC_KEYS |
|
162 | if k in USER_STATE_PUBLIC_KEYS | |
162 | } |
|
163 | } | |
163 |
|
164 | |||
164 | channels_info = {} |
|
165 | channels_info = {} | |
165 |
|
166 | |||
166 | for c_name, c_info in info_result['channels'].items(): |
|
167 | for c_name, c_info in list(info_result['channels'].items()): | |
167 | if c_name not in include_channel_info: |
|
168 | if c_name not in include_channel_info: | |
168 | continue |
|
169 | continue | |
169 | connected_list = [] |
|
170 | connected_list = [] | |
@@ -179,9 +180,9 b' def parse_channels_info(info_result, inc' | |||||
179 |
|
180 | |||
180 |
|
181 | |||
181 | def log_filepath(history_location, channel_name): |
|
182 | def log_filepath(history_location, channel_name): | |
182 | hasher = hashlib.sha256() |
|
183 | ||
183 | hasher.update(channel_name.encode('utf8')) |
|
184 | channel_hash = ascii_str(sha1_safe(channel_name)) | |
184 | filename = '{}.log'.format(hasher.hexdigest()) |
|
185 | filename = f'{channel_hash}.log' | |
185 | filepath = os.path.join(history_location, filename) |
|
186 | filepath = os.path.join(history_location, filename) | |
186 | return filepath |
|
187 | return filepath | |
187 |
|
188 | |||
@@ -226,7 +227,7 b' def write_history(config, message):' | |||||
226 |
|
227 | |||
227 | def get_connection_validators(registry): |
|
228 | def get_connection_validators(registry): | |
228 | validators = [] |
|
229 | validators = [] | |
229 | for k, config in registry.rhodecode_plugins.items(): |
|
230 | for k, config in list(registry.rhodecode_plugins.items()): | |
230 | validator = config.get('channelstream', {}).get('connect_validator') |
|
231 | validator = config.get('channelstream', {}).get('connect_validator') | |
231 | if validator: |
|
232 | if validator: | |
232 | validators.append(validator) |
|
233 | validators.append(validator) | |
@@ -340,7 +341,7 b' def comment_channelstream_push(request, ' | |||||
340 |
|
341 | |||
341 | comment_data = kwargs.pop('comment_data', {}) |
|
342 | comment_data = kwargs.pop('comment_data', {}) | |
342 | user_data = kwargs.pop('user_data', {}) |
|
343 | user_data = kwargs.pop('user_data', {}) | |
343 | comment_id = comment_data.keys()[0] if comment_data else '' |
|
344 | comment_id = list(comment_data.keys())[0] if comment_data else '' | |
344 |
|
345 | |||
345 | message = '<strong>{}</strong> {} #{}'.format( |
|
346 | message = '<strong>{}</strong> {} #{}'.format( | |
346 | user.username, |
|
347 | user.username, |
General Comments 0
You need to be logged in to leave comments.
Login now