Add cache, fix miss-align
This commit is contained in:
parent
93946a074d
commit
a8cd99873f
7 changed files with 17 additions and 19 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,4 +1,4 @@
|
|||
[submodule "app/console"]
|
||||
path = app/console
|
||||
url = https://github.com/appwrite/console
|
||||
branch = feat-vcs
|
||||
branch = feat-oauth
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit cad6f3b1bfdae4d423ba6f0735ba2a5cd5a58551
|
||||
Subproject commit 297f5f24389c905e4e2ff93f8fe6ed6f2e06e614
|
|
@ -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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Loading…
Reference in a new issue