diff --git a/.gitmodules b/.gitmodules
index e9f13bb1ac..cef850ec0a 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/.gitpod.yml b/.gitpod.yml
index a63c07bad2..4c081dd275 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -1,8 +1,9 @@
tasks:
- name: Run Appwrite Docker Stack
init: |
- docker compose pull
+ git submodule update --init
docker compose build
+ docker compose pull
docker pull composer
command: |
docker run --rm --interactive --tty \
diff --git a/CHANGES.md b/CHANGES.md
index 6b7af775de..0ba56af243 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,18 @@
-# Version 1.1.1
+- 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)
- Fix Migration for Stats adding the region attribute [#4704](https://github.com/appwrite/appwrite/pull/4704)
diff --git a/Dockerfile b/Dockerfile
index f63ed3ddda..95073df08b 100755
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,6 +18,12 @@ COPY app/console /usr/local/src/console
WORKDIR /usr/local/src/console
+ARG VITE_GA_PROJECT
+ARG VITE_CONSOLE_MODE
+
+ENV VITE_GA_PROJECT=$VITE_GA_PROJECT
+ENV VITE_CONSOLE_MODE=$VITE_CONSOLE_MODE
+
RUN npm ci
RUN npm run build
diff --git a/README-CN.md b/README-CN.md
index 4f8156f2ce..6f00cebf10 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 6942597115..0e613204c4 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/config/errors.php b/app/config/errors.php
index e4dc3d5b4d..c5c6a489b8 100644
--- a/app/config/errors.php
+++ b/app/config/errors.php
@@ -70,7 +70,7 @@ return [
],
Exception::GENERAL_ROUTE_NOT_FOUND => [
'name' => Exception::GENERAL_ROUTE_NOT_FOUND,
- 'description' => 'The requested route was not found. Please refer to the docs and try again.',
+ 'description' => 'The requested route was not found. Please refer to the API docs and try again.',
'code' => 404,
],
Exception::GENERAL_CURSOR_NOT_FOUND => [
@@ -486,7 +486,7 @@ return [
],
Exception::PROJECT_PROVIDER_UNSUPPORTED => [
'name' => Exception::PROJECT_PROVIDER_UNSUPPORTED,
- 'description' => 'The chosen OAuth provider is unsupported. Please check the docs for the complete list of supported OAuth providers.',
+ 'description' => 'The chosen OAuth provider is unsupported. Please check the Create OAuth2 Session docs for the complete list of supported OAuth providers.',
'code' => 501,
],
Exception::PROJECT_INVALID_SUCCESS_URL => [
diff --git a/app/console b/app/console
index f89584bdd4..af3d741ae8 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 115948f710..45fb03062f 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 4cf489e590..bfc1ccba42 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 3aee339dfe..6d824da055 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/projects.php b/app/controllers/api/projects.php
index d1dfea7245..1fc60c3725 100644
--- a/app/controllers/api/projects.php
+++ b/app/controllers/api/projects.php
@@ -59,7 +59,7 @@ App::post('/v1/projects')
->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
->param('teamId', '', new UID(), 'Team unique ID.')
- ->param('region', '', new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn($config) => !$config['disabled']))), 'Project Region.')
+ ->param('region', App::getEnv('_APP_REGION', 'default'), new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn($config) => !$config['disabled']))), 'Project Region.', true)
->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
->param('logo', '', new Text(1024), 'Project logo.', true)
->param('url', '', new URL(), 'Project URL.', true)
diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php
index dd214f562c..567560c6a8 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/controllers/general.php b/app/controllers/general.php
index 069a918680..0c10dd46e9 100644
--- a/app/controllers/general.php
+++ b/app/controllers/general.php
@@ -223,7 +223,9 @@ App::init()
return $response->redirect('https://' . $request->getHostname() . $request->getURI());
}
+ }
+ if ($request->getProtocol() === 'https') {
$response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days
}
diff --git a/app/init.php b/app/init.php
index 3d24ef81d4..ef9246e362 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 96264a9966..7199a338e3 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 364e64842f..5dc7e8d737 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/composer.lock b/composer.lock
index 3b4148a950..e97546287f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3358,16 +3358,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.18",
+ "version": "9.2.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a"
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559",
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559",
"shasum": ""
},
"require": {
@@ -3423,7 +3423,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19"
},
"funding": [
{
@@ -3431,7 +3431,7 @@
"type": "github"
}
],
- "time": "2022-10-27T13:35:33+00:00"
+ "time": "2022-11-18T07:47:47+00:00"
},
{
"name": "phpunit/php-file-iterator",
diff --git a/docs/examples/1.1.x/client-android/java/account/create-anonymous-session.md b/docs/examples/1.1.x/client-android/java/account/create-anonymous-session.md
index 7d2123b58d..b1a2a25828 100644
--- a/docs/examples/1.1.x/client-android/java/account/create-anonymous-session.md
+++ b/docs/examples/1.1.x/client-android/java/account/create-anonymous-session.md
@@ -1,18 +1,46 @@
-import io.appwrite.Client;
-import io.appwrite.coroutines.CoroutineCallback;
-import io.appwrite.services.Account;
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import io.appwrite.Client
+import io.appwrite.services.Account
-Client client = new Client(context)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+public class MainActivity extends AppCompatActivity {
-Account account = new Account(client);
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
-account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
- if (error != null)
- error.printStackTrace();
- return;
+ Client client = new Client(getApplicationContext())
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+ Account account = new Account(client);
+
+ account.createAnonymousSession(new Continuation