diff --git a/.env b/.env index 2373b618c2..09abb07be2 100644 --- a/.env +++ b/.env @@ -4,6 +4,7 @@ _APP_WORKER_PER_CORE=6 _APP_CONSOLE_WHITELIST_ROOT=disabled _APP_CONSOLE_WHITELIST_EMAILS= _APP_CONSOLE_WHITELIST_IPS= +_APP_CONSOLE_COUNTRIES_DENYLIST=AQ _APP_CONSOLE_HOSTNAMES=localhost,appwrite.io,*.appwrite.io _APP_SYSTEM_EMAIL_NAME=Appwrite _APP_SYSTEM_EMAIL_ADDRESS=team@appwrite.io @@ -86,7 +87,7 @@ _APP_LOGGING_PROVIDER= _APP_LOGGING_CONFIG= _APP_GRAPHQL_MAX_BATCH_SIZE=10 _APP_GRAPHQL_MAX_COMPLEXITY=250 -_APP_GRAPHQL_MAX_DEPTH=3 +_APP_GRAPHQL_MAX_DEPTH=4 _APP_DOCKER_HUB_USERNAME= _APP_DOCKER_HUB_PASSWORD= _APP_VCS_GITHUB_APP_NAME= @@ -97,4 +98,9 @@ _APP_VCS_GITHUB_CLIENT_SECRET= _APP_VCS_GITHUB_WEBHOOK_SECRET= _APP_MIGRATIONS_FIREBASE_CLIENT_ID= _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET= -_APP_ASSISTANT_OPENAI_API_KEY= \ No newline at end of file +_APP_ASSISTANT_OPENAI_API_KEY= +_APP_MESSAGE_SMS_TEST_DSN= +_APP_MESSAGE_EMAIL_TEST_DSN= +_APP_MESSAGE_PUSH_TEST_DSN= +_APP_WEBHOOK_MAX_FAILED_ATTEMPTS=10 +_APP_PROJECT_REGIONS=default \ No newline at end of file diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml new file mode 100644 index 0000000000..17caf3aa6b --- /dev/null +++ b/.github/workflows/check-dependencies.yml @@ -0,0 +1,19 @@ +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/publish.yml b/.github/workflows/publish.yml index 0fc3fc2df3..f914e662d3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,12 @@ jobs: fetch-depth: 2 submodules: recursive + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -35,11 +41,11 @@ jobs: uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ steps.meta.outputs.version }} VITE_APPWRITE_GROWTH_ENDPOINT=https://growth.appwrite.io/v1 VITE_GA_PROJECT=G-L7G2B6PLDS VITE_CONSOLE_MODE=cloud push: true - tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..5987eeeb0c --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,23 @@ +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/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2fb6840f6e..2cc4c700f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -123,6 +123,7 @@ jobs: Users, Webhooks, VCS, + Messaging, ] steps: @@ -140,7 +141,7 @@ jobs: run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d - sleep 10 + sleep 25 - name: Run ${{matrix.service}} Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.service}} --debug diff --git a/.gitignore b/.gitignore index 3151de5adb..ac88830b49 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ debug/ app/sdks dev/yasd_init.php .phpunit.result.cache +Makefile diff --git a/.gitmodules b/.gitmodules index 0c2321bcfa..c5a49ced3e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "app/console"] path = app/console url = https://github.com/appwrite/console - branch = 3.2.16 + branch = 4.0.6 diff --git a/.gitpod.yml b/.gitpod.yml index d740c467cb..478b62fc8d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -17,7 +17,6 @@ tasks: ports: - port: 8080 - onOpen: open-preview visibility: public vscode: diff --git a/CHANGES.md b/CHANGES.md index 606a8ff1b7..f106f97301 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,404 @@ +# Version 1.5.5 +## What's Changed +### Notable changes + +* Change SMS verification message to only have the code in [#7912](https://github.com/appwrite/appwrite/pull/7912) +* Add new country `Taiwan` with its translations in [#7873](https://github.com/appwrite/appwrite/pull/7873) +* Add Hong Kong (HK) to countries list in [#7962](https://github.com/appwrite/appwrite/pull/7962) +* Add French Polynesia flag to flags.php in [#8007](https://github.com/appwrite/appwrite/pull/8007) +* Enable auto upgrade for mariadb container in [#8020](https://github.com/appwrite/appwrite/pull/8020) + +## Fixes + +* Use team internal ID for checks and queries for membership in [#7836](https://github.com/appwrite/appwrite/pull/7836) +* Use internal IDs for queries and checks in [#7839](https://github.com/appwrite/appwrite/pull/7839) +* Remove redundant commas in [#7764](https://github.com/appwrite/appwrite/pull/7764) +* Remove a redundant call to fetch the topic document again in [#7894](https://github.com/appwrite/appwrite/pull/7894) +* Fix wrong refresh var for Autodesk in [#7897](https://github.com/appwrite/appwrite/pull/7897) +* Fix email attachment example in [#7681](https://github.com/appwrite/appwrite/pull/7681) +* Add missing chunkId param to create file abuse key in [#7913](https://github.com/appwrite/appwrite/pull/7913) +* Fix delete message event not firing in [#7906](https://github.com/appwrite/appwrite/pull/7906) +* Fix worker crash when using custom SMTP provider in [#7915](https://github.com/appwrite/appwrite/pull/7915) +* Update email attachments param in [#7885](https://github.com/appwrite/appwrite/pull/7885) +* Fix MFA protected group in [#7947](https://github.com/appwrite/appwrite/pull/7947) +* Fix recovery code removal in [#7950](https://github.com/appwrite/appwrite/pull/7950) +* Add recovery code to List factors in [#7949](https://github.com/appwrite/appwrite/pull/7949) +* Fix challenge type check in [#7981](https://github.com/appwrite/appwrite/pull/7981) +* Fix MFA links in specs in [#7966](https://github.com/appwrite/appwrite/pull/7966) +* Add missing 'apis' attribute to projects collection in [#7997](https://github.com/appwrite/appwrite/pull/7997) +* Update user create error message for console to be console specific in [#7996](https://github.com/appwrite/appwrite/pull/7996) +* Add DB environment variables to appwrite-worker-mails in [#8002](https://github.com/appwrite/appwrite/pull/8002) +* Delete related attributes on delete collection in [#7985](https://github.com/appwrite/appwrite/pull/7985) +* Fix server errors from invalid or outdated cookies in [#8008](https://github.com/appwrite/appwrite/pull/8008) +* Fix delete MFA authenticator response model in [#8005](https://github.com/appwrite/appwrite/pull/8005) +* Fix MFA with admin mode in [#7984](https://github.com/appwrite/appwrite/pull/7984) + +## Miscellaneous + +* Update getEnv to use system lib in [#7895](https://github.com/appwrite/appwrite/pull/7895) +* Update SDK and docs links in readme in [#7978](https://github.com/appwrite/appwrite/pull/7978) +* Update README.md in [#6358](https://github.com/appwrite/appwrite/pull/6358) +* Bump console to version 4.0.6 in [#8017](https://github.com/appwrite/appwrite/pull/8017) + +# Version 1.5.4 +## What's Changed +### Fixes + +* Fix function build command in [#7813](https://github.com/appwrite/appwrite/pull/7813) +* Bump executor version to fix docker conflict error in [#7804](https://github.com/appwrite/appwrite/pull/7804) +* Fix webhooks failed connection in [#7848](https://github.com/appwrite/appwrite/pull/7848) +* Fix msg91 params in [#7824](https://github.com/appwrite/appwrite/pull/7824) +* Fix functions domain permissions in [#7853](https://github.com/appwrite/appwrite/pull/7853) + +### Miscellaneous + +* Bump console to version 4.0.5 in [#7863](https://github.com/appwrite/appwrite/pull/7863) + +# Version 1.5.3 +## What's Changed +### Fixes + +* Fix Attribute not found when migrating users collection in [#7782](https://github.com/appwrite/appwrite/pull/7782) +* Fix git deployments in [#7780](https://github.com/appwrite/appwrite/pull/7780) +* Allow wildcards for url validation like OAuth2 success in [#7791](https://github.com/appwrite/appwrite/pull/7791) + +# Version 1.5.2 +## What's Changed +* Fix stats migration by @abnegate in https://github.com/appwrite/appwrite/pull/7760 +* Fix index migrations by @abnegate in https://github.com/appwrite/appwrite/pull/7769 +* Fix Flutter/Dart SDKs by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7765 +* Fix push notifications with no image by @abnegate in https://github.com/appwrite/appwrite/pull/7771 +* Fix Python SDK by @abnegate in https://github.com/appwrite/appwrite/pull/7770 +* Fix Android SDK deployment by @abnegate in https://github.com/appwrite/appwrite/pull/7770 + + +**Full Changelog**: https://github.com/appwrite/appwrite/compare/1.5.1...1.5.2 + +# Version 1.5.1 +## What's Changed +* fix: usage containers by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7757 + +**Full Changelog**: https://github.com/appwrite/appwrite/compare/1.5.0...1.5. + +# Version 1.5.0 +## What's Changed +### New features +- SSR support added. You can now handle sessions on your server app. [Learn more in docs](https://appwrite.io/docs/products/auth/server-side-rendering) +- 2FA support is now added for Appwrite Auth and for Console users. [Learn about adding 2FA to your app](https://appwrite.io/docs/products/auth/2fa) [Learn about 2FA on Console](https://appwrite.io/docs/advanced/security/2fa) +- Appwrite Messaging added. You can now send emails, SMS messages, and push notifications. [Learn more in docs](https://appwrite.io/docs/products/messaging) +- Appwrite now has enums for all config strings for OAuth, messaging adaptors, and more. [Learn more in the docs](https://appwrite.io/docs/sdks) +- New runtime versions for Dart, Bun, Ruby, Node, Deno, Python, PHP, Kotlin, Java, and Swift. [Learn more in docs](https://appwrite.io/docs/products/functions/runtimes) +- Create custom login flows with custom sessions and tokens. [Learn more in docs](https://appwrite.io/docs/products/auth/custom-token) + +### Upgrading +- Appwrite Cloud is not yet updated to 1.5.x, expect an announcement in the upcoming weeks. If you lock your Appwrite SDK version, this update is not breaking. +- Follow the [self-hosted docs](https://appwrite.io/docs/advanced/self-hosting/update) to update your self-hosted Appwrite. +- Update your SDKs to the latest versions. The API is backwards compatible, using old SDKs will not break existing apps, but you will not have access to new features. +### Full changes +* Sync 1.5.x by @abnegate in https://github.com/appwrite/appwrite/pull/6030 +* Sync master into 1.5.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/6092 +* add collections to config file and messaging scopes to config file by @fanatic75 in https://github.com/appwrite/appwrite/pull/5930 +* Sync 1.4.x to 1.5.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/6233 +* Feat add messaging response models by @fanatic75 in https://github.com/appwrite/appwrite/pull/5951 +* Feat messages event config by @fanatic75 in https://github.com/appwrite/appwrite/pull/5986 +* Sync main 1.5.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/6514 +* Sync 1.5.x with 1.4.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/6875 +* Feat provider controllers by @fanatic75 in https://github.com/appwrite/appwrite/pull/6023 +* Feat topics controller by @fanatic75 in https://github.com/appwrite/appwrite/pull/6032 +* Feat sms push controllers by @fanatic75 in https://github.com/appwrite/appwrite/pull/6950 +* Sync 1.4.x to 1.5.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/6965 +* Providers from attribute by @fanatic75 in https://github.com/appwrite/appwrite/pull/6991 +* made review changes by @fanatic75 in https://github.com/appwrite/appwrite/pull/7010 +* removes provider from topics by @fanatic75 in https://github.com/appwrite/appwrite/pull/7014 +* review changes by @fanatic75 in https://github.com/appwrite/appwrite/pull/7048 +* Event label messaging by @fanatic75 in https://github.com/appwrite/appwrite/pull/7058 +* Feat logs messaging api by @fanatic75 in https://github.com/appwrite/appwrite/pull/7069 +* Chore sync main 1.5.x by @fanatic75 in https://github.com/appwrite/appwrite/pull/7115 +* Chore sync main by @abnegate in https://github.com/appwrite/appwrite/pull/7120 +* Add XDebug by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7082 +* More review changes by @fanatic75 in https://github.com/appwrite/appwrite/pull/7129 +* Feat target provider type by @fanatic75 in https://github.com/appwrite/appwrite/pull/7132 +* removes internal provider by @fanatic75 in https://github.com/appwrite/appwrite/pull/7151 +* Feat account target by @fanatic75 in https://github.com/appwrite/appwrite/pull/7152 +* 1.4.x by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7149 +* adds user name in subscriber response model by @fanatic75 in https://github.com/appwrite/appwrite/pull/7177 +* feat: add migration stats task by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7187 +* migrates enum attribute size to 255 by @fanatic75 in https://github.com/appwrite/appwrite/pull/7183 +* changes TextMagic to Textmagic in all places and uses email validator by @fanatic75 in https://github.com/appwrite/appwrite/pull/7188 +* chore: upgrade console to 3.2.9 by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7189 +* makes provider creation fields optional and adds target info in subsc… by @fanatic75 in https://github.com/appwrite/appwrite/pull/7195 +* Chore update sdks by @abnegate in https://github.com/appwrite/appwrite/pull/7180 +* adds target when creating user via server endpoint by @fanatic75 in https://github.com/appwrite/appwrite/pull/7217 +* Feat add message provider type by @abnegate in https://github.com/appwrite/appwrite/pull/7219 +* feat: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7225 +* Implement Job based hamster by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7216 +* bump: console version by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7238 +* chore: update console version by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7240 +* misc changes by @fanatic75 in https://github.com/appwrite/appwrite/pull/7227 +* Update appwrite base image by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7241 +* Revert "Update appwrite base image" by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7256 +* feat: upgrade console to 3.2.15 by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7258 +* mail support string as attachment by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7261 +* fix redis issue by encoding content by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7262 +* Fix cookie issue by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7260 +* support mail template override by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7251 +* feat: project usage custom date range by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7266 +* feat: usage breakdown by project by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7270 +* provide retention time as queue server resource by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7272 +* fix: remove expired cookie by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7275 +* PEA-15 Refactor Deletes and maintenance worker by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7273 +* Refactor usage execution trigger by @shimonewman in https://github.com/appwrite/appwrite/pull/7274 +* Fix max array size 1 by @abnegate in https://github.com/appwrite/appwrite/pull/7287 +* chore: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7291 +* Fix SMS import by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7293 +* rename stats collection by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7301 +* fix deletes worker by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7310 +* Sync main with 1.4.x by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7312 +* combining network inbound by @shimonewman in https://github.com/appwrite/appwrite/pull/7298 +* chore: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7313 +* Update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7314 +* chore: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7315 +* chore: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7316 +* chore: update console by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7319 +* chore: update hamster script by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7320 +* Refactor usage worker sn by @shimonewman in https://github.com/appwrite/appwrite/pull/7326 +* usageHook tweaks by @shimonewman in https://github.com/appwrite/appwrite/pull/7330 +* Refactor inf metric calc by @shimonewman in https://github.com/appwrite/appwrite/pull/7339 +* Fix user last activity not updating by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7292 +* Fix user identity attaching to wrong user by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7280 +* fix for file extension not supported by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7349 +* Bump console to version 3.3.14 by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7358 +* Bump console to version 3.3.15 by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7359 +* Update tr.json by @fanksin in https://github.com/appwrite/appwrite/pull/7276 +* Improve large file handling by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7351 +* PEA-38 compression constants by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7366 +* Fix permission issue with chunk upload by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7328 +* 1.4.x by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7317 +* Sync with main by @shimonewman in https://github.com/appwrite/appwrite/pull/7374 +* Feat: Max password length by @Meldiron in https://github.com/appwrite/appwrite/pull/7376 +* feat: console hostname env variable by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7360 +* Sync main by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7384 +* Add `_APP_CONSOLE_HOSTNAMES` env var to allow more hostnames to the console project by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7377 +* Fix app console hostnames check by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7385 +* Add General E2E tests to CI pipeline by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7386 +* Fix app console hostnames check on refactor usage sn by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7387 +* executor: pass build timeout to runtimes by @iMacHumphries in https://github.com/appwrite/appwrite/pull/7350 +* Create an enum for Message status by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7380 +* [Feat]: Zoho OAuth Provider by @UtkarshAhuja2003 in https://github.com/appwrite/appwrite/pull/7365 +* Messaging uniform logic fixes by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7397 +* Webhook attempts PR suggestions by @Meldiron in https://github.com/appwrite/appwrite/pull/7402 +* fix: escape html in email params by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7409 +* Add a flag to install and upgrade commands to not start Appwrite by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7271 +* Add support for querying topic total by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7388 +* Adds uniform error logic for messaging worker and extra params for email by @fanatic75 in https://github.com/appwrite/appwrite/pull/7245 +* Update the delete identity endpoints to set the params and payload by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7348 +* Fix utopia-php/framework version by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7410 +* feat: account delete by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7415 +* chore: update collection name in hamster by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7417 +* Feat: Magic URL improvements by @Meldiron in https://github.com/appwrite/appwrite/pull/7416 +* feat: update assistant by @loks0n in https://github.com/appwrite/appwrite/pull/7421 +* Feat: Improve worker logging by @Meldiron in https://github.com/appwrite/appwrite/pull/7192 +* Added security phrase to magic URL by @Meldiron in https://github.com/appwrite/appwrite/pull/7424 +* fix: hotfix for redirect param in custom templates by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7437 +* Make OTP template more contextual by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7434 +* Fix: Remove passwordAgain by @Meldiron in https://github.com/appwrite/appwrite/pull/7441 +* Rename usage_network_infinity to usage_bandwidth_infinity by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7443 +* Added cloud base templates to appwrite/appwrite by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7440 +* Remove the endpoint param for APNS providers by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7418 +* Default topic description to an empty string instead of null by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7430 +* feat: SSR by @loks0n in https://github.com/appwrite/appwrite/pull/5777 +* Add support for draft messages by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7429 +* Add search param for list subscribers endpoint by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7382 +* Delete subscribers and update topic totals when deleting target by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7396 +* Fix list messages allowed queries by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7381 +* Allow filtering targets by provider type by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7419 +* Feat message scheduling by @abnegate in https://github.com/appwrite/appwrite/pull/7431 +* Fix create/update push target routes by @abnegate in https://github.com/appwrite/appwrite/pull/7461 +* Fix cc + bcc targets fetched by identifier instead of $id by @abnegate in https://github.com/appwrite/appwrite/pull/7468 +* Add endpoint to list a message's targets by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7463 +* Limit webhook failure attempts to 10 by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7128 +* Follow existing style of code by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7470 +* Refactored url construction by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7478 +* hamster additions by @shimonewman in https://github.com/appwrite/appwrite/pull/7462 +* Feat: session renewal by @Meldiron in https://github.com/appwrite/appwrite/pull/7452 +* Feat: Email OTP by @Meldiron in https://github.com/appwrite/appwrite/pull/7422 +* feat: delete account by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7392 +* Fix: Email image endpoints by @Meldiron in https://github.com/appwrite/appwrite/pull/7474 +* Feat smtp test endpoint by @eldadfux in https://github.com/appwrite/appwrite/pull/7307 +* Update ruby by @abnegate in https://github.com/appwrite/appwrite/pull/7464 +* Refactor usage by @shimonewman in https://github.com/appwrite/appwrite/pull/7005 +* Fix: Certificate email style by @Meldiron in https://github.com/appwrite/appwrite/pull/7475 +* sync: 1.5.x with main by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7486 +* 1.5.x <- main by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7485 +* Refactor Usage Stats by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7311 +* Feat maintenance delete expired targets by @abnegate in https://github.com/appwrite/appwrite/pull/7460 +* Trigger deletes worker when target is deleted by @abnegate in https://github.com/appwrite/appwrite/pull/7490 +* Throw on enable if provider credentials are missing instead of ignoring by @abnegate in https://github.com/appwrite/appwrite/pull/7484 +* Add Queue Retry Command to Appwrite by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7391 +* Add failed queues endpoint to health by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7466 +* Feat: CNAME validation logs by @Meldiron in https://github.com/appwrite/appwrite/pull/7482 +* Add queue management commands by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7497 +* Add threshold to queue failed health endpoint by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7499 +* fix: use atomic operations for count updates by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7511 +* chore: add logs by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7513 +* chore: add logs by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7514 +* chore: add auth label to phone endpoint by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7515 +* JSON + OR query support by @fogelito in https://github.com/appwrite/appwrite/pull/7252 +* Labels limit by @fogelito in https://github.com/appwrite/appwrite/pull/7504 +* chore: update rate limits by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7523 +* Add message delete route by @abnegate in https://github.com/appwrite/appwrite/pull/7510 +* Feat remove description by @abnegate in https://github.com/appwrite/appwrite/pull/7518 +* Upgrade to PHP 8.2 by @eldadfux in https://github.com/appwrite/appwrite/pull/7067 +* Add SMTP provider by @abnegate in https://github.com/appwrite/appwrite/pull/7525 +* remove debug leftovers by @shimonewman in https://github.com/appwrite/appwrite/pull/7531 +* feat: ssr changes by @loks0n in https://github.com/appwrite/appwrite/pull/7532 +* Add webhook max failed attempts as env variable by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7489 +* Feat: Rename security phrases by @Meldiron in https://github.com/appwrite/appwrite/pull/7533 +* Update to standard namespacing for enums by @abnegate in https://github.com/appwrite/appwrite/pull/7537 +* Remove redundant usage labels by @abnegate in https://github.com/appwrite/appwrite/pull/7536 +* Update containers by @abnegate in https://github.com/appwrite/appwrite/pull/7526 +* feat: mfa by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7346 +* Fix: client error reporting by @Meldiron in https://github.com/appwrite/appwrite/pull/7539 +* Feat session target delete by @abnegate in https://github.com/appwrite/appwrite/pull/7540 +* Fix spec generation by @abnegate in https://github.com/appwrite/appwrite/pull/7538 +* Feat block countries from certain regions by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7487 +* Fix: Empty values in PATCH of users by @Meldiron in https://github.com/appwrite/appwrite/pull/7471 +* Add a 20 second delay to maintenance worker by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7544 +* Add health certificate validity endpoint by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7547 +* Add count for messages(sms) metric by @shimonewman in https://github.com/appwrite/appwrite/pull/7520 +* Fix user API mfa route auth by @abnegate in https://github.com/appwrite/appwrite/pull/7549 +* Fix graphql tests by @abnegate in https://github.com/appwrite/appwrite/pull/7553 +* Fix message status values and enums by @abnegate in https://github.com/appwrite/appwrite/pull/7552 +* Update param name by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7519 +* Fix SHA function enum name by @abnegate in https://github.com/appwrite/appwrite/pull/7554 +* Sync main with refactor-usage-sn by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7556 +* Usage queue poc by @shimonewman in https://github.com/appwrite/appwrite/pull/7503 +* Update team counts by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7561 +* PEA-233-prevent console user deletion before deleting their team by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7500 +* PEA-233-prevent console user deletion before deleting their team by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7563 +* Update place holders from [PARAM_NAME] to by @gewenyu99 in https://github.com/appwrite/appwrite/pull/7560 +* PEA-334 - Fix spec use cloud endpoint by default by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7567 +* Merge main by @abnegate in https://github.com/appwrite/appwrite/pull/7568 +* Hardcode size and orders for Json Key Indexes by @fogelito in https://github.com/appwrite/appwrite/pull/7557 +* Feat support label queries by @abnegate in https://github.com/appwrite/appwrite/pull/7570 +* Fix missing user activity logs by @Souptik2001 in https://github.com/appwrite/appwrite/pull/7559 +* Refactor usage sn by @shimonewman in https://github.com/appwrite/appwrite/pull/7576 +* Catch errors parseQueries by @fogelito in https://github.com/appwrite/appwrite/pull/7558 +* fix Indexes by @fogelito in https://github.com/appwrite/appwrite/pull/7572 +* Fix updating message status by @abnegate in https://github.com/appwrite/appwrite/pull/7571 +* Fix telesign params by @abnegate in https://github.com/appwrite/appwrite/pull/7569 +* Fix email/sms template type enums getting the same values by @abnegate in https://github.com/appwrite/appwrite/pull/7551 +* Replace catching \Exception with \Throwable by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7555 +* cache collection attr migration by @shimonewman in https://github.com/appwrite/appwrite/pull/7575 +* Remove database methods from deletes worker by @shimonewman in https://github.com/appwrite/appwrite/pull/7135 +* Fix smtp provider update by @abnegate in https://github.com/appwrite/appwrite/pull/7578 +* usage logs updates by @shimonewman in https://github.com/appwrite/appwrite/pull/7588 +* Add unknown error is delivered total is 0 but there were no delivery … by @abnegate in https://github.com/appwrite/appwrite/pull/7579 +* Feat subscribe permission by @abnegate in https://github.com/appwrite/appwrite/pull/7580 +* Remove redundant hook by @abnegate in https://github.com/appwrite/appwrite/pull/7581 +* Update geodb by @abnegate in https://github.com/appwrite/appwrite/pull/7582 +* Project id to logger by @shimonewman in https://github.com/appwrite/appwrite/pull/7598 +* Refactor cache by @shimonewman in https://github.com/appwrite/appwrite/pull/5616 +* Feat topic totals per type by @abnegate in https://github.com/appwrite/appwrite/pull/7589 +* Update docker base by @abnegate in https://github.com/appwrite/appwrite/pull/7599 +* Update Response and Request filters aswell as Migrations for 1.5.x by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7457 +* fix: blocked users web controllers by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7601 +* dev: introduce redis insights by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7583 +* Update image lib by @abnegate in https://github.com/appwrite/appwrite/pull/7566 +* Update exception for github session not found by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7375 +* Feat more phone validation by @loks0n in https://github.com/appwrite/appwrite/pull/7165 +* fix project network usage by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7608 +* usage logs updates by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7615 +* usage/usage-dump queue health endpoints by @shimonewman in https://github.com/appwrite/appwrite/pull/7614 +* Make self-hosted and cloud specs consistent by @abnegate in https://github.com/appwrite/appwrite/pull/7617 +* Remove callback resources from workers by @abnegate in https://github.com/appwrite/appwrite/pull/7618 +* Feat email attachments by @abnegate in https://github.com/appwrite/appwrite/pull/7611 +* Update GETTING_STARTED.md by @GuptaPratik02 in https://github.com/appwrite/appwrite/pull/6826 +* Refactor remove resource collection by @abnegate in https://github.com/appwrite/appwrite/pull/7620 +* Fix duplicate subscribers by @abnegate in https://github.com/appwrite/appwrite/pull/7624 +* Allow push images by @abnegate in https://github.com/appwrite/appwrite/pull/7594 +* fix: msg91 by @loks0n in https://github.com/appwrite/appwrite/pull/7626 +* Fix: Router CURL by @Meldiron in https://github.com/appwrite/appwrite/pull/7627 +* Add storage health check by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7591 +* Revert "usage/usage-dump queue health endpoints" by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7629 +* Revert "Fix: Router CURL" by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7630 +* Fix: Router CURL by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7632 +* Use swoole process mode instead of base by @abnegate in https://github.com/appwrite/appwrite/pull/7635 +* feat: ssr dx by @loks0n in https://github.com/appwrite/appwrite/pull/7619 +* Remove preloading by @abnegate in https://github.com/appwrite/appwrite/pull/7637 +* fix: add mfa path to console by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7639 +* Fix 1.5.x Migrations by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7621 +* Provider null by @fogelito in https://github.com/appwrite/appwrite/pull/7625 +* Add ARM64 to docker publish by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7622 +* Fix tests by @abnegate in https://github.com/appwrite/appwrite/pull/7640 +* fix: email templates by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7641 +* Fix content-type of file by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7643 +* Fix update topics permissions by @abnegate in https://github.com/appwrite/appwrite/pull/7638 +* Allow setting APNS to sandbox mode by @abnegate in https://github.com/appwrite/appwrite/pull/7645 +* Fix: Functions CI/CD tests by @Meldiron in https://github.com/appwrite/appwrite/pull/7647 +* Fix missing userId on update challenge by @abnegate in https://github.com/appwrite/appwrite/pull/7650 +* Fix mail reset attachment by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7653 +* Fix return by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7654 +* Fix-function-id-2 by @eldadfux in https://github.com/appwrite/appwrite/pull/7656 +* Only return allowed runtimes in runtime list route by @abnegate in https://github.com/appwrite/appwrite/pull/7659 +* Add twoWayKey checks and multiple many-to-many restrictions by @fogelito in https://github.com/appwrite/appwrite/pull/7153 +* chore: remove array sdk method by @loks0n in https://github.com/appwrite/appwrite/pull/7649 +* Use new migration error handling by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7652 +* fix: phone verification flaky by @loks0n in https://github.com/appwrite/appwrite/pull/7666 +* feat: test perf by @loks0n in https://github.com/appwrite/appwrite/pull/7665 +* Fix: False positive MFA by @Meldiron in https://github.com/appwrite/appwrite/pull/7664 +* Fix: Spanish template translations by @DH-555 in https://github.com/appwrite/appwrite/pull/7658 +* Bug 7597 - Adding default value by @navjotNSK in https://github.com/appwrite/appwrite/pull/7651 +* 1.5.x api descriptions by @gewenyu99 in https://github.com/appwrite/appwrite/pull/7667 +* Fix: Empty password validation by @Meldiron in https://github.com/appwrite/appwrite/pull/7662 +* [Fix]: Remove internal attributes on select query by @UtkarshAhuja2003 in https://github.com/appwrite/appwrite/pull/7648 +* Feat remove status param by @abnegate in https://github.com/appwrite/appwrite/pull/7670 +* Sync main by @abnegate in https://github.com/appwrite/appwrite/pull/7669 +* Rescheduling fixes by @abnegate in https://github.com/appwrite/appwrite/pull/7668 +* Disallow creating a session if one already exists by @abnegate in https://github.com/appwrite/appwrite/pull/7616 +* Fix duplication by @abnegate in https://github.com/appwrite/appwrite/pull/7679 +* Feat fix 1.5.x migrations by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/7671 +* Allow ssl along with tls in custom smtp by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7674 +* Change status code from 503 to 403 by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7672 +* Train Assistant for Appwrite 1.5 by @loks0n in https://github.com/appwrite/appwrite/pull/7686 +* adding limit to queue retry by @shimonewman in https://github.com/appwrite/appwrite/pull/7692 +* fix: encode secret in oauth workaround by @loks0n in https://github.com/appwrite/appwrite/pull/7695 +* Update generator and deploy RC SDKs by @abnegate in https://github.com/appwrite/appwrite/pull/7545 +* Update endpoint description by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7704 +* Chore sync 1.4.x into main by @stnguyen90 in https://github.com/appwrite/appwrite/pull/7697 +* chore: update error types for create account endpoints by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7698 +* usage/usage-dump queue health endpoints by @shimonewman in https://github.com/appwrite/appwrite/pull/7661 +* Refactor usage sn by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7660 +* Fix: MFA flows and docs by @Meldiron in https://github.com/appwrite/appwrite/pull/7709 +* update cover image for SDKs by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7715 +* Feat: More Recovery code endpoints by @Meldiron in https://github.com/appwrite/appwrite/pull/7713 +* feat: mfa collection restructure by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7696 +* Fix: SDKs enums by @Meldiron in https://github.com/appwrite/appwrite/pull/7723 +* sync: main -> 1.5.x by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7705 +* Sync main 1.5.x by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7727 +* Updated header by @DylanG-64 in https://github.com/appwrite/appwrite/pull/7728 +* chore: update exector, runtimes by @loks0n in https://github.com/appwrite/appwrite/pull/7729 +* feat: pint by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7738 +* feat: cascading response/request filters by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7745 +* Revert 7629 revert 7614 chore usage queue health by @christyjacob4 in https://github.com/appwrite/appwrite/pull/7707 +* fix: migration 1.5.x by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7737 +* sync: main 1.5.x 3 by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/7747 +* Allow users to disable APIs by @vermakhushboo in https://github.com/appwrite/appwrite/pull/7725 +* Feat seperate image IDs by @abnegate in https://github.com/appwrite/appwrite/pull/7749 +* fix: account endpoint order by @loks0n in https://github.com/appwrite/appwrite/pull/7739 +* Feat image jwts by @abnegate in https://github.com/appwrite/appwrite/pull/7751 + +## New Contributors +* @fanksin made their first contribution in https://github.com/appwrite/appwrite/pull/7276 +* @iMacHumphries made their first contribution in https://github.com/appwrite/appwrite/pull/7350 +* @UtkarshAhuja2003 made their first contribution in https://github.com/appwrite/appwrite/pull/7365 +* @Souptik2001 made their first contribution in https://github.com/appwrite/appwrite/pull/7559 +* @GuptaPratik02 made their first contribution in https://github.com/appwrite/appwrite/pull/6826 +* @navjotNSK made their first contribution in https://github.com/appwrite/appwrite/pull/7651 +* @DylanG-64 made their first contribution in https://github.com/appwrite/appwrite/pull/7728 + +**Full Changelog**: https://github.com/appwrite/appwrite/compare/1.4.13...1.5.0 + # Version 1.4.14 ## Changes @@ -496,7 +897,7 @@ ## Features - Added Phone Authentication by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/3357 - Added Twilio Support - - Added TextMagic Support + - Added Textmagic Support - Added Telesign Support - Added Endpoint to create Phone Session (`POST:/v1/account/sessions/phone`) - Added Endpoint to confirm Phone Session (`PUT:/v1/account/sessions/phone`) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0522e33da5..9e3e6fcd81 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,6 +148,14 @@ Learn more at our [Technology Stack](#technology-stack) section. - [Microservices vs Monolithic](https://www.mulesoft.com/resources/api/microservices-vs-monolithic#:~:text=Microservices%20architecture%20vs%20monolithic%20architecture&text=A%20monolithic%20application%20is%20built%20as%20a%20single%20unit.&text=To%20make%20any%20alterations%20to,formally%20with%20business%2Doriented%20APIs.) - [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) - Appwrite console architecture +##### Container Namespace Conventions +To keep our services easy to understand within Docker we follow a naming convention for all our containers depending on it's intended use. + +`appwrite-worker-X` - Workers (`src/Appwrite/Platform/Workers/*`) +`appwrite-task-X` - Tasks (`src/Appwrite/Platform/Tasks/*`) + +Other containes should be named the same as their service, for example `redis` should just be called `redis`. + ##### Security - [Appwrite Auth and ACL](https://github.com/appwrite/appwrite/blob/master/docs/specs/authentication.drawio.svg) @@ -301,6 +309,143 @@ This will allow the Appwrite community to sufficiently discuss the new feature v This is also important for the Appwrite lead developers to be able to provide technical input and potentially a different emphasis regarding the feature design and architecture. Some bigger features might need to go through our [RFC process](https://github.com/appwrite/rfc). +## Adding New Usage Metrics + +These are the current metrics we collect usage stats for: + +| Metric | Description | +|--------|-------------------------------------------------| +| teams | Total number of teams per project | +| users | Total number of users per project| +| executions | Total number of executions per project | +| databases | Total number of databases per project | +| collections | Total number of collections per project | +| {databaseInternalId}.collections | Total number of collections per database| +| documents | Total number of documents per project | +| {databaseInternalId}.{collectionInternalId}.documents | Total number of documents per collection | +| buckets | Total number of buckets per project | +| files | Total number of files per project | +| {bucketInternalId}.files.storage | Sum of files.storage per bucket (in bytes) | +| functions | Total number of functions per project | +| deployments | Total number of deployments per project | +| builds | Total number of builds per project | +| {resourceType}.{resourceInternalId}.deployments | Total number of deployments per function | +| executions | Total number of executions per project | +| {functionInternalId}.executions | Total number of executions per function | +| files.storage | Sum of files storage per project (in bytes) | +| deployments.storage | Sum of deployments storage per project (in bytes) | +| {resourceType}.{resourceInternalId}.deployments.storage | Sum of deployments storage per function (in bytes) | +| builds.storage | Sum of builds storage per project (in bytes) | +| builds.compute | Sum of compute duration per project (in seconds) | +| {functionInternalId}.builds.storage | Sum of builds storage per function (in bytes) | +| {functionInternalId}.builds.compute | Sum of compute duration per function (in seconds) | +| network.requests | Total number of network requests per project | +| executions.compute | Sum of compute duration per project (in seconds) | +| network.inbound | Sum of network inbound traffic per project (in bytes)| +| network.outbound | Sum of network outbound traffic per project (in bytes)| + +> Note: The curly brackets in the metric name represents a template and is replaced with a value when the metric is processed. + +Metrics are collected within 3 scopes Daily, monthly, an infinity. Adding new usage metric in order to aggregate usage stats is very simple, but very much dependent on where do you want to collect +statistics ,via API or via background worker. For both cases you will need to add a `const` variable in `app/init.php` under the usage metrics list using the naming convention `METRIC_` as shown below. + +```php +// Usage metrics +const METRIC_FUNCTIONS = 'functions'; +const METRIC_DEPLOYMENTS = 'deployments'; +const METRIC_DEPLOYMENTS_STORAGE = 'deployments.storage'; +``` + +Next follow the appropriate steps below depending on whether you're adding the metric to the API or the worker. + +**API** + +In file `app/controllers/shared/api.php` On the database listener, add to an existing or create a new switch case. Add a call to the usage worker with your new metric const like so: + +```php + case $document->getCollection() === 'teams': + $queueForUsage + ->addMetric(METRIC_TEAMS, $value); // per project + break; +``` +There are cases when you need to handle metric that has a parent entity, like buckets. +Files are linked to a parent bucket, you should verify you remove the files stats when you delete a bucket. + +In that case you need also to handle children removal using addReduce() method call. + +```php + + case $document->getCollection() === 'buckets': //buckets + $queueForUsage + ->addMetric(METRIC_BUCKETS, $value); // per project + if ($event === Database::EVENT_DOCUMENT_DELETE) { + $queueForUsage + ->addReduce($document); + } + break; + +``` + +In addition, you will also need to add some logic to the `reduce()` method of the Usage worker located in `/src/Appwrite/Platform/Workers/Usage.php`, like so: + +```php +case $document->getCollection() === 'buckets': + $files = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{bucketInternalId}', $document->getInternalId(), METRIC_BUCKET_ID_FILES))); + $storage = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{bucketInternalId}', $document->getInternalId(), METRIC_BUCKET_ID_FILES_STORAGE))); + + if (!empty($files['value'])) { + $metrics[] = [ + 'key' => METRIC_FILES, + 'value' => ($files['value'] * -1), + ]; + } + + if (!empty($storage['value'])) { + $metrics[] = [ + 'key' => METRIC_FILES_STORAGE, + 'value' => ($storage['value'] * -1), + ]; + } + break; +``` + +**Background worker** + +You need to inject the usage queue in the desired worker on the constructor method +```php +/** +* @throws Exception +*/ +public function __construct() +{ + $this + ->desc('Functions worker') + ->groups(['functions']) + ->inject('message') + ->inject('dbForProject') + ->inject('queueForFunctions') + ->inject('queueForEvents') + ->inject('queueForUsage') + ->inject('log') + ->callback(fn (Message $message, Database $dbForProject, Func $queueForFunctions, Event $queueForEvents, Usage $queueForUsage, Log $log) => $this->action($message, $dbForProject, $queueForFunctions, $queueForEvents, $queueForUsage, $log)); +} +``` + +and then trigger the queue with the new metric like so: + +```php +$queueForUsage + ->addMetric(METRIC_BUILDS, 1) + ->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0)) + ->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS), 1) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE), $build->getAttribute('size', 0)) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000) + ->setProject($project) + ->trigger(); +``` + + ## Build To build a new version of the Appwrite server, all you need to do is run the build.sh file like this: @@ -344,13 +489,13 @@ Things to remember when releasing SDKs: ## Debug -Appwrite uses [yasd](https://github.com/swoole/yasd) debugger, which can be made available during build of Appwrite. You can connect to the debugger using VS Code's [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension. +Appwrite uses [XDebug](https://github.com/xdebug/xdebug) debugger, which can be made available during build of Appwrite. You can connect to the debugger using VS Code's [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension. -If you are in PHP Storm you don't need any plugin. Below are the settings required for remote debugger connection: +If you are in PHP Storm you don't need any plugin. Below are the settings required for remote debugger connection: -1. Create an init file. -2. Duplicate **dev/yasd_init.php.stub** file and name it **dev/yasd_init.php**. -3. Set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file. +1. Set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file. +2. If needed edit the **dev/xdebug.ini** file to your needs. +3. Launch your Appwrite instance while your debugger is listening for connections. ### VS Code Launch Configuration diff --git a/Dockerfile b/Dockerfile index 5d06d6c828..1d2ac91ae0 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist \ `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` -FROM --platform=$BUILDPLATFORM node:16.14.2-alpine3.15 as node +FROM --platform=$BUILDPLATFORM node:20.11.0-alpine3.19 as node COPY app/console /usr/local/src/console @@ -29,7 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT RUN npm ci RUN npm run build -FROM appwrite/base:0.4.3 as final +FROM appwrite/base:0.9.0 as final LABEL maintainer="team@appwrite.io" @@ -56,6 +56,7 @@ COPY ./public /usr/src/code/public COPY ./bin /usr/local/bin COPY ./docs /usr/src/code/docs COPY ./src /usr/src/code/src +COPY ./dev /usr/src/code/dev # Set Volumes RUN mkdir -p /storage/uploads && \ @@ -73,63 +74,43 @@ RUN mkdir -p /storage/uploads && \ # Executables RUN chmod +x /usr/local/bin/doctor && \ - chmod +x /usr/local/bin/maintenance && \ chmod +x /usr/local/bin/install && \ - chmod +x /usr/local/bin/upgrade && \ + chmod +x /usr/local/bin/maintenance && \ chmod +x /usr/local/bin/migrate && \ chmod +x /usr/local/bin/realtime && \ - chmod +x /usr/local/bin/schedule && \ + chmod +x /usr/local/bin/schedule-functions && \ + chmod +x /usr/local/bin/schedule-messages && \ chmod +x /usr/local/bin/sdks && \ chmod +x /usr/local/bin/specs && \ chmod +x /usr/local/bin/ssl && \ chmod +x /usr/local/bin/test && \ + chmod +x /usr/local/bin/upgrade && \ chmod +x /usr/local/bin/vars && \ chmod +x /usr/local/bin/queue-retry && \ chmod +x /usr/local/bin/queue-count-failed && \ chmod +x /usr/local/bin/queue-count-processing && \ chmod +x /usr/local/bin/queue-count-success && \ chmod +x /usr/local/bin/worker-audits && \ + chmod +x /usr/local/bin/worker-builds && \ chmod +x /usr/local/bin/worker-certificates && \ chmod +x /usr/local/bin/worker-databases && \ chmod +x /usr/local/bin/worker-deletes && \ chmod +x /usr/local/bin/worker-functions && \ - chmod +x /usr/local/bin/worker-builds && \ chmod +x /usr/local/bin/worker-mails && \ chmod +x /usr/local/bin/worker-messaging && \ - chmod +x /usr/local/bin/worker-webhooks && \ chmod +x /usr/local/bin/worker-migrations && \ - chmod +x /usr/local/bin/worker-hamster && \ + chmod +x /usr/local/bin/worker-webhooks && \ chmod +x /usr/local/bin/worker-usage && \ chmod +x /usr/local/bin/worker-usage-dump - -# Cloud Executabless -RUN chmod +x /usr/local/bin/hamster && \ - chmod +x /usr/local/bin/volume-sync && \ - chmod +x /usr/local/bin/patch-delete-schedule-updated-at-attribute && \ - chmod +x /usr/local/bin/patch-recreate-repositories-documents && \ - chmod +x /usr/local/bin/patch-delete-project-collections && \ - chmod +x /usr/local/bin/delete-orphaned-projects && \ - chmod +x /usr/local/bin/clear-card-cache && \ - chmod +x /usr/local/bin/calc-users-stats && \ - chmod +x /usr/local/bin/calc-tier-stats && \ - chmod +x /usr/local/bin/get-migration-stats && \ - chmod +x /usr/local/bin/create-inf-metric - # Letsencrypt Permissions RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ # Enable Extensions -RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/src/code/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi - -RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi -RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "default_socket_timeout=-1" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.jit_buffer_size=100M" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.jit=1235" >> /usr/local/etc/php/conf.d/appwrite.ini +RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi +RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi +RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi EXPOSE 80 -CMD [ "php", "app/http.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ] \ No newline at end of file +CMD [ "php", "app/http.php" ] \ No newline at end of file diff --git a/README-CN.md b/README-CN.md index 0ce27a0038..ba800a3bd6 100644 --- a/README-CN.md +++ b/README-CN.md @@ -11,6 +11,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) [![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) @@ -25,7 +26,7 @@ [**Appwrite 云公开测试版!立即注册!**](https://cloud.appwrite.io) -Appwrite是一个基于Docker的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面简化了从零开始编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 +Appwrite 是一个基于 Docker 的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面简化了从零开始编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 Appwrite 可以提供给开发者用户验证,外部授权,用户数据读写检索,文件储存,图像处理,云函数计算,[等多种服务](https://appwrite.io/docs). @@ -66,7 +67,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.4.13 + appwrite/appwrite:1.5.5 ``` ### Windows @@ -78,7 +79,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.4.13 + appwrite/appwrite:1.5.5 ``` #### PowerShell @@ -88,12 +89,11 @@ 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.4.13 + appwrite/appwrite:1.5.5 ``` 运行后,可以在浏览器上访问 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,52 +104,73 @@ docker run -it --rm ` 开始使用 Appwrite 只需要在控制台创建一个新项目,选择开发平台,然后抓取我们的开发套件。您可以从以下的教程中找到你喜欢的平台开始使用 Appwrite。 -* [开始使用 Web](https://appwrite.io/docs/getting-started-for-web) -* [开始使用 Flutter](https://appwrite.io/docs/getting-started-for-flutter) -* [开始使用 Apple](https://appwrite.io/docs/getting-started-for-apple) -* [开始使用 Android](https://appwrite.io/docs/getting-started-for-android) -* [开始使用 Server](https://appwrite.io/docs/getting-started-for-server) -* [开始使用 CLI](https://appwrite.io/docs/command-line) +| 类别 | 技术 | +| ------------------ | --------------------------------------------------------------------------- | +| **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) | ### 软件服务 -* [**帐户**](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/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 团队维护) + +- ✅   [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 团队维护) -* ✅   [Apple](https://github.com/appwrite/sdk-for-apple) - **公测** (由 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)) -找不到需要的的 SDK? - 欢迎通过发起PR来帮助我们完善Appwrite的软件生态环境 [SDK 生成器](https://github.com/appwrite/sdk-generator)! +- ✅   [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)! ## 软件架构 @@ -161,13 +182,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 62b084d320..865df745b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> Great news! Appwrite Cloud is now in public beta! Sign up at [cloud.appwrite.io](https://cloud.appwrite.io) for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉 +> Our Appwrite Init event has concluded. You can check out all the new and upcoming features [on our Init website](https://appwrite.io/init) 🚀

@@ -10,14 +10,13 @@

- [![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=ready&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) [![Build Status](https://img.shields.io/github/actions/workflow/status/appwrite/appwrite/tests.yml?branch=master&label=tests&style=flat-square)](https://github.com/appwrite/appwrite/actions) -[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) +[![X Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) @@ -76,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.4.13 + appwrite/appwrite:1.5.5 ``` ### Windows @@ -88,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.4.13 + appwrite/appwrite:1.5.5 ``` #### PowerShell @@ -98,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.4.13 + appwrite/appwrite:1.5.5 ``` 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. @@ -142,21 +141,39 @@ 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. -- [Getting Started for Web](https://appwrite.io/docs/getting-started-for-web) -- [Getting Started for Flutter](https://appwrite.io/docs/getting-started-for-flutter) -- [Getting Started for Apple](https://appwrite.io/docs/getting-started-for-apple) -- [Getting Started for Android](https://appwrite.io/docs/getting-started-for-android) -- [Getting Started for Server](https://appwrite.io/docs/getting-started-for-server) -- [Getting Started for CLI](https://appwrite.io/docs/command-line) +| 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) | -### Services +### Products - [**Account**](https://appwrite.io/docs/references/cloud/client-web/account) - Manage current user authentication and account. Track and manage the user sessions, devices, sign-in methods, and security logs. - [**Users**](https://appwrite.io/docs/server/users) - Manage and list all project users when building backend integrations with Server SDKs. - [**Teams**](https://appwrite.io/docs/references/cloud/client-web/teams) - Manage and group users in teams. Manage memberships, invites, and user roles within a team. - [**Databases**](https://appwrite.io/docs/references/cloud/client-web/databases) - Manage databases, collections, and documents. Read, create, update, and delete documents and filter lists of document collections using advanced filters. - [**Storage**](https://appwrite.io/docs/references/cloud/client-web/storage) - Manage storage files. Read, create, delete, and preview files. Manipulate the preview of your files to perfectly fit your app. All files are scanned by ClamAV and stored in a secure and encrypted way. -- [**Functions**](https://appwrite.io/docs/server/functions) - Customize your Appwrite server by executing your custom code in a secure, isolated environment. You can trigger your code on any Appwrite system event either manually or using a CRON schedule. +- [**Functions**](https://appwrite.io/docs/references/cloud/server-nodejs/functions) - Customize your Appwrite project by executing your custom code in a secure, isolated environment. You can trigger your code on any Appwrite system event either manually or using a CRON schedule. +- [**Messaging**](https://appwrite.io/docs/references/cloud/client-web/messaging) - Communicate with your users through push notifications, emails, and SMS text messages using Appwrite Messaging. - [**Realtime**](https://appwrite.io/docs/realtime) - Listen to real-time events for any of your Appwrite services including users, storage, functions, databases, and more. - [**Locale**](https://appwrite.io/docs/references/cloud/client-web/locale) - Track your user's location and manage your app locale-based data. - [**Avatars**](https://appwrite.io/docs/references/cloud/client-web/avatars) - Manage your users' avatars, countries' flags, browser icons, and credit card symbols. Generate QR codes from links or plaintext strings. @@ -171,20 +188,21 @@ Below is a list of currently supported platforms and languages. If you would lik - ✅   [Web](https://github.com/appwrite/sdk-for-web) (Maintained by the Appwrite Team) - ✅   [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team) -- ✅   [Apple](https://github.com/appwrite/sdk-for-apple) - **Beta** (Maintained by the Appwrite Team) +- ✅   [Apple](https://github.com/appwrite/sdk-for-apple) (Maintained by the Appwrite Team) - ✅   [Android](https://github.com/appwrite/sdk-for-android) (Maintained by the Appwrite Team) +- ✅   [React Native](https://github.com/appwrite/sdk-for-react-native) - **Beta** (Maintained by the Appwrite Team) #### Server - ✅   [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team) - ✅   [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team) -- ✅   [Dart](https://github.com/appwrite/sdk-for-dart) - (Maintained by the Appwrite Team) -- ✅   [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team) +- ✅   [Dart](https://github.com/appwrite/sdk-for-dart) (Maintained by the Appwrite Team) +- ✅   [Deno](https://github.com/appwrite/sdk-for-deno) (Maintained by the Appwrite Team) - ✅   [Ruby](https://github.com/appwrite/sdk-for-ruby) (Maintained by the Appwrite Team) - ✅   [Python](https://github.com/appwrite/sdk-for-python) (Maintained by the Appwrite Team) -- ✅   [Kotlin](https://github.com/appwrite/sdk-for-kotlin) - **Beta** (Maintained by the Appwrite Team) -- ✅   [Apple](https://github.com/appwrite/sdk-for-apple) - **Beta** (Maintained by the Appwrite Team) -- ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Experimental** (Maintained by the Appwrite Team) +- ✅   [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (Maintained by the Appwrite Team) +- ✅   [Swift](https://github.com/appwrite/sdk-for-swift) (Maintained by the Appwrite Team) +- ✅   [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Beta** (Maintained by the Appwrite Team) #### Community @@ -213,7 +231,7 @@ For security issues, kindly email us at [security@appwrite.io](mailto:security@a ## Follow Us -Join our growing community around the world! Check out our official [Blog](https://medium.com/appwrite-io). Follow us on [Twitter](https://twitter.com/appwrite), [Facebook Page](https://www.facebook.com/appwrite.io), [Facebook Group](https://www.facebook.com/groups/appwrite.developers/), [Dev Community](https://dev.to/appwrite) or join our live [Discord server](https://discord.gg/GSeTUeA) for more help, ideas, and discussions. +Join our growing community around the world! Check out our official [Blog](https://appwrite.io/blog). Follow us on [X](https://twitter.com/appwrite), [LinkedIn](https://www.linkedin.com/company/appwrite/), [Dev Community](https://dev.to/appwrite) or join our live [Discord server](https://appwrite.io/discord) for more help, ideas, and discussions. ## License diff --git a/SECURITY.md b/SECURITY.md index a0591d7745..a17a55e368 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -10,6 +10,7 @@ | 1.2.x | :white_check_mark: | | 1.3.x | :white_check_mark: | | 1.4.x | :white_check_mark: | +| 1.5.x | :white_check_mark: | ## Reporting a Vulnerability diff --git a/app/assets/dbip/dbip-country-lite-2023-01.mmdb b/app/assets/dbip/dbip-country-lite-2023-01.mmdb deleted file mode 100644 index dd98483fe5..0000000000 Binary files a/app/assets/dbip/dbip-country-lite-2023-01.mmdb and /dev/null differ diff --git a/app/assets/dbip/dbip-country-lite-2024-02.mmdb b/app/assets/dbip/dbip-country-lite-2024-02.mmdb new file mode 100644 index 0000000000..e02ba8af04 Binary files /dev/null and b/app/assets/dbip/dbip-country-lite-2024-02.mmdb differ diff --git a/app/cli.php b/app/cli.php index d7cc5fe414..1996b4da32 100644 --- a/app/cli.php +++ b/app/cli.php @@ -3,29 +3,28 @@ require_once __DIR__ . '/init.php'; require_once __DIR__ . '/controllers/general.php'; -use Appwrite\Event\Delete; use Appwrite\Event\Certificate; +use Appwrite\Event\Delete; use Appwrite\Event\Func; -use Appwrite\Event\Hamster; use Appwrite\Platform\Appwrite; -use Utopia\CLI\CLI; -use Utopia\Database\Validator\Authorization; -use Utopia\Platform\Service; -use Utopia\App; -use Utopia\CLI\Console; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; +use Utopia\CLI\CLI; +use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Validator\Authorization; use Utopia\Logger\Log; +use Utopia\Platform\Service; use Utopia\Pools\Group; use Utopia\Queue\Connection; use Utopia\Registry\Registry; +use Utopia\System\System; Authorization::disable(); -CLI::setResource('register', fn()=>$register); +CLI::setResource('register', fn () => $register); CLI::setResource('cache', function ($pools) { $list = Config::getParam('pools-cache', []); @@ -72,12 +71,12 @@ CLI::setResource('dbForConsole', function ($pools, $cache) { $collections = Config::getParam('collections', [])['console']; $last = \array_key_last($collections); - if (!($dbForConsole->exists($dbForConsole->getDefaultDatabase(), $last))) { /** TODO cache ready variable using registry */ + if (!($dbForConsole->exists($dbForConsole->getDatabase(), $last))) { /** TODO cache ready variable using registry */ throw new Exception('Tables not ready yet.'); } $ready = true; - } catch (\Exception $err) { + } catch (\Throwable $err) { Console::warning($err->getMessage()); $pools->get('console')->reclaim(); sleep($sleep); @@ -131,9 +130,6 @@ CLI::setResource('queue', function (Group $pools) { CLI::setResource('queueForFunctions', function (Connection $queue) { return new Func($queue); }, ['queue']); -CLI::setResource('queueForHamster', function (Connection $queue) { - return new Hamster($queue); -}, ['queue']); CLI::setResource('queueForDeletes', function (Connection $queue) { return new Delete($queue); }, ['queue']); @@ -145,7 +141,7 @@ CLI::setResource('logError', function (Registry $register) { $logger = $register->get('logger'); if ($logger) { - $version = App::getEnv('_APP_VERSION', 'UNKNOWN'); + $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); $log = new Log(); $log->setNamespace($namespace); @@ -164,7 +160,7 @@ CLI::setResource('logError', function (Registry $register) { $log->setAction($action); - $isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; + $isProduction = System::getEnv('_APP_ENV', 'development') === 'production'; $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $responseCode = $logger->addLog($log); diff --git a/app/config/apis.php b/app/config/apis.php new file mode 100644 index 0000000000..a625999682 --- /dev/null +++ b/app/config/apis.php @@ -0,0 +1,16 @@ + [ + 'key' => 'rest', + 'name' => 'REST', + ], + 'graphql' => [ + 'key' => 'graphql', + 'name' => 'GraphQL', + ], + 'realtime' => [ + 'key' => 'realtime', + 'name' => 'Realtime', + ], +]; diff --git a/app/config/auth.php b/app/config/auth.php index cf1d180aaa..2330fe75cf 100644 --- a/app/config/auth.php +++ b/app/config/auth.php @@ -7,21 +7,28 @@ return [ 'name' => 'Email/Password', 'key' => 'emailPassword', 'icon' => '/images/users/email.png', - 'docs' => 'https://appwrite.io/docs/client/account?sdk=web-default#accountCreateEmailSession', + 'docs' => 'https://appwrite.io/docs/references/cloud/client-web/account#accountCreateEmailPasswordSession', 'enabled' => true, ], 'magic-url' => [ 'name' => 'Magic URL', 'key' => 'usersAuthMagicURL', 'icon' => '/images/users/magic-url.png', - 'docs' => 'https://appwrite.io/docs/client/account?sdk=web-default#accountCreateMagicURLSession', + 'docs' => 'https://appwrite.io/docs/references/cloud/client-web/account#accountCreateMagicURLToken', + 'enabled' => true, + ], + 'email-otp' => [ + 'name' => 'Email (OTP)', + 'key' => 'emailOtp', + 'icon' => '/images/users/email.png', + 'docs' => 'https://appwrite.io/docs/references/cloud/client-web/account#accountCreateEmailToken', 'enabled' => true, ], 'anonymous' => [ 'name' => 'Anonymous', 'key' => 'anonymous', 'icon' => '/images/users/anonymous.png', - 'docs' => 'https://appwrite.io/docs/client/account?sdk=web-default#accountCreateAnonymousSession', + 'docs' => 'https://appwrite.io/docs/references/cloud/client-web/account#accountCreateAnonymousSession', 'enabled' => true, ], 'invites' => [ @@ -42,7 +49,7 @@ return [ 'name' => 'Phone', 'key' => 'phone', 'icon' => '/images/users/phone.png', - 'docs' => 'https://appwrite.io/docs/client/account?sdk=web-default#accountCreatePhoneSession', + 'docs' => 'https://appwrite.io/docs/references/cloud/client-web/account#accountCreatePhoneToken', 'enabled' => true, ], ]; diff --git a/app/config/avatars/credit-cards.php b/app/config/avatars/credit-cards.php index aaef17ee3f..eb76c576cf 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'], - 'censosud' => ['name' => 'Consosud', 'path' => __DIR__ . '/credit-cards/consosud.png'], + 'cencosud' => ['name' => 'Cencosud', 'path' => __DIR__ . '/credit-cards/cencosud.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'], @@ -17,4 +17,4 @@ return [ 'visa' => ['name' => 'Visa', 'path' => __DIR__ . '/credit-cards/visa.png'], 'mir' => ['name' => 'MIR', 'path' => __DIR__ . '/credit-cards/mir.png'], 'maestro' => ['name' => 'Maestro', 'path' => __DIR__ . '/credit-cards/maestro.png'] - ]; +]; diff --git a/app/config/avatars/credit-cards/censosud.png b/app/config/avatars/credit-cards/cencosud.png similarity index 100% rename from app/config/avatars/credit-cards/censosud.png rename to app/config/avatars/credit-cards/cencosud.png diff --git a/app/config/avatars/flags.php b/app/config/avatars/flags.php index 696656738e..cd7364a5e9 100644 --- a/app/config/avatars/flags.php +++ b/app/config/avatars/flags.php @@ -142,6 +142,7 @@ return [ 'pw' => ['name' => 'Palau', 'path' => __DIR__ . '/flags/pw.png'], 'pg' => ['name' => 'Papua New Guinea', 'path' => __DIR__ . '/flags/pg.png'], 'pl' => ['name' => 'Poland', 'path' => __DIR__ . '/flags/pl.png'], + 'pf' => ['name' => 'French Polynesia', 'path' => __DIR__ . '/flags/pf.png'], 'kp' => ['name' => 'North Korea', 'path' => __DIR__ . '/flags/kp.png'], 'pt' => ['name' => 'Portugal', 'path' => __DIR__ . '/flags/pt.png'], 'py' => ['name' => 'Paraguay', 'path' => __DIR__ . '/flags/py.png'], diff --git a/app/config/collections.php b/app/config/collections.php index 3bc58eff56..cd0d1b2ef5 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -5,7 +5,7 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Helpers\ID; -$providers = Config::getParam('providers', []); +$providers = Config::getParam('oAuthProviders', []); $auth = Config::getParam('auth', []); /** @@ -267,6 +267,39 @@ $commonCollections = [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('mfa'), + 'type' => Database::VAR_BOOLEAN, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('mfaRecoveryCodes'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 256, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => ['encrypt'], + ], + [ + '$id' => ID::custom('authenticators'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryAuthenticators'], + ], [ '$id' => ID::custom('sessions'), 'type' => Database::VAR_STRING, @@ -289,6 +322,17 @@ $commonCollections = [ 'array' => false, 'filters' => ['subQueryTokens'], ], + [ + '$id' => ID::custom('challenges'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryChallenges'], + ], [ '$id' => ID::custom('memberships'), 'type' => Database::VAR_STRING, @@ -300,6 +344,17 @@ $commonCollections = [ 'array' => false, 'filters' => ['subQueryMemberships'], ], + [ + '$id' => ID::custom('targets'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryTargets'], + ], [ '$id' => ID::custom('search'), 'type' => Database::VAR_STRING, @@ -321,7 +376,7 @@ $commonCollections = [ 'default' => null, 'array' => false, 'filters' => ['datetime'], - ] + ], ], 'indexes' => [ [ @@ -491,6 +546,159 @@ $commonCollections = [ ], ], + 'authenticators' => [ + '$collection' => ID::custom(Database::METADATA), + '$id' => ID::custom('authenticators'), + 'name' => 'Authenticators', + 'attributes' => [ + [ + '$id' => ID::custom('userInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('userId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('type'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('verified'), + 'type' => Database::VAR_BOOLEAN, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => false, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('data'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65535, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => false, + 'filters' => ['json', 'encrypt'], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_userInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ] + ], + ], + + 'challenges' => [ + '$collection' => ID::custom(Database::METADATA), + '$id' => ID::custom('challenges'), + 'name' => 'Challenges', + 'attributes' => [ + [ + '$id' => ID::custom('userInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('userId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('type'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('token'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 512, // https://www.tutorialspoint.com/how-long-is-the-sha256-hash-in-mysql (512 for encryption) + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['encrypt'], + ], [ + '$id' => ID::custom('code'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 512, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['encrypt'], + ], [ + '$id' => ID::custom('expire'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ] + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_user'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ] + ], + ], + 'sessions' => [ '$collection' => ID::custom(Database::METADATA), '$id' => ID::custom('sessions'), @@ -749,6 +957,39 @@ $commonCollections = [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('factors'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 256, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('expire'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('mfaUpdatedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], ], 'indexes' => [ [ @@ -1352,7 +1593,7 @@ $commonCollections = [ 'stats' => [ '$collection' => ID::custom(Database::METADATA), '$id' => ID::custom('stats'), - 'name' => 'stats', + 'name' => 'Stats', 'attributes' => [ [ '$id' => ID::custom('metric'), @@ -1434,7 +1675,699 @@ $commonCollections = [ ], ], ], - ]; + + 'providers' => [ + '$collection' => ID::custom(DATABASE::METADATA), + '$id' => ID::custom('providers'), + 'name' => 'Providers', + 'attributes' => [ + [ + '$id' => ID::custom('name'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('provider'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('type'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('enabled'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => true, + 'default' => true, + 'array' => false, + ], + [ + '$id' => ID::custom('credentials'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => ['json', 'encrypt'], + ], + [ + '$id' => ID::custom('options'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => false, + 'filters' => ['json'], + ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65535, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => ['providerSearch'], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_provider'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['provider'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['name'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_type'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['type'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_enabled_type'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['enabled', 'type'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ] + ], + ], + + 'messages' => [ + '$collection' => ID::custom(DATABASE::METADATA), + '$id' => ID::custom('messages'), + 'name' => 'Messages', + 'attributes' => [ + [ + '$id' => ID::custom('providerType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('status'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => 'processing', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('data'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65535, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => ['json'], + ], + [ + '$id' => ID::custom('topics'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 21845, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('users'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 21845, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('targets'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 21845, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('scheduledAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('scheduleInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('scheduleId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deliveredAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('deliveryErrors'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65535, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('deliveredTotal'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => ['messageSearch'], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ], + ], + ], + + 'topics' => [ + '$collection' => ID::custom(DATABASE::METADATA), + '$id' => ID::custom('topics'), + 'name' => 'Topics', + 'attributes' => [ + [ + '$id' => ID::custom('name'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('subscribe'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('emailTotal'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('smsTotal'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('pushTotal'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('targets'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryTopicTargets'], + ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => ['topicSearch'], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['name'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ] + ], + ], + + 'subscribers' => [ + '$collection' => ID::custom(DATABASE::METADATA), + '$id' => ID::custom('subscribers'), + 'name' => 'Subscribers', + 'attributes' => [ + [ + '$id' => ID::custom('targetId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('targetInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('userId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('userInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('topicId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('topicInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_targetId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['targetId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_targetInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['targetInternalId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_userId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_userInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userInternalId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_topicId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['topicId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_topicInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['topicInternalId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_unique_target_topic'), + 'type' => Database::INDEX_UNIQUE, + 'attributes' => ['targetInternalId', 'topicInternalId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_fulltext_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ], + ], + ], + + 'targets' => [ + '$collection' => ID::custom(DATABASE::METADATA), + '$id' => ID::custom('targets'), + 'name' => 'Targets', + 'attributes' => [ + [ + '$id' => ID::custom('userId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('userInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('sessionId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('sessionInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('identifier'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('name'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('expired'), + 'type' => Database::VAR_BOOLEAN, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => false, + 'array' => false, + 'filters' => [], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_userId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userId'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_userInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['userInternalId'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_providerId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['providerId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_providerInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['providerInternalId'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_identifier'), + 'type' => Database::INDEX_UNIQUE, + 'attributes' => ['identifier'], + 'lengths' => [], + 'orders' => [], + ], + ], + ], +]; $projectCollections = array_merge([ 'databases' => [ @@ -3389,6 +4322,17 @@ $consoleCollections = array_merge([ 'array' => false, 'filters' => ['json'], ], + [ + '$id' => ID::custom('apis'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => false, + 'filters' => ['json'], + ], [ '$id' => ID::custom('smtp'), 'type' => Database::VAR_STRING, @@ -3423,7 +4367,7 @@ $consoleCollections = array_merge([ 'filters' => ['json'], ], [ - '$id' => ID::custom('authProviders'), + '$id' => ID::custom('oAuthProviders'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => 16384, @@ -3925,6 +4869,39 @@ $consoleCollections = array_merge([ '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('logs'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 1000000, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('attempts'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], ], 'indexes' => [ [ diff --git a/app/config/errors.php b/app/config/errors.php index 7dedc373ef..67d4706a5d 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -5,12 +5,13 @@ */ use Appwrite\Extend\Exception; +use Appwrite\Messaging\Status as MessageStatus; return [ /** General Errors */ Exception::GENERAL_UNKNOWN => [ 'name' => Exception::GENERAL_UNKNOWN, - 'description' => 'An unknown error has occured. Please check the logs for more information.', + 'description' => 'An unknown error has occurred. Please check the logs for more information.', 'code' => 500, ], Exception::GENERAL_MOCK => [ @@ -28,10 +29,15 @@ return [ 'description' => 'The request originated from an unknown origin. If you trust this domain, please list it as a trusted platform in the Appwrite console.', 'code' => 403, ], + Exception::GENERAL_API_DISABLED => [ + 'name' => Exception::GENERAL_API_DISABLED, + 'description' => 'The requested API is disabled. You can enable the API from the Appwrite console.', + 'code' => 403, + ], Exception::GENERAL_SERVICE_DISABLED => [ 'name' => Exception::GENERAL_SERVICE_DISABLED, 'description' => 'The requested service is disabled. You can enable the service from the Appwrite console.', - 'code' => 503, + 'code' => 403, ], Exception::GENERAL_UNAUTHORIZED_SCOPE => [ 'name' => Exception::GENERAL_UNAUTHORIZED_SCOPE, @@ -103,6 +109,26 @@ return [ 'description' => 'This method was not fully implemented yet. If you believe this is a mistake, please upgrade your Appwrite server version.', 'code' => 405, ], + Exception::GENERAL_INVALID_EMAIL => [ + 'name' => Exception::GENERAL_INVALID_EMAIL, + 'description' => 'Value must be a valid email address.', + 'code' => 400, + ], + Exception::GENERAL_INVALID_PHONE => [ + 'name' => Exception::GENERAL_INVALID_PHONE, + 'description' => 'Value must be a valid phone number. Format this number with a leading \'+\' and a country code, e.g., +16175551212.', + 'code' => 400, + ], + Exception::GENERAL_REGION_ACCESS_DENIED => [ + 'name' => Exception::GENERAL_REGION_ACCESS_DENIED, + 'description' => 'Your location is not supported due to legal requirements.', + 'code' => 451, + ], + Exception::GENERAL_BAD_REQUEST => [ + 'name' => Exception::GENERAL_BAD_REQUEST, + 'description' => 'There was an error processing your request. Please check the inputs and try again.', + 'code' => 400, + ], /** User Errors */ Exception::USER_COUNT_EXCEEDED => [ @@ -110,6 +136,11 @@ return [ 'description' => 'The current project has exceeded the maximum number of users. Please check your user limit in the Appwrite console.', 'code' => 501, ], + Exception::USER_CONSOLE_COUNT_EXCEEDED => [ + 'name' => Exception::USER_CONSOLE_COUNT_EXCEEDED, + 'description' => 'Sign up to the console is restricted. You can contact an administrator to update console sign up restrictions by setting _APP_CONSOLE_WHITELIST_ROOT to "disabled".', + 'code' => 501, + ], Exception::USER_JWT_INVALID => [ 'name' => Exception::USER_JWT_INVALID, 'description' => 'The JWT token is invalid. Please check the value of the X-Appwrite-JWT header to ensure the correct token is being used.', @@ -162,7 +193,7 @@ return [ ], Exception::USER_SESSION_ALREADY_EXISTS => [ 'name' => Exception::USER_SESSION_ALREADY_EXISTS, - 'description' => 'Creation of anonymous users is prohibited when a session is active.', + 'description' => 'Creation of a session is prohibited when a session is active.', 'code' => 401, ], Exception::USER_NOT_FOUND => [ @@ -216,6 +247,26 @@ return [ 'description' => 'A user with the same phone number already exists in the current project.', 'code' => 409, ], + Exception::USER_RECOVERY_CODES_ALREADY_EXISTS => [ + 'name' => Exception::USER_RECOVERY_CODES_ALREADY_EXISTS, + 'description' => 'The current user already generated recovery codes and they can only be read once for security reasons.', + 'code' => 409, + ], + Exception::USER_AUTHENTICATOR_NOT_FOUND => [ + 'name' => Exception::USER_AUTHENTICATOR_NOT_FOUND, + 'description' => 'Authenticator could not be found on the current user.', + 'code' => 404, + ], + Exception::USER_RECOVERY_CODES_NOT_FOUND => [ + 'name' => Exception::USER_RECOVERY_CODES_NOT_FOUND, + 'description' => 'Recovery codes could not be found on the current user.', + 'code' => 404, + ], + Exception::USER_AUTHENTICATOR_ALREADY_VERIFIED => [ + 'name' => Exception::USER_AUTHENTICATOR_ALREADY_VERIFIED, + 'description' => 'This authenticator is already verified on the current user.', + 'code' => 409, + ], Exception::USER_PHONE_NOT_FOUND => [ 'name' => Exception::USER_PHONE_NOT_FOUND, 'description' => 'The current user does not have a phone number associated with their account.', @@ -226,6 +277,16 @@ return [ 'description' => 'Missing ID from OAuth2 provider.', 'code' => 400, ], + Exception::USER_MORE_FACTORS_REQUIRED => [ + 'name' => Exception::USER_MORE_FACTORS_REQUIRED, + 'description' => 'More factors are required to complete the sign in process.', + 'code' => 401, + ], + 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.', + 'code' => 401, + ], Exception::USER_OAUTH2_BAD_REQUEST => [ 'name' => Exception::USER_OAUTH2_BAD_REQUEST, 'description' => 'OAuth2 provider rejected the bad request.', @@ -256,6 +317,21 @@ return [ 'description' => 'User deletion is not allowed for users with active memberships. Please delete all confirmed memberships before deleting the account.', 'code' => 400 ], + Exception::USER_TARGET_NOT_FOUND => [ + 'name' => Exception::USER_TARGET_NOT_FOUND, + 'description' => 'The target could not be found.', + 'code' => 404, + ], + Exception::USER_TARGET_ALREADY_EXISTS => [ + 'name' => Exception::USER_TARGET_ALREADY_EXISTS, + 'description' => 'A target with the same ID already exists.', + 'code' => 409, + ], + Exception::USER_API_KEY_AND_SESSION_SET => [ + 'name' => Exception::USER_API_KEY_AND_SESSION_SET, + 'description' => 'API key and session used in the same request. Use either `setSession` or `setKey`. Learn about which authentication method to use in the SSR docs: https://appwrite.io/docs/products/auth/server-side-rendering', + 'code' => 403, + ], /** Teams */ Exception::TEAM_NOT_FOUND => [ @@ -394,6 +470,11 @@ return [ 'description' => 'The value for x-appwrite-id header is invalid. Please check the value of the x-appwrite-id header is a valid id and not unique().', 'code' => 400, ], + Exception::STORAGE_FILE_NOT_PUBLIC => [ + 'name' => Exception::STORAGE_FILE_NOT_PUBLIC, + 'description' => 'The requested file is not publicly readable.', + 'code' => 403, + ], /** VCS */ Exception::INSTALLATION_NOT_FOUND => [ @@ -408,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 respository.', + 'description' => 'Repository with the requested ID could not be found. Check to see if the ID is correct, or create the repository.', 'code' => 404, ], Exception::PROVIDER_CONTRIBUTION_CONFLICT => [ @@ -418,7 +499,7 @@ return [ ], Exception::GENERAL_PROVIDER_FAILURE => [ 'name' => Exception::GENERAL_PROVIDER_FAILURE, - '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.', + '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.', 'code' => 400, ], @@ -438,6 +519,11 @@ return [ 'description' => 'Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".', 'code' => 404, ], + Exception::FUNCTION_SYNCHRONOUS_TIMEOUT => [ + 'name' => Exception::FUNCTION_SYNCHRONOUS_TIMEOUT, + 'description' => 'Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn\'t exceed 30 seconds.', + 'code' => 408, + ], /** Builds */ Exception::BUILD_NOT_FOUND => [ @@ -621,11 +707,6 @@ return [ 'description' => 'Project with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.', '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.', - 'code' => 400, - ], Exception::PROJECT_PROVIDER_DISABLED => [ 'name' => Exception::PROJECT_PROVIDER_DISABLED, 'description' => 'The chosen OAuth provider is disabled. You can enable the OAuth provider using the Appwrite console.', @@ -697,6 +778,11 @@ return [ 'description' => 'You can\'t delete default template. If you are trying to reset your template changes, you can ignore this error as it\'s already been reset.', 'code' => 401, ], + Exception::PROJECT_REGION_UNSUPPORTED => [ + 'name' => Exception::PROJECT_REGION_UNSUPPORTED, + 'description' => 'The requested region is either inactive or unsupported. Please check the value of the _APP_REGIONS environment variable.', + 'code' => 400, + ], Exception::WEBHOOK_NOT_FOUND => [ 'name' => Exception::WEBHOOK_NOT_FOUND, 'description' => 'Webhook with the requested ID could not be found.', @@ -791,4 +877,114 @@ return [ 'description' => 'Failed to establish a connection to the specified domain. Please verify the domain name and ensure that the server is running and accessible.', 'code' => 404, ], + + /** Providers */ + Exception::PROVIDER_NOT_FOUND => [ + 'name' => Exception::PROVIDER_NOT_FOUND, + 'description' => 'Provider with the requested ID could not be found.', + 'code' => 404, + ], + Exception::PROVIDER_ALREADY_EXISTS => [ + 'name' => Exception::PROVIDER_ALREADY_EXISTS, + 'description' => 'Provider with the requested ID already exists.', + 'code' => 409, + ], + Exception::PROVIDER_INCORRECT_TYPE => [ + 'name' => Exception::PROVIDER_INCORRECT_TYPE, + 'description' => 'Provider with the requested ID is of the incorrect type.', + 'code' => 400, + ], + Exception::PROVIDER_MISSING_CREDENTIALS => [ + 'name' => Exception::PROVIDER_MISSING_CREDENTIALS, + 'description' => 'Provider with the requested ID is missing credentials.', + 'code' => 400, + ], + + /** Topics */ + Exception::TOPIC_NOT_FOUND => [ + 'name' => Exception::TOPIC_NOT_FOUND, + 'description' => 'Topic with the request ID could not be found.', + 'code' => 404, + ], + Exception::TOPIC_ALREADY_EXISTS => [ + 'name' => Exception::TOPIC_ALREADY_EXISTS, + 'description' => 'Topic with the request ID already exists.', + 'code' => 409, + ], + + /** Subscribers */ + Exception::SUBSCRIBER_NOT_FOUND => [ + 'name' => Exception::SUBSCRIBER_NOT_FOUND, + 'description' => 'Subscriber with the request ID could not be found.', + 'code' => 404, + ], + Exception::SUBSCRIBER_ALREADY_EXISTS => [ + 'name' => Exception::SUBSCRIBER_ALREADY_EXISTS, + 'description' => 'Subscriber with the request ID already exists.', + 'code' => 409, + ], + + /** Messages */ + Exception::MESSAGE_NOT_FOUND => [ + 'name' => Exception::MESSAGE_NOT_FOUND, + 'description' => 'Message with the requested ID could not be found.', + 'code' => 404, + ], + Exception::MESSAGE_MISSING_TARGET => [ + 'name' => Exception::MESSAGE_MISSING_TARGET, + 'description' => 'Message with the requested ID has no recipients (topics or users or targets).', + 'code' => 400, + ], + Exception::MESSAGE_ALREADY_SENT => [ + 'name' => Exception::MESSAGE_ALREADY_SENT, + 'description' => 'Message with the requested ID has already been sent.', + 'code' => 400, + ], + Exception::MESSAGE_ALREADY_PROCESSING => [ + 'name' => Exception::MESSAGE_ALREADY_PROCESSING, + 'description' => 'Message with the requested ID is already being processed.', + 'code' => 400, + ], + Exception::MESSAGE_ALREADY_FAILED => [ + 'name' => Exception::MESSAGE_ALREADY_FAILED, + 'description' => 'Message with the requested ID has already failed.', + 'code' => 400, + ], + Exception::MESSAGE_ALREADY_SCHEDULED => [ + 'name' => Exception::MESSAGE_ALREADY_SCHEDULED, + 'description' => 'Message with the requested ID has already been scheduled for delivery.', + 'code' => 400, + ], + Exception::MESSAGE_TARGET_NOT_EMAIL => [ + 'name' => Exception::MESSAGE_TARGET_NOT_EMAIL, + 'description' => 'Message with the target ID is not an email target.', + 'code' => 400, + ], + Exception::MESSAGE_TARGET_NOT_SMS => [ + 'name' => Exception::MESSAGE_TARGET_NOT_SMS, + 'description' => 'Message with the target ID is not an SMS target.', + 'code' => 400, + ], + Exception::MESSAGE_TARGET_NOT_PUSH => [ + 'name' => Exception::MESSAGE_TARGET_NOT_PUSH, + 'description' => 'Message with the target ID is not a push target.', + 'code' => 400, + ], + Exception::MESSAGE_MISSING_SCHEDULE => [ + 'name' => Exception::MESSAGE_MISSING_SCHEDULE, + 'description' => 'Message can not have status ' . MessageStatus::SCHEDULED . ' without a schedule.', + 'code' => 400, + ], + Exception::SCHEDULE_NOT_FOUND => [ + 'name' => Exception::SCHEDULE_NOT_FOUND, + 'description' => 'Schedule with the requested ID could not be found.', + 'code' => 404, + ], + + /** Targets */ + Exception::TARGET_PROVIDER_INVALID_TYPE => [ + 'name' => Exception::TARGET_PROVIDER_INVALID_TYPE, + 'description' => 'Target has an invalid provider type.', + 'code' => 400, + ], ]; diff --git a/app/config/events.php b/app/config/events.php index c0b6cc3b41..5378502faf 100644 --- a/app/config/events.php +++ b/app/config/events.php @@ -44,6 +44,28 @@ return [ '$description' => 'This event triggers when a verification token for a user is validated.' ], ], + 'targets' => [ + '$model' => Response::MODEL_TARGET, + '$resource' => true, + '$description' => 'This event triggers on any user\'s target event.', + 'create' => [ + '$description' => 'This event triggers when a user\'s target is created.', + ], + 'update' => [ + '$description' => 'This event triggers when a user\'s target is updated.', + ], + 'delete' => [ + '$description' => 'This event triggers when a user\'s target is deleted.', + ], + ], + 'tokens' => [ + '$model' => Response::MODEL_TOKEN, + '$resource' => true, + '$description' => 'This event triggers on any user\'s token event.', + 'create' => [ + '$description' => 'This event triggers when a user\'s token is created.', + ], + ], 'create' => [ '$description' => 'This event triggers when a user is created.' ], @@ -237,6 +259,56 @@ return [ '$description' => 'This event triggers when a function is updated.', ] ], + 'messages' => [ + '$model' => Response::MODEL_MESSAGE, + '$resource' => true, + '$description' => 'This event triggers on any messaging event.', + 'create' => [ + '$description' => 'This event triggers when a message is created.', + ], + 'update' => [ + '$description' => 'This event triggers when a message is updated.', + ], + ], + 'topics' => [ + '$model' => Response::MODEL_TOPIC, + '$resource' => true, + '$description' => 'This event triggers on any topic event.', + 'create' => [ + '$description' => 'This event triggers when a topic is created.', + ], + 'update' => [ + '$description' => 'This event triggers when a topic is updated.', + ], + 'delete' => [ + '$description' => 'This event triggers when a topic is deleted.' + ], + 'subscribers' => [ + '$model' => Response::MODEL_SUBSCRIBER, + '$resource' => true, + '$description' => 'This event triggers on any subscriber event.', + 'create' => [ + '$description' => 'This event triggers when a subscriber is created.', + ], + 'delete' => [ + '$description' => 'This event triggers when a subscriber is deleted.' + ], + ], + ], + 'providers' => [ + '$model' => Response::MODEL_PROVIDER, + '$resource' => true, + '$description' => 'This event triggers on any provider event.', + 'create' => [ + '$description' => 'This event triggers when a provider is created.', + ], + 'update' => [ + '$description' => 'This event triggers when a provider is updated.', + ], + 'delete' => [ + '$description' => 'This event triggers when a provider is deleted.' + ], + ], 'rules' => [ '$model' => Response::MODEL_PROXY_RULE, '$resource' => true, diff --git a/app/config/locale/countries.php b/app/config/locale/countries.php index a794c31fdb..bd2cbbbaaa 100644 --- a/app/config/locale/countries.php +++ b/app/config/locale/countries.php @@ -1,5 +1,13 @@ "پښتو" ], [ - "code" => "pt", + "code" => "pt-pt", "name" => "Portuguese", "nativeName" => "Português" ], + [ + "code" => "pt-br", + "name" => "Portuguese (Brazilian)", + "nativeName" => "Português" + ], [ "code" => "qu", "name" => "Quechua", @@ -919,8 +924,13 @@ return [ "nativeName" => "Cuengh / Tôô / 壮语" ], [ - "code" => "zh", - "name" => "Chinese", + "code" => "zh-cn", + "name" => "Chinese (Simplified)", + "nativeName" => "中文" + ], + [ + "code" => "zh-tw", + "name" => "Chinese (Traditional)", "nativeName" => "中文" ], [ diff --git a/app/config/locale/phones.php b/app/config/locale/phones.php index d32efb33a0..12a1c50a75 100644 --- a/app/config/locale/phones.php +++ b/app/config/locale/phones.php @@ -136,6 +136,7 @@ return [ 'NZ' => '64', 'OM' => '968', 'PK' => '92', + 'PS' => '970', 'PA' => '507', 'PE' => '51', 'PH' => '63', @@ -179,6 +180,7 @@ return [ 'TN' => '216', 'TR' => '90', 'TV' => '688', + 'TW' => '886', 'TZ' => '255', 'UG' => '256', 'UA' => '380', diff --git a/app/config/locale/templates.php b/app/config/locale/templates.php index f2672c04a0..ac5a2acf1d 100644 --- a/app/config/locale/templates.php +++ b/app/config/locale/templates.php @@ -6,10 +6,12 @@ return [ 'magicSession', 'recovery', 'invitation', + 'mfaChallenge' ], 'sms' => [ 'verification', 'login', - 'invitation' + 'invitation', + 'mfaChallenge' ] ]; diff --git a/app/config/locale/templates/email-base-styled.tpl b/app/config/locale/templates/email-base-styled.tpl new file mode 100644 index 0000000000..4d6972389e --- /dev/null +++ b/app/config/locale/templates/email-base-styled.tpl @@ -0,0 +1,207 @@ + + + + + + + + + + + +
+ + + + +
+ +
+ + + + + +
+

{{subject}}

+
+ + + + + +
+{{body}} +
+ + + + + +
+ + + + + + + +
+ + + + + +
+ + + + + + +
Terms +
|
+
Privacy
+

+ © {{year}} Appwrite | 251 Little Falls Drive, Wilmington 19808, + Delaware, United States +

+
+ + \ No newline at end of file diff --git a/app/config/locale/templates/email-base.tpl b/app/config/locale/templates/email-base.tpl index f41a9530e1..13056fd5ae 100644 --- a/app/config/locale/templates/email-base.tpl +++ b/app/config/locale/templates/email-base.tpl @@ -1,5 +1,74 @@ + + + + + + @@ -8,13 +77,14 @@ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@500;600&display=swap" rel="stylesheet">