| 251 | var setupQuickBailToMainHTML = function(app) { |
| 252 | |
| 253 | const fast = template => (function(req, res, next) { |
| 254 | let features; |
| 255 | req.features = (features = {}); |
| 256 | |
| 257 | if (config.isProduction || true) { |
| 258 | res.header('Cache-Control', 'public, max-age=60'); |
| 259 | res.header('Expires', 60); |
| 260 | } else { |
| 261 | res.header('Cache-Control', 'no-cache, no-store, must-revalidate'); |
| 262 | res.header('Pragma', 'no-cache'); |
| 263 | res.header('Expires', 0); |
| 264 | } |
| 265 | |
| 266 | if (/(cn\.codecombat\.com|koudashijie|aojiarui)/.test(req.get('host'))) { |
| 267 | features.china = true; |
| 268 | if ((template === 'home.html') && (config.product === 'codecombat')) { |
| 269 | template = 'home-cn.html'; |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | if (config.chinaInfra) { |
| 274 | features.chinaInfra = true; |
| 275 | } |
| 276 | |
| 277 | return renderMain(template, req, res); |
| 278 | }); |
| 279 | |
| 280 | app.get('/', fast('home.html')); |
| 281 | app.get('/home', fast('home.html')); |
no test coverage detected