2019-05-09 18:54:39 +12:00
|
|
|
<?php
|
2019-09-07 05:10:41 +12:00
|
|
|
|
2022-11-23 10:14:38 +13:00
|
|
|
use Appwrite\Utopia\Request;
|
2022-05-27 01:23:49 +12:00
|
|
|
use Appwrite\Utopia\Response;
|
2020-06-29 05:31:21 +12:00
|
|
|
use Utopia\App;
|
2019-05-09 18:54:39 +12:00
|
|
|
|
2022-11-23 10:14:38 +13:00
|
|
|
App::init()
|
|
|
|
->groups(['web'])
|
|
|
|
->inject('request')
|
|
|
|
->inject('response')
|
|
|
|
->action(function (Request $request, Response $response) {
|
|
|
|
$time = (60 * 60 * 24 * 45); // 45 days cache
|
|
|
|
|
|
|
|
$response
|
|
|
|
->addHeader('Cache-Control', 'public, max-age=' . $time)
|
|
|
|
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + $time) . ' GMT') // 45 days cache
|
|
|
|
->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes
|
|
|
|
->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url=' . \urlencode($request->getURI()))
|
|
|
|
->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode
|
|
|
|
;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2022-11-15 04:26:10 +13:00
|
|
|
App::get('/console')
|
2022-10-31 23:50:19 +13:00
|
|
|
->alias('/')
|
2022-10-31 21:53:36 +13:00
|
|
|
->alias('/invite')
|
|
|
|
->alias('/login')
|
|
|
|
->alias('/recover')
|
|
|
|
->alias('/register')
|
2022-10-12 03:36:39 +13:00
|
|
|
->groups(['web'])
|
2019-05-09 18:54:39 +12:00
|
|
|
->label('permission', 'public')
|
|
|
|
->label('scope', 'home')
|
2022-06-22 22:51:49 +12:00
|
|
|
->inject('response')
|
2022-10-31 21:53:36 +13:00
|
|
|
->action(function (Response $response) {
|
|
|
|
$fallback = file_get_contents(__DIR__ . '/../../../console/index.html');
|
|
|
|
$response->html($fallback);
|
|
|
|
});
|