@@ -42,7 +42,7 @@ class CoCreateFileSystem {
42
42
return file . object [ 0 ] . src
43
43
}
44
44
45
- let default403 , default404 , hostNotFound , signup
45
+ let default403 , default404 , hostNotFound , signup , balanceFalse
46
46
defaultFiles ( '/403.html' ) . then ( ( file ) => {
47
47
default403 = file
48
48
} )
@@ -52,6 +52,9 @@ class CoCreateFileSystem {
52
52
defaultFiles ( '/hostNotFound.html' ) . then ( ( file ) => {
53
53
hostNotFound = file
54
54
} )
55
+ defaultFiles ( '/balanceFalse' ) . then ( ( file ) => {
56
+ balanceFalse = file
57
+ } )
55
58
defaultFiles ( '/superadmin/signup.html' ) . then ( ( file ) => {
56
59
signup = file
57
60
} )
@@ -76,12 +79,7 @@ class CoCreateFileSystem {
76
79
77
80
if ( ! org || ! org . object || ! org . object [ 0 ] ) {
78
81
hostNotFound = hostNotFound || 'An organization could not be found using the host: ' + hostname + ' in platformDB: ' + process . env . organization_id
79
- res . writeHead ( 404 , { 'Content-Type' : 'text/html' } ) ;
80
- if ( org . storage === false && org . error )
81
- res . setHeader ( 'storage' , 'false' )
82
- else
83
- res . setHeader ( 'storage' , 'true' )
84
-
82
+ res . writeHead ( 404 , { 'Content-Type' : 'text/html' , 'storage' : organization . storage } ) ;
85
83
return res . end ( hostNotFound ) ;
86
84
} else {
87
85
organization = { _id : org . object [ 0 ] . _id , storage : ! ! org . object [ 0 ] . storage }
@@ -90,7 +88,16 @@ class CoCreateFileSystem {
90
88
}
91
89
92
90
let organization_id = organization . _id
91
+
92
+ let active = crud . wsManager . organizations . get ( organization_id )
93
+ if ( active === false ) {
94
+ balanceFalse = balanceFalse || 'This organizations account balance has fallen bellow 0: '
95
+ res . writeHead ( 404 , { 'Content-Type' : 'text/html' , 'Account-Balance' : 'false' , 'storage' : organization . storage } ) ;
96
+ return res . end ( balanceFalse ) ;
97
+ }
98
+
93
99
res . setHeader ( 'organization' , organization_id )
100
+ res . setHeader ( 'storage' , organization . storage ) ;
94
101
res . setHeader ( 'Access-Control-Allow-Origin' , '*' ) ;
95
102
res . setHeader ( 'Access-Control-Allow-Methods' , '' ) ;
96
103
res . setHeader ( 'Access-Control-Allow-Headers' , 'Content-Type, Authorization' ) ;
@@ -125,10 +132,6 @@ class CoCreateFileSystem {
125
132
data . organization_id = process . env . organization_id
126
133
127
134
let file = await crud . send ( data ) ;
128
- if ( file . storage === false && file . error )
129
- res . setHeader ( 'storage' , 'false' )
130
- else
131
- res . setHeader ( 'storage' , 'true' )
132
135
133
136
const fileContent = req . headers [ 'File-Content' ]
134
137
if ( fileContent && ! pathname . startsWith ( '/superadmin' ) ) {
0 commit comments