@rbxts/tether 1.4.4 → 1.4.6
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.
|
@@ -168,9 +168,6 @@ do
|
|
|
168
168
|
end
|
|
169
169
|
end
|
|
170
170
|
function MessageEmitter:runServerReceiveMiddlewares(message, player, data)
|
|
171
|
-
if not self:validateData(message, data) then
|
|
172
|
-
return { true, data }
|
|
173
|
-
end
|
|
174
171
|
local ctx = {
|
|
175
172
|
message = message,
|
|
176
173
|
data = data,
|
|
@@ -179,10 +176,10 @@ do
|
|
|
179
176
|
end,
|
|
180
177
|
}
|
|
181
178
|
for _, middleware in self.middleware:getServerReceive(message) do
|
|
179
|
+
local result = middleware(player, ctx)
|
|
182
180
|
if not self:validateData(message, ctx.data, "Invalid data after server receive middleware") then
|
|
183
181
|
return { true, ctx.data }
|
|
184
182
|
end
|
|
185
|
-
local result = middleware(player, ctx)
|
|
186
183
|
if result == DropRequest then
|
|
187
184
|
self.middleware:notifyRequestDropped(message, "Server receive middleware")
|
|
188
185
|
return { true, ctx.data }
|
|
@@ -194,9 +191,6 @@ do
|
|
|
194
191
|
return { false, ctx.data }
|
|
195
192
|
end
|
|
196
193
|
function MessageEmitter:runClientReceiveMiddlewares(message, data)
|
|
197
|
-
if not self:validateData(message, data) then
|
|
198
|
-
return { true, data }
|
|
199
|
-
end
|
|
200
194
|
local ctx = {
|
|
201
195
|
message = message,
|
|
202
196
|
data = data,
|
|
@@ -205,10 +199,10 @@ do
|
|
|
205
199
|
end,
|
|
206
200
|
}
|
|
207
201
|
for _, middleware in self.middleware:getClientReceive(message) do
|
|
202
|
+
local result = middleware(ctx)
|
|
208
203
|
if not self:validateData(message, ctx.data, "Invalid data after client receive middleware") then
|
|
209
204
|
return { true, ctx.data }
|
|
210
205
|
end
|
|
211
|
-
local result = middleware(ctx)
|
|
212
206
|
if result == DropRequest then
|
|
213
207
|
self.middleware:notifyRequestDropped(message, "Client receive middleware")
|
|
214
208
|
return { true, ctx.data }
|
package/out/middleware.luau
CHANGED
|
@@ -81,7 +81,7 @@ do
|
|
|
81
81
|
if type(_middlewares) == "function" then
|
|
82
82
|
local _condition = order
|
|
83
83
|
if _condition == nil then
|
|
84
|
-
_condition = #messageMiddleware - 1
|
|
84
|
+
_condition = math.max(#messageMiddleware - 1, 0)
|
|
85
85
|
end
|
|
86
86
|
local _middlewares_1 = middlewares
|
|
87
87
|
table.insert(messageMiddleware, _condition + 1, _middlewares_1)
|
|
@@ -98,7 +98,7 @@ do
|
|
|
98
98
|
if type(_middlewares) == "function" then
|
|
99
99
|
local _condition = order
|
|
100
100
|
if _condition == nil then
|
|
101
|
-
_condition = #messageMiddleware - 1
|
|
101
|
+
_condition = math.max(#messageMiddleware - 1, 0)
|
|
102
102
|
end
|
|
103
103
|
local _middlewares_1 = middlewares
|
|
104
104
|
table.insert(messageMiddleware, _condition + 1, _middlewares_1)
|
|
@@ -134,7 +134,7 @@ do
|
|
|
134
134
|
if type(_middlewares) == "function" then
|
|
135
135
|
local _condition = order
|
|
136
136
|
if _condition == nil then
|
|
137
|
-
_condition = #messageMiddleware - 1
|
|
137
|
+
_condition = math.max(#messageMiddleware - 1, 0)
|
|
138
138
|
end
|
|
139
139
|
local _middlewares_1 = middlewares
|
|
140
140
|
table.insert(messageMiddleware, _condition + 1, _middlewares_1)
|
|
@@ -151,7 +151,7 @@ do
|
|
|
151
151
|
if type(_middlewares) == "function" then
|
|
152
152
|
local _condition = order
|
|
153
153
|
if _condition == nil then
|
|
154
|
-
_condition = #messageMiddleware - 1
|
|
154
|
+
_condition = math.max(#messageMiddleware - 1, 0)
|
|
155
155
|
end
|
|
156
156
|
local _middlewares_1 = middlewares
|
|
157
157
|
table.insert(messageMiddleware, _condition + 1, _middlewares_1)
|
|
@@ -187,7 +187,7 @@ do
|
|
|
187
187
|
if type(_middlewares) == "function" then
|
|
188
188
|
local _condition = order
|
|
189
189
|
if _condition == nil then
|
|
190
|
-
_condition = #globalMiddleware - 1
|
|
190
|
+
_condition = math.max(#globalMiddleware - 1, 0)
|
|
191
191
|
end
|
|
192
192
|
local _middlewares_1 = middlewares
|
|
193
193
|
table.insert(globalMiddleware, _condition + 1, _middlewares_1)
|
|
@@ -204,7 +204,7 @@ do
|
|
|
204
204
|
if type(_middlewares) == "function" then
|
|
205
205
|
local _condition = order
|
|
206
206
|
if _condition == nil then
|
|
207
|
-
_condition = #globalMiddleware - 1
|
|
207
|
+
_condition = math.max(#globalMiddleware - 1, 0)
|
|
208
208
|
end
|
|
209
209
|
local _middlewares_1 = middlewares
|
|
210
210
|
table.insert(globalMiddleware, _condition + 1, _middlewares_1)
|