Skip to content

Commit

Permalink
Merge branch 'master' into feat-5542-validate-x-appwrite-id-header-fo…
Browse files Browse the repository at this point in the history
…r-CreateFile
  • Loading branch information
eldadfux authored Aug 5, 2023
2 parents 42b2587 + 06570a0 commit a56f91b
Show file tree
Hide file tree
Showing 210 changed files with 3,624 additions and 494 deletions.
28 changes: 27 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
# Version 1.3.8

## Bugs
- Fix audit user internal [#5809](https://github.com/appwrite/appwrite/pull/5809)

# Version 1.3.7

## Bugs
- Fix the routing for the default OAuth2 pages [#5640](https://github.com/appwrite/appwrite/pull/5640) [#5648](https://github.com/appwrite/appwrite/pull/5648)
- Add support for trailing slashes in Routes and URLs [#5647](https://github.com/appwrite/appwrite/pull/5647) [#5648](https://github.com/appwrite/appwrite/pull/5648)

# Version 1.3.6

## Bugs

- Fix Console deep linking to result in a 404 [#5632](https://github.com/appwrite/appwrite/pull/5632)
- Fix ACME HTTP Challenge [#5632](https://github.com/appwrite/appwrite/pull/5632)

# Version 1.3.5

## Bugs

- Fix minimum length for string attribute default values [#5606](https://github.com/appwrite/appwrite/pull/5606), [#5602](https://github.com/appwrite/appwrite/pull/5602)
- Update framework to fix route mismatches [#5603](https://github.com/appwrite/appwrite/pull/5603)

# Version 1.3.4

## Bugs

- Update migration to properly migrate bucket permissiosn [#5497](https://github.com/appwrite/appwrite/pull/5497)
- Update migration to properly migrate bucket permissions [#5497](https://github.com/appwrite/appwrite/pull/5497)

# Version 1.3.3

Expand Down Expand Up @@ -76,6 +101,7 @@
## 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)
- Add security headers to the console endpoint [#4758](https://github.com/appwrite/appwrite/pull/4758)

## Bugs
- Fix default oauth paths [#4725](https://github.com/appwrite/appwrite/pull/4725)
Expand Down
6 changes: 3 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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.3.4
appwrite/appwrite:1.3.8
```

### Windows
Expand All @@ -78,7 +78,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.3.4
appwrite/appwrite:1.3.8
```

#### PowerShell
Expand All @@ -88,7 +88,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.3.4
appwrite/appwrite:1.3.8
```

运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.4
appwrite/appwrite:1.3.8
```

### Windows
Expand All @@ -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.3.4
appwrite/appwrite:1.3.8
```

#### PowerShell
Expand All @@ -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.3.4
appwrite/appwrite:1.3.8
```

Once the Docker installation is complete, 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 completing the installation.
Expand Down Expand Up @@ -128,6 +128,12 @@ Choose from one of the providers below:
<br /><sub><b>Gitpod</b></sub></a>
</a>
</td>
<td align="center" width="100" height="100">
<a href="https://www.linode.com/marketplace/apps/appwrite/appwrite/">
<img width="50" height="39" src="public/images/integrations/akamai-logo.svg" alt="Akamai Logo" />
<br /><sub><b>Akamai</b></sub></a>
</a>
</td>
</tr>
</table>

Expand Down
11 changes: 11 additions & 0 deletions app/config/collections.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('enabled'),
'type' => Database::VAR_BOOLEAN,
'signed' => true,
'size' => 0,
'format' => '',
'filters' => [],
'required' => false,
'default' => true,
'array' => false,
],
[
'$id' => ID::custom('search'),
'type' => Database::VAR_STRING,
Expand Down
19 changes: 17 additions & 2 deletions app/config/errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
],
Exception::USER_BLOCKED => [
'name' => Exception::USER_BLOCKED,
'description' => 'The current user has been blocked. You can unblock the user from the Appwrite console.',
'description' => 'The current user has been blocked.',
'code' => 401,
],
Exception::USER_INVALID_TOKEN => [
Expand Down Expand Up @@ -227,6 +227,11 @@
'description' => 'The invite does not belong to the current user.',
'code' => 401,
],
Exception::TEAM_ALREADY_EXISTS => [
'name' => Exception::TEAM_ALREADY_EXISTS,
'description' => 'Team with requested ID already exists.',
'code' => 409,
],

/** Membership */
Exception::MEMBERSHIP_NOT_FOUND => [
Expand Down Expand Up @@ -408,9 +413,14 @@
'description' => 'The document structure is invalid. Please ensure the attributes match the collection definition.',
'code' => 400,
],
Exception::DOCUMENT_MISSING_DATA => [
'name' => Exception::DOCUMENT_MISSING_DATA,
'description' => 'The document data is missing. You must provide the document data.',
'code' => 400,
],
Exception::DOCUMENT_MISSING_PAYLOAD => [
'name' => Exception::DOCUMENT_MISSING_PAYLOAD,
'description' => 'The document payload is missing.',
'description' => 'The document data and permissions are missing. You must provide either the document data or permissions to be updated.',
'code' => 400,
],
Exception::DOCUMENT_ALREADY_EXISTS => [
Expand Down Expand Up @@ -499,6 +509,11 @@
'description' => 'Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.',
'code' => 404,
],
Exception::PROJECT_ALREADY_EXISTS => [
'name' => Exception::PROJECT_ALREADY_EXISTS,
'description' => 'Project with the requested ID already exists.',
'code' => 409,
],
Exception::PROJECT_UNKNOWN => [
'name' => Exception::PROJECT_UNKNOWN,
'description' => 'The project ID is either missing or not valid. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.',
Expand Down
2 changes: 1 addition & 1 deletion app/config/locale/translations/pt-pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"emails.magicSession.signature": "Equipa {{project}}",
"emails.recovery.subject": "Redefinição de senha",
"emails.recovery.hello": "Olá {{name}}",
"emails.recovery.body": "tilize este link para redefinir a palavra-passe do seu projecto {{project}}",
"emails.recovery.body": "Utilize este link para redefinir a palavra-passe do seu projecto {{project}}",
"emails.recovery.footer": "Se não pediu para redefinir a sua palavra-passe, pode ignorar esta mensagem.",
"emails.recovery.thanks": "Obrigado",
"emails.recovery.signature": "Equipa {{project}}",
Expand Down
8 changes: 4 additions & 4 deletions app/config/platforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
[
'key' => 'python',
'name' => 'Python',
'version' => '2.0.0',
'version' => '2.0.2',
'url' => 'https://github.com/appwrite/sdk-for-python',
'package' => 'https://pypi.org/project/appwrite/',
'enabled' => true,
Expand Down Expand Up @@ -357,12 +357,12 @@
[
'key' => 'dotnet',
'name' => '.NET',
'version' => '2.0.0',
'version' => '0.4.2',
'url' => 'https://github.com/appwrite/sdk-for-dotnet',
'package' => 'https://www.nuget.org/packages/Appwrite',
'enabled' => false,
'enabled' => true,
'beta' => true,
'dev' => true,
'dev' => false,
'hidden' => false,
'family' => APP_PLATFORM_SERVER,
'prism' => 'csharp',
Expand Down
14 changes: 12 additions & 2 deletions app/config/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@
'beta' => false,
'mock' => false,
],
'oidc' => [
'name' => 'OpenID Connect',
'developers' => 'https://openid.net/connect/faq/',
'icon' => 'icon-oidc',
'enabled' => true,
'sandbox' => false,
'form' => 'oidc.phtml',
'beta' => false,
'mock' => false,
],
'okta' => [
'name' => 'Okta',
'developers' => 'https://developer.okta.com/',
Expand All @@ -222,7 +232,7 @@
'mock' => false
],
'paypalSandbox' => [
'name' => 'PayPal',
'name' => 'PayPal Sandbox',
'developers' => 'https://developer.paypal.com/docs/api/overview/',
'icon' => 'icon-paypal',
'enabled' => true,
Expand Down Expand Up @@ -292,7 +302,7 @@
'mock' => false,
],
'tradeshiftBox' => [
'name' => 'Tradeshift',
'name' => 'Tradeshift Sandbox',
'developers' => 'https://developers.tradeshift.com/docs/api',
'icon' => 'icon-tradeshiftbox',
'enabled' => true,
Expand Down
32 changes: 20 additions & 12 deletions app/controllers/api/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration));

$session = new Document(array_merge([
'$id' => ID::unique(),
Expand Down Expand Up @@ -701,7 +701,7 @@
}

$loginSecret = Auth::tokenGenerator();
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM));

$token = new Document([
'$id' => ID::unique(),
Expand Down Expand Up @@ -827,7 +827,7 @@
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration));

$session = new Document(array_merge(
[
Expand Down Expand Up @@ -976,7 +976,7 @@
}

$secret = Auth::codeGenerator();
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE));

$token = new Document([
'$id' => ID::unique(),
Expand Down Expand Up @@ -1064,7 +1064,7 @@
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration));

$session = new Document(array_merge(
[
Expand Down Expand Up @@ -1216,7 +1216,7 @@
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration));

$session = new Document(array_merge(
[
Expand Down Expand Up @@ -1389,6 +1389,7 @@

$session->setAttribute('countryName', $countryName);
$session->setAttribute('current', ($current == $session->getId()) ? true : false);
$session->setAttribute('expire', DateTime::formatTz(DateTime::addSeconds(new \DateTime($session->getCreatedAt()), $authDuration)));

$sessions[$key] = $session;
}
Expand Down Expand Up @@ -1426,7 +1427,7 @@

$audit = new EventAudit($dbForProject);

$logs = $audit->getLogsByUser($user->getId(), $limit, $offset);
$logs = $audit->getLogsByUser($user->getInternalId(), $limit, $offset);

$output = [];

Expand Down Expand Up @@ -1495,7 +1496,7 @@
$session
->setAttribute('current', ($session->getAttribute('secret') == Auth::hash(Auth::$secret)))
->setAttribute('countryName', $countryName)
->setAttribute('expire', DateTime::addSeconds(new \DateTime($session->getCreatedAt()), $authDuration))
->setAttribute('expire', DateTime::formatTz(DateTime::addSeconds(new \DateTime($session->getCreatedAt()), $authDuration)))
;

return $response->dynamic($session, Response::MODEL_SESSION);
Expand Down Expand Up @@ -1763,11 +1764,12 @@
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_USER)
->inject('requestTimestamp')
->inject('request')
->inject('response')
->inject('user')
->inject('dbForProject')
->inject('events')
->action(function (?\DateTime $requestTimestamp, Response $response, Document $user, Database $dbForProject, Event $events) {
->action(function (?\DateTime $requestTimestamp, Request $request, Response $response, Document $user, Database $dbForProject, Event $events) {

$user->setAttribute('status', false);

Expand All @@ -1781,6 +1783,12 @@
$response->addHeader('X-Fallback-Cookies', \json_encode([]));
}

$protocol = $request->getProtocol();
$response
->addCookie(Auth::$cookieName . '_legacy', '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, null)
->addCookie(Auth::$cookieName, '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, Config::getParam('cookieSamesite'))
;

$response->dynamic($user, Response::MODEL_ACCOUNT);
});

Expand Down Expand Up @@ -1932,7 +1940,7 @@

$authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;

$session->setAttribute('expire', DateTime::addSeconds(new \DateTime($session->getCreatedAt()), $authDuration));
$session->setAttribute('expire', DateTime::formatTz(DateTime::addSeconds(new \DateTime($session->getCreatedAt()), $authDuration)));

$events
->setParam('userId', $user->getId())
Expand Down Expand Up @@ -2299,7 +2307,7 @@
->setBody($body)
->setFrom($from)
->setRecipient($user->getAttribute('email'))
->setName($user->getAttribute('name'))
->setName($user->getAttribute('name') ?? '')
->trigger()
;

Expand Down Expand Up @@ -2373,7 +2381,7 @@
$dbForProject->deleteCachedDocument('users', $profile->getId());

$events
->setParam('userId', $user->getId())
->setParam('userId', $userId)
->setParam('tokenId', $verificationDocument->getId())
;

Expand Down
Loading

0 comments on commit a56f91b

Please sign in to comment.