diff --git a/.gitmodules b/.gitmodules index 1b0456cd29..9725af9cef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "app/console"] path = app/console url = https://github.com/appwrite/console - branch = feat-vcs + branch = feat-oauth diff --git a/app/console b/app/console index cad6f3b1bf..297f5f2438 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit cad6f3b1bfdae4d423ba6f0735ba2a5cd5a58551 +Subproject commit 297f5f24389c905e4e2ff93f8fe6ed6f2e06e614 diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 9c56be5e2b..9d7acd26f5 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -474,8 +474,9 @@ App::get('/v1/avatars/initials') ->desc('Get Front Of Cloud Card') ->groups(['api', 'avatars']) ->label('scope', 'avatars.read') - // ->label('cache', true) - // ->label('cache.resource', 'cards/cloud') + ->label('cache', true) + ->label('cache.resourceType', 'cards/cloud') + ->label('cache.resource', 'card/{request.userId}') ->label('docs', false) ->label('origin', '*') ->param('userId', '', new UID(), 'User ID.', true) @@ -491,12 +492,10 @@ App::get('/v1/avatars/initials') ->inject('contributors') ->inject('employees') ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees) use ($getUserGitHub) { - if (!empty($userId)) { - $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); - } + $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); if ($user->isEmpty() && empty($mock)) { - throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); + throw new Exception(Exception::USER_NOT_FOUND); } if(!$mock) { @@ -542,7 +541,7 @@ App::get('/v1/avatars/initials') if($isEmployee) { $image = new Imagick('public/images/cards/cloud/employee.png'); $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 795, 35); $text = new \ImagickDraw(); $text->setTextAlignment(Imagick::ALIGN_CENTER); @@ -579,13 +578,13 @@ App::get('/v1/avatars/initials') if($isContributor) { $image = new Imagick('public/images/cards/cloud/contributor.png'); $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 795, 35); } if($isHero) { $image = new Imagick('public/images/cards/cloud/hero.png'); $image->setGravity(Imagick::GRAVITY_CENTER); - $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 795, 35); } setlocale(LC_ALL, "en_US.utf8"); @@ -650,8 +649,9 @@ App::get('/v1/avatars/initials') ->desc('Get Back Of Cloud Card') ->groups(['api', 'avatars']) ->label('scope', 'avatars.read') - // ->label('cache', true) - // ->label('cache.resource', 'cards/cloud') + ->label('cache', true) + ->label('cache.resourceType', 'cards/cloud-back') + ->label('cache.resource', 'card/{request.userId}') ->label('docs', false) ->label('origin', '*') ->param('userId', '', new UID(), 'User ID.', true) @@ -667,12 +667,10 @@ App::get('/v1/avatars/initials') ->inject('contributors') ->inject('employees') ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees) use ($getUserGitHub) { - if (!empty($userId)) { - $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); - } + $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); if ($user->isEmpty() && empty($mock)) { - throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); + throw new Exception(Exception::USER_NOT_FOUND); } if(!$mock) { @@ -724,8 +722,6 @@ App::get('/v1/avatars/initials') ->file($baseImage->getImageBlob()); }); -// TODO: Uncomment cache flags - // TODO: 3D: // $baseImage = new \Imagick("public/images/cards/cloud/front.png"); // $text = new \ImagickDraw(); diff --git a/docker-compose.yml b/docker-compose.yml index a2117adc5a..591b051223 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -165,6 +165,8 @@ services: - _APP_SMS_PROVIDER - _APP_SMS_FROM - _APP_REGION + - _APP_CONSOLE_GITHUB_APP_ID + - _APP_CONSOLE_GITHUB_SECRET appwrite-realtime: entrypoint: realtime diff --git a/public/images/cards/cloud/contributor.png b/public/images/cards/cloud/contributor.png index 935987979a..203f0f18e8 100644 Binary files a/public/images/cards/cloud/contributor.png and b/public/images/cards/cloud/contributor.png differ diff --git a/public/images/cards/cloud/employee.png b/public/images/cards/cloud/employee.png index 8b454aba30..587c1feb84 100644 Binary files a/public/images/cards/cloud/employee.png and b/public/images/cards/cloud/employee.png differ diff --git a/public/images/cards/cloud/hero.png b/public/images/cards/cloud/hero.png index 1f901a3543..811df0f8cd 100644 Binary files a/public/images/cards/cloud/hero.png and b/public/images/cards/cloud/hero.png differ