From bafcfcfbb9332a8ea5ba45520e6ae47017a0c99a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 12 Apr 2023 02:56:48 +1200 Subject: [PATCH 1/5] Update cache buster --- app/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/init.php b/app/init.php index 980040da68..e5b6b9b4f4 100644 --- a/app/init.php +++ b/app/init.php @@ -100,7 +100,7 @@ const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate pe const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return in list API calls const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours -const APP_CACHE_BUSTER = 501; +const APP_CACHE_BUSTER = 502; const APP_VERSION_STABLE = '1.3.0'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; From 71b96452c64c48bcfb224f46c3d565492dae17f6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 12 Apr 2023 02:58:59 +1200 Subject: [PATCH 2/5] Update platforms --- app/config/platforms.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 272c44ff0e..9dfc098430 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -15,7 +15,7 @@ return [ [ 'key' => 'web', 'name' => 'Web', - 'version' => '10.2.0', + 'version' => '10.3.0', 'url' => 'https://github.com/appwrite/sdk-for-web', 'package' => 'https://www.npmjs.com/package/appwrite', 'enabled' => true, @@ -63,7 +63,7 @@ return [ [ 'key' => 'flutter', 'name' => 'Flutter', - 'version' => '8.2.0', + 'version' => '8.3.0', 'url' => 'https://github.com/appwrite/sdk-for-flutter', 'package' => 'https://pub.dev/packages/appwrite', 'enabled' => true, @@ -81,7 +81,7 @@ return [ [ 'key' => 'apple', 'name' => 'Apple', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-apple', 'package' => 'https://github.com/appwrite/sdk-for-apple', 'enabled' => true, @@ -116,7 +116,7 @@ return [ [ 'key' => 'android', 'name' => 'Android', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-android', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android', 'enabled' => true, @@ -185,7 +185,7 @@ return [ [ 'key' => 'web', 'name' => 'Console', - 'version' => '0.0.2-preview-0.0', + 'version' => '0.1.0', 'url' => 'https://github.com/appwrite/sdk-for-console', 'package' => '', 'enabled' => true, @@ -203,7 +203,7 @@ return [ [ 'key' => 'cli', 'name' => 'Command Line', - 'version' => '1.2.1', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://www.npmjs.com/package/appwrite-cli', 'enabled' => true, @@ -231,7 +231,7 @@ return [ [ 'key' => 'nodejs', 'name' => 'Node.js', - 'version' => '8.2.0', + 'version' => '8.3.0', 'url' => 'https://github.com/appwrite/sdk-for-node', 'package' => 'https://www.npmjs.com/package/node-appwrite', 'enabled' => true, @@ -249,7 +249,7 @@ return [ [ 'key' => 'deno', 'name' => 'Deno', - 'version' => '6.2.0', + 'version' => '6.3.0', 'url' => 'https://github.com/appwrite/sdk-for-deno', 'package' => 'https://deno.land/x/appwrite', 'enabled' => true, @@ -267,7 +267,7 @@ return [ [ 'key' => 'php', 'name' => 'PHP', - 'version' => '7.2.0', + 'version' => '7.3.0', 'url' => 'https://github.com/appwrite/sdk-for-php', 'package' => 'https://packagist.org/packages/appwrite/appwrite', 'enabled' => true, @@ -285,7 +285,7 @@ return [ [ 'key' => 'python', 'name' => 'Python', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-python', 'package' => 'https://pypi.org/project/appwrite/', 'enabled' => true, @@ -303,7 +303,7 @@ return [ [ 'key' => 'ruby', 'name' => 'Ruby', - 'version' => '7.2.0', + 'version' => '7.3.0', 'url' => 'https://github.com/appwrite/sdk-for-ruby', 'package' => 'https://rubygems.org/gems/appwrite', 'enabled' => true, @@ -321,7 +321,7 @@ return [ [ 'key' => 'go', 'name' => 'Go', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-go', 'package' => '', 'enabled' => false, @@ -339,7 +339,7 @@ return [ [ 'key' => 'java', 'name' => 'Java', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-java', 'package' => '', 'enabled' => false, @@ -357,7 +357,7 @@ return [ [ 'key' => 'dotnet', 'name' => '.NET', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => false, @@ -375,7 +375,7 @@ return [ [ 'key' => 'dart', 'name' => 'Dart', - 'version' => '7.2.0', + 'version' => '7.3.0', 'url' => 'https://github.com/appwrite/sdk-for-dart', 'package' => 'https://pub.dev/packages/dart_appwrite', 'enabled' => true, @@ -393,7 +393,7 @@ return [ [ 'key' => 'kotlin', 'name' => 'Kotlin', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-kotlin', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin', 'enabled' => true, @@ -415,7 +415,7 @@ return [ [ 'key' => 'swift', 'name' => 'Swift', - 'version' => '1.2.0', + 'version' => '1.3.0', 'url' => 'https://github.com/appwrite/sdk-for-swift', 'package' => 'https://github.com/appwrite/sdk-for-swift', 'enabled' => true, From 26eaddee8254f07db55b209c6a64b413d4dd926f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 12 Apr 2023 02:59:45 +1200 Subject: [PATCH 3/5] Update comment --- app/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/init.php b/app/init.php index e5b6b9b4f4..aaa4229cb0 100644 --- a/app/init.php +++ b/app/init.php @@ -1168,7 +1168,7 @@ App::setResource('schema', function ($utopia, $dbForProject) { }, ['utopia', 'dbForProject']); App::setResource('requestTimestamp', function ($request) { - // Validate x-appwrite-timestamp header + //TODO: Move this to the Request class itself $timestampHeader = $request->getHeader('x-appwrite-timestamp'); $requestTimestamp = null; if (!empty($timestampHeader)) { From f869252d901f5edc449e1d04063b57fdaf1ee1fe Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 12 Apr 2023 03:00:09 +1200 Subject: [PATCH 4/5] Remove redundant import --- app/controllers/api/databases.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index c92c3c8cfe..b309b74894 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -4,7 +4,6 @@ use Utopia\App; use Appwrite\Event\Delete; use Appwrite\Extend\Exception; use Utopia\Audit\Audit; -use Utopia\Database\Document as DatabaseDocument; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Datetime as DatetimeValidator; From d86d604624b7d560167d03208db9337e3b802d44 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 12 Apr 2023 03:32:14 +1200 Subject: [PATCH 5/5] Reviews fixes --- app/controllers/api/teams.php | 8 ++++---- src/Appwrite/Auth/Validator/PasswordDictionary.php | 2 -- src/Appwrite/Auth/Validator/PasswordHistory.php | 2 ++ .../Utopia/Database/Validator/Queries/Document.php | 5 ----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 34eab1cdd8..fbe7fd5398 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -417,10 +417,10 @@ App::post('/v1/teams/:teamId/memberships') if ($invitee->isEmpty()) { throw new Exception(Exception::USER_NOT_FOUND, 'User with given userId doesn\'t exist.', 404); } - if (!empty($email) && $invitee->getAttribute('email', '') != $email) { + if (!empty($email) && $invitee->getAttribute('email', '') !== $email) { throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given userId and email doesn\'t match', 409); } - if (!empty($phone) && $invitee->getAttribute('phone', '') != $phone) { + if (!empty($phone) && $invitee->getAttribute('phone', '') !== $phone) { throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given userId and phone doesn\'t match', 409); } $email = $invitee->getAttribute('email', ''); @@ -428,12 +428,12 @@ App::post('/v1/teams/:teamId/memberships') $name = empty($name) ? $invitee->getAttribute('name', '') : $name; } elseif (!empty($email)) { $invitee = $dbForProject->findOne('users', [Query::equal('email', [$email])]); // Get user by email address - if (!empty($invitee) && !empty($phone) && $invitee->getAttribute('phone', '') != $phone) { + if (!empty($invitee) && !empty($phone) && $invitee->getAttribute('phone', '') !== $phone) { throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given email and phone doesn\'t match', 409); } } elseif (!empty($phone)) { $invitee = $dbForProject->findOne('users', [Query::equal('phone', [$phone])]); - if (!empty($invitee) && !empty($email) && $invitee->getAttribute('email', '') != $email) { + if (!empty($invitee) && !empty($email) && $invitee->getAttribute('email', '') !== $email) { throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given phone and email doesn\'t match', 409); } } diff --git a/src/Appwrite/Auth/Validator/PasswordDictionary.php b/src/Appwrite/Auth/Validator/PasswordDictionary.php index 269babef37..003d68bc73 100644 --- a/src/Appwrite/Auth/Validator/PasswordDictionary.php +++ b/src/Appwrite/Auth/Validator/PasswordDictionary.php @@ -2,8 +2,6 @@ namespace Appwrite\Auth\Validator; -use Utopia\Database\Document; - /** * Password. * diff --git a/src/Appwrite/Auth/Validator/PasswordHistory.php b/src/Appwrite/Auth/Validator/PasswordHistory.php index 9848f2c946..8cfabf4666 100644 --- a/src/Appwrite/Auth/Validator/PasswordHistory.php +++ b/src/Appwrite/Auth/Validator/PasswordHistory.php @@ -12,6 +12,8 @@ use Appwrite\Auth\Auth; class PasswordHistory extends Password { protected array $history; + protected string $algo; + protected array $algoOptions; public function __construct(array $history, string $algo, array $algoOptions = []) { diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Document.php b/src/Appwrite/Utopia/Database/Validator/Queries/Document.php index cfb39ca8db..3c630dfca9 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Document.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Document.php @@ -3,11 +3,6 @@ namespace Appwrite\Utopia\Database\Validator\Queries; use Appwrite\Utopia\Database\Validator\Queries; -use Appwrite\Utopia\Database\Validator\Query\Cursor; -use Appwrite\Utopia\Database\Validator\Query\Filter; -use Appwrite\Utopia\Database\Validator\Query\Limit; -use Appwrite\Utopia\Database\Validator\Query\Offset; -use Appwrite\Utopia\Database\Validator\Query\Order; use Appwrite\Utopia\Database\Validator\Query\Select; use Utopia\Database\Database;