mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix(console): register /console web redirects only for the legacy URL scheme
With _APP_CONSOLE_URL_SCHEME=root the console serves /, /auth/*, /card/*, /invite, /login, /mfa, /recover and /register/* at the root, so redirecting them to /console sends users to legacy paths.
This commit is contained in:
1 parent
ac9c382fd8
commit
879f85083b
2 files changed
+15
-10
No files matched your search
@@ -20,6 +20,7 @@ use Appwrite\Platform\Modules\Console\Http\Scopes\Project\XList as ListKeyScopes
|
||||
use Appwrite\Platform\Modules\Console\Http\Templates\Email\Get as GetEmailTemplate;
|
||||
use Appwrite\Platform\Modules\Console\Http\Variables\Get as GetVariables;
|
||||
use Utopia\Platform\Service;
|
||||
use Utopia\System\System;
|
||||
|
||||
class Http extends Service
|
||||
{
|
||||
@@ -39,14 +40,16 @@ class Http extends Service
|
||||
$this->addAction(CreateAssistantQuery::getName(), new CreateAssistantQuery());
|
||||
$this->addAction(GetResourceAvailability::getName(), new GetResourceAvailability());
|
||||
|
||||
// web redirects to /console
|
||||
$this->addAction(RedirectRoot::getName(), new RedirectRoot());
|
||||
$this->addAction(RedirectAuth::getName(), new RedirectAuth());
|
||||
$this->addAction(RedirectInvite::getName(), new RedirectInvite());
|
||||
$this->addAction(RedirectLogin::getName(), new RedirectLogin());
|
||||
$this->addAction(RedirectMFA::getName(), new RedirectMFA());
|
||||
$this->addAction(RedirectCard::getName(), new RedirectCard());
|
||||
$this->addAction(RedirectRecover::getName(), new RedirectRecover());
|
||||
$this->addAction(RedirectRegister::getName(), new RedirectRegister());
|
||||
// web redirects to /console; root-scheme consoles serve these paths themselves
|
||||
if (System::getEnv('_APP_CONSOLE_URL_SCHEME', 'legacy') !== 'root') {
|
||||
$this->addAction(RedirectRoot::getName(), new RedirectRoot());
|
||||
$this->addAction(RedirectAuth::getName(), new RedirectAuth());
|
||||
$this->addAction(RedirectInvite::getName(), new RedirectInvite());
|
||||
$this->addAction(RedirectLogin::getName(), new RedirectLogin());
|
||||
$this->addAction(RedirectMFA::getName(), new RedirectMFA());
|
||||
$this->addAction(RedirectCard::getName(), new RedirectCard());
|
||||
$this->addAction(RedirectRecover::getName(), new RedirectRecover());
|
||||
$this->addAction(RedirectRegister::getName(), new RedirectRegister());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Tests\E2E\Scopes\ProjectNone;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideNone;
|
||||
use Utopia\Config\Config;
|
||||
use Utopia\System\System;
|
||||
|
||||
final class HTTPTest extends Scope
|
||||
{
|
||||
@@ -241,7 +242,8 @@ final class HTTPTest extends Scope
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, $endpoint, [], [], true, false);
|
||||
|
||||
$this->assertEquals('/console' . $endpoint, $response['headers']['location']);
|
||||
$location = System::getEnv('_APP_CONSOLE_URL_SCHEME', 'legacy') !== 'root' ? '/console' . $endpoint : null;
|
||||
$this->assertEquals($location, $response['headers']['location'] ?? null);
|
||||
}
|
||||
|
||||
public function testConsoleServed()
|
||||
|
||||
Reference in new issue
Block a user