From 1a81f10d89d047b687332650517511c0822a46c9 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 30 Nov 2021 16:11:45 +0000 Subject: [PATCH 01/69] Add a DNS warning during install --- app/config/variables.php | 2 +- app/tasks/install.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index e6313a977..e57f4fb42 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -68,7 +68,7 @@ return [ 'default' => 'localhost', 'required' => true, 'question' => 'Enter a DNS A record hostname to serve as a CNAME for your custom domains.' . PHP_EOL . 'You can use the same value as used for the Appwrite hostname.', - 'filter' => '' + 'filter' => 'domainTarget' ], [ 'name' => '_APP_CONSOLE_WHITELIST_ROOT', diff --git a/app/tasks/install.php b/app/tasks/install.php index 0898ae67c..24743403a 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -11,6 +11,19 @@ use Utopia\Config\Config; use Utopia\View; use Utopia\Validator\Text; +function formatArray(array $arr) { + $mask = "%10.10s %-10.10s %10.10s\n"; + printf($mask, "Type", "Name", "Value"); + + // array_walk($arr, function(&$key) use ($descriptionColumnLimit){ + // $key = explode("\n", wordwrap($key, $descriptionColumnLimit)); + // }); + + foreach($arr as $key => $value) { + printf($mask, $key, $value[0], $value[1]); + } +} + $cli ->task('install') ->desc('Install Appwrite') @@ -167,6 +180,16 @@ $cli if(empty($input[$var['name']])) { $input[$var['name']] = $var['default']; } + + if ($var['filter'] === 'domainTarget') { + if ($input[$var['name']] !== 'localhost') { + Console::warning("If you haven't already done so, make sure you create an 'A' or 'AAAA' DNS record for '".$input[$var['name']]."' pointing to your external server IP. \nYour DNS Table should look like so: "); + formatArray([ + 'A/AAAA' => ['@', 'Your IP'], + ]); + Console::warning("Use 'AAAA' if you have an IPv6 address and 'A' if you have an IPv4 address."); + } + } } $templateForCompose = new View(__DIR__.'/../views/install/compose.phtml'); From c1ef83eec74058e8837770a1ac3964f8e27449cf Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 1 Dec 2021 02:39:42 +0400 Subject: [PATCH 02/69] feat: update PR --- app/tasks/install.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 24743403a..9f3f138dd 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -11,19 +11,6 @@ use Utopia\Config\Config; use Utopia\View; use Utopia\Validator\Text; -function formatArray(array $arr) { - $mask = "%10.10s %-10.10s %10.10s\n"; - printf($mask, "Type", "Name", "Value"); - - // array_walk($arr, function(&$key) use ($descriptionColumnLimit){ - // $key = explode("\n", wordwrap($key, $descriptionColumnLimit)); - // }); - - foreach($arr as $key => $value) { - printf($mask, $key, $value[0], $value[1]); - } -} - $cli ->task('install') ->desc('Install Appwrite') @@ -183,11 +170,11 @@ $cli if ($var['filter'] === 'domainTarget') { if ($input[$var['name']] !== 'localhost') { - Console::warning("If you haven't already done so, make sure you create an 'A' or 'AAAA' DNS record for '".$input[$var['name']]."' pointing to your external server IP. \nYour DNS Table should look like so: "); - formatArray([ - 'A/AAAA' => ['@', 'Your IP'], - ]); - Console::warning("Use 'AAAA' if you have an IPv6 address and 'A' if you have an IPv4 address."); + Console::info("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider: \n"); + $mask = "%-15.15s %-10.10s %-30.30s\n"; + printf($mask, "Type", "Name", "Value"); + printf($mask, "A or AAAA", "@", ""); + Console::info("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } } } From 859444703faeaee9fb2123aef719cb9c989a3c73 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 1 Dec 2021 02:41:53 +0400 Subject: [PATCH 03/69] feat: update PR --- app/tasks/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 9f3f138dd..6ada31d09 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -170,11 +170,11 @@ $cli if ($var['filter'] === 'domainTarget') { if ($input[$var['name']] !== 'localhost') { - Console::info("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider: \n"); + Console::warning("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider:\n"); $mask = "%-15.15s %-10.10s %-30.30s\n"; printf($mask, "Type", "Name", "Value"); printf($mask, "A or AAAA", "@", ""); - Console::info("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); + Console::warning("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } } } From f70e2479062b4c47da0ceff0e3ddf0a49c1c5803 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 9 May 2022 13:13:41 +0100 Subject: [PATCH 04/69] Update app/tasks/install.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- app/tasks/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 6ada31d09..da2ad8d5a 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -173,7 +173,7 @@ $cli Console::warning("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider:\n"); $mask = "%-15.15s %-10.10s %-30.30s\n"; printf($mask, "Type", "Name", "Value"); - printf($mask, "A or AAAA", "@", ""); + printf($mask, "A or AAAA", "@", ""); Console::warning("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } } From cdace54b7a27e582486f1f0ec0ea3559410d571e Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 28 Jun 2022 17:01:14 +0200 Subject: [PATCH 05/69] feat: node sdk version 7.0.1 --- app/config/platforms.php | 2 +- composer.json | 2 +- composer.lock | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index b31ea27f0..851b9210a 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -208,7 +208,7 @@ return [ [ 'key' => 'nodejs', 'name' => 'Node.js', - 'version' => '7.0.0', + 'version' => '7.0.1', 'url' => 'https://github.com/appwrite/sdk-for-node', 'package' => 'https://www.npmjs.com/package/node-appwrite', 'enabled' => true, diff --git a/composer.json b/composer.json index e33cc1637..a729f5f0e 100644 --- a/composer.json +++ b/composer.json @@ -71,7 +71,7 @@ } ], "require-dev": { - "appwrite/sdk-generator": "0.19.2", + "appwrite/sdk-generator": "0.19.3", "phpunit/phpunit": "9.5.20", "squizlabs/php_codesniffer": "^3.6", "swoole/ide-helper": "4.8.9", diff --git a/composer.lock b/composer.lock index af31b6212..6f9573665 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "27f63bdbc1b54f0f5cee981afe6da9b8", + "content-hash": "5f84d34aaf40746cf5a5ea3d231b9aee", "packages": [ { "name": "adhocore/jwt", @@ -2828,16 +2828,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.19.2", + "version": "0.19.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "91892b98880767019f340dee0074dcdc75329f94" + "reference": "a27cdc6b7e60e776a175be023e59cfd0e85bf4fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/91892b98880767019f340dee0074dcdc75329f94", - "reference": "91892b98880767019f340dee0074dcdc75329f94", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/a27cdc6b7e60e776a175be023e59cfd0e85bf4fa", + "reference": "a27cdc6b7e60e776a175be023e59cfd0e85bf4fa", "shasum": "" }, "require": { @@ -2872,9 +2872,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.19.2" + "source": "https://github.com/appwrite/sdk-generator/tree/0.19.3" }, - "time": "2022-06-28T11:15:16+00:00" + "time": "2022-06-28T14:56:03+00:00" }, { "name": "doctrine/instantiator", From 9fdaa92bd1ea23c53f408c39f15d9d008c3fb4fe Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 29 Jun 2022 01:04:08 +0200 Subject: [PATCH 06/69] feat: trigger sms for createVerification --- app/controllers/api/account.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index f61490b11..5144441a1 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -2301,7 +2301,9 @@ App::post('/v1/account/verification/phone') $messaging ->setRecipient($user->getAttribute('phone')) - ->setMessage($secret); + ->setMessage($secret) + ->trigger() + ; $events ->setParam('userId', $user->getId()) From 8ee78137e6428f6ef858a02cb69612a7fff93b72 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 29 Jun 2022 01:07:48 +0200 Subject: [PATCH 07/69] fix: internal attribute and index key on migration --- src/Appwrite/Migration/Version/V14.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V14.php b/src/Appwrite/Migration/Version/V14.php index 308850d2c..6f80bc2e6 100644 --- a/src/Appwrite/Migration/Version/V14.php +++ b/src/Appwrite/Migration/Version/V14.php @@ -583,11 +583,11 @@ class V14 extends Migration break; case 'attributes': case 'indexes': + $internalId = $this->projectDB->getDocument('database_1', $document->getAttribute('collectionId'))->getInternalId(); /** * Add Internal ID 'collectionId' for Subqueries. */ if (!empty($document->getAttribute('collectionId')) && is_null($document->getAttribute('collectionInternalId'))) { - $internalId = $this->projectDB->getDocument('database_1', $document->getAttribute('collectionId'))->getInternalId(); $document->setAttribute('collectionInternalId', $internalId); } /** @@ -608,7 +608,7 @@ class V14 extends Migration * Re-create Collection Document */ $this->projectDB->deleteDocument($document->getCollection(), $document->getId()); - $this->projectDB->createDocument($document->getCollection(), $document->setAttribute('$id', "1_{$document->getInternalId()}_{$document->getAttribute('key')}")); + $this->projectDB->createDocument($document->getCollection(), $document->setAttribute('$id', "1_{$internalId}_{$document->getAttribute('key')}")); } catch (\Throwable $th) { Console::warning("Create Collection Document - {$th->getMessage()}"); } From 33850dcfffa11366168d3cabf30fafb1dc3db048 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 29 Jun 2022 02:37:52 +0200 Subject: [PATCH 08/69] feat: update docs --- docs/references/account/create-phone-session.md | 2 +- docs/references/account/create-phone-verification.md | 2 +- docs/references/account/update-phone-session.md | 4 +--- docs/references/account/update-phone.md | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/references/account/create-phone-session.md b/docs/references/account/create-phone-session.md index a03c7adc1..677c315ac 100644 --- a/docs/references/account/create-phone-session.md +++ b/docs/references/account/create-phone-session.md @@ -1 +1 @@ -Sends the user a SMS with a secret key for creating a session. Use the returned user ID and the secret to submit a request to the [PUT /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. \ No newline at end of file +Sends the user an SMS with a secret key for creating a session. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. \ No newline at end of file diff --git a/docs/references/account/create-phone-verification.md b/docs/references/account/create-phone-verification.md index 0acc8f6d3..28627b439 100644 --- a/docs/references/account/create-phone-verification.md +++ b/docs/references/account/create-phone-verification.md @@ -1 +1 @@ -Use this endpoint to send a verification message to your user's phone number to confirm they are the valid owners of that address. The provided secret should allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#accountUpdatePhoneVerification). The verification link sent to the user's phone number is valid for 15 minutes. \ No newline at end of file +Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone) endpoint. Learn more about how to [complete the verification process](/docs/client/account#accountUpdatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. \ No newline at end of file diff --git a/docs/references/account/update-phone-session.md b/docs/references/account/update-phone-session.md index b85036082..7bd8e6161 100644 --- a/docs/references/account/update-phone-session.md +++ b/docs/references/account/update-phone-session.md @@ -1,3 +1 @@ -Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession) endpoint. - -Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. \ No newline at end of file +Use this endpoint to complete creating a session with SMS. Use the **userId** from the [createPhoneSession](/docs/client/account#accountCreatePhoneSession) endpoint and the **secret** received via SMS to successfully update and confirm the phone session. \ No newline at end of file diff --git a/docs/references/account/update-phone.md b/docs/references/account/update-phone.md index 442fc0620..934d9cad7 100644 --- a/docs/references/account/update-phone.md +++ b/docs/references/account/update-phone.md @@ -1 +1 @@ -Update currently logged in user account phone number. After changing phone number, the user confirmation status will get reset. A new confirmation SMS is not sent automatically however you can use the phone confirmation endpoint again to send the confirmation SMS. \ No newline at end of file +Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](/docs/client/account#accountCreatePhoneVerification) endpoint to send a confirmation SMS. \ No newline at end of file From f387ce08bcb985ae32e21a5c1c8ea4c2f3e1946c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 29 Jun 2022 12:11:45 +0200 Subject: [PATCH 09/69] fix: ui issues --- app/views/console/databases/collection.phtml | 2 +- public/dist/scripts/app-all.js | 2 +- public/dist/scripts/app-dep.js | 2 +- public/scripts/dependencies/appwrite.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/console/databases/collection.phtml b/app/views/console/databases/collection.phtml index 5121cf714..e8ede3df5 100644 --- a/app/views/console/databases/collection.phtml +++ b/app/views/console/databases/collection.phtml @@ -92,7 +92,7 @@ $logs = $this->getParam('logs', null);