From 942b81053d7bbcff32170a1a96f80613133bad64 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 13 May 2025 16:23:29 +0530 Subject: [PATCH] address comments. --- app/controllers/api/storage.php | 6 +++--- src/Appwrite/Utopia/Response/Model/ResourceToken.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d879de8728..b0d07f3061 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -951,7 +951,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') ->param('rotation', 0, new Range(-360, 360), 'Preview image rotation in degrees. Pass an integer between -360 and 360.', true) ->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true) ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true) - // NOTE: this is only for the sdk generator and is not used in the action below. + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. ->param('token', '', new Text(512), 'File token for accessing this file', true) ->inject('response') ->inject('dbForProject') @@ -1131,7 +1131,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/download') )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') - // NOTE: this is only for the sdk generator and is not used in the action below. + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. ->param('token', '', new Text(512), 'File token for accessing this file', true) ->inject('request') ->inject('response') @@ -1288,7 +1288,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/view') )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') - // NOTE: this is only for the sdk generator and is not used in the action below. + // NOTE: this is only for the sdk generator and is not used in the action below and is utilised in `resources.php` for `resourceToken`. ->param('token', '', new Text(512), 'File token for accessing this file', true) ->inject('response') ->inject('request') diff --git a/src/Appwrite/Utopia/Response/Model/ResourceToken.php b/src/Appwrite/Utopia/Response/Model/ResourceToken.php index 9bc7a46a5b..87598aadd0 100644 --- a/src/Appwrite/Utopia/Response/Model/ResourceToken.php +++ b/src/Appwrite/Utopia/Response/Model/ResourceToken.php @@ -76,7 +76,7 @@ class ResourceToken extends Model $expiryDate = new \DateTime($expire); // set 1 min if expired, we check for expiry later on route hooks for validation! - $maxAge = min(360, $expiryDate->getTimestamp() - $now->getTimestamp()); + $maxAge = min(60, $expiryDate->getTimestamp() - $now->getTimestamp()); } $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $maxAge, 10);