Merge remote-tracking branch 'origin/master' into fix-region-parameter
# Conflicts: # CHANGES.md
This commit is contained in:
commit
cefd5660b9
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,4 +1,4 @@
|
||||||
[submodule "app/console"]
|
[submodule "app/console"]
|
||||||
path = app/console
|
path = app/console
|
||||||
url = https://github.com/appwrite/console
|
url = https://github.com/appwrite/console
|
||||||
branch = 2.0.1
|
branch = 2.0.2
|
||||||
|
|
10
CHANGES.md
10
CHANGES.md
|
@ -1,11 +1,17 @@
|
||||||
# Version 1.2.0
|
- Fix invited account verified status [#4776](https://github.com/appwrite/appwrite/pull/4776)
|
||||||
## Changes
|
|
||||||
- Get default region from environment on project create [#4780](https://github.com/appwrite/appwrite/pull/4780)
|
- Get default region from environment on project create [#4780](https://github.com/appwrite/appwrite/pull/4780)
|
||||||
|
|
||||||
# Version 1.1.2
|
# Version 1.1.2
|
||||||
## Changes
|
## 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)
|
- 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
|
# Version 1.1.1
|
||||||
## Bugs
|
## Bugs
|
||||||
- Fix Deletes worker using incorrect device for file deletion [#4662](https://github.com/appwrite/appwrite/pull/4662)
|
- Fix Deletes worker using incorrect device for file deletion [#4662](https://github.com/appwrite/appwrite/pull/4662)
|
||||||
|
|
|
@ -64,7 +64,7 @@ docker run -it --rm \
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||||
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
||||||
--entrypoint="install" \
|
--entrypoint="install" \
|
||||||
appwrite/appwrite:1.1.1
|
appwrite/appwrite:1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
@ -76,7 +76,7 @@ docker run -it --rm ^
|
||||||
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
||||||
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
||||||
--entrypoint="install" ^
|
--entrypoint="install" ^
|
||||||
appwrite/appwrite:1.1.1
|
appwrite/appwrite:1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
#### PowerShell
|
#### PowerShell
|
||||||
|
@ -86,7 +86,7 @@ docker run -it --rm ,
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock ,
|
--volume /var/run/docker.sock:/var/run/docker.sock ,
|
||||||
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ,
|
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ,
|
||||||
--entrypoint="install" ,
|
--entrypoint="install" ,
|
||||||
appwrite/appwrite:1.1.1
|
appwrite/appwrite:1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
|
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
|
||||||
|
|
|
@ -75,7 +75,7 @@ docker run -it --rm \
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||||
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
||||||
--entrypoint="install" \
|
--entrypoint="install" \
|
||||||
appwrite/appwrite:1.1.1
|
appwrite/appwrite:1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
@ -87,7 +87,7 @@ docker run -it --rm ^
|
||||||
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
||||||
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
||||||
--entrypoint="install" ^
|
--entrypoint="install" ^
|
||||||
appwrite/appwrite:1.1.1
|
appwrite/appwrite:1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
#### PowerShell
|
#### PowerShell
|
||||||
|
@ -97,7 +97,7 @@ docker run -it --rm `
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock `
|
--volume /var/run/docker.sock:/var/run/docker.sock `
|
||||||
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
|
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
|
||||||
--entrypoint="install" `
|
--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.
|
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.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f89584bdd4ba3de07fb54cecbc275b131e23a4fb
|
Subproject commit af3d741ae8f02c2e16b8b4ea4664a3f8970290fd
|
|
@ -41,8 +41,8 @@ use Utopia\Validator\Assoc;
|
||||||
use Utopia\Validator\Text;
|
use Utopia\Validator\Text;
|
||||||
use Utopia\Validator\WhiteList;
|
use Utopia\Validator\WhiteList;
|
||||||
|
|
||||||
$oauthDefaultSuccess = '/v1/auth/oauth2/success';
|
$oauthDefaultSuccess = '/auth/oauth2/success';
|
||||||
$oauthDefaultFailure = '/v1/auth/oauth2/failure';
|
$oauthDefaultFailure = '/auth/oauth2/failure';
|
||||||
|
|
||||||
App::post('/v1/account')
|
App::post('/v1/account')
|
||||||
->desc('Create Account')
|
->desc('Create Account')
|
||||||
|
@ -426,8 +426,6 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
throw new Exception(Exception::PROJECT_INVALID_FAILURE_URL);
|
throw new Exception(Exception::PROJECT_INVALID_FAILURE_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$state['failure'] = null;
|
|
||||||
|
|
||||||
$accessToken = $oauth2->getAccessToken($code);
|
$accessToken = $oauth2->getAccessToken($code);
|
||||||
$refreshToken = $oauth2->getRefreshToken($code);
|
$refreshToken = $oauth2->getRefreshToken($code);
|
||||||
$accessTokenExpiry = $oauth2->getAccessTokenExpiry($code);
|
$accessTokenExpiry = $oauth2->getAccessTokenExpiry($code);
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ App::post('/v1/functions/:functionId/executions')
|
||||||
'functionId' => $function->getId(),
|
'functionId' => $function->getId(),
|
||||||
'deploymentId' => $deployment->getId(),
|
'deploymentId' => $deployment->getId(),
|
||||||
'trigger' => 'http', // http / schedule / event
|
'trigger' => 'http', // http / schedule / event
|
||||||
'status' => 'waiting', // waiting / processing / completed / failed
|
'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed
|
||||||
'statusCode' => 0,
|
'statusCode' => 0,
|
||||||
'response' => '',
|
'response' => '',
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
|
|
|
@ -40,7 +40,6 @@ App::get('/v1/locale')
|
||||||
$output['countryCode'] = $record['country']['iso_code'];
|
$output['countryCode'] = $record['country']['iso_code'];
|
||||||
$output['country'] = $locale->getText('countries.' . strtolower($record['country']['iso_code']), $locale->getText('locale.country.unknown'));
|
$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'] = $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['continentCode'] = $record['continent']['code'];
|
||||||
$output['eu'] = (\in_array($record['country']['iso_code'], $eu)) ? true : false;
|
$output['eu'] = (\in_array($record['country']['iso_code'], $eu)) ? true : false;
|
||||||
|
|
||||||
|
|
|
@ -724,7 +724,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
|
||||||
->setAttribute('confirm', true)
|
->setAttribute('confirm', true)
|
||||||
;
|
;
|
||||||
|
|
||||||
$user->setAttribute('emailVerification', true);
|
$user = Authorization::skip(fn() => $dbForProject->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', true)));
|
||||||
|
|
||||||
// Log user in
|
// Log user in
|
||||||
|
|
||||||
|
|
|
@ -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_KEY_ACCCESS = 24 * 60 * 60; // 24 hours
|
||||||
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
|
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
|
||||||
const APP_CACHE_BUSTER = 501;
|
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_EMAIL = 'email';
|
||||||
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
|
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
|
||||||
const APP_DATABASE_ATTRIBUTE_IP = 'ip';
|
const APP_DATABASE_ATTRIBUTE_IP = 'ip';
|
||||||
|
@ -790,9 +790,11 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons
|
||||||
Authorization::setDefaultStatus(true);
|
Authorization::setDefaultStatus(true);
|
||||||
|
|
||||||
Auth::setCookieName('a_session_' . $project->getId());
|
Auth::setCookieName('a_session_' . $project->getId());
|
||||||
|
$authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
|
||||||
|
|
||||||
if (APP_MODE_ADMIN === $mode) {
|
if (APP_MODE_ADMIN === $mode) {
|
||||||
Auth::setCookieName('a_session_' . $console->getId());
|
Auth::setCookieName('a_session_' . $console->getId());
|
||||||
|
$authDuration = Auth::TOKEN_EXPIRATION_LOGIN_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = Auth::decodeSession(
|
$session = Auth::decodeSession(
|
||||||
|
@ -829,8 +831,6 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons
|
||||||
$user = $dbForConsole->getDocument('users', Auth::$unique);
|
$user = $dbForConsole->getDocument('users', Auth::$unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
$authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$user->isEmpty() // Check a document has been found in the DB
|
$user->isEmpty() // Check a document has been found in the DB
|
||||||
|| !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration)
|
|| !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration)
|
||||||
|
|
|
@ -98,7 +98,6 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_SESSIONS)
|
->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();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Appwrite\Auth\Auth;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\Cache\Adapter\Filesystem;
|
use Utopia\Cache\Adapter\Filesystem;
|
||||||
use Utopia\Cache\Cache;
|
use Utopia\Cache\Cache;
|
||||||
|
@ -13,6 +14,7 @@ use Utopia\Abuse\Abuse;
|
||||||
use Utopia\Abuse\Adapters\TimeLimit;
|
use Utopia\Abuse\Adapters\TimeLimit;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
use Utopia\Audit\Audit;
|
use Utopia\Audit\Audit;
|
||||||
|
use Utopia\Database\DateTime;
|
||||||
|
|
||||||
require_once __DIR__ . '/../init.php';
|
require_once __DIR__ . '/../init.php';
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ class DeletesV1 extends Worker
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_TYPE_SESSIONS:
|
case DELETE_TYPE_SESSIONS:
|
||||||
$this->deleteExpiredSessions($this->args['datetime']);
|
$this->deleteExpiredSessions();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_TYPE_CERTIFICATES:
|
case DELETE_TYPE_CERTIFICATES:
|
||||||
|
@ -105,7 +107,7 @@ class DeletesV1 extends Worker
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_TYPE_USAGE:
|
case DELETE_TYPE_USAGE:
|
||||||
$this->deleteUsageStats($this->args['dateTime1d'], $this->args['hourlyUsageRetentionDatetime']);
|
$this->deleteUsageStats($this->args['hourlyUsageRetentionDatetime']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_TYPE_CACHE_BY_RESOURCE:
|
case DELETE_TYPE_CACHE_BY_RESOURCE:
|
||||||
|
@ -214,7 +216,6 @@ class DeletesV1 extends Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $datetime1d
|
|
||||||
* @param string $hourlyUsageRetentionDatetime
|
* @param string $hourlyUsageRetentionDatetime
|
||||||
*/
|
*/
|
||||||
protected function deleteUsageStats(string $hourlyUsageRetentionDatetime)
|
protected function deleteUsageStats(string $hourlyUsageRetentionDatetime)
|
||||||
|
@ -316,16 +317,20 @@ class DeletesV1 extends Worker
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function deleteExpiredSessions(): void
|
||||||
* @param string $datetime
|
|
||||||
*/
|
|
||||||
protected function deleteExpiredSessions(string $datetime): void
|
|
||||||
{
|
{
|
||||||
$this->deleteForProjectIds(function (string $projectId) use ($datetime) {
|
$consoleDB = $this->getConsoleDB();
|
||||||
|
|
||||||
|
$this->deleteForProjectIds(function (string $projectId) use ($consoleDB) {
|
||||||
$dbForProject = $this->getProjectDB($projectId);
|
$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
|
// Delete Sessions
|
||||||
$this->deleteByGroup('sessions', [
|
$this->deleteByGroup('sessions', [
|
||||||
Query::lessThan('expire', $datetime)
|
Query::lessThan('$createdAt', $expired)
|
||||||
], $dbForProject);
|
], $dbForProject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ abstract class Migration
|
||||||
'1.0.3' => 'V15',
|
'1.0.3' => 'V15',
|
||||||
'1.1.0' => 'V16',
|
'1.1.0' => 'V16',
|
||||||
'1.1.1' => 'V16',
|
'1.1.1' => 'V16',
|
||||||
|
'1.1.2' => 'V16',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -550,7 +550,6 @@ class FunctionsCustomServerTest extends Scope
|
||||||
$this->assertIsArray($function['body']['deployments']);
|
$this->assertIsArray($function['body']['deployments']);
|
||||||
$this->assertCount(2, $function['body']['deployments']);
|
$this->assertCount(2, $function['body']['deployments']);
|
||||||
$this->assertEquals($function['body']['deployments'][0]['$id'], $data['deploymentId']);
|
$this->assertEquals($function['body']['deployments'][0]['$id'], $data['deploymentId']);
|
||||||
$this->assertGreaterThanOrEqual(2, $function['body']['deployments'][0]['buildTime']);
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,6 +342,15 @@ trait TeamsBaseClient
|
||||||
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']];
|
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']];
|
||||||
$data['session'] = $session;
|
$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 */
|
/** [START] TESTS TO CHECK PASSWORD UPDATE OF NEW USER CREATED USING TEAM INVITE */
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue