From 2ed38271a017760afeaa7dc2b614ab42c8039fd2 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 2 May 2024 13:51:19 +0100 Subject: [PATCH 01/11] feat: add version header --- app/controllers/general.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/general.php b/app/controllers/general.php index 71ecc80d54..36b2b7179d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -545,6 +545,7 @@ App::init() $response ->addHeader('Server', 'Appwrite') + ->addHeader('X-Appwrite-Version', System::getEnv('_APP_VERSION', 'UNKNOWN')) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') From 3ab9875ca78d9484be013222c1a1fb2e5fbbe8e5 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 2 May 2024 14:16:35 +0100 Subject: [PATCH 02/11] feat: use x-appwrite-response-format --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 36b2b7179d..532996631a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -545,7 +545,7 @@ App::init() $response ->addHeader('Server', 'Appwrite') - ->addHeader('X-Appwrite-Version', System::getEnv('_APP_VERSION', 'UNKNOWN')) + ->addHeader('X-Appwrite-Response-Format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', 'UNKNOWN')) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') From 644bbe1f5b267d7b1c0d13ca250c4fbc470c9b4c Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 2 May 2024 14:25:41 +0100 Subject: [PATCH 03/11] fix: version --- app/controllers/general.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 532996631a..e95531fcda 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -543,9 +543,16 @@ App::init() $response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days } + $responseVersion = System::getEnv('_APP_VERSION', 'UNKNOWN'); + if ($responseVersion !== 'UNKNOWN') { + $responseVersion = \explode('.', $responseVersion); + $responseVersion[2] = '0'; + $responseVersion = \implode('.', $responseVersion); + } + $response ->addHeader('Server', 'Appwrite') - ->addHeader('X-Appwrite-Response-Format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', 'UNKNOWN')) + ->addHeader('X-Appwrite-Version', $responseVersion) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') From 1295128b1098804ca1e02bb7095fc4b4775f759e Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 3 May 2024 11:56:54 +0100 Subject: [PATCH 04/11] fix: use APP_VERSION_STABLE --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index e95531fcda..af30d57ba5 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -543,7 +543,7 @@ App::init() $response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days } - $responseVersion = System::getEnv('_APP_VERSION', 'UNKNOWN'); + $responseVersion = APP_VERSION_STABLE; if ($responseVersion !== 'UNKNOWN') { $responseVersion = \explode('.', $responseVersion); $responseVersion[2] = '0'; From c746fb40f82ccee093663d923c90ea132959a594 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 3 May 2024 12:03:01 +0100 Subject: [PATCH 05/11] chore: better name --- app/controllers/general.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index af30d57ba5..bb9028f197 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -543,16 +543,16 @@ App::init() $response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days } - $responseVersion = APP_VERSION_STABLE; - if ($responseVersion !== 'UNKNOWN') { - $responseVersion = \explode('.', $responseVersion); - $responseVersion[2] = '0'; - $responseVersion = \implode('.', $responseVersion); + $defaultResponseFormat = APP_VERSION_STABLE; + if ($defaultResponseFormat !== 'UNKNOWN') { + $defaultResponseFormat = \explode('.', $defaultResponseFormat); + $defaultResponseFormat[2] = '0'; + $defaultResponseFormat = \implode('.', $defaultResponseFormat); } $response ->addHeader('Server', 'Appwrite') - ->addHeader('X-Appwrite-Version', $responseVersion) + ->addHeader('X-Appwrite-Default-Response-Format', $defaultResponseFormat) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') From 0aadda960585e589a662663dcb5c44610f6f8f78 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 8 May 2024 10:07:10 +0100 Subject: [PATCH 06/11] chore: steven review --- app/controllers/general.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index bb9028f197..85c76bd820 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -544,11 +544,11 @@ App::init() } $defaultResponseFormat = APP_VERSION_STABLE; - if ($defaultResponseFormat !== 'UNKNOWN') { - $defaultResponseFormat = \explode('.', $defaultResponseFormat); + $defaultResponseFormat = \explode('.', $defaultResponseFormat); + if (\count($defaultResponseFormat) === 3) { $defaultResponseFormat[2] = '0'; - $defaultResponseFormat = \implode('.', $defaultResponseFormat); } + $defaultResponseFormat = \implode('.', $defaultResponseFormat); $response ->addHeader('Server', 'Appwrite') From 91ee67d69fe9bb260a8e725abeaa58f647007053 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 8 May 2024 10:09:28 +0100 Subject: [PATCH 07/11] Revert "Merge branch 'main' of https://github.com/appwrite/appwrite into feat-add-version-header" This reverts commit 824309e4e60e4d68bead30cef5a1dbeb1745cb7b, reversing changes made to 2d09a3a17b5675d9f1895424ed63e4b9c1b11ad3. --- .github/workflows/check-dependencies.yml | 19 --- .github/workflows/stale.yml | 23 ---- README-CN.md | 112 +++++++++--------- README.md | 47 ++++---- app/config/avatars/credit-cards.php | 2 +- .../{cencosud.png => censosud.png} | Bin app/config/errors.php | 8 +- app/config/locale/countries.php | 8 -- app/controllers/api/account.php | 3 +- app/controllers/api/functions.php | 2 +- app/controllers/api/proxy.php | 6 - app/controllers/shared/api.php | 2 +- app/init.php | 4 +- src/Appwrite/Platform/Tasks/CalcTierStats.php | 4 +- .../Platform/Tasks/CreateInfMetric.php | 4 +- .../PatchRecreateRepositoriesDocuments.php | 4 +- tests/e2e/Services/Account/AccountBase.php | 2 - .../Projects/ProjectsCustomServerTest.php | 30 +---- 18 files changed, 97 insertions(+), 183 deletions(-) delete mode 100644 .github/workflows/check-dependencies.yml delete mode 100644 .github/workflows/stale.yml rename app/config/avatars/credit-cards/{cencosud.png => censosud.png} (100%) diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml deleted file mode 100644 index 17caf3aa6b..0000000000 --- a/.github/workflows/check-dependencies.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check dependencies - -# Adapted from https://google.github.io/osv-scanner/github-action/#scan-on-pull-request - -on: - pull_request: - branches: [main, 1.*.x] - merge_group: - branches: [main, 1.*.x] - -permissions: - # Require writing security events to upload SARIF file to security tab - security-events: write - # Only need to read contents - contents: read - -jobs: - scan-pr: - uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v1.7.1" \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 5987eeeb0c..0000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Mark stale issues - -on: - schedule: - - cron: "0 0 * * *" # Midnight Runtime - -jobs: - stale: - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v9 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "This issue has been labeled as a 'question', indicating that it requires additional information from the requestor. It has been inactive for 7 days. If no further activity occurs, this issue will be closed in 14 days." - stale-issue-label: "stale" - days-before-stale: 7 - days-before-close: 14 - remove-stale-when-updated: true - close-issue-message: "This issue has been closed due to inactivity. If you still require assistance, please provide the requested information." - close-issue-reason: "not_planned" - operations-per-run: 100 - only-labels: "question" diff --git a/README-CN.md b/README-CN.md index ba800a3bd6..e526b5613d 100644 --- a/README-CN.md +++ b/README-CN.md @@ -11,7 +11,6 @@

- [![We're Hiring](https://img.shields.io/static/v1?label=We're&message=Hiring&color=blue&style=flat-square)](https://appwrite.io/company/careers) [![Hacktoberfest](https://img.shields.io/static/v1?label=hacktoberfest&message=friendly&color=191120&style=flat-square)](https://hacktoberfest.appwrite.io) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord?r=Github) @@ -26,7 +25,7 @@ [**Appwrite 云公开测试版!立即注册!**](https://cloud.appwrite.io) -Appwrite 是一个基于 Docker 的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面简化了从零开始编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 +Appwrite是一个基于Docker的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面简化了从零开始编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 Appwrite 可以提供给开发者用户验证,外部授权,用户数据读写检索,文件储存,图像处理,云函数计算,[等多种服务](https://appwrite.io/docs). @@ -94,6 +93,7 @@ docker run -it --rm ` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 + 需要自定义容器构架,请查看我们的 Docker [环境变量](https://appwrite.io/docs/environment-variables) 文档。您还可以参考我们的 [docker-compose.yml](https://appwrite.io/install/compose) 和 [.env](https://appwrite.io/install/env) 文件手动设置环境。 ### 从旧版本升级 @@ -104,73 +104,71 @@ docker run -it --rm ` 开始使用 Appwrite 只需要在控制台创建一个新项目,选择开发平台,然后抓取我们的开发套件。您可以从以下的教程中找到你喜欢的平台开始使用 Appwrite。 -| 类别 | 技术 | -| ------------------ | --------------------------------------------------------------------------- | -| **Web 应用** | [Web 快速开始](https://appwrite.io/docs/quick-starts/web) | -| | [Next.js 快速开始](https://appwrite.io/docs/quick-starts/nextjs) | -| | [React 快速开始](https://appwrite.io/docs/quick-starts/react) | -| | [Vue.js 快速开始](https://appwrite.io/docs/quick-starts/vue) | -| | [Nuxt 快速开始](https://appwrite.io/docs/quick-starts/nuxt) | -| | [SvelteKit 快速开始](https://appwrite.io/docs/quick-starts/sveltekit) | -| | [Refine 快速开始](https://appwrite.io/docs/quick-starts/refine) | -| | [Angular 快速开始](https://appwrite.io/docs/quick-starts/angular) | -| **苹果于安卓应用** | [React Native 快速开始](https://appwrite.io/docs/quick-starts/react-native) | -| | [Flutter 快速开始](https://appwrite.io/docs/quick-starts/flutter) | -| | [Apple 快速开始](https://appwrite.io/docs/quick-starts/apple) | -| | [Android 快速开始](https://appwrite.io/docs/quick-starts/android) | -| **服务器** | [Node.js 快速开始](https://appwrite.io/docs/quick-starts/node) | -| | [Python 快速开始](https://appwrite.io/docs/quick-starts/python) | -| | [.NET 快速开始](https://appwrite.io/docs/quick-starts/dotnet) | -| | [Dart 快速开始](https://appwrite.io/docs/quick-starts/dart) | -| | [Ruby 快速开始](https://appwrite.io/docs/quick-starts/ruby) | -| | [Deno 快速开始](https://appwrite.io/docs/quick-starts/deno) | -| | [PHP 快速开始](https://appwrite.io/docs/quick-starts/php) | -| | [Kotlin 快速开始](https://appwrite.io/docs/quick-starts/kotlin) | -| | [Swift 快速开始](https://appwrite.io/docs/quick-starts/swift) | +| 类别 | 技术 | +|---------------------|------| +| **Web 应用** | [Web 快速开始](/docs/quick-starts/web) | +| | [Next.js 快速开始](/docs/quick-starts/nextjs) | +| | [React 快速开始](/docs/quick-starts/react) | +| | [Vue.js 快速开始](/docs/quick-starts/vue) | +| | [Nuxt 快速开始](/docs/quick-starts/nuxt) | +| | [SvelteKit 快速开始](/docs/quick-starts/sveltekit) | +| | [Refine 快速开始](/docs/quick-starts/refine) | +| | [Angular 快速开始](/docs/quick-starts/angular) | +| **苹果于安卓应用** | [React Native 快速开始](/docs/quick-starts/react-native) | +| | [Flutter 快速开始](/docs/quick-starts/flutter) | +| | [Apple 快速开始](/docs/quick-starts/apple) | +| | [Android 快速开始](/docs/quick-starts/android) | +| **服务器** | [Node.js 快速开始](/docs/quick-starts/node) | +| | [Python 快速开始](/docs/quick-starts/python) | +| | [.NET 快速开始](/docs/quick-starts/dotnet) | +| | [Dart 快速开始](/docs/quick-starts/dart) | +| | [Ruby 快速开始](/docs/quick-starts/ruby) | +| | [Deno 快速开始](/docs/quick-starts/deno) | +| | [PHP 快速开始](/docs/quick-starts/php) | +| | [Kotlin 快速开始](/docs/quick-starts/kotlin) | +| | [Swift 快速开始](/docs/quick-starts/swift) | ### 软件服务 -- [**帐户**](https://appwrite.io/docs/references/cloud/client-web/account) -管理当前用户的帐户和登录方式。跟踪和管理用户 Session,登录设备,登录方法和查看相关记录。 -- [**用户**](https://appwrite.io/docs/server/users) - 在以管理员模式登录时管理和列出所有用户。 -- [**团队**](https://appwrite.io/docs/references/cloud/client-web/teams) - 管理用户分组。邀请成员,管理团队中的用户权限和用户角色。 -- [**数据库**](https://appwrite.io/docs/references/cloud/client-web/databases) - 管理数据库文档和文档集。用检索界面来对文档和文档集进行读取,创建,更新,和删除。 -- [**贮存**](https://appwrite.io/docs/references/cloud/client-web/storage) - 管理文件的阅读、创建、删除和预览。设置文件的预览来满足程序的个性化需求。所有文件都由 ClamAV 扫描并安全存储和加密。 -- [**云函数**](https://appwrite.io/docs/server/functions) - 在安全,隔离的环境中运行自定义代码。这些代码可以被事件,CRON,或者手动操作触发。 -- [**消息传递**](https://appwrite.io/docs/references/cloud/client-web/messaging) - 使用 Appwrite 消息传递功能通过推送通知、电子邮件和短信与用户进行通信。 -- [**语言适配**](https://appwrite.io/docs/references/cloud/client-web/locale) - 根据用户所在的的国家和地区做出合适的语言适配。 -- [**头像**](https://appwrite.io/docs/references/cloud/client-web/avatars) -管理用户头像、国家旗帜、浏览器图标、信用卡符号,和生成二维码。 - 如需完整的 API 界面文档,请访问 [https://appwrite.io/docs](https://appwrite.io/docs)。如需更多教程、新闻和公告,请订阅我们的 [博客](https://medium.com/appwrite-io) 和 加入我们的[Discord 社区](https://discord.gg/GSeTUeA)。 +* [**帐户**](https://appwrite.io/docs/references/cloud/client-web/account) -管理当前用户的帐户和登录方式。跟踪和管理用户 Session,登录设备,登录方法和查看相关记录。 +* [**用户**](https://appwrite.io/docs/server/users) - 在以管理员模式登录时管理和列出所有用户。 +* [**团队**](https://appwrite.io/docs/references/cloud/client-web/teams) - 管理用户分组。邀请成员,管理团队中的用户权限和用户角色。 +* [**数据库**](https://appwrite.io/docs/references/cloud/client-web/databases) - 管理数据库文档和文档集。用检索界面来对文档和文档集进行读取,创建,更新,和删除。 +* [**贮存**](https://appwrite.io/docs/references/cloud/client-web/storage) - 管理文件的阅读、创建、删除和预览。设置文件的预览来满足程序的个性化需求。所有文件都由 ClamAV 扫描并安全存储和加密。 +* [**云函数**](https://appwrite.io/docs/server/functions) - 在安全,隔离的环境中运行自定义代码。这些代码可以被事件,CRON,或者手动操作触发。 +* [**消息传递**](https://appwrite.io/docs/references/cloud/client-web/messaging) - 使用 Appwrite 消息传递功能通过推送通知、电子邮件和短信与用户进行通信。 +* [**语言适配**](https://appwrite.io/docs/references/cloud/client-web/locale) - 根据用户所在的的国家和地区做出合适的语言适配。 +* [**头像**](https://appwrite.io/docs/references/cloud/client-web/avatars) -管理用户头像、国家旗帜、浏览器图标、信用卡符号,和生成二维码。 +如需完整的 API 界面文档,请访问 [https://appwrite.io/docs](https://appwrite.io/docs)。如需更多教程、新闻和公告,请订阅我们的 [博客](https://medium.com/appwrite-io) 和 加入我们的[Discord 社区](https://discord.gg/GSeTUeA)。 ### 开发套件 以下是当前支持的平台和语言列表。如果您想帮助我们为您选择的平台添加支持,您可以访问我们的 [SDK 生成器](https://github.com/appwrite/sdk-generator) 项目并查看我们的 [贡献指南](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md)。 #### 客户端 - -- ✅   [Web](https://github.com/appwrite/sdk-for-web) (由 Appwrite 团队维护) -- ✅   [Flutter](https://github.com/appwrite/sdk-for-flutter) (由 Appwrite 团队维护) -- ✅   [Apple](https://github.com/appwrite/sdk-for-apple) (由 Appwrite 团队维护) -- ✅   [Android](https://github.com/appwrite/sdk-for-android) (由 Appwrite 团队维护) -- ✅   [React Native](https://github.com/appwrite/sdk-for-react-native) - **公测** (由 Appwrite 团队维护) +* ✅   [Web](https://github.com/appwrite/sdk-for-web) (由 Appwrite 团队维护) +* ✅   [Flutter](https://github.com/appwrite/sdk-for-flutter) (由 Appwrite 团队维护) +* ✅   [Apple](https://github.com/appwrite/sdk-for-apple) (由 Appwrite 团队维护) +* ✅   [Android](https://github.com/appwrite/sdk-for-android) (由 Appwrite 团队维护) +* ✅   [React Native](https://github.com/appwrite/sdk-for-react-native) - **公测** (由 Appwrite 团队维护) #### 服务器 - -- ✅   [NodeJS](https://github.com/appwrite/sdk-for-node) (由 Appwrite 团队维护) -- ✅   [PHP](https://github.com/appwrite/sdk-for-php) (由 Appwrite 团队维护) -- ✅   [Dart](https://github.com/appwrite/sdk-for-dart) (由 Appwrite 团队维护) -- ✅   [Deno](https://github.com/appwrite/sdk-for-deno) (由 Appwrite 团队维护) -- ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) (由 Appwrite 团队维护) -- ✅   [Python](https://github.com/appwrite/sdk-for-python) (由 Appwrite 团队维护) -- ✅   [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (由 Appwrite 团队维护) -- ✅   [Swift](https://github.com/appwrite/sdk-for-swift) (由 Appwrite 团队维护) -- ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **公测** (由 Appwrite 团队维护) +* ✅   [NodeJS](https://github.com/appwrite/sdk-for-node) (由 Appwrite 团队维护) +* ✅   [PHP](https://github.com/appwrite/sdk-for-php) (由 Appwrite 团队维护) +* ✅   [Dart](https://github.com/appwrite/sdk-for-dart) (由 Appwrite 团队维护) +* ✅   [Deno](https://github.com/appwrite/sdk-for-deno) (由 Appwrite 团队维护) +* ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) (由 Appwrite 团队维护) +* ✅   [Python](https://github.com/appwrite/sdk-for-python) (由 Appwrite 团队维护) +* ✅   [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (由 Appwrite 团队维护) +* ✅   [Swift](https://github.com/appwrite/sdk-for-swift) (由 Appwrite 团队维护) +* ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **公测** (由 Appwrite 团队维护) #### 开发者社区 +* ✅   [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (维护者 [Michael Gangolf](https://github.com/m1ga/)) +* ✅   [Godot Engine](https://github.com/GodotNuts/appwrite-sdk) (维护者 [fenix-hub @GodotNuts](https://github.com/fenix-hub)) -- ✅   [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (维护者 [Michael Gangolf](https://github.com/m1ga/)) -- ✅   [Godot Engine](https://github.com/GodotNuts/appwrite-sdk) (维护者 [fenix-hub @GodotNuts](https://github.com/fenix-hub)) +找不到需要的的 SDK? - 欢迎通过发起PR来帮助我们完善Appwrite的软件生态环境 [SDK 生成器](https://github.com/appwrite/sdk-generator)! -找不到需要的的 SDK? - 欢迎通过发起 PR 来帮助我们完善 Appwrite 的软件生态环境 [SDK 生成器](https://github.com/appwrite/sdk-generator)! ## 软件架构 @@ -182,13 +180,13 @@ Appwrite API 界面层利用后台缓存和任务委派来提供极速的响应 ## 贡献代码 -为了确保正确审查,所有代码贡献 - 包括来自具有直接提交更改权限的贡献者 - 都必须提交 PR 请求并在合并分支之前得到核心开发人员的批准。 +为了确保正确审查,所有代码贡献 - 包括来自具有直接提交更改权限的贡献者 - 都必须提交PR请求并在合并分支之前得到核心开发人员的批准。 -我们欢迎所有人提交 PR!如果您愿意提供帮助,可以在 [贡献指南](CONTRIBUTING.md) 中了解有关如何为项目做出贡献的更多信息。 +我们欢迎所有人提交PR!如果您愿意提供帮助,可以在 [贡献指南](CONTRIBUTING.md) 中了解有关如何为项目做出贡献的更多信息。 ## 安全 -为了保护您的隐私,请避免在 GitHub 上发布安全问题。发送问题至 security@appwrite.io,我们将为您做更细致的解答。 +为了保护您的隐私,请避免在GitHub 上发布安全问题。发送问题至 security@appwrite.io,我们将为您做更细致的解答。 ## 订阅我们 diff --git a/README.md b/README.md index 865df745b4..eb4e963585 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@

+ [![We're Hiring](https://img.shields.io/static/v1?label=We're&message=Hiring&color=blue&style=flat-square)](https://appwrite.io/company/careers) @@ -141,29 +142,29 @@ Choose from one of the providers below: Getting started with Appwrite is as easy as creating a new project, choosing your platform, and integrating its SDK into your code. You can easily get started with your platform of choice by reading one of our Getting Started tutorials. -| Platform | Technology | -| --------------------- | ---------------------------------------------------------------------------------- | -| **Web app** | [Quick start for Web](https://appwrite.io/docs/quick-starts/web) | -| | [Quick start for Next.js](https://appwrite.io/docs/quick-starts/nextjs) | -| | [Quick start for React](https://appwrite.io/docs/quick-starts/react) | -| | [Quick start for Vue.js](https://appwrite.io/docs/quick-starts/vue) | -| | [Quick start for Nuxt](https://appwrite.io/docs/quick-starts/nuxt) | -| | [Quick start for SvelteKit](https://appwrite.io/docs/quick-starts/sveltekit) | -| | [Quick start for Refine](https://appwrite.io/docs/quick-starts/refine) | -| | [Quick start for Angular](https://appwrite.io/docs/quick-starts/angular) | -| **Mobile and Native** | [Quick start for React Native](https://appwrite.io/docs/quick-starts/react-native) | -| | [Quick start for Flutter](https://appwrite.io/docs/quick-starts/flutter) | -| | [Quick start for Apple](https://appwrite.io/docs/quick-starts/apple) | -| | [Quick start for Android](https://appwrite.io/docs/quick-starts/android) | -| **Server** | [Quick start for Node.js](https://appwrite.io/docs/quick-starts/node) | -| | [Quick start for Python](https://appwrite.io/docs/quick-starts/python) | -| | [Quick start for .NET](https://appwrite.io/docs/quick-starts/dotnet) | -| | [Quick start for Dart](https://appwrite.io/docs/quick-starts/dart) | -| | [Quick start for Ruby](https://appwrite.io/docs/quick-starts/ruby) | -| | [Quick start for Deno](https://appwrite.io/docs/quick-starts/deno) | -| | [Quick start for PHP](https://appwrite.io/docs/quick-starts/php) | -| | [Quick start for Kotlin](https://appwrite.io/docs/quick-starts/kotlin) | -| | [Quick start for Swift](https://appwrite.io/docs/quick-starts/swift) | +| Platform | Technology | +|--------------------|------------| +| **Web app** | [Quick start for Web](/docs/quick-starts/web) | +| | [Quick start for Next.js](/docs/quick-starts/nextjs) | +| | [Quick start for React](/docs/quick-starts/react) | +| | [Quick start for Vue.js](/docs/quick-starts/vue) | +| | [Quick start for Nuxt](/docs/quick-starts/nuxt) | +| | [Quick start for SvelteKit](/docs/quick-starts/sveltekit) | +| | [Quick start for Refine](/docs/quick-starts/refine) | +| | [Quick start for Angular](/docs/quick-starts/angular) | +| **Mobile and Native** | [Quick start for React Native](/docs/quick-starts/react-native) | +| | [Quick start for Flutter](/docs/quick-starts/flutter) | +| | [Quick start for Apple](/docs/quick-starts/apple) | +| | [Quick start for Android](/docs/quick-starts/android) | +| **Server** | [Quick start for Node.js](/docs/quick-starts/node) | +| | [Quick start for Python](/docs/quick-starts/python) | +| | [Quick start for .NET](/docs/quick-starts/dotnet) | +| | [Quick start for Dart](/docs/quick-starts/dart) | +| | [Quick start for Ruby](/docs/quick-starts/ruby) | +| | [Quick start for Deno](/docs/quick-starts/deno) | +| | [Quick start for PHP](/docs/quick-starts/php) | +| | [Quick start for Kotlin](/docs/quick-starts/kotlin) | +| | [Quick start for Swift](/docs/quick-starts/swift) | ### Products diff --git a/app/config/avatars/credit-cards.php b/app/config/avatars/credit-cards.php index eb76c576cf..1aa22c4174 100644 --- a/app/config/avatars/credit-cards.php +++ b/app/config/avatars/credit-cards.php @@ -4,7 +4,7 @@ return [ 'amex' => ['name' => 'American Express', 'path' => __DIR__ . '/credit-cards/amex.png'], 'argencard' => ['name' => 'Argencard', 'path' => __DIR__ . '/credit-cards/argencard.png'], 'cabal' => ['name' => 'Cabal', 'path' => __DIR__ . '/credit-cards/cabal.png'], - 'cencosud' => ['name' => 'Cencosud', 'path' => __DIR__ . '/credit-cards/cencosud.png'], + 'censosud' => ['name' => 'Consosud', 'path' => __DIR__ . '/credit-cards/consosud.png'], 'diners' => ['name' => 'Diners Club', 'path' => __DIR__ . '/credit-cards/diners.png'], 'discover' => ['name' => 'Discover', 'path' => __DIR__ . '/credit-cards/discover.png'], 'elo' => ['name' => 'Elo', 'path' => __DIR__ . '/credit-cards/elo.png'], diff --git a/app/config/avatars/credit-cards/cencosud.png b/app/config/avatars/credit-cards/censosud.png similarity index 100% rename from app/config/avatars/credit-cards/cencosud.png rename to app/config/avatars/credit-cards/censosud.png diff --git a/app/config/errors.php b/app/config/errors.php index 287e639f6b..47bb6d8348 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -11,7 +11,7 @@ return [ /** General Errors */ Exception::GENERAL_UNKNOWN => [ 'name' => Exception::GENERAL_UNKNOWN, - 'description' => 'An unknown error has occurred. Please check the logs for more information.', + 'description' => 'An unknown error has occured. Please check the logs for more information.', 'code' => 500, ], Exception::GENERAL_MOCK => [ @@ -284,7 +284,7 @@ return [ ], Exception::USER_CHALLENGE_REQUIRED => [ 'name' => Exception::USER_CHALLENGE_REQUIRED, - 'description' => 'A recently successful challenge is required to complete this action. A challenge is considered recent for 5 minutes.', + 'description' => 'A recently succeessful challenge is required to complete this action. A challenge is considered recent for 5 minutes.', 'code' => 401, ], Exception::USER_OAUTH2_BAD_REQUEST => [ @@ -489,7 +489,7 @@ return [ ], Exception::REPOSITORY_NOT_FOUND => [ 'name' => Exception::REPOSITORY_NOT_FOUND, - 'description' => 'Repository with the requested ID could not be found. Check to see if the ID is correct, or create the repository.', + 'description' => 'Repository with the requested ID could not be found. Check to see if the ID is correct, or create the respository.', 'code' => 404, ], Exception::PROVIDER_CONTRIBUTION_CONFLICT => [ @@ -499,7 +499,7 @@ return [ ], Exception::GENERAL_PROVIDER_FAILURE => [ 'name' => Exception::GENERAL_PROVIDER_FAILURE, - 'description' => 'VCS (Version Control System) provider failed to process the request. We believe this is an error with the VCS provider. Try again, or contact support for more information.', + 'description' => 'VCS (Version Control System) provider failed to proccess the request. We believe this is an error with the VCS provider. Try again, or contact support for more information.', 'code' => 400, ], diff --git a/app/config/locale/countries.php b/app/config/locale/countries.php index 07a418da9c..33673cdc9b 100644 --- a/app/config/locale/countries.php +++ b/app/config/locale/countries.php @@ -1,13 +1,5 @@ $dbForProject->deleteDocument('tokens', $verifiedToken->getId())); $dbForProject->purgeCachedDocument('users', $user->getId()); - // Magic URL + Email OTP - if ($verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_MAGIC_URL || $verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_EMAIL) { + if ($verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_MAGIC_URL) { $user->setAttribute('emailVerification', true); } diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 4ff2b40241..ed5af1d38a 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1282,7 +1282,7 @@ App::get('/v1/functions/:functionId/deployments') } // Set resource queries - $queries[] = Query::equal('resourceInternalId', [$function->getInternalId()]); + $queries[] = Query::equal('resourceId', [$function->getId()]); $queries[] = Query::equal('resourceType', ['functions']); /** diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 29f39c55af..1dfbc0ba0f 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -49,12 +49,6 @@ App::post('/v1/proxy/rules') if ($domain === $mainDomain) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.'); } - - $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); - if (str_ends_with($domain, $functionsDomain)) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your functions domain or it\'s subdomain to specific resource. Please use different domain.'); - } - if ($domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please pick another one.'); } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 1afd6b652e..6a7fa15925 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -697,7 +697,7 @@ App::shutdown() if ($project->getId() !== 'console') { - if (!Auth::isPrivilegedUser(Authorization::getRoles())) { + if ($mode !== APP_MODE_ADMIN) { $fileSize = 0; $file = $request->getFiles('file'); if (!empty($file)) { diff --git a/app/init.php b/app/init.php index f69bd323c6..5165f64d7f 100644 --- a/app/init.php +++ b/app/init.php @@ -837,7 +837,7 @@ $register->set('pools', function () { /** * Get Resource * - * Creation could be reused across connection types like database, cache, queue, etc. + * Creation could be reused accross connection types like database, cache, queue, etc. * * Resource assignment to an adapter will happen below. */ @@ -847,7 +847,7 @@ $register->set('pools', function () { $resource = function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, array( - // No need to set PDO::ATTR_ERRMODE it is overwritten in PDOProxy + // No need to set PDO::ATTR_ERRMODE it is overwitten in PDOProxy PDO::ATTR_TIMEOUT => 3, // Seconds PDO::ATTR_PERSISTENT => true, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, diff --git a/src/Appwrite/Platform/Tasks/CalcTierStats.php b/src/Appwrite/Platform/Tasks/CalcTierStats.php index ae8bd27fe3..2d7dd3403f 100644 --- a/src/Appwrite/Platform/Tasks/CalcTierStats.php +++ b/src/Appwrite/Platform/Tasks/CalcTierStats.php @@ -103,7 +103,7 @@ class CalcTierStats extends Action return; } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); @@ -129,7 +129,7 @@ class CalcTierStats extends Action $data = $this->getData($project, $dbForConsole, $dbForProject); $csv->insertOne($data); } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); diff --git a/src/Appwrite/Platform/Tasks/CreateInfMetric.php b/src/Appwrite/Platform/Tasks/CreateInfMetric.php index ce3484edbf..c50b6e09f9 100644 --- a/src/Appwrite/Platform/Tasks/CreateInfMetric.php +++ b/src/Appwrite/Platform/Tasks/CreateInfMetric.php @@ -50,7 +50,7 @@ class CreateInfMetric extends Action $dbForProject = call_user_func($getProjectDB, $project); $this->getUsageData($dbForProject, $project); } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); @@ -72,7 +72,7 @@ class CreateInfMetric extends Action $dbForProject = call_user_func($getProjectDB, $project); $this->getUsageData($dbForProject, $project); } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); diff --git a/src/Appwrite/Platform/Tasks/PatchRecreateRepositoriesDocuments.php b/src/Appwrite/Platform/Tasks/PatchRecreateRepositoriesDocuments.php index a7e2367d59..9cf65d05b6 100644 --- a/src/Appwrite/Platform/Tasks/PatchRecreateRepositoriesDocuments.php +++ b/src/Appwrite/Platform/Tasks/PatchRecreateRepositoriesDocuments.php @@ -42,7 +42,7 @@ class PatchRecreateRepositoriesDocuments extends Action $dbForProject = call_user_func($getProjectDB, $project); $this->recreateRepositories($dbForConsole, $dbForProject, $project); } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); @@ -64,7 +64,7 @@ class PatchRecreateRepositoriesDocuments extends Action $dbForProject = call_user_func($getProjectDB, $project); $this->recreateRepositories($dbForConsole, $dbForProject, $project); } catch (\Throwable $th) { - Console::error("Unexpected error occurred with Project ID {$projectId}"); + Console::error("Unexpected error occured with Project ID {$projectId}"); Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); Console::error('[Error] File: ' . $th->getFile()); diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 2d72625121..d61f44ca1b 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -202,8 +202,6 @@ trait AccountBase $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals($userId, $response['body']['$id']); - $this->assertEquals($userId, $response['body']['$id']); - $this->assertTrue($response['body']['emailVerification']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/token', array_merge([ 'origin' => 'http://localhost', diff --git a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php index bae0d8bda9..436d1df611 100644 --- a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php +++ b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php @@ -2,43 +2,17 @@ namespace Tests\E2E\Services\Projects; -use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\System\System; class ProjectsCustomServerTest extends Scope { use ProjectCustom; use SideServer; - // Domains - - public function testCreateProjectRule() + public function testMock() { - $headers = array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-mode' => 'admin', - 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ]); - - $response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [ - 'resourceType' => 'api', - 'domain' => 'api.appwrite.test', - ]); - - $this->assertEquals(201, $response['headers']['status-code']); - - // prevent functions domain - $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); - - $response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [ - 'resourceType' => 'api', - 'domain' => $functionsDomain, - ]); - - $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals(true, true); } } From e73b4b85733da20b586b1282fcec2878b0e222f4 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 15 May 2024 10:46:31 +0100 Subject: [PATCH 08/11] feat: generic approach --- app/controllers/general.php | 11 +++-------- app/init.php | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 618f0b465c..cf578d9806 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -521,6 +521,9 @@ App::init() if (version_compare($responseFormat, '1.5.0', '<')) { $response->addFilter(new ResponseV17()); } + if (version_compare($responseFormat, APP_VERSION_FORMAT, '>')) { + $response->addHeader('X-Appwrite-Warning', 'Request made with SDK for Appwrite version ' . $responseFormat . '. Response format is meant for Appwrite version ' . APP_VERSION_FORMAT . '. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks'); + } } /* @@ -543,16 +546,8 @@ App::init() $response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days } - $defaultResponseFormat = APP_VERSION_STABLE; - $defaultResponseFormat = \explode('.', $defaultResponseFormat); - if (\count($defaultResponseFormat) === 3) { - $defaultResponseFormat[2] = '0'; - } - $defaultResponseFormat = \implode('.', $defaultResponseFormat); - $response ->addHeader('Server', 'Appwrite') - ->addHeader('X-Appwrite-Default-Response-Format', $defaultResponseFormat) ->addHeader('X-Content-Type-Options', 'nosniff') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') diff --git a/app/init.php b/app/init.php index 8bf5d682cd..ce136cdc48 100644 --- a/app/init.php +++ b/app/init.php @@ -114,6 +114,7 @@ const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 406; const APP_VERSION_STABLE = '1.5.5'; +const APP_VERSION_FORMAT = '1.5.0'; // Response format version, typically the last minor version const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; From cb4c15ce0a168919f4d0a35347bc74b444d4d127 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 May 2024 16:07:22 +0100 Subject: [PATCH 09/11] ui: improve warning message --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index cf578d9806..951094364e 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -522,7 +522,7 @@ App::init() $response->addFilter(new ResponseV17()); } if (version_compare($responseFormat, APP_VERSION_FORMAT, '>')) { - $response->addHeader('X-Appwrite-Warning', 'Request made with SDK for Appwrite version ' . $responseFormat . '. Response format is meant for Appwrite version ' . APP_VERSION_FORMAT . '. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks'); + $response->addHeader('X-Appwrite-Warning', "The current SDK is built fors Appwrite ${responseFormat}. However, the current Appwrite server version is ${APP_VERSION_STABLE}. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks'); } } From ad3cc4e68fc714986cd69847a2d4f147925e4751 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 May 2024 16:16:57 +0100 Subject: [PATCH 10/11] fix: typo --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 2e80cf4602..a4b2cabdab 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -555,7 +555,7 @@ App::init() $response->addFilter(new ResponseV17()); } if (version_compare($responseFormat, APP_VERSION_FORMAT, '>')) { - $response->addHeader('X-Appwrite-Warning', "The current SDK is built fors Appwrite ${responseFormat}. However, the current Appwrite server version is ${APP_VERSION_STABLE}. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks'); + $response->addHeader('X-Appwrite-Warning', "The current SDK is built for Appwrite ${responseFormat}. However, the current Appwrite server version is ${APP_VERSION_STABLE}. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks"); } } From d73a9e75cda33886f84e6e2d8cc22ae38faceb67 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 May 2024 16:27:13 +0100 Subject: [PATCH 11/11] refactor: remove version format const --- app/controllers/general.php | 4 ++-- app/init.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index a4b2cabdab..e5d9bd4b83 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -554,8 +554,8 @@ App::init() if (version_compare($responseFormat, '1.5.0', '<')) { $response->addFilter(new ResponseV17()); } - if (version_compare($responseFormat, APP_VERSION_FORMAT, '>')) { - $response->addHeader('X-Appwrite-Warning', "The current SDK is built for Appwrite ${responseFormat}. However, the current Appwrite server version is ${APP_VERSION_STABLE}. Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks"); + if (version_compare($responseFormat, APP_VERSION_STABLE, '>')) { + $response->addHeader('X-Appwrite-Warning', "The current SDK is built for Appwrite " . $responseFormat . ". However, the current Appwrite server version is ". APP_VERSION_STABLE . ". Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks"); } } diff --git a/app/init.php b/app/init.php index 4fa58a3e07..57ad5fab87 100644 --- a/app/init.php +++ b/app/init.php @@ -114,7 +114,6 @@ const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 432; const APP_VERSION_STABLE = '1.5.6'; -const APP_VERSION_FORMAT = '1.5.0'; // Response format version, typically the last minor version const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip';