diff --git a/app/assets/fonts/inter-v8-latin-regular.woff2 b/app/assets/fonts/inter-v8-latin-regular.woff2 new file mode 100644 index 000000000..56a570b24 Binary files /dev/null and b/app/assets/fonts/inter-v8-latin-regular.woff2 differ diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 1830886be..93df84a6f 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -50,7 +50,7 @@ $oauthDefaultSuccess = '/auth/oauth2/success'; $oauthDefaultFailure = '/auth/oauth2/failure'; App::post('/v1/account') - ->desc('Create Account') + ->desc('Create account') ->groups(['api', 'account', 'auth']) ->label('event', 'users.[userId].create') ->label('scope', 'public') @@ -165,7 +165,7 @@ App::post('/v1/account') App::post('/v1/account/sessions/email') ->alias('/v1/account/sessions') - ->desc('Create Email Session') + ->desc('Create email session') ->groups(['api', 'account', 'auth', 'session']) ->label('event', 'users.[userId].sessions.[sessionId].create') ->label('scope', 'public') @@ -437,7 +437,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') ->inject('dbForProject') ->inject('geodb') ->inject('queueForEvents') - ->action(function (string $provider, string $code, string $state, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Reader $geodb, Event $queueForEvents) use ($oauthDefaultSuccess) { + ->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Reader $geodb, Event $queueForEvents) use ($oauthDefaultSuccess) { $protocol = $request->getProtocol(); $callback = $protocol . '://' . $request->getHostname() . '/v1/account/sessions/oauth2/callback/' . $provider . '/' . $project->getId(); @@ -1110,7 +1110,7 @@ App::put('/v1/account/sessions/magic-url') ->inject('locale') ->inject('geodb') ->inject('queueForEvents') - ->action(function (string $userId, string $secret, Request $request, Response $response, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents) { + ->action(function (string $userId, string $secret, Request $request, Response $response,Document $user, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents) { /** @var Utopia\Database\Document $user */ @@ -1845,7 +1845,7 @@ App::patch('/v1/account/name') ->inject('user') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $name, Response $response, Document $user, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $name, ?\DateTime $requestTimestamp, Response $response, Document $user, Database $dbForProject, Event $queueForEvents) { $user->setAttribute('name', $name); @@ -1881,7 +1881,7 @@ App::patch('/v1/account/password') ->inject('project') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $password, string $oldPassword, Response $response, Document $user, Document $project, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $password, string $oldPassword, ?\DateTime $requestTimestamp, Response $response, Document $user, Document $project, Database $dbForProject, Event $queueForEvents) { // Check old password only if its an existing user. if (!empty($user->getAttribute('passwordUpdate')) && !Auth::passwordVerify($oldPassword, $user->getAttribute('password'), $user->getAttribute('hash'), $user->getAttribute('hashOptions'))) { // Double check user password @@ -2148,7 +2148,7 @@ App::delete('/v1/account/sessions/:sessionId') ->inject('locale') ->inject('queueForEvents') ->inject('project') - ->action(function (?string $sessionId, Request $request, Response $response, Document $user, Database $dbForProject, Locale $locale, Event $queueForEvents, Document $project) { + ->action(function (?string $sessionId, ?\DateTime $requestTimestamp, Request $request, Response $response, Document $user, Database $dbForProject, Locale $locale, Event $queueForEvents, Document $project) { $protocol = $request->getProtocol(); $authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index b510f37b5..58ffb0ac9 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -521,7 +521,7 @@ App::get('/v1/functions/:functionId/usage') }); App::get('/v1/functions/usage') - ->desc('Get Functions Usage') + ->desc('Get functions usage') ->groups(['api', 'functions']) ->label('scope', 'functions.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1001,7 +1001,7 @@ App::post('/v1/functions/:functionId/deployments') ->inject('deviceFunctions') ->inject('deviceLocal') ->inject('queueForBuilds') - ->action(function (string $functionId, string $entrypoint, ?string $commands, mixed $code, bool $activate, Request $request, Response $response, Database $dbForProject, Event $queueForEvents, Document $project, Device $deviceFunctions, Device $deviceLocal, Build $queueForBuilds) { + ->action(function (string $functionId, mixed $entrypoint, ?string $commands, mixed $code, bool $activate, Request $request, Response $response, Database $dbForProject, Event $queueForEvents, Document $project, Device $deviceFunctions, Device $deviceLocal, Build $queueForBuilds) { $activate = filter_var($activate, FILTER_VALIDATE_BOOLEAN); diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 011063505..3b04b8f89 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -2,8 +2,15 @@ use Appwrite\ClamAV\Network; use Appwrite\Event\Audit; +use Appwrite\Event\Build; use Appwrite\Event\Certificate; +use Appwrite\Event\Database; +use Appwrite\Event\Delete; use Appwrite\Event\Event; +use Appwrite\Event\Func; +use Appwrite\Event\Mail; +use Appwrite\Event\Migration; +use Appwrite\Event\Phone; use Appwrite\Extend\Exception; use Appwrite\Utopia\Response; use Utopia\App; @@ -41,7 +48,7 @@ App::get('/v1/health') }); App::get('/v1/health/version') - ->desc('Get Version') + ->desc('Get version') ->groups(['api', 'health']) ->label('scope', 'public') ->label('sdk.response.code', Response::STATUS_CODE_OK) @@ -111,7 +118,7 @@ App::get('/v1/health/db') }); App::get('/v1/health/cache') - ->desc('Get Cache') + ->desc('Get cache') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -168,7 +175,7 @@ App::get('/v1/health/cache') }); App::get('/v1/health/queue') - ->desc('Get Queue') + ->desc('Get queue') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -225,7 +232,7 @@ App::get('/v1/health/queue') }); App::get('/v1/health/pubsub') - ->desc('Get PubSub') + ->desc('Get pubsub') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -282,7 +289,7 @@ App::get('/v1/health/pubsub') }); App::get('/v1/health/time') - ->desc('Get Time') + ->desc('Get time') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -339,7 +346,7 @@ App::get('/v1/health/time') }); App::get('/v1/health/queue/webhooks') - ->desc('Get Webhooks Queue') + ->desc('Get webhooks queue') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -349,15 +356,15 @@ App::get('/v1/health/queue/webhooks') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) - ->inject('queueForEvents') + ->inject('queue') ->inject('response') - ->action(function (Event $queueForEvents, Response $response) { - - $response->dynamic(new Document([ 'size' => $queueForEvents->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); - }, ['response']); + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::WEBHOOK_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize()]), Response::MODEL_HEALTH_QUEUE); + }); App::get('/v1/health/queue/logs') - ->desc('Get Logs Queue') + ->desc('Get logs queue') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -367,15 +374,15 @@ App::get('/v1/health/queue/logs') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) - ->inject('queueForAudits') + ->inject('queue') ->inject('response') - ->action(function (Audit $queueForAudits, Response $response) { - - $response->dynamic(new Document([ 'size' => $queueForAudits->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); - }, ['response']); + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::AUDITS_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); App::get('/v1/health/queue/certificates') - ->desc('Get Certificates Queue') + ->desc('Get certificates queue') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -385,15 +392,124 @@ App::get('/v1/health/queue/certificates') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) - ->inject('queueForCertificates') + ->inject('queue') ->inject('response') - ->action(function (Certificate $queueForCertificates, Response $response) { + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::CERTIFICATES_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + +App::get('/v1/health/queue/builds') + ->desc('Get builds queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueBuilds') + ->label('sdk.description', '/docs/references/health/get-queue-builds.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::BUILDS_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + +App::get('/v1/health/queue/databases') + ->desc('Get databases queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueDatabases') + ->label('sdk.description', '/docs/references/health/get-queue-databases.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::CERTIFICATES_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + +App::get('/v1/health/queue/deletes') + ->desc('Get deletes queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueDeletes') + ->label('sdk.description', '/docs/references/health/get-queue-deletes.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::DELETE_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + +App::get('/v1/health/queue/mails') + ->desc('Get mails queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueMails') + ->label('sdk.description', '/docs/references/health/get-queue-mails.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::MAILS_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); - $response->dynamic(new Document([ 'size' => $queueForCertificates->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); +App::get('/v1/health/queue/messaging') + ->desc('Get messaging queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueMessaging') + ->label('sdk.description', '/docs/references/health/get-queue-messaging.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::MESSAGING_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + +App::get('/v1/health/queue/migrations') + ->desc('Get migrations queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) + ->label('sdk.namespace', 'health') + ->label('sdk.method', 'getQueueMigrations') + ->label('sdk.description', '/docs/references/health/get-queue-migrations.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE) + ->inject('queue') + ->inject('response') + ->action(function (Connection $queue, Response $response) { + $client = new Client(Event::MIGRATIONS_QUEUE_NAME, $queue); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); + App::get('/v1/health/queue/functions') - ->desc('Get Functions Queue') + ->desc('Get functions queue') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -407,11 +523,11 @@ App::get('/v1/health/queue/functions') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::FUNCTIONS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); - }, ['response']); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); + }); App::get('/v1/health/storage/local') - ->desc('Get Local Storage') + ->desc('Get local storage') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -454,7 +570,7 @@ App::get('/v1/health/storage/local') }); App::get('/v1/health/anti-virus') - ->desc('Get Antivirus') + ->desc('Get antivirus') ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -493,7 +609,7 @@ App::get('/v1/health/anti-virus') }); App::get('/v1/health/stats') // Currently only used internally - ->desc('Get System Stats') + ->desc('Get system stats') ->groups(['api', 'health']) ->label('scope', 'root') // ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index ddcc19f4c..596702aa7 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -49,7 +49,7 @@ App::init() }); App::post('/v1/projects') - ->desc('Create Project') + ->desc('Create project') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -220,7 +220,7 @@ App::post('/v1/projects') }); App::get('/v1/projects') - ->desc('List Projects') + ->desc('List projects') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -267,7 +267,7 @@ App::get('/v1/projects') }); App::get('/v1/projects/:projectId') - ->desc('Get Project') + ->desc('Get project') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -291,7 +291,7 @@ App::get('/v1/projects/:projectId') }); App::patch('/v1/projects/:projectId') - ->desc('Update Project') + ->desc('Update project') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -338,7 +338,7 @@ App::patch('/v1/projects/:projectId') }); App::patch('/v1/projects/:projectId/team') - ->desc('Update Project Team') + ->desc('Update project team') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -443,7 +443,7 @@ App::patch('/v1/projects/:projectId/service/all') }); App::patch('/v1/projects/:projectId/oauth2') - ->desc('Update Project OAuth2') + ->desc('Update project OAuth2') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -487,7 +487,7 @@ App::patch('/v1/projects/:projectId/oauth2') }); App::patch('/v1/projects/:projectId/auth/limit') - ->desc('Update Project users limit') + ->desc('Update project users limit') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -518,7 +518,7 @@ App::patch('/v1/projects/:projectId/auth/limit') }); App::patch('/v1/projects/:projectId/auth/duration') - ->desc('Update Project Authentication Duration') + ->desc('Update project authentication duration') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -549,7 +549,7 @@ App::patch('/v1/projects/:projectId/auth/duration') }); App::patch('/v1/projects/:projectId/auth/:method') - ->desc('Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project.') + ->desc('Update project auth method status. Use this endpoint to enable or disable a given auth method for this project.') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -676,7 +676,7 @@ App::patch('/v1/projects/:projectId/auth/personal-data') }); App::patch('/v1/projects/:projectId/auth/max-sessions') - ->desc('Update Project user sessions limit') + ->desc('Update project user sessions limit') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -707,7 +707,7 @@ App::patch('/v1/projects/:projectId/auth/max-sessions') }); App::delete('/v1/projects/:projectId') - ->desc('Delete Project') + ->desc('Delete project') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -742,7 +742,7 @@ App::delete('/v1/projects/:projectId') // Webhooks App::post('/v1/projects/:projectId/webhooks') - ->desc('Create Webhook') + ->desc('Create webhook') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -798,7 +798,7 @@ App::post('/v1/projects/:projectId/webhooks') }); App::get('/v1/projects/:projectId/webhooks') - ->desc('List Webhooks') + ->desc('List webhooks') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -830,7 +830,7 @@ App::get('/v1/projects/:projectId/webhooks') }); App::get('/v1/projects/:projectId/webhooks/:webhookId') - ->desc('Get Webhook') + ->desc('Get webhook') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -864,7 +864,7 @@ App::get('/v1/projects/:projectId/webhooks/:webhookId') }); App::put('/v1/projects/:projectId/webhooks/:webhookId') - ->desc('Update Webhook') + ->desc('Update webhook') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -917,7 +917,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId') }); App::patch('/v1/projects/:projectId/webhooks/:webhookId/signature') - ->desc('Update Webhook Signature Key') + ->desc('Update webhook signature key') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -956,7 +956,7 @@ App::patch('/v1/projects/:projectId/webhooks/:webhookId/signature') }); App::delete('/v1/projects/:projectId/webhooks/:webhookId') - ->desc('Delete Webhook') + ->desc('Delete webhook') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -994,7 +994,7 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId') // Keys App::post('/v1/projects/:projectId/keys') - ->desc('Create Key') + ->desc('Create key') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1044,7 +1044,7 @@ App::post('/v1/projects/:projectId/keys') }); App::get('/v1/projects/:projectId/keys') - ->desc('List Keys') + ->desc('List keys') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1076,7 +1076,7 @@ App::get('/v1/projects/:projectId/keys') }); App::get('/v1/projects/:projectId/keys/:keyId') - ->desc('Get Key') + ->desc('Get key') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1110,7 +1110,7 @@ App::get('/v1/projects/:projectId/keys/:keyId') }); App::put('/v1/projects/:projectId/keys/:keyId') - ->desc('Update Key') + ->desc('Update key') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1156,7 +1156,7 @@ App::put('/v1/projects/:projectId/keys/:keyId') }); App::delete('/v1/projects/:projectId/keys/:keyId') - ->desc('Delete Key') + ->desc('Delete key') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1195,7 +1195,7 @@ App::delete('/v1/projects/:projectId/keys/:keyId') // Platforms App::post('/v1/projects/:projectId/platforms') - ->desc('Create Platform') + ->desc('Create platform') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1245,7 +1245,7 @@ App::post('/v1/projects/:projectId/platforms') }); App::get('/v1/projects/:projectId/platforms') - ->desc('List Platforms') + ->desc('List platforms') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1277,7 +1277,7 @@ App::get('/v1/projects/:projectId/platforms') }); App::get('/v1/projects/:projectId/platforms/:platformId') - ->desc('Get Platform') + ->desc('Get platform') ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1311,7 +1311,7 @@ App::get('/v1/projects/:projectId/platforms/:platformId') }); App::put('/v1/projects/:projectId/platforms/:platformId') - ->desc('Update Platform') + ->desc('Update platform') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1358,7 +1358,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId') }); App::delete('/v1/projects/:projectId/platforms/:platformId') - ->desc('Delete Platform') + ->desc('Delete platform') ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -1394,6 +1394,7 @@ App::delete('/v1/projects/:projectId/platforms/:platformId') $response->noContent(); }); + // CUSTOM SMTP and Templates App::patch('/v1/projects/:projectId/smtp') ->desc('Update SMTP configuration') @@ -1525,6 +1526,7 @@ App::get('/v1/projects/:projectId/templates/sms/:type/:locale') $response->dynamic(new Document($template), Response::MODEL_SMS_TEMPLATE); }); + App::get('/v1/projects/:projectId/templates/email/:type/:locale') ->desc('Get custom email template') ->groups(['api', 'projects']) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 427f360f7..12fe61846 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -1288,7 +1288,7 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId') ->inject('user') ->inject('mode') ->inject('queueForEvents') - ->action(function (string $bucketId, string $fileId, ?array $permissions, Response $response, Database $dbForProject, Document $user, string $mode, Event $queueForEvents) { + ->action(function (string $bucketId, string $fileId, ?string $name, ?array $permissions, Response $response, Database $dbForProject, Document $user, string $mode, Event $queueForEvents) { $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index ec7f82a29..15e6f2140 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -108,7 +108,7 @@ function createUser(string $hash, mixed $hashOptions, string $userId, ?string $e } App::post('/v1/users') - ->desc('Create User') + ->desc('Create user') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -139,7 +139,7 @@ App::post('/v1/users') }); App::post('/v1/users/bcrypt') - ->desc('Create User with Bcrypt Password') + ->desc('Create user with bcrypt password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -169,7 +169,7 @@ App::post('/v1/users/bcrypt') }); App::post('/v1/users/md5') - ->desc('Create User with MD5 Password') + ->desc('Create user with MD5 password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -199,7 +199,7 @@ App::post('/v1/users/md5') }); App::post('/v1/users/argon2') - ->desc('Create User with Argon2 Password') + ->desc('Create user with Argon2 password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -229,7 +229,7 @@ App::post('/v1/users/argon2') }); App::post('/v1/users/sha') - ->desc('Create User with SHA Password') + ->desc('Create user with SHA password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -266,7 +266,7 @@ App::post('/v1/users/sha') }); App::post('/v1/users/phpass') - ->desc('Create User with PHPass Password') + ->desc('Create user with PHPass password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -296,7 +296,7 @@ App::post('/v1/users/phpass') }); App::post('/v1/users/scrypt') - ->desc('Create User with Scrypt Password') + ->desc('Create user with Scrypt password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -339,7 +339,7 @@ App::post('/v1/users/scrypt') }); App::post('/v1/users/scrypt-modified') - ->desc('Create User with Scrypt Modified Password') + ->desc('Create user with Scrypt modified password') ->groups(['api', 'users']) ->label('event', 'users.[userId].create') ->label('scope', 'users.write') @@ -372,7 +372,7 @@ App::post('/v1/users/scrypt-modified') }); App::get('/v1/users') - ->desc('List Users') + ->desc('List users') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -420,7 +420,7 @@ App::get('/v1/users') }); App::get('/v1/users/:userId') - ->desc('Get User') + ->desc('Get user') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -445,7 +445,7 @@ App::get('/v1/users/:userId') }); App::get('/v1/users/:userId/prefs') - ->desc('Get User Preferences') + ->desc('Get user preferences') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -472,7 +472,7 @@ App::get('/v1/users/:userId/prefs') }); App::get('/v1/users/:userId/sessions') - ->desc('List User Sessions') + ->desc('List user sessions') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -513,7 +513,7 @@ App::get('/v1/users/:userId/sessions') }); App::get('/v1/users/:userId/memberships') - ->desc('List User Memberships') + ->desc('List user memberships') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -552,7 +552,7 @@ App::get('/v1/users/:userId/memberships') }); App::get('/v1/users/:userId/logs') - ->desc('List User Logs') + ->desc('List user logs') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) @@ -681,7 +681,7 @@ App::get('/v1/users/identities') }); App::patch('/v1/users/:userId/status') - ->desc('Update User Status') + ->desc('Update user status') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.status') ->label('scope', 'users.write') @@ -717,9 +717,9 @@ App::patch('/v1/users/:userId/status') }); App::put('/v1/users/:userId/labels') - ->desc('Update User Labels') + ->desc('Update user labels') ->groups(['api', 'users']) - ->label('event', 'users.[userId].update.verification') + ->label('event', 'users.[userId].update.labels') ->label('scope', 'users.write') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') @@ -754,7 +754,7 @@ App::put('/v1/users/:userId/labels') }); App::patch('/v1/users/:userId/verification/phone') - ->desc('Update Phone Verification') + ->desc('Update phone verification') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.verification') ->label('scope', 'users.write') @@ -789,7 +789,7 @@ App::patch('/v1/users/:userId/verification/phone') }); App::patch('/v1/users/:userId/name') - ->desc('Update Name') + ->desc('Update name') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.name') ->label('scope', 'users.write') @@ -826,7 +826,7 @@ App::patch('/v1/users/:userId/name') }); App::patch('/v1/users/:userId/password') - ->desc('Update Password') + ->desc('Update password') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.password') ->label('scope', 'users.write') @@ -890,7 +890,7 @@ App::patch('/v1/users/:userId/password') }); App::patch('/v1/users/:userId/email') - ->desc('Update Email') + ->desc('Update email') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.email') ->label('scope', 'users.write') @@ -946,7 +946,7 @@ App::patch('/v1/users/:userId/email') }); App::patch('/v1/users/:userId/phone') - ->desc('Update Phone') + ->desc('Update phone') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.phone') ->label('scope', 'users.write') @@ -989,7 +989,7 @@ App::patch('/v1/users/:userId/phone') }); App::patch('/v1/users/:userId/verification') - ->desc('Update Email Verification') + ->desc('Update email verification') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.verification') ->label('scope', 'users.write') @@ -1024,7 +1024,7 @@ App::patch('/v1/users/:userId/verification') }); App::patch('/v1/users/:userId/prefs') - ->desc('Update User Preferences') + ->desc('Update user preferences') ->groups(['api', 'users']) ->label('event', 'users.[userId].update.prefs') ->label('scope', 'users.write') @@ -1057,7 +1057,7 @@ App::patch('/v1/users/:userId/prefs') }); App::delete('/v1/users/:userId/sessions/:sessionId') - ->desc('Delete User Session') + ->desc('Delete user session') ->groups(['api', 'users']) ->label('event', 'users.[userId].sessions.[sessionId].delete') ->label('scope', 'users.write') @@ -1100,7 +1100,7 @@ App::delete('/v1/users/:userId/sessions/:sessionId') }); App::delete('/v1/users/:userId/sessions') - ->desc('Delete User Sessions') + ->desc('Delete user sessions') ->groups(['api', 'users']) ->label('event', 'users.[userId].sessions.[sessionId].delete') ->label('scope', 'users.write') @@ -1142,7 +1142,7 @@ App::delete('/v1/users/:userId/sessions') }); App::delete('/v1/users/:userId') - ->desc('Delete User') + ->desc('Delete user') ->groups(['api', 'users']) ->label('event', 'users.[userId].delete') ->label('scope', 'users.write') diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 9db6594a1..b0cf28cae 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -57,8 +57,7 @@ class Mails extends Action $subject = $payload['subject']; $variables = $payload['variables']; $name = $payload['name']; - - $body = Template::fromFile(__DIR__ . '/../config/locale/templates/email-base.tpl'); + $body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base.tpl'); foreach ($variables as $key => $value) { $body->setParam('{{' . $key . '}}', $value);