@@ -87,7 +87,6 @@ class CoCreateFileSystem {
87
87
organization = { _id : org . object [ 0 ] . _id , storage : ! ! org . object [ 0 ] . storage }
88
88
organizations . set ( hostname , organization )
89
89
}
90
-
91
90
}
92
91
93
92
let organization_id = organization . _id
@@ -133,6 +132,18 @@ class CoCreateFileSystem {
133
132
134
133
const fileContent = req . headers [ 'File-Content' ]
135
134
if ( fileContent && ! pathname . startsWith ( '/superadmin' ) ) {
135
+ crud . wsManager . emit ( "setBandwidth" , {
136
+ type : 'in' ,
137
+ data : fileContent ,
138
+ organization_id
139
+ } ) ;
140
+
141
+ crud . wsManager . emit ( "setBandwidth" , {
142
+ type : 'out' ,
143
+ data : fileContent ,
144
+ organization_id
145
+ } ) ;
146
+
136
147
res . writeHead ( 200 , { 'Content-Type' : req . headers [ 'Content-Type' ] } ) ;
137
148
return res . end ( fileContent ) ;
138
149
}
@@ -147,6 +158,13 @@ class CoCreateFileSystem {
147
158
pageNotFound = default404 || `${ pathname } could not be found for ${ organization_id } `
148
159
else
149
160
pageNotFound = pageNotFound . object [ 0 ] . src
161
+
162
+ crud . wsManager . emit ( "setBandwidth" , {
163
+ type : 'out' ,
164
+ data : pageNotFound ,
165
+ organization_id
166
+ } ) ;
167
+
150
168
res . writeHead ( 404 , { 'Content-Type' : 'text/html' } ) ;
151
169
return res . end ( pageNotFound ) ;
152
170
}
@@ -162,6 +180,13 @@ class CoCreateFileSystem {
162
180
pageForbidden = default403 || `${ pathname } access not allowed for ${ organization_id } `
163
181
else
164
182
pageForbidden = pageForbidden . object [ 0 ] . src
183
+
184
+ crud . wsManager . emit ( "setBandwidth" , {
185
+ type : 'out' ,
186
+ data : pageForbidden ,
187
+ organization_id
188
+ } ) ;
189
+
165
190
res . writeHead ( 403 , { 'Content-Type' : 'text/html' } ) ;
166
191
return res . end ( pageForbidden ) ;
167
192
}
@@ -192,6 +217,11 @@ class CoCreateFileSystem {
192
217
else
193
218
pageNotFound = pageNotFound . object [ 0 ] . src
194
219
220
+ crud . wsManager . emit ( "setBandwidth" , {
221
+ type : 'out' ,
222
+ data : pageNotFound ,
223
+ organization_id
224
+ } ) ;
195
225
196
226
res . writeHead ( 404 , { 'Content-Type' : 'text/html' } ) ;
197
227
return res . end ( pageNotFound ) ;
@@ -212,6 +242,12 @@ class CoCreateFileSystem {
212
242
if ( file . modified )
213
243
res . setHeader ( 'Last-Modified' , file . modified . on ) ;
214
244
245
+ crud . wsManager . emit ( "setBandwidth" , {
246
+ type : 'out' ,
247
+ data : src ,
248
+ organization_id
249
+ } ) ;
250
+
215
251
res . writeHead ( 200 , { 'Content-Type' : contentType } ) ;
216
252
return res . end ( src ) ;
217
253
} catch ( error ) {
0 commit comments