django-restit 4.2.46__py3-none-any.whl → 4.2.47__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- account/models/session.py +6 -0
- {django_restit-4.2.46.dist-info → django_restit-4.2.47.dist-info}/METADATA +1 -1
- {django_restit-4.2.46.dist-info → django_restit-4.2.47.dist-info}/RECORD +8 -8
- incident/models/event.py +2 -0
- rest/__init__.py +1 -1
- ws4redis/client.py +49 -0
- {django_restit-4.2.46.dist-info → django_restit-4.2.47.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.46.dist-info → django_restit-4.2.47.dist-info}/WHEEL +0 -0
account/models/session.py
CHANGED
@@ -29,7 +29,7 @@ account/models/member.py,sha256=XwT4evwN6_THL2bKb_TjtQg7NWNwQqtotMHLScplv1s,5018
|
|
29
29
|
account/models/membership.py,sha256=K2fd0TJYhfv58HPyjQVlahlOPz3Q6ZwrxVkguG-2Ej8,7806
|
30
30
|
account/models/notify.py,sha256=YnZujSHJHY7B09e6FIyZIEJRWLPYk1Sk1e92tFzB1IA,12078
|
31
31
|
account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
|
32
|
-
account/models/session.py,sha256=
|
32
|
+
account/models/session.py,sha256=o3t98e8itXEtkknBHdBH_PSq9kuw1A858_wl6ZleXMM,3729
|
33
33
|
account/models/settings.py,sha256=gOyRWBVd3BQpjfj_hJPtqX3H46ztyRAFxBrPbv11lQg,2137
|
34
34
|
account/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
account/oauth/google.py,sha256=q5M6Qhpfp9QslKRVYFZBvtG6kgXV6vYMrR5fp6Xdb9I,2078
|
@@ -103,7 +103,7 @@ incident/migrations/0013_rulecheck_is_required.py,sha256=cL7tOj5XGPpKd2f5BojIKfN
|
|
103
103
|
incident/migrations/0014_event_group_alter_rulecheck_index.py,sha256=v3gm5k0LVoas27qUDOt7el7YtK4yjFVLeEpuFUCoXaQ,724
|
104
104
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
|
106
|
-
incident/models/event.py,sha256=
|
106
|
+
incident/models/event.py,sha256=qa6BIlellU7uUQcA2c4Botd2x7JLL8b7IjSfxyi5iHk,7306
|
107
107
|
incident/models/incident.py,sha256=0M7QN32BwlHYRvnUWPqI4IIThSpActGDdbmbPjNcJ9A,18415
|
108
108
|
incident/models/ossec.py,sha256=p1ptr-8lnaj1EP_VmPR58b2LmaYBGaYYKAMqhWK5yZM,2227
|
109
109
|
incident/models/rules.py,sha256=uT5GhW6Flso287lJGphAlWwL20NRnHDAZoGrWBBQfeE,6260
|
@@ -363,7 +363,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
363
363
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
364
364
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
365
365
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
366
|
-
rest/__init__.py,sha256=
|
366
|
+
rest/__init__.py,sha256=KPZYlX8yNoUvOBRew6LnBQO59yY6TNSoJO9DSSVFH10,121
|
367
367
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
368
368
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
369
369
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -485,7 +485,7 @@ wiki/rpc/wiki.py,sha256=iWehZasU8J1E5sPPqz9QoQr3MpGxqu3rd7CH4wFrm2w,1333
|
|
485
485
|
wiki/tq.py,sha256=wvuBZ3OMV_D2o4kpJhVLIOwpEUfwlglqLJQvpncAwtk,313
|
486
486
|
ws4redis/README.md,sha256=QvwdsauPKxx4qQqnJ991xeU8DgFQCj3CeQt-nCE4s-w,3624
|
487
487
|
ws4redis/__init__.py,sha256=teNfv83A_ke1CBt9BB7NsnWCcFBhnUFPsPESjF554_k,46
|
488
|
-
ws4redis/client.py,sha256=
|
488
|
+
ws4redis/client.py,sha256=ZI8m6c8cG-Ysn80OokZQxg2ihHHWbp0Ea7C7jmFk1UQ,6506
|
489
489
|
ws4redis/connection.py,sha256=QGjzalYrx1y4o6sb6P1akL-Y2fjf2qil0JCo-ona5F8,13431
|
490
490
|
ws4redis/exceptions.py,sha256=EGLoRTdqJVwz900pwhciqPuSjBBd08hhLgFu6umHrI4,636
|
491
491
|
ws4redis/redis.py,sha256=IfT4p3bUtlqso9rryNliH9Ebzlx8-Q2VJcs1kFioeGA,6093
|
@@ -496,7 +496,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
496
496
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
497
497
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
498
498
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
499
|
-
django_restit-4.2.
|
500
|
-
django_restit-4.2.
|
501
|
-
django_restit-4.2.
|
502
|
-
django_restit-4.2.
|
499
|
+
django_restit-4.2.47.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
500
|
+
django_restit-4.2.47.dist-info/METADATA,sha256=L-HD17mdjnfiJOiNb865oC4nGAAQsYmAXETtIrCZnL4,7594
|
501
|
+
django_restit-4.2.47.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
502
|
+
django_restit-4.2.47.dist-info/RECORD,,
|
incident/models/event.py
CHANGED
@@ -136,6 +136,8 @@ class Event(JSONMetaData, rm.RestModel):
|
|
136
136
|
self.lookupIP(request.ip)
|
137
137
|
|
138
138
|
def on_rest_saved(self, request, is_new=False):
|
139
|
+
if not is_new:
|
140
|
+
return
|
139
141
|
if INCIDENT_EVENT_METRICS:
|
140
142
|
if self.hostname:
|
141
143
|
metrics.metric(f"incident_evt_{self.hostname}", category="incident_events", min_granularity="hourly")
|
rest/__init__.py
CHANGED
ws4redis/client.py
CHANGED
@@ -131,6 +131,55 @@ def hincrby(name, field, inc=1):
|
|
131
131
|
return c.hincrby(name, field, inc)
|
132
132
|
|
133
133
|
|
134
|
+
def lpush(name, value, unique=False):
|
135
|
+
c = getRedisClient()
|
136
|
+
if isinstance(value, list):
|
137
|
+
for v in value:
|
138
|
+
if unique and value.encode() in c.lrange(name, 0, -1):
|
139
|
+
return 0
|
140
|
+
c.lpush(name, v)
|
141
|
+
return len(value)
|
142
|
+
if unique and value.encode() in c.lrange(name, 0, -1):
|
143
|
+
return 0
|
144
|
+
return c.lpush(name, value)
|
145
|
+
|
146
|
+
|
147
|
+
def rpush(name, value, unique=False):
|
148
|
+
c = getRedisClient()
|
149
|
+
if isinstance(value, list):
|
150
|
+
for v in value:
|
151
|
+
if unique and value.encode() in c.lrange(name, 0, -1):
|
152
|
+
return 0
|
153
|
+
c.rpush(name, v)
|
154
|
+
return len(value)
|
155
|
+
if unique and value.encode() in c.lrange(name, 0, -1):
|
156
|
+
return 0
|
157
|
+
return c.rpush(name, value)
|
158
|
+
|
159
|
+
|
160
|
+
def lpop(name, timeout=None):
|
161
|
+
c = getRedisClient()
|
162
|
+
if timeout is None:
|
163
|
+
return c.lpop(name)
|
164
|
+
r = c.blpop(name, timeout=timeout)
|
165
|
+
if isinstance(r, tuple):
|
166
|
+
return r[1].decode()
|
167
|
+
|
168
|
+
|
169
|
+
def rpop(name, timeout=None):
|
170
|
+
c = getRedisClient()
|
171
|
+
if timeout is None:
|
172
|
+
return c.rpop(name)
|
173
|
+
r = c.brpop(name, timeout=timeout)
|
174
|
+
if isinstance(r, tuple):
|
175
|
+
return r[1].decode()
|
176
|
+
|
177
|
+
|
178
|
+
def lrange(name, start, end):
|
179
|
+
c = getRedisClient()
|
180
|
+
return [v.decode() for v in c.lrange(name, start, end)]
|
181
|
+
|
182
|
+
|
134
183
|
def sendToUser(user, name, message=None, priority=0, model=None, model_pk=None, custom=None):
|
135
184
|
return sendMessageToUsers([user], buildEventMessage(name, message, priority, model, model_pk, custom))
|
136
185
|
|
File without changes
|
File without changes
|