1
0
Fork 0
mirror of synced 2024-09-29 17:01:37 +13:00

Merge pull request #6329 from appwrite/patch-oauth-flows-1.4.x

Patch: Disable console protection
This commit is contained in:
Christy Jacob 2023-09-25 09:34:43 -04:00 committed by GitHub
commit 6a28499f1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,5 @@
<?php
use Appwrite\Extend\Exception;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Utopia\App;
@ -28,17 +27,9 @@ App::get('/console/*')
->groups(['web'])
->label('permission', 'public')
->label('scope', 'home')
->inject('utopia')
->inject('request')
->inject('response')
->action(function (App $utopia, Request $request, Response $response) {
$host = $request->getHostname() ?? '';
$mainDomain = App::getEnv('_APP_DOMAIN', '');
if (App::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled' && $host !== $mainDomain) {
$utopia->getRoute()?->label('error', __DIR__ . '/../../views/general/error.phtml');
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite Console over custom domain. Please disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.');
}
->action(function (Request $request, Response $response) {
$fallback = file_get_contents(__DIR__ . '/../../../console/index.html');
// Card SSR