diff --git a/.gitmodules b/.gitmodules index e9f13bb1a..cef850ec0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "app/console"] path = app/console url = https://github.com/appwrite/console - branch = 2.0.1 + branch = 2.0.2 diff --git a/CHANGES.md b/CHANGES.md index 1668f1c04..0ba56af24 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,11 +1,17 @@ -# Version 1.2.0 -## Changes +- Fix invited account verified status [#4776](https://github.com/appwrite/appwrite/pull/4776) - Get default region from environment on project create [#4780](https://github.com/appwrite/appwrite/pull/4780) # Version 1.1.2 ## Changes +- Released `appwrite/console` [2.0.2](https://github.com/appwrite/console/releases/tag/2.0.2) - Make `region` parameter optional with default for project create [#4763](https://github.com/appwrite/appwrite/pull/4763) +## Bugs +- Fix default oauth paths [#4725](https://github.com/appwrite/appwrite/pull/4725) +- Fix session expiration, and expired session deletion [#4739](https://github.com/appwrite/appwrite/pull/4739) +- Fix processing status on sync executions [#4737](https://github.com/appwrite/appwrite/pull/4737) +- Fix Locale API returning Unknown continent [#4761](https://github.com/appwrite/appwrite/pull/4761) + # Version 1.1.1 ## Bugs - Fix Deletes worker using incorrect device for file deletion [#4662](https://github.com/appwrite/appwrite/pull/4662) diff --git a/README-CN.md b/README-CN.md index 4f8156f2c..6f00cebf1 100644 --- a/README-CN.md +++ b/README-CN.md @@ -64,7 +64,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:1.1.1 + appwrite/appwrite:1.1.2 ``` ### Windows @@ -76,7 +76,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:1.1.1 + appwrite/appwrite:1.1.2 ``` #### PowerShell @@ -86,7 +86,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:1.1.1 + appwrite/appwrite:1.1.2 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 694259711..0e613204c 100644 --- a/README.md +++ b/README.md @@ -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:1.1.1 + appwrite/appwrite:1.1.2 ``` ### Windows @@ -87,7 +87,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:1.1.1 + appwrite/appwrite:1.1.2 ``` #### PowerShell @@ -97,7 +97,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:1.1.1 + appwrite/appwrite:1.1.2 ``` 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/console b/app/console index f89584bdd..af3d741ae 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit f89584bdd4ba3de07fb54cecbc275b131e23a4fb +Subproject commit af3d741ae8f02c2e16b8b4ea4664a3f8970290fd diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 115948f71..45fb03062 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -41,8 +41,8 @@ use Utopia\Validator\Assoc; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -$oauthDefaultSuccess = '/v1/auth/oauth2/success'; -$oauthDefaultFailure = '/v1/auth/oauth2/failure'; +$oauthDefaultSuccess = '/auth/oauth2/success'; +$oauthDefaultFailure = '/auth/oauth2/failure'; App::post('/v1/account') ->desc('Create Account') @@ -426,8 +426,6 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') throw new Exception(Exception::PROJECT_INVALID_FAILURE_URL); } - $state['failure'] = null; - $accessToken = $oauth2->getAccessToken($code); $refreshToken = $oauth2->getRefreshToken($code); $accessTokenExpiry = $oauth2->getAccessTokenExpiry($code); diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 4cf489e59..bfc1ccba4 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1080,7 +1080,7 @@ App::post('/v1/functions/:functionId/executions') 'functionId' => $function->getId(), 'deploymentId' => $deployment->getId(), 'trigger' => 'http', // http / schedule / event - 'status' => 'waiting', // waiting / processing / completed / failed + 'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed 'statusCode' => 0, 'response' => '', 'stderr' => '', diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index 3aee339df..6d824da05 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -40,7 +40,6 @@ App::get('/v1/locale') $output['countryCode'] = $record['country']['iso_code']; $output['country'] = $locale->getText('countries.' . strtolower($record['country']['iso_code']), $locale->getText('locale.country.unknown')); $output['continent'] = $locale->getText('continents.' . strtolower($record['continent']['code']), $locale->getText('locale.country.unknown')); - $output['continent'] = (isset($continents[$record['continent']['code']])) ? $continents[$record['continent']['code']] : $locale->getText('locale.country.unknown'); $output['continentCode'] = $record['continent']['code']; $output['eu'] = (\in_array($record['country']['iso_code'], $eu)) ? true : false; diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index dd214f562..567560c6a 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -724,7 +724,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status') ->setAttribute('confirm', true) ; - $user->setAttribute('emailVerification', true); + $user = Authorization::skip(fn() => $dbForProject->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', true))); // Log user in diff --git a/app/init.php b/app/init.php index 3d24ef81d..ef9246e36 100644 --- a/app/init.php +++ b/app/init.php @@ -95,7 +95,7 @@ const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate pe 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_VERSION_STABLE = '1.1.1'; +const APP_VERSION_STABLE = '1.1.2'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; @@ -790,9 +790,11 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons Authorization::setDefaultStatus(true); Auth::setCookieName('a_session_' . $project->getId()); + $authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; if (APP_MODE_ADMIN === $mode) { Auth::setCookieName('a_session_' . $console->getId()); + $authDuration = Auth::TOKEN_EXPIRATION_LOGIN_LONG; } $session = Auth::decodeSession( @@ -829,8 +831,6 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons $user = $dbForConsole->getDocument('users', Auth::$unique); } - $authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; - if ( $user->isEmpty() // Check a document has been found in the DB || !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration) diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index 96264a996..7199a338e 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -98,7 +98,6 @@ $cli { (new Delete()) ->setType(DELETE_TYPE_SESSIONS) - ->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG)) //TODO: Update to use project session expiration instead of default. ->trigger(); } diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 364e64842..5dc7e8d73 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -1,5 +1,6 @@ deleteExpiredSessions($this->args['datetime']); + $this->deleteExpiredSessions(); break; case DELETE_TYPE_CERTIFICATES: @@ -105,7 +107,7 @@ class DeletesV1 extends Worker break; case DELETE_TYPE_USAGE: - $this->deleteUsageStats($this->args['dateTime1d'], $this->args['hourlyUsageRetentionDatetime']); + $this->deleteUsageStats($this->args['hourlyUsageRetentionDatetime']); break; case DELETE_TYPE_CACHE_BY_RESOURCE: @@ -214,7 +216,6 @@ class DeletesV1 extends Worker } /** - * @param string $datetime1d * @param string $hourlyUsageRetentionDatetime */ protected function deleteUsageStats(string $hourlyUsageRetentionDatetime) @@ -316,16 +317,20 @@ class DeletesV1 extends Worker }); } - /** - * @param string $datetime - */ - protected function deleteExpiredSessions(string $datetime): void + protected function deleteExpiredSessions(): void { - $this->deleteForProjectIds(function (string $projectId) use ($datetime) { + $consoleDB = $this->getConsoleDB(); + + $this->deleteForProjectIds(function (string $projectId) use ($consoleDB) { $dbForProject = $this->getProjectDB($projectId); + + $project = $consoleDB->getDocument('projects', $projectId); + $duration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; + $expired = DateTime::addSeconds(new \DateTime(), -1 * $duration); + // Delete Sessions $this->deleteByGroup('sessions', [ - Query::lessThan('expire', $datetime) + Query::lessThan('$createdAt', $expired) ], $dbForProject); }); } diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 6c293723e..bef6e5e60 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -47,6 +47,7 @@ abstract class Migration '1.0.3' => 'V15', '1.1.0' => 'V16', '1.1.1' => 'V16', + '1.1.2' => 'V16', ]; /** diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 6d421484f..29ceb1254 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -550,7 +550,6 @@ class FunctionsCustomServerTest extends Scope $this->assertIsArray($function['body']['deployments']); $this->assertCount(2, $function['body']['deployments']); $this->assertEquals($function['body']['deployments'][0]['$id'], $data['deploymentId']); - $this->assertGreaterThanOrEqual(2, $function['body']['deployments'][0]['buildTime']); return $data; } diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php index c5ecf9f7f..788626b10 100644 --- a/tests/e2e/Services/Teams/TeamsBaseClient.php +++ b/tests/e2e/Services/Teams/TeamsBaseClient.php @@ -342,6 +342,15 @@ trait TeamsBaseClient $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']]; $data['session'] = $session; + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, + ])); + + $this->assertEquals(true, $response['body']['emailVerification']); + /** [START] TESTS TO CHECK PASSWORD UPDATE OF NEW USER CREATED USING TEAM INVITE */ /**