django-restit 4.2.147__py3-none-any.whl → 4.2.151__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {django_restit-4.2.147.dist-info → django_restit-4.2.151.dist-info}/METADATA +1 -1
- {django_restit-4.2.147.dist-info → django_restit-4.2.151.dist-info}/RECORD +10 -10
- inbox/utils/parsing.py +7 -2
- medialib/caching.py +13 -1
- rest/__init__.py +1 -1
- rest/models/base.py +1 -0
- rest/rpc.py +1 -1
- ws4redis/connection.py +22 -17
- {django_restit-4.2.147.dist-info → django_restit-4.2.151.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.147.dist-info → django_restit-4.2.151.dist-info}/WHEEL +0 -0
@@ -91,7 +91,7 @@ inbox/models/message.py,sha256=acPm2z0QsucoFFmfzPekehElZm8EMzkcGChX_BpzGLU,3758
|
|
91
91
|
inbox/models/template.py,sha256=i5vf0vsM1U0251UmVsF61MDCV_c7xt-zdCdx1SiKOG0,1013
|
92
92
|
inbox/rpc.py,sha256=7JXvpXlEGKG7by_NkANPGYLCzagyCnTIGM4rme_htpk,1534
|
93
93
|
inbox/utils/__init__.py,sha256=P_UR2rGK3L0tZNlTN-mf99tpeYM-tLkA18iDKXSSLDM,89
|
94
|
-
inbox/utils/parsing.py,sha256=
|
94
|
+
inbox/utils/parsing.py,sha256=ORYgg_QRKQqv3M3vok1MPK7eIMmmwqUwxk_Fa-cb3bM,5550
|
95
95
|
inbox/utils/render.py,sha256=CU_F2qUBQE7mjb9Q6Dn9ro5CS_O_zEY-wDMHEClKkIA,4331
|
96
96
|
inbox/utils/sending.py,sha256=BKelTZnbkdSLGpjOY6IRTrzj-Hnw2pPZ7RYQGwe-tqk,2179
|
97
97
|
incident/README.md,sha256=4vbZTJj7uUmq8rogYngxqNYjFTlBOujfWUGheLoFKMc,1114
|
@@ -163,7 +163,7 @@ location/rpc/location.py,sha256=D5R54nnmmp8NaHQRkP_TF921Ej6j9nmTUNzX1K5WVPc,779
|
|
163
163
|
location/rpc/track.py,sha256=jSS9_eiKayM_8iW_4Ldojg9a2_trjfXhnLe_a261x5E,3735
|
164
164
|
medialib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
165
165
|
medialib/admin.py,sha256=befSpVP7TpyWGsh47E1CiFMUSwNYT7bxMgzgyDK07yI,2261
|
166
|
-
medialib/caching.py,sha256=
|
166
|
+
medialib/caching.py,sha256=Hhkj8OsR6sLJ1RSWtQKsIHru2yYQpk-UBYK5IUWD-Jk,2776
|
167
167
|
medialib/cvutil/__init__.py,sha256=ADxS2MfnLqzd7NI2QgWeQSNcgJCNBP2Wgy3hBZV9w4s,27
|
168
168
|
medialib/cvutil/contours.py,sha256=B6_PGOIg_ORX9i3K8PE35H_c2H0LejLSRE1sQMxPaIc,4269
|
169
169
|
medialib/cvutil/images.py,sha256=9qQDd1rE3HJZ0MBn2v39snBXatI9fLqYPQXgdCuaQs0,12649
|
@@ -379,7 +379,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
379
379
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
380
380
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
381
381
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
382
|
-
rest/__init__.py,sha256=
|
382
|
+
rest/__init__.py,sha256=NlPBDSPooXfNg535Lz8YBFDbF0KQOjtEHtUd8dGdGOA,122
|
383
383
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
384
384
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
385
385
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -412,13 +412,13 @@ rest/middleware/request.py,sha256=JchRNy5L-bGd-7h-KFYekGRvREe2eCkZXKOYqIkP2hI,41
|
|
412
412
|
rest/middleware/session.py,sha256=zHSoQpIzRLmpqr_JvW406wzpvU3W3gDbm5JhtzLAMlE,10240
|
413
413
|
rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75e6U,1901
|
414
414
|
rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
|
415
|
-
rest/models/base.py,sha256=
|
415
|
+
rest/models/base.py,sha256=RnL6-8N7tghGDcOtWIRwlTWrllgwW6EMoeyi8I-bm4I,71856
|
416
416
|
rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
|
417
417
|
rest/models/metadata.py,sha256=1nQ7CYo9bJHoaXE_hVNaj1-Y7yqhHlf2ZlaD1IfTzic,12904
|
418
418
|
rest/net.py,sha256=LcB2QV6VNRtsSdmiQvYZgwQUDwOPMn_VBdRiZ6OpI-I,2974
|
419
419
|
rest/regexes.yaml,sha256=VoGb4E-P_K9f82Yzcpltgzekpt9usRtwu9PYlo46nUw,149463
|
420
420
|
rest/requestex.py,sha256=N56056vV3zWkAP-QrYsCu7SdpPzE5kLuPoxGIuZAKt0,16127
|
421
|
-
rest/rpc.py,sha256=
|
421
|
+
rest/rpc.py,sha256=WXZe5CLdYMeSXRH6wuzl-_riPPRnmtFNVJB9dfY1GSo,2965
|
422
422
|
rest/search.py,sha256=QVjk2b5tZLgf1zM2MHvJTyRjwUbY5ZD7HXSTmSPXtvU,8362
|
423
423
|
rest/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
424
424
|
rest/serializers/collection.py,sha256=V9O4qxw26VX9dSYdbsN0-RNnXEi347Ln8eFLZ003LhA,4646
|
@@ -505,7 +505,7 @@ wiki/tq.py,sha256=wvuBZ3OMV_D2o4kpJhVLIOwpEUfwlglqLJQvpncAwtk,313
|
|
505
505
|
ws4redis/README.md,sha256=QvwdsauPKxx4qQqnJ991xeU8DgFQCj3CeQt-nCE4s-w,3624
|
506
506
|
ws4redis/__init__.py,sha256=teNfv83A_ke1CBt9BB7NsnWCcFBhnUFPsPESjF554_k,46
|
507
507
|
ws4redis/client.py,sha256=HTntgqlMzZU9MhBz3fn3fXDpzfaTDZx_9tIb5SU91hY,7077
|
508
|
-
ws4redis/connection.py,sha256=
|
508
|
+
ws4redis/connection.py,sha256=SM0KOaTjNeRt3W28mBsSPi3dgegXlhWhLIpGYULgl1Q,14060
|
509
509
|
ws4redis/exceptions.py,sha256=EGLoRTdqJVwz900pwhciqPuSjBBd08hhLgFu6umHrI4,636
|
510
510
|
ws4redis/redis.py,sha256=jHfwpUG0Nru_zSyD-xwJhX67gASqVtTFiAc3RwgTcJs,6542
|
511
511
|
ws4redis/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -515,7 +515,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
515
515
|
ws4redis/settings.py,sha256=KKq00EwoGnz1yLwCZr5Dfoq2izivmAdsNEEM4EhZwN4,1610
|
516
516
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
517
517
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
518
|
-
django_restit-4.2.
|
519
|
-
django_restit-4.2.
|
520
|
-
django_restit-4.2.
|
521
|
-
django_restit-4.2.
|
518
|
+
django_restit-4.2.151.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
519
|
+
django_restit-4.2.151.dist-info/METADATA,sha256=0mVYsiUDKwkB_0VkL_-c_AYqtKqycTiUyl7-UWGsV4Y,7663
|
520
|
+
django_restit-4.2.151.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
521
|
+
django_restit-4.2.151.dist-info/RECORD,,
|
inbox/utils/parsing.py
CHANGED
@@ -131,7 +131,7 @@ def toFileObject(attachment):
|
|
131
131
|
return obj
|
132
132
|
|
133
133
|
|
134
|
-
def parseAddresses(input_string):
|
134
|
+
def parseAddresses(input_string, force_name=False):
|
135
135
|
# Define a regex pattern to capture email addresses
|
136
136
|
email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
|
137
137
|
# Find all matches of the pattern in the input string
|
@@ -141,11 +141,16 @@ def parseAddresses(input_string):
|
|
141
141
|
for addr in emails:
|
142
142
|
# Extract name if it exists
|
143
143
|
name_match = re.search(r'([a-zA-Z\s]+)?\s*<{}>'.format(re.escape(addr)), input_string)
|
144
|
+
addr = addr.strip().lower()
|
145
|
+
full_email = addr
|
144
146
|
if name_match and name_match.group(1):
|
145
147
|
name = name_match.group(1).strip()
|
148
|
+
full_email = f"{name} <{addr}>"
|
149
|
+
elif force_name:
|
150
|
+
name = addr.split('@')[1]
|
146
151
|
else:
|
147
152
|
name = None
|
148
|
-
parsed_emails.append(objict(name=name, email=addr))
|
153
|
+
parsed_emails.append(objict(name=name, email=addr, full_email=full_email))
|
149
154
|
return parsed_emails
|
150
155
|
|
151
156
|
|
medialib/caching.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import io
|
1
2
|
from rest import settings
|
2
3
|
from medialib.stores import s3
|
3
4
|
from django.http import HttpResponse, StreamingHttpResponse
|
@@ -45,7 +46,18 @@ def getCachedItem(cache_guid, content_type="application/json"):
|
|
45
46
|
def cacheResponse(response, cache_guid, content_type="application/json"):
|
46
47
|
url = f"s3://{settings.AWS_S3_BUCKET}/caching/{cache_guid}"
|
47
48
|
item = s3.S3Item(url, content_type)
|
48
|
-
|
49
|
+
if isinstance(response, StreamingHttpResponse):
|
50
|
+
# Access the streaming content and convert it to a file-like object
|
51
|
+
content = io.BytesIO()
|
52
|
+
for chunk in response.streaming_content:
|
53
|
+
content.write(chunk)
|
54
|
+
# Reset the file pointer to the beginning before uploading
|
55
|
+
content.seek(0)
|
56
|
+
item.upload(content)
|
57
|
+
content.seek(0)
|
58
|
+
response.streaming_content = iter(lambda: content.read(8192), b'')
|
59
|
+
else:
|
60
|
+
item.upload(response.content)
|
49
61
|
return item
|
50
62
|
|
51
63
|
|
rest/__init__.py
CHANGED
rest/models/base.py
CHANGED
@@ -1028,6 +1028,7 @@ class RestModel(object):
|
|
1028
1028
|
if tr_start is not None:
|
1029
1029
|
dr_start = rh.updateTimeFromString(dr_start, tr_start)
|
1030
1030
|
if tr_end is not None:
|
1031
|
+
dr_end = request.DATA.get("dr_end", field_type=datetime)
|
1031
1032
|
dr_end = rh.updateTimeFromString(dr_end, tr_end)
|
1032
1033
|
|
1033
1034
|
if dr_tz is not None:
|
rest/rpc.py
CHANGED
@@ -81,7 +81,7 @@ def on_get_system_info(request):
|
|
81
81
|
out = hostinfo.getHostInfo(
|
82
82
|
include_versions=request.DATA.get("versions") and SOFTWARE_VERSIONS,
|
83
83
|
include_blocked=request.DATA.get("blocked"))
|
84
|
-
out["
|
84
|
+
out["redis_pool"] = redis.getPoolStatus()
|
85
85
|
return views.restGet(request, out)
|
86
86
|
|
87
87
|
|
ws4redis/connection.py
CHANGED
@@ -60,13 +60,14 @@ class WebsocketConnection():
|
|
60
60
|
# check our other auth mechanisms
|
61
61
|
auther = self.getAuthenticator(msg.kind)
|
62
62
|
if auther is None or not hasattr(auther, "authWS4RedisConnection"):
|
63
|
-
logger.error("invalid auth", msg)
|
63
|
+
logger.error(f"{self.ip} invalid auth", msg)
|
64
64
|
self.sendToWS(msg.channel, dict(error="invalid auth kind", code=500))
|
65
65
|
return
|
66
66
|
|
67
|
+
# logger.info(f"{self.ip} authenticating")
|
67
68
|
self.credentials = auther.authWS4RedisConnection(msg)
|
68
69
|
if self.credentials is None or self.credentials.pk is None:
|
69
|
-
logger.error("invalid credentials for", msg, self.credentials)
|
70
|
+
logger.error(f"{self.ip} invalid credentials for", msg, self.credentials)
|
70
71
|
self.sendToWS(msg.channel, dict(error="invalid credentials", code=401))
|
71
72
|
return
|
72
73
|
self.on_authenticated()
|
@@ -182,20 +183,24 @@ class WebsocketConnection():
|
|
182
183
|
dmsg = UberDict.fromJSON(raw_data, ignore_errors=True)
|
183
184
|
if dmsg.action:
|
184
185
|
# this is a special message that we want to handle directly
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
186
|
+
try:
|
187
|
+
if dmsg.action == "auth":
|
188
|
+
self.on_auth(dmsg)
|
189
|
+
elif dmsg.action == "subscribe":
|
190
|
+
self.on_subscribe(dmsg)
|
191
|
+
elif dmsg.action == "unsubscribe":
|
192
|
+
self.on_unsubscribe(dmsg)
|
193
|
+
elif dmsg.action == "resubscribe":
|
194
|
+
self.on_resubscribe(dmsg)
|
195
|
+
elif dmsg.action == "publish":
|
196
|
+
self.on_publish(dmsg)
|
197
|
+
elif dmsg.action == "save":
|
198
|
+
self.on_save(dmsg)
|
199
|
+
elif dmsg.channel:
|
200
|
+
self.on_channel_msg(dmsg)
|
201
|
+
except Exception as err:
|
202
|
+
self.sendToWS(dmsg.get("channel", "system"), dict(error=str(err)))
|
203
|
+
logger.exception(self.ip)
|
199
204
|
|
200
205
|
def on_save(self, msg):
|
201
206
|
if self.credentials and self.credentials.instance:
|
@@ -287,7 +292,7 @@ class WebsocketConnection():
|
|
287
292
|
self.on_ws_msg(self.last_msg)
|
288
293
|
except Exception:
|
289
294
|
# logger.exception()
|
290
|
-
logger.error("unable to recv on ws... flushing")
|
295
|
+
logger.error(f"{self.ip}: unable to recv on ws... flushing")
|
291
296
|
self.websocket.flush()
|
292
297
|
|
293
298
|
def checkHeartbeat(self):
|
File without changes
|
File without changes
|