@@ -112,24 +112,32 @@ function createExpressApp() {
112
112
app . get ( "/build/*" , handleStatic ) ;
113
113
114
114
app . get ( "*" , ( request , response ) => {
115
- let client = new HTTPRuntimeClient ( ) ;
116
- let content = "" ;
117
- if ( filepath ) content = fs . readFileSync ( filepath ) . toString ( ) ;
118
- client . load ( content , "user" ) ;
119
- client . handle ( request , response ) ;
120
- if ( ! client . server . handling ) {
115
+ let client ;
116
+ // @FIXME : When Owner.both is added this needs updated.
117
+ if ( config . runtimeOwner === Owner . server ) {
118
+ client = new HTTPRuntimeClient ( ) ;
119
+ let content = "" ;
120
+ if ( filepath ) content = fs . readFileSync ( filepath ) . toString ( ) ;
121
+ client . load ( content , "user" ) ;
122
+ client . handle ( request , response ) ;
123
+ }
124
+ if ( config . runtimeOwner === Owner . client || client && ! client . server . handling ) {
121
125
response . setHeader ( "Content-Type" , `${ contentTypes [ "html" ] } ; charset=utf-8` ) ;
122
126
response . end ( fs . readFileSync ( path . join ( config . eveRoot , "index.html" ) ) ) ;
123
127
}
124
128
} ) ;
125
129
126
130
app . post ( "*" , ( request , response ) => {
127
- let client = new HTTPRuntimeClient ( ) ;
128
- let content = "" ;
129
- if ( filepath ) content = fs . readFileSync ( filepath ) . toString ( ) ;
130
- client . load ( content , "user" ) ;
131
- client . handle ( request , response ) ;
132
- if ( ! client . server . handling ) {
131
+ let client ;
132
+ // @FIXME : When Owner.both is added this needs updated.
133
+ if ( config . runtimeOwner === Owner . server ) {
134
+ client = new HTTPRuntimeClient ( ) ;
135
+ let content = "" ;
136
+ if ( filepath ) content = fs . readFileSync ( filepath ) . toString ( ) ;
137
+ client . load ( content , "user" ) ;
138
+ client . handle ( request , response ) ;
139
+ }
140
+ if ( config . runtimeOwner === Owner . client || client && ! client . server . handling ) {
133
141
return response . status ( 404 ) . send ( "Looks like that asset is missing." ) ;
134
142
}
135
143
} ) ;
0 commit comments