diff --git a/.claude/skills/patch-release-checklist/SKILL.md b/.claude/skills/patch-release-checklist/SKILL.md index 000fcd065a..d052640f23 100644 --- a/.claude/skills/patch-release-checklist/SKILL.md +++ b/.claude/skills/patch-release-checklist/SKILL.md @@ -6,9 +6,8 @@ When bumping a patch version (e.g., `1.9.0` -> `1.9.1`), follow this checklist. ### Bump console image -Update the console Docker image tag in both files: -- [ ] `docker-compose.yml` -- update `image: appwrite/console:X.Y.Z` -- [ ] `app/views/install/compose.phtml` -- update `image: /console:X.Y.Z` +Update the console Docker image tag: +- [ ] `docker-compose.yml` -- update `image: appwrite/vibes:X.Y.Z` (the `appwrite-console` service) ### Bump Appwrite version diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index bde3ff427b..b3444967b4 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -77,8 +77,8 @@ use Utopia\Validator\Range; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -$oauthDefaultSuccess = '/console/auth/oauth2/success'; -$oauthDefaultFailure = '/console/auth/oauth2/failure'; +$oauthDefaultSuccess = '/auth/oauth2/success'; +$oauthDefaultFailure = '/auth/oauth2/failure'; $createSession = function (string $userId, string $secret, Request $request, Response $response, User $user, Database $dbForProject, Document $project, array $platform, Locale $locale, GeoRecord $geoRecord, Event $queueForEvents, Bus $bus, Store $store, ProofsToken $proofForToken, ProofsCode $proofForCode, bool $domainVerification, ?string $cookieDomain, Authorization $authorization) { @@ -2352,7 +2352,7 @@ Http::post('/v1/account/tokens/magic-url') } elseif ($protocol === 'http' && $port !== '80') { $callbackBase .= ':' . $port; } - $url = $callbackBase . '/console/auth/magic-url'; + $url = $callbackBase . '/auth/magic-url'; } $url = Template::parseURL($url); diff --git a/app/controllers/general.php b/app/controllers/general.php index c8d266cf8d..914acf6d2d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -125,7 +125,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (\str_ends_with($host, $denyDomain)) { $exception = new AppwriteException(AppwriteException::RULE_NOT_FOUND, 'This domain is not connected to any Appwrite resources. Visit domains tab under function/site settings to configure it.', view: $errorView); - $exception->addCTA('Start with this domain', $url . '/console'); + $exception->addCTA('Start with this domain', $url); throw $exception; } } @@ -200,7 +200,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $resourceId = $rule->getAttribute('deploymentResourceId', ''); $type = ($resourceType === 'site') ? 'sites' : 'functions'; $exception = new AppwriteException(AppwriteException::DEPLOYMENT_NOT_FOUND, view: $errorView); - $exception->addCTA('View deployments', $url . '/console/project-' . $project->getAttribute('region', 'default') . '-' . $projectId . '/' . $type . '/' . $resourceType . '-' . $resourceId); + $exception->addCTA('View deployments', $url . '/projects/' . $projectId . '/' . $type . '/' . $resourceId); throw $exception; } @@ -289,7 +289,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $response ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->addHeader('Pragma', 'no-cache') - ->redirect($url . '/console/auth/preview?' + ->redirect($url . '/auth/preview?' . \http_build_query([ 'projectId' => $projectId, 'origin' => $protocol . '://' . $host, @@ -346,22 +346,21 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $allowAnyStatus = !\is_null($apiKey) && $apiKey->isDeploymentStatusIgnored(); if (!$allowAnyStatus && $deployment->getAttribute('status') !== 'ready') { $status = $deployment->getAttribute('status'); - $region = $project->getAttribute('region', 'default'); switch ($status) { case 'failed': $exception = new AppwriteException(AppwriteException::BUILD_FAILED, view: $errorView); - $ctaUrl = '/console/project-' . $region . '-' . $project->getId() . '/sites/site-' . $resource->getId() . '/deployments/deployment-' . $deployment->getId(); + $ctaUrl = '/projects/' . $project->getId() . '/sites/' . $resource->getId() . '/deployments/' . $deployment->getId(); $exception->addCTA('View logs', $url . $ctaUrl); break; case 'canceled': $exception = new AppwriteException(AppwriteException::BUILD_CANCELED, view: $errorView); - $ctaUrl = '/console/project-' . $region . '-' . $project->getId() . '/sites/site-' . $resource->getId() . '/deployments'; + $ctaUrl = '/projects/' . $project->getId() . '/sites/' . $resource->getId() . '/deployments'; $exception->addCTA('View deployments', $url . $ctaUrl); break; default: $exception = new AppwriteException(AppwriteException::BUILD_NOT_READY, view: $errorView); - $ctaUrl = '/console/project-' . $region . '-' . $project->getId() . '/sites/site-' . $resource->getId() . '/deployments/deployment-' . $deployment->getId(); + $ctaUrl = '/projects/' . $project->getId() . '/sites/' . $resource->getId() . '/deployments/' . $deployment->getId(); $exception->addCTA('Reload', '/'); $exception->addCTA('View logs', $url . $ctaUrl); break; @@ -373,7 +372,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $permissions = $resource->getAttribute('execute'); if (!(\in_array('any', $permissions)) && !(\in_array('guests', $permissions))) { $exception = new AppwriteException(AppwriteException::FUNCTION_EXECUTE_PERMISSION_MISSING, view: $errorView); - $exception->addCTA('View settings', $url . '/console/project-' . $project->getAttribute('region', 'default') . '-' . $project->getId() . '/functions/function-' . $resource->getId() . '/settings'); + $exception->addCTA('View settings', $url . '/projects/' . $project->getId() . '/functions/' . $resource->getId() . '/settings'); throw $exception; } } diff --git a/docker-compose.yml b/docker-compose.yml index 1b5163e1e5..42b23852b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -213,20 +213,35 @@ services: max-file: "5" max-size: 10m container_name: appwrite-console - image: appwrite/console:8.7.11 + image: appwrite/vibes:0.3.1 restart: unless-stopped networks: - appwrite + healthcheck: + test: + - CMD-SHELL + - 'bun -e "fetch(''http://localhost:3000/health'').then((r) => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"' + interval: 5s + timeout: 5s + retries: 12 + start_period: 30s + environment: + - VITE_CONSOLE_PROFILE=self-hosted labels: - traefik.enable=true - traefik.constraint-label-stack=appwrite - traefik.docker.network=appwrite - - traefik.http.services.appwrite_console.loadbalancer.server.port=80 + - traefik.http.services.appwrite_console.loadbalancer.server.port=3000 + - traefik.http.middlewares.appwrite_console_compat.redirectregex.regex=^(https?://[^/]+)/console(?:/(.*))?$$ + - traefik.http.middlewares.appwrite_console_compat.redirectregex.replacement=$${1}/$${2} + - traefik.http.middlewares.appwrite_console_compat.redirectregex.permanent=false - traefik.http.routers.appwrite_console_http.entrypoints=appwrite_web - - traefik.http.routers.appwrite_console_http.rule=PathPrefix(`/console`) + - traefik.http.routers.appwrite_console_http.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`) + - traefik.http.routers.appwrite_console_http.middlewares=appwrite_console_compat - traefik.http.routers.appwrite_console_http.service=appwrite_console - traefik.http.routers.appwrite_console_https.entrypoints=appwrite_websecure - - traefik.http.routers.appwrite_console_https.rule=PathPrefix(`/console`) + - traefik.http.routers.appwrite_console_https.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`) + - traefik.http.routers.appwrite_console_https.middlewares=appwrite_console_compat - traefik.http.routers.appwrite_console_https.service=appwrite_console - traefik.http.routers.appwrite_console_https.tls=true appwrite-realtime: diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 5466ade630..bce33f0efb 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -259,8 +259,6 @@ class Webhooks extends Action $projectId = $project->getId(); $projectInternalId = $project->getSequence(); - $region = $project->getAttribute('region', 'default'); - $webhookId = $webhook->getId(); $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'disabled' ? 'http' : 'https'; $consoleHostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', 'localhost')); @@ -304,7 +302,7 @@ class Webhooks extends Action $template->setParam('{{url}}', $webhook->getAttribute('url')); $template->setParam('{{error}}', 'The server returned ' . $statusCode . ' status code'); $template->setParam('{{host}}', $protocol . '://' . $consoleHostname); - $template->setParam('{{path}}', "/console/project-$region-$projectId/settings/webhooks/$webhookId"); + $template->setParam('{{path}}', "/projects/$projectId/settings/webhooks"); $template->setParam('{{attempts}}', $attempts); $publisherForNotifications->enqueue(new NotificationMessage( diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 8741ecff6c..77df933a04 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -161,7 +161,7 @@ class Comment }; if ($site['action']['type'] === 'logs') { - $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $site['region'] . '-' . $projectId . '/sites/site-' . $siteId . '/deployments/deployment-' . $site['deploymentId'] . ')'; + $action = '[View Logs](' . $protocol . '://' . $hostname . '/projects/' . $projectId . '/sites/' . $siteId . '/deployments/' . $site['deploymentId'] . ')'; } else { $action = '[Authorize](' . $site['action']['url'] . ')'; } @@ -209,7 +209,7 @@ class Comment }; if ($function['action']['type'] === 'logs') { - $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $function['region'] . '-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')'; + $action = '[View Logs](' . $protocol . '://' . $hostname . '/projects/' . $projectId . '/functions/' . $functionId . '/deployments/' . $function['deploymentId'] . ')'; } else { $action = '[Authorize](' . $function['action']['url'] . ')'; } diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 16f0c8199f..925b040a7d 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -26,6 +26,7 @@ final class HTTPTest extends Scope /** * Test for SUCCESS */ + $this->client->setEndpoint('http://localhost'); $response = $this->client->call(Client::METHOD_OPTIONS, '/', \array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json', @@ -51,6 +52,7 @@ final class HTTPTest extends Scope /** * Test for SUCCESS */ + $this->client->setEndpoint('http://localhost'); $response = $this->client->call(Client::METHOD_GET, '/humans.txt', \array_merge([ 'origin' => 'http://localhost', ])); @@ -64,6 +66,7 @@ final class HTTPTest extends Scope /** * Test for SUCCESS */ + $this->client->setEndpoint('http://localhost'); $response = $this->client->call(Client::METHOD_GET, '/robots.txt', \array_merge([ 'origin' => 'http://localhost', ])); @@ -77,6 +80,7 @@ final class HTTPTest extends Scope /** * Test for SUCCESS */ + $this->client->setEndpoint('http://localhost'); $response = $this->client->call(Client::METHOD_GET, '/.well-known/acme-challenge/8DdIKX257k6Dih5s_saeVMpTnjPJdKO5Ase0OCiJrIg'); // 'Unknown path', but validation passed @@ -87,8 +91,8 @@ final class HTTPTest extends Scope */ $response = $this->client->call(Client::METHOD_GET, '/.well-known/acme-challenge/../../../../../../../etc/passwd'); - // 'Unknown path', but validation passed - $this->assertEquals(404, $response['headers']['status-code']); + // 'Invalid challenge token', traversal rejected by validation + $this->assertEquals(400, $response['headers']['status-code']); } public function testVersions() @@ -96,6 +100,7 @@ final class HTTPTest extends Scope /** * Test without header */ + $this->client->setEndpoint('http://localhost'); $response = $this->client->call(Client::METHOD_GET, '/versions', \array_merge([ 'content-type' => 'application/json', ], $this->getHeaders())); @@ -172,11 +177,23 @@ final class HTTPTest extends Scope /** * Test for SUCCESS */ + $this->client->setEndpoint('http://localhost'); $endpoint = '/invite?membershipId=123&userId=asdf'; - $response = $this->client->call(Client::METHOD_GET, $endpoint); + $response = $this->client->call(Client::METHOD_GET, $endpoint, [], [], true, false); $this->assertEquals('/console' . $endpoint, $response['headers']['location']); } + + public function testConsoleServed() + { + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_GET, '/'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('text/html', $response['headers']['content-type']); + } } diff --git a/tests/unit/Platform/Workers/WebhooksTest.php b/tests/unit/Platform/Workers/WebhooksTest.php index 356db9f146..cf611e285b 100644 --- a/tests/unit/Platform/Workers/WebhooksTest.php +++ b/tests/unit/Platform/Workers/WebhooksTest.php @@ -69,7 +69,7 @@ final class WebhooksTest extends TestCase ); $this->assertStringContainsString('Payments', (string) $payload['body']); $this->assertStringContainsString('Ada Lovelace', (string) $payload['body']); - $this->assertStringContainsString('/console/project-fra-project-1/settings/webhooks/webhook-1', (string) $payload['body']); + $this->assertStringContainsString('/projects/project-1/settings/webhooks', (string) $payload['body']); $this->assertStringNotContainsString('{{', (string) $payload['body']); $this->assertSame(APP_NAME, $payload['variables']['platform']); $this->assertSame(APP_EMAIL_LOGO_URL, $payload['variables']['logoUrl']);