From 192ba00e3fe0020e1f0a2580f2f481c8b8999b86 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 4 Mar 2021 12:18:50 -0500 Subject: [PATCH 01/23] Add event for users.update.prefs --- app/config/events.php | 5 +++++ app/controllers/api/users.php | 1 + 2 files changed, 6 insertions(+) diff --git a/app/config/events.php b/app/config/events.php index 2bb3862fd..4893f6f18 100644 --- a/app/config/events.php +++ b/app/config/events.php @@ -117,6 +117,11 @@ return [ 'model' => Response::MODEL_USER, 'note' => 'version >= 0.7', ], + 'users.update.prefs' => [ + 'description' => 'This event triggers when a user preference is updated from the users API.', + 'model' => Response::MODEL_USER, + 'note' => 'version >= 0.7', + ], 'users.update.status' => [ 'description' => 'This event triggers when a user status is updated from the users API.', 'model' => Response::MODEL_USER, diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index efb0041ce..0af3ec03a 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -373,6 +373,7 @@ App::patch('/v1/users/:userId/status') App::patch('/v1/users/:userId/prefs') ->desc('Update User Preferences') ->groups(['api', 'users']) + ->label('event', 'users.update.prefs') ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') From 440a67e6d2c7eaa75066bd22e1ade47cf3364024 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 4 Mar 2021 13:47:02 -0500 Subject: [PATCH 02/23] Add e2e test for users.update.prefs --- .../Webhooks/WebhooksCustomServerTest.php | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 360dee2cb..5869bddbb 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -186,7 +186,46 @@ class WebhooksCustomServerTest extends Scope */ return ['userId' => $user['body']['$id'], 'name' => $user['body']['name'], 'email' => $user['body']['email']]; } - + + /** + * @depends testCreateUser + */ + public function testUpdateUserPrefs(array $data):array + { + /** + * Test for SUCCESS + */ + $user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'prefs' => ['test' => true], + ]); + + $this->assertEquals($user['headers']['status-code'], 200); + $this->assertNotEmpty($user['body']['prefs']); + + $webhook = $this->getLastRequest(); + + $this->assertEquals($webhook['method'], 'POST'); + $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); + $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); + $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Event'], 'users.update.prefs'); + $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], 'not-yet-implemented'); + $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); + $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); + $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertNotEmpty($webhook['data']['$id']); + $this->assertEquals($webhook['data']['name'], $data['name']); + $this->assertIsInt($webhook['data']['registration']); + $this->assertEquals($webhook['data']['status'], 0); + $this->assertEquals($webhook['data']['email'], $data['email']); + $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals($webhook['data']['prefs'], ["test" => true]); + + return $data; + } + /** * @depends testCreateUser */ @@ -261,4 +300,4 @@ class WebhooksCustomServerTest extends Scope return $data; } -} \ No newline at end of file +} From 0546a0e428483c85574d84125adcd5d58a292f1c Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 5 Mar 2021 13:36:30 -0500 Subject: [PATCH 03/23] Return correct response model --- app/config/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/events.php b/app/config/events.php index 4893f6f18..601b50216 100644 --- a/app/config/events.php +++ b/app/config/events.php @@ -119,7 +119,7 @@ return [ ], 'users.update.prefs' => [ 'description' => 'This event triggers when a user preference is updated from the users API.', - 'model' => Response::MODEL_USER, + 'model' => Response::MODEL_ANY, 'note' => 'version >= 0.7', ], 'users.update.status' => [ From cc532dbc593638eadba4d7cfc1959002394a35ab Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 7 Mar 2021 10:47:49 +0200 Subject: [PATCH 04/23] Getting ready for 0.7.1 release --- CHANGES.md | 2 +- README.md | 6 +++--- app/init.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8670aa1d7..78de748d4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,7 @@ - Anonymous login -# Version 0.7.1 (Not Released Yet) +# Version 0.7.1 ## Features diff --git a/README.md b/README.md index 950c5a301..3d4bd7573 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:0.7.0 + appwrite/appwrite:0.7.1 ``` ### Windows @@ -65,7 +65,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:0.7.0 + appwrite/appwrite:0.7.1 ``` #### PowerShell @@ -75,7 +75,7 @@ docker run -it --rm , --volume /var/run/docker.sock:/var/run/docker.sock , --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw , --entrypoint="install" , - appwrite/appwrite:0.7.0 + appwrite/appwrite:0.7.1 ``` Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-linux native hosts, the server might take a few minutes to start after installation completes. diff --git a/app/init.php b/app/init.php index a70ed1b88..effa61ad5 100644 --- a/app/init.php +++ b/app/init.php @@ -40,7 +40,7 @@ const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 12; const APP_CACHE_BUSTER = 144; -const APP_VERSION_STABLE = '0.7.0'; +const APP_VERSION_STABLE = '0.7.1'; const APP_STORAGE_UPLOADS = '/storage/uploads'; const APP_STORAGE_FUNCTIONS = '/storage/functions'; const APP_STORAGE_CACHE = '/storage/cache'; From 56f5c73126d2d9c02278040819be8b30764d602f Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Sun, 7 Mar 2021 08:09:45 -0500 Subject: [PATCH 05/23] Update tests --- .../Webhooks/WebhooksCustomServerTest.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 5869bddbb..9b32b7560 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -199,11 +199,10 @@ class WebhooksCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'prefs' => ['test' => true], + 'prefs' => ['a' => 'b'] ]); $this->assertEquals($user['headers']['status-code'], 200); - $this->assertNotEmpty($user['body']['prefs']); $webhook = $this->getLastRequest(); @@ -215,13 +214,7 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); - $this->assertNotEmpty($webhook['data']['$id']); - $this->assertEquals($webhook['data']['name'], $data['name']); - $this->assertIsInt($webhook['data']['registration']); - $this->assertEquals($webhook['data']['status'], 0); - $this->assertEquals($webhook['data']['email'], $data['email']); - $this->assertEquals($webhook['data']['emailVerification'], false); - $this->assertEquals($webhook['data']['prefs'], ["test" => true]); + $this->assertEquals($webhook['data']['a'], 'b'); return $data; } @@ -260,7 +253,7 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($webhook['data']['status'], 2); $this->assertEquals($webhook['data']['email'], $data['email']); $this->assertEquals($webhook['data']['emailVerification'], false); - $this->assertEquals($webhook['data']['prefs'], []); + $this->assertEquals($webhook['data']['prefs']['a'], 'b'); return $data; } @@ -296,7 +289,7 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($webhook['data']['status'], 2); $this->assertEquals($webhook['data']['email'], $data['email']); $this->assertEquals($webhook['data']['emailVerification'], false); - $this->assertEquals($webhook['data']['prefs'], []); + $this->assertEquals($webhook['data']['prefs']['a'], 'b'); return $data; } From 023b662b102bc1b4ce3aba91d27f58a579fb333b Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 8 Mar 2021 11:55:33 +0100 Subject: [PATCH 06/23] set default security email to certs@appwrite.io --- app/config/variables.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 14b29bc45..369a860fe 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -107,8 +107,8 @@ return [ 'name' => '_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', 'description' => 'This is the email address used to issue SSL certificates for custom domains or the user agent in your webhooks payload.', 'introduction' => '0.7.0', - 'default' => '', - 'required' => true, + 'default' => 'certs@appwrite.io', + 'required' => false, 'question' => '', ], [ From 68b1511672ee22c0a79c97996e483ec540d87a52 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Mon, 8 Mar 2021 10:16:28 -0500 Subject: [PATCH 07/23] Chain tests together --- tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 9b32b7560..dbd170980 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -203,7 +203,6 @@ class WebhooksCustomServerTest extends Scope ]); $this->assertEquals($user['headers']['status-code'], 200); - $webhook = $this->getLastRequest(); $this->assertEquals($webhook['method'], 'POST'); @@ -220,7 +219,7 @@ class WebhooksCustomServerTest extends Scope } /** - * @depends testCreateUser + * @depends testUpdateUserPrefs */ public function testUpdateUserStatus(array $data):array { From 5eaced933dfd779269582c34c4b9510c43c30629 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Mon, 8 Mar 2021 14:58:16 -0500 Subject: [PATCH 08/23] Use uppercase countryCode as index for $countries assoc array --- app/controllers/api/account.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index e8ae76312..cab25eb74 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -236,9 +236,11 @@ App::post('/v1/account/sessions') ->setStatusCode(Response::STATUS_CODE_CREATED) ; + $countries = $locale->getText('countries'); + $session ->setAttribute('current', true) - ->setAttribute('countryName', (isset($countries[$session->getAttribute('countryCode')])) ? $countries[$session->getAttribute('countryCode')] : $locale->getText('locale.country.unknown')) + ->setAttribute('countryName', (isset($countries[strtoupper($session->getAttribute('countryCode'))])) ? $countries[strtoupper($session->getAttribute('countryCode'))] : $locale->getText('locale.country.unknown')) ; $response->dynamic($session, Response::MODEL_SESSION); @@ -679,8 +681,8 @@ App::get('/v1/account/sessions') continue; } - $token->setAttribute('countryName', (isset($countries[$token->getAttribute('contryCode')])) - ? $countries[$token->getAttribute('contryCode')] + $token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('countryCode'))])) + ? $countries[strtoupper($token->getAttribute('countryCode'))] : $locale->getText('locale.country.unknown')); $token->setAttribute('current', ($current == $token->getId()) ? true : false); From 0d75dd362343e2635e07800b1e9eacb0c142003d Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Mon, 8 Mar 2021 15:48:45 -0500 Subject: [PATCH 09/23] Prove user prefs update before webhook --- tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index dbd170980..d2d554913 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -203,6 +203,8 @@ class WebhooksCustomServerTest extends Scope ]); $this->assertEquals($user['headers']['status-code'], 200); + $this->assertEquals($user['body']['a'], 'b'); + $webhook = $this->getLastRequest(); $this->assertEquals($webhook['method'], 'POST'); From c87a1165f68aef363c4bbb26478c94c2458305b7 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Tue, 9 Mar 2021 06:00:19 -0500 Subject: [PATCH 10/23] Update changelog --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 626198184..d0cd072bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,7 @@ ## Features -- Better error logs on appwrite cretificates worker +- Better error logs on appwrite certificates worker - Added option for Redis authentication - Force adding a security email on setup - SMTP is now disabled by default, no dummy SMTP is included in setup @@ -28,6 +28,7 @@ - Updated missing storage env vars - Fixed a bug, that Response format header was not added in the access-control-allow-header list. +- Fixed a bug where countryName is unknown on sessions (#933) ## Security From ed447986eaf3f17724146f0771ba6a184ec6fe2f Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Tue, 9 Mar 2021 06:03:42 -0500 Subject: [PATCH 11/23] Use uppercase countryCode --- app/controllers/api/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index efb0041ce..dbff5a019 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -205,8 +205,8 @@ App::get('/v1/users/:userId/sessions') continue; } - $token->setAttribute('countryName', (isset($countries[$token->getAttribute('contryCode')])) - ? $countries[$token->getAttribute('contryCode')] + $token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('contryCode'))])) + ? $countries[strtoupper($token->getAttribute('contryCode'))] : $locale->getText('locale.country.unknown')); $token->setAttribute('current', false); From 7e12b82d75bd47c7f3342abd98787d921472ea52 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Tue, 9 Mar 2021 09:21:37 -0500 Subject: [PATCH 12/23] Use updated package paths --- app/preload.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/preload.php b/app/preload.php index f73aaea61..7c8ae0093 100644 --- a/app/preload.php +++ b/app/preload.php @@ -28,10 +28,9 @@ foreach ([ realpath(__DIR__ . '/../vendor/felixfbecker'), realpath(__DIR__ . '/../vendor/twig/twig'), realpath(__DIR__ . '/../vendor/guzzlehttp/guzzle'), - realpath(__DIR__ . '/../vendor/domnikl'), - realpath(__DIR__ . '/../vendor/domnikl'), + realpath(__DIR__ . '/../vendor/slickdeals'), realpath(__DIR__ . '/../vendor/psr/log'), - realpath(__DIR__ . '/../vendor/piwik'), + realpath(__DIR__ . '/../vendor/matomo'), realpath(__DIR__ . '/../vendor/symfony'), ] as $key => $value) { if($value !== false) { From 6295bdba86e99268fa6103a52940d4395d21e052 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 13:49:59 +0545 Subject: [PATCH 13/23] remove other files --- docs/sdks/deno/GETTING_STARTED.md | 59 -------------- docs/sdks/flutter/GETTING_STARTED.md | 115 --------------------------- 2 files changed, 174 deletions(-) delete mode 100644 docs/sdks/deno/GETTING_STARTED.md delete mode 100644 docs/sdks/flutter/GETTING_STARTED.md diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md deleted file mode 100644 index d06f5ff58..000000000 --- a/docs/sdks/deno/GETTING_STARTED.md +++ /dev/null @@ -1,59 +0,0 @@ -## Getting Started - -### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. - -```typescript -let client = new sdk.Client(); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - -``` - -### Make your first request - -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. - -```typescript -let users = new sdk.Users(client); - -let promise = users.create('email@example.com', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Full Example -```typescript -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -let client = new sdk.Client(); -let users = new sdk.Users(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - -let promise = users.create('email@example.com', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md deleted file mode 100644 index c66ec5c09..000000000 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ /dev/null @@ -1,115 +0,0 @@ -## Getting Started for Flutter - -### Create Your First Appwrite Project -Go to your new Appwrite console, and once inside, click the (plus) icon in the top navigation header or on the **'Create Project'** button on your console homepage. Choose a name for your project and click create to get started. - -### Add your Flutter Platform -To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button. - -From the options, choose to add a new **Flutter** platform and add your app credentials. Appwrite Flutter SDK currently supports building apps for both iOS and Android. - -If you are building your Flutter application for multiple devices, you have to follow this process for each different device. - -### iOS -For **iOS** add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode. - -### Android -For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. - -#### iOS - -The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device. - -1. In Xcode, open Runner.xcworkspace in your app's ios folder. -2. To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target. -3. Select the General tab. -4. In Deployment Info, 'Target' select iOS 11.0 - -### Android -In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. - -```xml - - - - - - - - - - - - -``` - -#### Web -Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.

- -### Flutter Web Cross-Domain Communication & Cookies -

While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple custom-domains for each project.

- -### Init your SDK - -

Initialize your SDK code with your project ID, which can be found in your project settings page. - -``` -import 'package:appwrite/appwrite.dart'; -Client client = Client(); - - -client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production -; -``` - -

Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address.

When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API.

- -### Make Your First Request - -

Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. - -``` -// Register User -Account account = Account(client); -Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); -``` - -### Full Example - -``` -import 'package:appwrite/appwrite.dart'; -Client client = Client(); - - -client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production -; - - -// Register User -Account account = Account(client); - - -Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) \ No newline at end of file From e77280f67c0d5de34373c71481ed252c31dd3dd0 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 12 Mar 2021 12:58:41 +0100 Subject: [PATCH 14/23] fix timezone offset --- CHANGES.md | 1 + app/http.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d0cd072bc..2088bb1de 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ ## Bug Fixes - Updated missing storage env vars +- Fixed a bug, that added a wrong timzone offset to user log timestamps - Fixed a bug, that Response format header was not added in the access-control-allow-header list. - Fixed a bug where countryName is unknown on sessions (#933) diff --git a/app/http.php b/app/http.php index 9e45bc3b5..d144c2e54 100644 --- a/app/http.php +++ b/app/http.php @@ -94,7 +94,7 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo return; } - $app = new App('America/New_York'); + $app = new App('UTC'); try { Authorization::cleanRoles(); From c6270dcca50147e8604794df78ec8b0feffd1fb9 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 12 Mar 2021 08:06:53 -0500 Subject: [PATCH 15/23] Add webhook event to scope --- tests/e2e/Scopes/ProjectCustom.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index e1059f6af..0596aee09 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -117,6 +117,7 @@ trait ProjectCustom 'storage.files.update', 'storage.files.delete', 'users.create', + 'users.update.prefs', 'users.update.status', 'users.delete', 'users.sessions.delete', From cd247debd482ccf8e4c0d4da1595b89c7cb5b6f2 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 12 Mar 2021 09:28:34 -0500 Subject: [PATCH 16/23] Changelog for event users.update.prefs --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 8670aa1d7..bd32e2556 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ ## Bug Fixes - Updated missing storage env vars +- Added missing event for users.update.prefs #952 ## Security From 5361ddac1b23d693181056dc642d257bdf3afb00 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 12 Mar 2021 09:34:11 -0500 Subject: [PATCH 17/23] Revert "Changelog for event users.update.prefs" This reverts commit cd247debd482ccf8e4c0d4da1595b89c7cb5b6f2. --- CHANGES.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index bd32e2556..8670aa1d7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,7 +27,6 @@ ## Bug Fixes - Updated missing storage env vars -- Added missing event for users.update.prefs #952 ## Security From 6d11df4e84de1dd161251dc5c98138b1fb0643dc Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 12 Mar 2021 09:35:28 -0500 Subject: [PATCH 18/23] Add users.update.prefs to changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index d0cd072bc..bf14eedb7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ - Updated missing storage env vars - Fixed a bug, that Response format header was not added in the access-control-allow-header list. - Fixed a bug where countryName is unknown on sessions (#933) +- Added missing event users.update.prefs (#952) ## Security From feda2fd7877e72c715129824c27e04f6c66c0e95 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 12 Mar 2021 17:10:51 +0100 Subject: [PATCH 19/23] fix typo in countrycode --- app/controllers/api/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 0394cd8c0..958dfc148 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -205,8 +205,8 @@ App::get('/v1/users/:userId/sessions') continue; } - $token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('contryCode'))])) - ? $countries[strtoupper($token->getAttribute('contryCode'))] + $token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('countryCode'))])) + ? $countries[strtoupper($token->getAttribute('countryCode'))] : $locale->getText('locale.country.unknown')); $token->setAttribute('current', false); From 70088b0c0c2015dedcafbe2562c587bb279bce14 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 12 Mar 2021 17:11:01 +0100 Subject: [PATCH 20/23] fix duplicate line --- app/tasks/sdks.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index f8d4ed397..1f4667d5b 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -97,7 +97,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $config->setComposerVendor('appwrite'); $config->setComposerPackage('cli'); $config->setExecutableName('appwrite'); - $config->setExecutableName('appwrite'); $config->setLogo(" _ _ _ ___ __ _____ /_\ _ __ _ ____ ___ __(_) |_ ___ / __\ / / \_ \ From 16e446bbf5aa4491e6286d24d6f1a6c36235f722 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 14 Mar 2021 10:13:06 +0545 Subject: [PATCH 21/23] update sdk generator version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 39e8a0416..d4135536d 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "slickdeals/statsd": "~3.0" }, "require-dev": { - "appwrite/sdk-generator": "dev-master", + "appwrite/sdk-generator": "0.6.3", "phpunit/phpunit": "9.4.2", "swoole/ide-helper": "4.5.5", "vimeo/psalm": "4.1.1" From 583b9c8c5c710bbbceaff56fcd89cd72aebbc387 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 14 Mar 2021 10:14:55 +0545 Subject: [PATCH 22/23] learn more section --- docs/sdks/dart/GETTING_STARTED.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 78d7c4972..50aaab0f8 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -25,6 +25,7 @@ void main() async { ### Learn more You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file +- [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file From 14e7a63287464f65d4417e2d7a631daa16c8636c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 15 Mar 2021 09:08:24 +0545 Subject: [PATCH 23/23] getting started tutorial --- docs/sdks/dart/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 50aaab0f8..7a5e8340d 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -25,7 +25,7 @@ void main() async { ### Learn more You can use followng resources to learn more and get help -- [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) - 📜 [Appwrite Docs](https://appwrite.io/docs) - 💬 [Discord Community](https://appwrite.io/discord) -- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file +- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart)