diff --git a/.travis-ci/build.sh b/.travis-ci/build.sh
index 27b598fd4..050168289 100644
--- a/.travis-ci/build.sh
+++ b/.travis-ci/build.sh
@@ -15,7 +15,7 @@ then
exit 1
fi
-if test $(find "./app/db/DBIP/dbip-country-lite-2021-02.mmdb" -mmin +259200)
+if test $(find "./app/db/DBIP/dbip-country-lite-2021-06.mmdb" -mmin +259200)
then
printf "${RED}GEO country DB has not been updated for more than 6 months. Go to https://db-ip.com/db/download/ip-to-country-lite to download a newer version${NC}\n"
fi
diff --git a/Dockerfile b/Dockerfile
index b442e694f..09cbd677a 100755
--- a/Dockerfile
+++ b/Dockerfile
@@ -62,8 +62,10 @@ RUN \
make && make install && \
cd .. && \
## Imagick Extension
- git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/Imagick/imagick && \
+ ## Last working commit https://github.com/Imagick/imagick/commit/35741750aa1cda2b7ac354bfa6128fa037e9cf32
+ git clone --branch $PHP_IMAGICK_VERSION https://github.com/Imagick/imagick && \
cd imagick && \
+ git checkout 35741750aa1cda2b7ac354bfa6128fa037e9cf32 && \
phpize && \
./configure && \
make && make install && \
diff --git a/app/config/platforms.php b/app/config/platforms.php
index cfb21f3d8..deec77d98 100644
--- a/app/config/platforms.php
+++ b/app/config/platforms.php
@@ -15,7 +15,7 @@ return [
[
'key' => 'web',
'name' => 'Web',
- 'version' => '3.0.4',
+ 'version' => '3.1.0',
'url' => 'https://github.com/appwrite/sdk-for-web',
'package' => 'https://www.npmjs.com/package/appwrite',
'enabled' => true,
@@ -62,7 +62,7 @@ return [
[
'key' => 'flutter',
'name' => 'Flutter',
- 'version' => '0.6.2',
+ 'version' => '0.6.4',
'url' => 'https://github.com/appwrite/sdk-for-flutter',
'package' => 'https://pub.dev/packages/appwrite',
'enabled' => true,
@@ -178,7 +178,7 @@ return [
[
'key' => 'nodejs',
'name' => 'Node.js',
- 'version' => '2.2.2',
+ 'version' => '2.3.0',
'url' => 'https://github.com/appwrite/sdk-for-node',
'package' => 'https://www.npmjs.com/package/node-appwrite',
'enabled' => true,
@@ -195,7 +195,7 @@ return [
[
'key' => 'deno',
'name' => 'Deno',
- 'version' => '0.2.1',
+ 'version' => '0.2.2',
'url' => 'https://github.com/appwrite/sdk-for-deno',
'package' => 'https://deno.land/x/appwrite',
'enabled' => true,
@@ -212,7 +212,7 @@ return [
[
'key' => 'php',
'name' => 'PHP',
- 'version' => '2.1.1',
+ 'version' => '2.1.2',
'url' => 'https://github.com/appwrite/sdk-for-php',
'package' => 'https://packagist.org/packages/appwrite/appwrite',
'enabled' => true,
@@ -229,7 +229,7 @@ return [
[
'key' => 'python',
'name' => 'Python',
- 'version' => '0.2.1',
+ 'version' => '0.3.0',
'url' => 'https://github.com/appwrite/sdk-for-python',
'package' => 'https://pypi.org/project/appwrite/',
'enabled' => true,
@@ -246,7 +246,7 @@ return [
[
'key' => 'ruby',
'name' => 'Ruby',
- 'version' => '2.1.1',
+ 'version' => '2.2.0',
'url' => 'https://github.com/appwrite/sdk-for-ruby',
'package' => 'https://rubygems.org/gems/appwrite',
'enabled' => true,
@@ -314,7 +314,7 @@ return [
[
'key' => 'dart',
'name' => 'Dart',
- 'version' => '0.6.1',
+ 'version' => '0.6.3',
'url' => 'https://github.com/appwrite/sdk-for-dart',
'package' => 'https://pub.dev/packages/dart_appwrite',
'enabled' => true,
@@ -331,7 +331,7 @@ return [
[
'key' => 'cli',
'name' => 'Command Line',
- 'version' => '0.10.1',
+ 'version' => '0.10.0',
'url' => 'https://github.com/appwrite/sdk-for-cli',
'package' => 'https://github.com/appwrite/sdk-for-cli',
'enabled' => true,
diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php
index 11f4e86a4..a10c94035 100644
--- a/app/controllers/api/account.php
+++ b/app/controllers/api/account.php
@@ -58,15 +58,16 @@ App::post('/v1/account')
/** @var Utopia\Database\Database $dbForInternal */
/** @var Appwrite\Event\Event $audits */
+ $email = \strtolower($email);
if ('console' === $project->getId()) {
- $whitlistEmails = $project->getAttribute('authWhitelistEmails');
- $whitlistIPs = $project->getAttribute('authWhitelistIPs');
+ $whitelistEmails = $project->getAttribute('authWhitelistEmails');
+ $whitelistIPs = $project->getAttribute('authWhitelistIPs');
- if (!empty($whitlistEmails) && !\in_array($email, $whitlistEmails)) {
+ if (!empty($whitelistEmails) && !\in_array($email, $whitelistEmails)) {
throw new Exception('Console registration is restricted to specific emails. Contact your administrator for more information.', 401);
}
- if (!empty($whitlistIPs) && !\in_array($request->getIP(), $whitlistIPs)) {
+ if (!empty($whitelistIPs) && !\in_array($request->getIP(), $whitelistIPs)) {
throw new Exception('Console registration is restricted to specific IPs. Contact your administrator for more information.', 401);
}
}
@@ -153,6 +154,7 @@ App::post('/v1/account/sessions')
/** @var MaxMind\Db\Reader $geodb */
/** @var Appwrite\Event\Event $audits */
+ $email = \strtolower($email);
$protocol = $request->getProtocol();
$profile = $dbForInternal->findFirst('users', [new Query('email', Query::TYPE_EQUAL, [$email])], 1); // Get user by email address
@@ -1004,7 +1006,8 @@ App::patch('/v1/account/email')
throw new Exception('Invalid credentials', 401);
}
- $profile = $dbForInternal->findFirst('users', [new Query('email', Query::TYPE_EQUAL, [$email])], 1); // Get user by email address
+ $email = \strtolower($email);
+ $profile = $dbForInternal->findFirst('users', [new Query('email', Query::TYPE_EQUAL, [\strtolower($email)])], 1); // Get user by email address
if ($profile) {
throw new Exception('User already registered', 400);
@@ -1298,6 +1301,7 @@ App::post('/v1/account/recovery')
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::$roles);
$isAppUser = Auth::isAppUser(Authorization::$roles);
+ $email = \strtolower($email);
$profile = $dbForInternal->findFirst('users', [new Query('email', Query::TYPE_EQUAL, [$email])], 1); // Get user by email address
if (!$profile) {
diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php
index 08d4a7a50..682bbd642 100644
--- a/app/controllers/api/teams.php
+++ b/app/controllers/api/teams.php
@@ -257,7 +257,8 @@ App::post('/v1/teams/:teamId/memberships')
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::$roles);
$isAppUser = Auth::isAppUser(Authorization::$roles);
-
+
+ $email = \strtolower($email);
$name = (empty($name)) ? $email : $name;
$team = $dbForInternal->getDocument('teams', $teamId);
diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php
index 618299eed..fcd6aaee7 100644
--- a/app/controllers/api/users.php
+++ b/app/controllers/api/users.php
@@ -40,6 +40,8 @@ App::post('/v1/users')
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForInternal */
+ $email = \strtolower($email);
+
try {
$userId = $dbForInternal->getId();
$user = $dbForInternal->createDocument('users', new Document([
@@ -362,23 +364,17 @@ App::patch('/v1/users/:userId/verification')
->inject('projectDB')
->action(function ($userId, $emailVerification, $response, $projectDB) {
/** @var Appwrite\Utopia\Response $response */
- /** @var Appwrite\Database\Database $projectDB */
+ /** @var Utopia\Database\Database $dbForInternal */
- $user = $projectDB->getDocument($userId);
+ $user = $dbForInternal->getDocument('users', $userId);
- if (empty($user->getId()) || Database::SYSTEM_COLLECTION_USERS != $user->getCollection()) {
+ if ($user->isEmpty()) {
throw new Exception('User not found', 404);
}
- $user = $projectDB->updateDocument(\array_merge($user->getArrayCopy(), [
- 'emailVerification' => $emailVerification,
- ]));
+ $user = $dbForInternal->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', $emailVerification));
- if (false === $user) {
- throw new Exception('Failed saving user to DB', 500);
- }
-
- $response->dynamic($user, Response::MODEL_USER);
+ $response->dynamic2($user, Response::MODEL_USER);
});
App::patch('/v1/users/:userId/prefs')
diff --git a/app/controllers/mock.php b/app/controllers/mock.php
index 307b8c291..80c4c6c42 100644
--- a/app/controllers/mock.php
+++ b/app/controllers/mock.php
@@ -6,9 +6,9 @@ use Appwrite\Database\Document;
use Appwrite\Network\Validator\Host;
use Appwrite\Utopia\Response;
use Utopia\App;
-use Utopia\Validator\Numeric;
-use Utopia\Validator\Text;
use Utopia\Validator\ArrayList;
+use Utopia\Validator\Integer;
+use Utopia\Validator\Text;
use Utopia\Storage\Validator\File;
App::get('/v1/mock/tests/foo')
@@ -24,7 +24,7 @@ App::get('/v1/mock/tests/foo')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -42,7 +42,7 @@ App::post('/v1/mock/tests/foo')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -60,7 +60,7 @@ App::patch('/v1/mock/tests/foo')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -78,7 +78,7 @@ App::put('/v1/mock/tests/foo')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -96,7 +96,7 @@ App::delete('/v1/mock/tests/foo')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -114,7 +114,7 @@ App::get('/v1/mock/tests/bar')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -132,7 +132,7 @@ App::post('/v1/mock/tests/bar')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -150,7 +150,7 @@ App::patch('/v1/mock/tests/bar')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -168,7 +168,7 @@ App::put('/v1/mock/tests/bar')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -186,7 +186,7 @@ App::delete('/v1/mock/tests/bar')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) {
});
@@ -230,7 +230,7 @@ App::post('/v1/mock/tests/general/upload')
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('x', '', new Text(100), 'Sample string param')
- ->param('y', '', new Numeric(), 'Sample numeric param')
+ ->param('y', '', new Integer(), 'Sample numeric param')
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->param('file', [], new File(), 'Sample file param', false)
->inject('request')
@@ -271,6 +271,7 @@ App::get('/v1/mock/tests/general/redirect')
->label('sdk.description', 'Mock a redirect request.')
->label('sdk.response.code', Response::STATUS_CODE_MOVED_PERMANENTLY)
->label('sdk.response.type', Response::CONTENT_TYPE_HTML)
+ ->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->inject('response')
->action(function ($response) {
@@ -394,6 +395,7 @@ App::get('/v1/mock/tests/general/502-error')
->label('sdk.description', 'Mock a 502 bad gateway.')
->label('sdk.response.code', Response::STATUS_CODE_BAD_GATEWAY)
->label('sdk.response.type', Response::CONTENT_TYPE_TEXT)
+ ->label('sdk.response.model', Response::MODEL_ANY)
->label('sdk.mock', true)
->inject('response')
->action(function ($response) {
diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php
index 016c4fed4..828253954 100644
--- a/app/controllers/web/home.php
+++ b/app/controllers/web/home.php
@@ -8,6 +8,7 @@ use Utopia\App;
use Utopia\View;
use Utopia\Config\Config;
use Utopia\Exception;
+use Utopia\Validator\Boolean;
use Utopia\Validator\Range;
use Utopia\Validator\WhiteList;
@@ -488,4 +489,4 @@ App::get('/versions')
}
$response->json($versions);
- });
\ No newline at end of file
+ });
diff --git a/app/db/DBIP/dbip-country-lite-2021-02.mmdb b/app/db/DBIP/dbip-country-lite-2021-02.mmdb
deleted file mode 100644
index 6434c220f..000000000
Binary files a/app/db/DBIP/dbip-country-lite-2021-02.mmdb and /dev/null differ
diff --git a/app/db/DBIP/dbip-country-lite-2021-06.mmdb b/app/db/DBIP/dbip-country-lite-2021-06.mmdb
new file mode 100644
index 000000000..984d200d1
Binary files /dev/null and b/app/db/DBIP/dbip-country-lite-2021-06.mmdb differ
diff --git a/app/init.php b/app/init.php
index 22a7f47e5..f79ef3270 100644
--- a/app/init.php
+++ b/app/init.php
@@ -47,7 +47,7 @@ const APP_MODE_ADMIN = 'admin';
const APP_PAGING_LIMIT = 12;
const APP_LIMIT_COUNT = 5000;
const APP_LIMIT_USERS = 10000;
-const APP_CACHE_BUSTER = 146;
+const APP_CACHE_BUSTER = 148;
const APP_VERSION_STABLE = '0.8.0';
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_FUNCTIONS = '/storage/functions';
@@ -263,7 +263,7 @@ $register->set('smtp', function () {
return $mail;
});
$register->set('geodb', function () {
- return new Reader(__DIR__.'/db/DBIP/dbip-country-lite-2021-02.mmdb');
+ return new Reader(__DIR__.'/db/DBIP/dbip-country-lite-2021-06.mmdb');
});
/*
diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php
index 108ce7a48..96d9dbf56 100644
--- a/app/tasks/sdks.php
+++ b/app/tasks/sdks.php
@@ -202,7 +202,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
\exec('rm -rf '.$target.' && \
mkdir -p '.$target.' && \
cd '.$target.' && \
- git init && \
+ git init --initial-branch=master && \
git remote add origin '.$gitUrl.' && \
git fetch && \
git pull '.$gitUrl.' && \
diff --git a/app/views/layouts/default.phtml b/app/views/layouts/default.phtml
index 465e08366..aa4dfc3f5 100644
--- a/app/views/layouts/default.phtml
+++ b/app/views/layouts/default.phtml
@@ -43,7 +43,7 @@ if(!empty($platforms)) {
-
+
getParam('prefetch', []) as $prefetch): ?>
@@ -52,12 +52,12 @@ if(!empty($platforms)) {
-
-
+
+
-
+
-
+