Compare commits

...
Author SHA1 Message Date
Matej Bačo 708b6279e0 upgrade lib 2025-03-25 23:38:44 +01:00
Matej Bačo 0295dfcc63 Fix function tsts 2025-03-25 23:07:56 +01:00
Matej BačoandGitHub 06f138b39d Merge branch 'feat-sites' into feat-bash-support 2025-03-25 22:50:18 +01:00
Matej Bačo 524ce8789f Upgrade libs 2025-03-25 21:01:28 +01:00
Matej Bačo 8db247c840 Update SDKs 2025-03-25 15:57:38 +01:00
Matej BačoandGitHub b11749c452 Merge pull request #9576 from appwrite/feat-add-logging-param-to-sites
Add logging param to sites
2025-03-25 15:55:22 +01:00
Khushboo Verma c38a5177dd Address PR comments 2025-03-25 20:02:29 +05:30
Khushboo Verma abae54f72c Update copy for logging 2025-03-25 19:49:57 +05:30
Khushboo Verma bf2b3b68e3 Add logging param to sites 2025-03-25 19:14:14 +05:30
Matej BačoandGitHub 11d2b06b67 Merge pull request #9570 from appwrite/feat-add-fallback-file-to-deployment
Add fallbackfile and adapter to deployments collection
2025-03-25 14:14:52 +01:00
Khushboo Verma fe94717196 Update tests 2025-03-25 18:31:14 +05:30
Matej Bačo 81b3e81d83 Add bash support 2025-03-25 10:57:32 +01:00
Khushboo Verma 9fd8c5ab9d Add fallbackfile and adapter to deployments collection 2025-03-24 20:04:02 +05:30
Matej Bačo 871e4b70f7 Upgrade Console 2025-03-24 12:32:44 +01:00
Matej Bačo 3e7cf6d60a Fix tests 2025-03-24 12:13:28 +01:00
Matej Bačo 0f182817ec Sync templates 2025-03-21 15:46:36 +01:00
Matej BačoandGitHub c323c227f9 Merge pull request #9549 from appwrite/fix-github-check-url
Fix GitHub check URL
2025-03-20 16:50:34 +01:00
Matej BačoandGitHub d72ba2a4b9 Merge pull request #9551 from appwrite/chore-code-readability-tasks-and-workers
Split params across multiple lines where overflowing
2025-03-20 16:50:01 +01:00
Matej BačoandGitHub ccb96d6525 Merge pull request #9550 from appwrite/chore-re-enable-commented-tests
Re-enable test
2025-03-20 16:49:16 +01:00
Matej Bačo 2dcebf3083 Add remaining changes after sync with 1.7.x 2025-03-20 16:48:09 +01:00
Matej Bačo cb85cfc5d9 Merge branch '1.7.x' into feat-sites 2025-03-20 16:42:36 +01:00
Matej Bačo 4aaa07d57b Merge branch '1.6.x' into 1.7.x 2025-03-20 16:41:18 +01:00
Matej BačoandGitHub d07b543e71 Merge pull request #9537 from appwrite/feat-latest-deployment-details
Feat: Latest deployment details
2025-03-20 16:40:04 +01:00
Matej Bačo 08b74007f7 Fix specs for console 2025-03-20 16:20:31 +01:00
Khushboo Verma 813424aa3c Split params across multiple lines where overflowing 2025-03-20 20:37:32 +05:30
Khushboo Verma e28333ed63 Re-enable test 2025-03-20 20:23:36 +05:30
Matej Bačo 172ebb5f7f Update specs 2025-03-20 15:51:15 +01:00
Matej Bačo 0f5480cbc0 Fix copy 2025-03-20 15:48:18 +01:00
Matej Bačo e34fc92c7c PR review changes 2025-03-20 15:44:15 +01:00
Matej Bačo bb01c9e9e9 Add latest deployment tests 2025-03-20 15:22:35 +01:00
Khushboo Verma ec6683cfa9 Refactor 2025-03-20 18:44:00 +05:30
Khushboo Verma c2d0aded6d Fix GitHub check URL 2025-03-20 18:04:36 +05:30
Jake BarnbyandGitHub 9345025ade Merge pull request #9546 from appwrite/feat-improve-maintenance
Use cursor pagination with bigger limit for maintenance project loop
2025-03-20 02:51:31 +00:00
Jake Barnby 31ca35782b Use cursor pagination with bigger limit for maintenance project loop 2025-03-20 15:21:24 +13:00
Christy JacobandGitHub 2505e25da8 Merge pull request #9430 from appwrite/updates-projects-regions
Remove default region
2025-03-19 22:36:30 +05:30
shimon 88d6150db2 revert 2025-03-19 10:29:18 +02:00
shimon faed019d92 revert 2025-03-19 09:32:48 +02:00
shimon b318c2cc08 Merge branch '1.6.x' of github.com:appwrite/appwrite into updates-projects-regions 2025-03-18 21:54:55 +02:00
shimon eb4340cf4c revert 2025-03-18 21:49:28 +02:00
shimon ee09e2c91b revert 2025-03-18 21:47:54 +02:00
shimon e6e7c5c816 revert 2025-03-18 21:44:34 +02:00
shimon e9841e53b9 revert 2025-03-18 21:40:46 +02:00
Eldad A. FuxandGitHub 7d86ce76d8 Merge pull request #9536 from appwrite/pla-2687
chore: set min operations to 1 for reads and writes
2025-03-18 16:30:52 +01:00
Matej Bačo e75441a097 Didn't mean to remove that 🎀 2025-03-18 15:46:28 +01:00
Matej Bačo ffb86ace38 Add latest info detail to site & function 2025-03-18 15:29:21 +01:00
Chirag Aggarwal aab8bca91e fix: logic 2025-03-18 14:20:25 +00:00
Matej BačoandGitHub 963760678c Merge pull request #9534 from appwrite/feat-active-deployment-details
Feat: Active deployment details - status, creation date
2025-03-18 15:03:06 +01:00
Chirag Aggarwal 70e27748be chore: set min operations to 1 for reads and writes 2025-03-18 12:52:41 +00:00
Jake BarnbyandGitHub 556e00b62b Merge pull request #9526 from appwrite/feat-disable-pdo-persist
Disable PDO persistence since we manage our own pool
2025-03-18 12:19:58 +00:00
Khushboo VermaandGitHub e95aeed56c Merge pull request #9535 from appwrite/fix-github-author-url
Fix incorrect URL for git commits
2025-03-18 17:39:37 +05:30
Matej Bačo 362520ff4a Remove active depoyment status (not relevant, always ready) 2025-03-18 12:56:44 +01:00
Khushboo Verma 1299fffdb2 Fix incorrect URL for git commits 2025-03-18 17:18:08 +05:30
Matej Bačo 7cade1a27d Add active deployment status and creation date 2025-03-18 12:44:21 +01:00
Matej BačoandGitHub 20d90e06f2 Merge pull request #9532 from appwrite/feat-site-deployment-details
Feat: Add screenshots to site
2025-03-18 12:16:55 +01:00
Matej Bačo ef163e8517 Add screenshots to site 2025-03-18 12:01:30 +01:00
Matej BačoandGitHub a0d4e4736c Merge pull request #9524 from appwrite/feat-deployment-total-size
Feat: totalSize attribute
2025-03-18 11:03:11 +01:00
Matej Bačo 3f1c4c2095 Add per-framework screenshot sleep 2025-03-18 11:02:32 +01:00
Christy JacobandGitHub 370a8e231c Merge pull request #9530 from appwrite/PLA-2662
feat: add pool telemetry
2025-03-18 14:44:52 +05:30
Matej Bačo 83bcad6e17 Fix deployment rule deletion 2025-03-18 10:10:16 +01:00
Fabian Gruber aa5ea7f3a1 feat: add pool telemetry 2025-03-18 10:01:06 +01:00
Jake BarnbyandGitHub 8a77eaf2bb Merge pull request #9529 from appwrite/feat-migration-read-db
Migration read from db
2025-03-18 08:01:07 +00:00
Jake Barnby fe308b4f1f Update lib 2025-03-18 20:49:19 +13:00
Jake Barnby e43a3109eb Update migration lib 2025-03-18 20:05:12 +13:00
Jake Barnby d9fbe9658d Merge branch '1.6.x' into feat-migration-read-db 2025-03-18 20:04:23 +13:00
Jake BarnbyandGitHub 1e2f5bcb84 Merge branch '1.6.x' into feat-disable-pdo-persist 2025-03-18 07:02:54 +00:00
Christy JacobandGitHub 088d0998cd Merge pull request #9514 from appwrite/feat-domains-count
Feat: domains count
2025-03-18 11:03:45 +05:30
Jake Barnby a7165e6a32 Disable PDO persistence since we manage our own pool 2025-03-18 16:51:00 +13:00
Matej Bačo fd4b43569b Enable CodeRabbit for feat-sites 2025-03-17 17:48:33 +01:00
Matej Bačo b4536a94e0 Introduce dpeloyment totalSize + tests 2025-03-17 17:35:03 +01:00
shimon e5261e7d70 _app_region 2025-03-17 18:31:14 +02:00
shimon 60912cb084 _app_region 2025-03-17 18:14:58 +02:00
shimon 7149deeacb _app_region 2025-03-17 18:11:49 +02:00
shimon 59f613f9bb _app_region 2025-03-17 17:33:48 +02:00
shimon 8184bc8c78 _app_region 2025-03-17 17:31:24 +02:00
Matej BačoandGitHub 6c193f4862 Merge pull request #9522 from appwrite/fix-frameworks-response
Fix: Response model for framework (adapters)
2025-03-17 16:20:47 +01:00
Matej Bačo 23b245e058 Leftover 2025-03-17 16:03:52 +01:00
Matej Bačo ae5267cda7 Fix response model for adapters (frameworks) 2025-03-17 16:02:16 +01:00
Matej BačoandGitHub f1b5807174 Merge pull request #9519 from appwrite/fix-realtime-deployments
Fix: Realtime events in build worker
2025-03-17 15:30:54 +01:00
Matej Bačo 6e77221da0 Fix CI/CD preps 2025-03-17 14:25:29 +01:00
Matej Bačo 4de935a322 Fix CI/CD flaky test 2025-03-17 14:16:31 +01:00
Matej Bačo 86b66d70bf Debug CI/CD 2025-03-17 14:07:27 +01:00
Matej Bačo 828b9349c3 Improve build worker realtime, new tests 2025-03-17 13:21:36 +01:00
shimon 9cb860d446 _app_region 2025-03-17 13:52:17 +02:00
Matej Bačo 313a6b0f7e Fix bug in usage test 2025-03-17 12:29:44 +01:00
shimon 6eff011100 Merge branch '1.6.x' of github.com:appwrite/appwrite into updates-projects-regions
# Conflicts:
#	app/views/install/compose.phtml
2025-03-17 13:29:22 +02:00
Matej Bačo 04140c2acc Fix crashing init 2025-03-17 12:08:01 +01:00
Matej Bačo 0f961f0d04 Fix composer conflict 2025-03-17 11:55:14 +01:00
Matej Bačo 25f7741d3c Linter fix 2025-03-17 11:53:23 +01:00
Matej Bačo 2ff339dad4 Re-implement init changes 2025-03-17 11:53:09 +01:00
Matej Bačo 91dd4c9c6f Merge branch '1.7.x' into feat-sites 2025-03-17 11:47:22 +01:00
Matej Bačo 8413909b12 Merge branch '1.6.x' into 1.7.x 2025-03-17 11:42:30 +01:00
Matej Bačo a4d4b6ffb5 Fix tests 2025-03-17 11:41:02 +01:00
Matej Bačo cbdd344490 Remove framework env var 2025-03-17 11:21:52 +01:00
Damodar LohaniandGitHub 8fd877810d Merge branch '1.6.x' into feat-domains-count 2025-03-17 12:49:59 +05:45
Jake Barnby 04711d8c02 Add doc 2025-03-17 19:21:31 +13:00
Eldad A. FuxandGitHub 5a5d43f3d0 Merge pull request #9515 from appwrite/feat-env-to-system
Feat env vars to system lib
2025-03-16 17:09:47 +01:00
Eldad A. FuxandGitHub 3e462ded0a Merge pull request #9408 from appwrite/feat-dynamic-regions
Feat dynamic regions
2025-03-16 17:05:04 +01:00
Eldad Fux de96b2511a Merge remote-tracking branch 'origin/1.6.x' into feat-dynamic-regions 2025-03-16 16:31:09 +01:00
Eldad Fux 90899b92e3 Change envs to system lib 2025-03-16 10:36:32 +01:00
Damodar Lohani 4eece99768 Feat: domains count 2025-03-16 02:35:10 +00:00
Eldad A. FuxandGitHub 971a4b8f30 Merge pull request #9511 from appwrite/feat-eldad-cleanups
Cleanups
2025-03-15 19:15:32 +01:00
Eldad Fux 418185b914 fixed format 2025-03-15 14:43:51 +01:00
Eldad Fux 167011ce87 Fixed timelimit 2025-03-15 14:38:01 +01:00
Eldad Fux 3d69a35d5a Fixed tests 2025-03-15 14:32:18 +01:00
Eldad Fux aac90ea8b8 Fixed format 2025-03-15 14:17:47 +01:00
Eldad Fux 56aa503146 Fixed paths 2025-03-15 13:57:12 +01:00
Eldad Fux 875a60fe07 fixed paths 2025-03-15 13:53:00 +01:00
Eldad Fux 3427755695 Merge remote-tracking branch 'origin/1.6.x' into feat-eldad-cleanups 2025-03-15 13:45:31 +01:00
Jake BarnbyandGitHub 68238193d2 Merge pull request #9512 from appwrite/feat-improve-ordering
Improve delete ordering
2025-03-16 01:34:02 +13:00
Eldad Fux 07926534bf Fixed namespace 2025-03-15 13:24:56 +01:00
Eldad Fux a2a0a1405f plurals 2025-03-15 13:23:02 +01:00
Eldad Fux 195edd19ac wip 2025-03-15 13:18:34 +01:00
Eldad Fux 6cf333141c Merge remote-tracking branch 'origin/1.6.x' into feat-eldad-cleanups 2025-03-15 13:18:30 +01:00
Jake Barnby 12dbb1d50d Reapply "Improve deletes queries"
This reverts commit 9dff192508.
2025-03-16 01:02:44 +13:00
Jake Barnby 9dff192508 Revert "Improve deletes queries"
This reverts commit 650627bfb4.
2025-03-16 01:02:41 +13:00
Jake Barnby 650627bfb4 Improve deletes queries 2025-03-16 01:01:13 +13:00
Eldad Fux 4016895b8f Fixed DB test 2025-03-15 12:58:41 +01:00
Eldad Fux 3b7aea22c2 Fixed test 2025-03-15 12:42:34 +01:00
Eldad Fux 50fe0bf98d Code review fix 2025-03-15 12:39:15 +01:00
Eldad Fux 4f0a7de868 Fixes 2025-03-15 12:34:49 +01:00
Eldad Fux 1933e48d9c Cleanups 2025-03-15 12:00:36 +01:00
Steven NguyenandGitHub 90228a5ffb Merge pull request #9294 from appwrite/feat-1.6.1-release-prep
Prepare 1.6.1 release
2025-03-14 16:38:55 -07:00
Steven NguyenandGitHub 063c2be38f Merge pull request #9495 from appwrite/chore-bump-console-5.2.53
Bump console to version 5.2.53
2025-03-14 16:35:22 -07:00
Steven NguyenandGitHub ff9845c9b9 Merge pull request #9496 from appwrite/main
Sync main into 1.6.x
2025-03-14 16:35:01 -07:00
Steven NguyenandGitHub bd5bfc04ef Merge pull request #9466 from appwrite/fix-certificates-in-deletes
Fix certificates in deletes worker
2025-03-14 16:34:21 -07:00
Matej Bačo 7a131d3508 Post-merge fixes 2025-03-14 13:56:37 +01:00
Matej Bačo d77dbebe8b Merge branch '1.7.x' into feat-sites 2025-03-14 13:53:34 +01:00
Matej Bačo 8eadaec676 Merge branch '1.6.x' into 1.7.x 2025-03-14 13:50:53 +01:00
Matej BačoandGitHub c55030387f Merge pull request #9508 from appwrite/feat-rules-improvements
Feat: Add rule attributes
2025-03-14 13:35:05 +01:00
Matej Bačo 5f2512dc4f code quality improvement 2025-03-14 12:07:38 +01:00
Matej Bačo f6fc425c98 Add rule attributes 2025-03-14 09:37:44 +01:00
Jake BarnbyandGitHub 810d650aba Merge pull request #9507 from appwrite/feat-improve-delete-queries
Feat improve delete queries
2025-03-14 18:37:56 +13:00
Jake Barnby 817a3808e5 Add 5 min timeout for workers and tasks DBs 2025-03-14 16:40:57 +13:00
Jake Barnby d96910138f Update lock 2025-03-14 15:40:05 +13:00
Jake Barnby b8673ac07f Merge remote-tracking branch 'origin/1.6.x' into feat-improve-delete-queries
# Conflicts:
#	composer.lock
2025-03-14 15:34:18 +13:00
Jake Barnby 246c8ce939 Add order on inequality queries 2025-03-14 15:29:52 +13:00
Jake Barnby 49d89a4206 Force clear timeout to ensure it's not set 2025-03-14 15:29:23 +13:00
Matej Bačo ba45c191c5 Updat console 2025-03-13 16:20:36 +01:00
Matej Bačo 74f9464c18 Fix site specs for vcs deployment 2025-03-13 15:39:41 +01:00
Matej Bačo c5dfabdb7c Fix commit deployments, allow for sites 2025-03-13 15:38:29 +01:00
Matej BačoandGitHub bfdd2b65dc Merge pull request #9504 from appwrite/fix-github-comment
Fix github comment
2025-03-13 15:17:13 +01:00
Khushboo Verma 8a4c5bec27 Revert /deployments from function logs 2025-03-13 18:58:56 +05:30
Christy JacobandGitHub 2c803b262c Merge pull request #9505 from appwrite/PLA-2640
update queue to 0.9.*
2025-03-13 18:51:41 +05:30
Matej Bačo 9bc793b216 Fix realtime tests 2025-03-13 14:08:14 +01:00
Fabian Gruber fcf15689e8 update queue to 0.9.* 2025-03-13 14:02:32 +01:00
Khushboo Verma 97acbd42ba Fix github comment 2025-03-13 17:58:05 +05:30
Christy JacobandGitHub aef38aa114 Merge pull request #9414 from appwrite/bump-sdk
chore: bump sdk
2025-03-13 17:29:56 +05:30
Matej Bačo 79e066a4d7 Post-merge fixes 2025-03-13 12:04:20 +01:00
Matej Bačo 725dff7f0f Merge branch '1.7.x' into feat-sites 2025-03-13 11:41:28 +01:00
Matej Bačo 358e096301 Merge branch '1.6.x' into 1.7.x 2025-03-13 11:34:14 +01:00
Matej Bačo 74c050ffb6 Improve tests 2025-03-13 11:19:55 +01:00
Matej Bačo 8376b176cb Support commit type 2025-03-13 11:17:10 +01:00
Matej Bačo 69ed3bb776 New deployment status while queued 2025-03-13 10:53:25 +01:00
Matej Bačo 262b2e6cff Fix error messag coloring 2025-03-13 10:53:15 +01:00
Matej Bačo acb9548e85 Fix preview deicison-maker; speed-up tests 2025-03-13 10:33:28 +01:00
Matej Bačo ee1ee7ecfe Fix ping 5xx error 2025-03-13 10:20:45 +01:00
Matej BačoandGitHub b14d76af0d Merge pull request #9500 from appwrite/chore-improve-readability
Improve params readability
2025-03-13 09:56:11 +01:00
Khushboo Verma f2ba319e6e Improve params readability 2025-03-13 12:16:17 +05:30
Chirag AggarwalandGitHub d81f2f8b5c Merge branch '1.6.x' into bump-sdk 2025-03-13 11:01:14 +05:30
Chirag Aggarwal e119bf6777 chore: update changelogs 2025-03-13 05:30:09 +00:00
Steven NguyenandGitHub 6e0c8724ce Merge pull request #9498 from appwrite/chore-regenerate-examples
Regenerate examples
2025-03-12 22:05:52 -07:00
Steven NguyenandGitHub 8f6d45b207 Merge pull request #9497 from appwrite/chore-regenerate-specs
Regenerate specs
2025-03-12 21:49:16 -07:00
Chirag AggarwalandGitHub 1d53cb41de Merge branch '1.6.x' into chore-regenerate-examples 2025-03-13 10:07:50 +05:30
Chirag AggarwalandGitHub dc073b8298 Merge branch '1.6.x' into chore-regenerate-specs 2025-03-13 10:07:13 +05:30
Steven NguyenandGitHub 8c3aebf735 Merge pull request #9499 from appwrite/feat-1.6.2-release-prep
Prepare 1.6.2 release
2025-03-12 21:26:09 -07:00
Jake BarnbyandGitHub b0d6ffa582 Merge pull request #9487 from appwrite/feat-bulk-audit-delete
Feat bulk audit delete
2025-03-13 12:53:57 +13:00
Steven Nguyen 556f7338c1 Bump appwrite version to 1.6.2 2025-03-12 15:52:29 -07:00
Steven Nguyen 301471354e chore: regenerated 1.6.x examples
To ensure we didn't have anything extra, I deleted the 1.6.x folder and
then regenerated the examples via the sdk command.
2025-03-12 15:45:40 -07:00
Steven Nguyen 5bce1e17cb chore: regenerate latest and 1.6.x specs 2025-03-12 15:34:38 -07:00
Steven Nguyen 7402145c9d Bump console to version 5.2.53 2025-03-12 15:22:43 -07:00
Damodar LohaniandGitHub 4b1e4008a9 Merge pull request #9494 from appwrite/fix-delete-usage-stats
chore: update initializing dbForLogs
2025-03-12 18:24:15 +05:45
Matej Bačo f1877476d0 Upgrade console 2025-03-12 13:36:16 +01:00
Chirag Aggarwal 46693faa67 chore: prevent console project to queue for delete stats 2025-03-12 12:35:56 +00:00
Matej BačoandGitHub 75b3e78098 Merge pull request #9492 from appwrite/chore-add-invalid-ssr-site-test
Throw build error for adapter mismatch
2025-03-12 13:10:27 +01:00
Matej Bačo 82e16e6d9e Merge branch 'feat-sites' of github.com:appwrite/appwrite into feat-sites 2025-03-12 13:07:37 +01:00
Matej Bačo 63710e8ff8 Fix response filter version 2025-03-12 13:07:15 +01:00
Chirag Aggarwal ae00a69592 chore: update initializing dbForLogs 2025-03-12 11:58:06 +00:00
Khushboo Verma 794329be82 Updated check 2025-03-12 17:25:39 +05:30
Khushboo Verma 5549cd8900 Merge branch 'feat-sites' into chore-add-invalid-ssr-site-test 2025-03-12 17:16:03 +05:30
Matej BačoandGitHub a840d9de20 Merge pull request #9490 from appwrite/chore-avoid-repetition-in-workers
Avoid code repetition in workers and tasks
2025-03-12 12:40:29 +01:00
Matej Bačo 1a90c8aab5 Add Vite framework 2025-03-12 12:39:33 +01:00
Matej Bačo 7f2fdf623c Update specs 2025-03-12 12:27:15 +01:00
Khushboo Verma 39699d16ba Simplify callback syntax in tasks 2025-03-12 16:55:48 +05:30
Matej BačoandGitHub 8f391db39a Merge pull request #9484 from appwrite/chore-attribute-conistency
Chore: Attribute name consistency
2025-03-12 12:23:56 +01:00
Khushboo Verma 2f9802afa2 Use empty check 2025-03-12 16:50:20 +05:30
Khushboo Verma 3af1910cf9 Throw build error for adapter mismatch 2025-03-12 16:43:46 +05:30
Matej Bačo 796a845bcf Setup request & response filters 2025-03-12 12:10:10 +01:00
Matej BačoandGitHub 56736a79e2 Merge pull request #9485 from appwrite/feat-opr-v5
Feat: OPR v5
2025-03-12 11:44:07 +01:00
Damodar LohaniandGitHub 7f76bfed11 Merge pull request #9491 from appwrite/feat-add-timings-to-stats-resources
Feat: calculate and log time taken for each project
2025-03-12 16:28:11 +05:45
Matej Bačo 536319b440 PR review changes 2025-03-12 11:32:43 +01:00
Damodar Lohani 81159e82d5 show time in seconds 2025-03-12 10:29:07 +00:00
Chirag Aggarwal 74f4ebf90e chore: update sdk generator 2025-03-12 10:26:01 +00:00
Damodar Lohani 5c25b58351 Fix date format 2025-03-12 10:19:55 +00:00
Matej Bačo ea35b6226d Fix flutter screenshots 2025-03-12 11:16:55 +01:00
Damodar Lohani d77940d22f Feat: calculate and log time taken for each project 2025-03-12 10:00:07 +00:00
Khushboo Verma 42cd1df77d Remove duplication from workers 2025-03-12 15:24:52 +05:30
Jake Barnby 2052fb975b Use bulk deletes for audit cleanup 2025-03-12 16:53:08 +13:00
Matej Bačo 994e2faa42 OPR v5 + Flutter starter 2025-03-11 18:19:25 +01:00
Matej Bačo ba26dd6df5 Apply consistency of attributes 2025-03-11 16:26:49 +01:00
Matej BačoandGitHub 0170b4c9e8 Merge pull request #9483 from appwrite/chore-add-template-tests-to-sites
Add get and list template tests for sites
2025-03-11 14:56:24 +01:00
Matej Bačo ab7041d653 Merge branch 'feat-sites' into chore-add-template-tests-to-sites 2025-03-11 14:17:40 +01:00
Matej Bačo 1a56be197c Fix failing tests 2025-03-11 14:17:23 +01:00
Matej Bačo b79b320414 Tempaltes: Fix react native, add Angular 2025-03-11 14:16:27 +01:00
Khushboo Verma 1b04ae6d96 Add get and list template tests for sites 2025-03-11 17:21:28 +05:30
Matej Bačo 95e96b3bfb Fix missing deployment domains 2025-03-11 11:53:26 +01:00
Matej Bačo 18e4be2eab Add JS template 2025-03-11 11:49:31 +01:00
Matej Bačo 7f05a74b31 Increase rate limit for 0.5s debounce in UI 2025-03-11 10:27:08 +01:00
Matej Bačo 733c5ad97d Add enforced minimal specs 2025-03-11 10:24:18 +01:00
Matej Bačo 71b56fc504 Remove log/execution search 2025-03-11 10:22:28 +01:00
shimon d6e53d8e2e Merge branch '1.6.x' of github.com:appwrite/appwrite into updates-projects-regions 2025-03-11 11:17:18 +02:00
Matej Bačo 62eb159e6a Merge branch 'feat-sites' of github.com:appwrite/appwrite into feat-sites 2025-03-11 10:08:47 +01:00
Christy JacobandGitHub d4dd7fb757 Merge pull request #9462 from appwrite/pla-2550
chore: added logsdb for deletes worker
2025-03-11 14:30:40 +05:30
Matej Bačo f61db29498 Rename config to follow folder pattern 2025-03-11 09:50:02 +01:00
Christy JacobandGitHub 1971126e7b Merge pull request #9481 from appwrite/audits-timestamp-update
Update audit timestamp origin
2025-03-11 14:16:53 +05:30
Matej BačoandGitHub d8418a222c Merge pull request #9433 from appwrite/chore-truncate-git-commit-message
Truncate commit message to 252 characters
2025-03-11 09:42:21 +01:00
shimon 141f0fc376 linter 2025-03-11 10:27:23 +02:00
shimon b387823d63 Update audit timestamp origin 2025-03-11 09:17:28 +02:00
Chirag Aggarwal e3f59c696d bump: python version 2025-03-11 05:43:30 +00:00
Chirag Aggarwal 107a185953 Merge branch '1.6.x' into bump-sdk 2025-03-11 05:30:47 +00:00
Christy JacobandGitHub acf86e47e2 Merge pull request #9479 from appwrite/pla-2567
chore: queue console project for maintenance delete
2025-03-10 22:40:26 +05:30
Matej Bačo 63c7f4c8bc Fix remix detection false postive 2025-03-10 15:33:11 +01:00
Matej Bačo b11ad4b1c9 Fix a bug 2025-03-10 15:16:47 +01:00
Matej Bačo 93510d170e Quality fixes 2025-03-10 14:53:44 +01:00
Matej Bačo be3d18ab41 Fix test 2025-03-10 12:56:20 +01:00
Matej Bačo efc5b9e353 Add frameworks 2025-03-10 12:32:12 +01:00
Chirag Aggarwal 61377ceb6e chore: shift initialization of console project to config 2025-03-10 10:48:44 +00:00
Chirag Aggarwal 6a6d99a9d0 chore: queue console project for maintenance delete 2025-03-10 08:54:20 +00:00
Jake BarnbyandGitHub 078f953e32 Merge pull request #9467 from appwrite/fix-logging-config
Fix logging config
2025-03-10 14:10:41 +13:00
Matej Bačo d86cf7b437 Fix 5xx error on authroization 2025-03-09 18:51:49 +01:00
Matej Bačo aabee0ac37 Fix order of site commands 2025-03-09 16:15:08 +01:00
Matej Bačo 4e1168654d Fix tests 2025-03-09 15:42:17 +01:00
Matej Bačo 254018071a Fix tests; upgrade console 2025-03-09 15:33:06 +01:00
Matej Bačo e904ab6232 Fix path issue 2025-03-09 15:07:25 +01:00
Matej Bačo fed6cefa81 Fix cors issues 2025-03-09 14:50:45 +01:00
Matej Bačo 640f09c49b Fix specs 2025-03-09 13:57:19 +01:00
Matej Bačo 06bb001d0b Improve enums 2025-03-09 00:35:55 +01:00
Matej Bačo 3730ff4895 Fix SDK generation 2025-03-09 00:19:54 +01:00
Matej Bačo 05771c46d6 Update specs 2025-03-09 00:02:39 +01:00
Matej BačoandGitHub 4ff0b6283a Merge pull request #9474 from appwrite/fix-sites-tests
Fix: site tests
2025-03-08 23:57:59 +01:00
Matej Bačo 852a16d01b Remove leftovers 2025-03-08 23:34:37 +01:00
Matej Bačo 084b6c799a Revert "Simplify tests further"
This reverts commit 7e460f6155.
2025-03-08 23:33:37 +01:00
Matej Bačo eddeac6e4f Revert temp changes 2025-03-08 23:33:33 +01:00
Matej Bačo 874f60dce6 Upgrade detection lib 2025-03-08 23:26:25 +01:00
Matej Bačo d21814c51f Improve logs 2025-03-08 23:04:32 +01:00
Matej Bačo 65bcf7898e Improve CI/CD logs 2025-03-08 22:56:16 +01:00
Matej Bačo 7e460f6155 Simplify tests further 2025-03-08 22:43:35 +01:00
Matej Bačo 1a271ff272 Temporarly simplify CI/CD 2025-03-08 22:26:04 +01:00
Matej Bačo 5963631c70 Fix site tests 2025-03-08 22:25:52 +01:00
Matej BačoandGitHub 0fa5460a7e Merge pull request #9461 from appwrite/chore-rules-rehaul
Chore: 2nd rules rehaul
2025-03-08 21:52:47 +01:00
Matej Bačo 12e3d70032 Post-merge fixes 2025-03-08 21:33:43 +01:00
Matej Bačo 5f766f6a13 Merge branch 'feat-sites' into chore-rules-rehaul 2025-03-08 21:33:13 +01:00
Matej BačoandGitHub 7d27ceef43 Merge pull request #9315 from appwrite/feat-add-detection-logic
Integrate detection library with Appwrite
2025-03-08 21:30:19 +01:00
Matej BačoandGitHub 9c3cfc4f83 Merge pull request #9357 from appwrite/feat-authroized-previews
Feat: Authorized previews
2025-03-08 21:04:25 +01:00
Matej BačoandGitHub b4d366eea1 Merge pull request #9457 from appwrite/chore-remove-builds-collection
Chore Remove builds collection
2025-03-08 20:45:10 +01:00
Matej Bačo 8a4954d4e8 PR review changes 2025-03-08 20:44:54 +01:00
Matej Bačo 1943e00e40 Fix tests 2025-03-08 19:58:54 +01:00
Matej Bačo f75acfa503 Remove deploymentUpdatePolicy, add trigger 2025-03-08 19:19:05 +01:00
Matej Bačo b69c40345f Improve docs 2025-03-08 18:45:38 +01:00
Matej Bačo 83dd6a9897 FIx tests 2025-03-08 18:39:13 +01:00
Matej Bačo 75f543c6b0 Upgrade lib version 2025-03-08 18:01:50 +01:00
Matej Bačo 232f99c6c9 Finalize PR, review changes, fix tests 2025-03-08 16:50:39 +01:00
Matej Bačo faa1b0a59b Merge branch 'feat-sites' into feat-add-detection-logic 2025-03-08 14:58:49 +01:00
Matej Bačo fe210e0cf0 Merge branch 'feat-sites' into feat-authroized-previews 2025-03-08 13:04:00 +01:00
Matej Bačo f85bf337b7 Migrate authorize endpoint to http lib 2025-03-08 13:03:23 +01:00
Matej Bačo 06020e2b62 Add preview auth tests, finish todos, improve quality 2025-03-08 12:57:55 +01:00
Matej BačoandGitHub 8ff4d60dbb Merge pull request #9469 from appwrite/feat-site-specifications
Feat: Merge specs
2025-03-08 10:58:49 +01:00
Matej Bačo 43cd7ac8b3 Linter fix 2025-03-07 23:45:19 +01:00
Matej Bačo 393c4012d9 Merge branch 'feat-sites' into feat-authroized-previews 2025-03-07 23:44:52 +01:00
Matej Bačo c6a862a0a3 Specifications test, fix failures 2025-03-07 23:17:15 +01:00
Matej Bačo 1d983a949e Merge site & function specs 2025-03-07 22:36:13 +01:00
Steven Nguyen 59a8172e96 fix: prevent "Failed to initialize logging provider" errors
If the _APP_EXPERIMENT_LOGGING_CONFIG env var isn't set, every 4XX error
outputs this warning:

Failed to initialize logging provider: Unable to parse DSN: scheme is
required

To reduce this unnecessary clutter when _APP_EXPERIMENT_LOGGING_CONFIG
isn't set, this PR adds a check to only attempt to initialize the
logging provider if the env var is set.
2025-03-07 12:59:11 -08:00
Steven Nguyen 0fbd2c6425 fix: prevent warning if no logging config is set
If no logging config is set, there's a warning saying:

> Using deprecated logging configuration.

However, if they didn't set any config, it's not deprecated.
2025-03-07 12:54:53 -08:00
Steven Nguyen f6b5deda6d fix: add missing _APP_EMAIL_CERTIFICATES env var to deletes worker
The deletes worker uses the certificates resource to delete
certificates, but the certificates resource requires the
_APP_EMAIL_CERTIFICATES env var to be set or it will throw an exception
and not process any delete jobs. This commit adds the missing env var
to the deletes worker.

Also add _APP_SYSTEM_SECURITY_EMAIL_ADDRESS as a fallback.
2025-03-07 12:46:14 -08:00
Matej Bačo 5e30fc5350 Fix graphQL test 2025-03-07 21:20:37 +01:00
Matej Bačo a5457da91c Linter fix 2025-03-07 21:12:13 +01:00
Matej Bačo a37a6d9d7c Merge branch 'feat-sites' into chore-remove-builds-collection 2025-03-07 21:05:15 +01:00
Matej Bačo c1ee2f2b41 Failing test fixes 2025-03-07 21:04:24 +01:00
Matej Bačo 6a584c83c1 Attribute renaming 2025-03-07 20:14:11 +01:00
Matej Bačo 777fb3fcdd Update proxy rule tests 2025-03-07 18:00:20 +01:00
Matej BačoandGitHub 6ea20659e6 Merge branch 'feat-sites' into chore-rules-rehaul 2025-03-07 17:34:37 +01:00
Matej BačoandGitHub dade177af2 Merge pull request #9463 from appwrite/feat-reuse-node
Feat: Reuse Node runtime
2025-03-07 16:03:56 +01:00
Matej Bačo 97ffbbc44b Remove need for ssr runtime 2025-03-07 15:46:49 +01:00
Chirag Aggarwal 493f536a6e chore: added logsdb for deletes worker 2025-03-07 14:04:52 +00:00
Chirag Aggarwal d9fc6b70ad chore: bump react native 2025-03-07 13:18:20 +00:00
Christy JacobandGitHub 3af7f0aa3d Merge pull request #9412 from appwrite/chore-bump-cache-0.12.x
chore: bump cache 0.12.x
2025-03-07 17:31:20 +05:30
loks0n b791e59672 chore: bump composer 2025-03-07 10:59:16 +00:00
loks0n c50a0de627 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into chore-bump-cache-0.12.x 2025-03-07 10:58:31 +00:00
Matej Bačo f07c351c94 Linter fix 2025-03-07 11:22:13 +01:00
Matej Bačo a42522feaa Fix test failures 2025-03-07 11:11:32 +01:00
Matej Bačo 9400fdbbe5 Leftover bugs after rework 2025-03-07 10:43:54 +01:00
Matej Bačo 92b696ea21 Introduce type-relevant attributes to rules 2025-03-07 10:14:45 +01:00
Chirag Aggarwal a0605b14cb chore: regen specs and update vers 2025-03-07 04:14:45 +00:00
Matej Bačo 50ec55d595 Fix site tests 2025-03-06 18:35:57 +01:00
Matej Bačo a7fc8cf84b Fix functions 2025-03-06 18:17:01 +01:00
Chirag Aggarwal 6c652ba3ae Merge branch '1.6.x' into bump-sdk 2025-03-06 17:04:05 +00:00
Matej Bačo 794c6536fb Fixbugs 2025-03-06 17:55:53 +01:00
Matej Bačo 2e30c1ba1f Reapply "Remove builds collection"
This reverts commit 654d178cf2.
2025-03-06 15:34:06 +01:00
Matej Bačo 654d178cf2 Revert "Remove builds collection"
This reverts commit 02e740f8b0.
2025-03-06 15:33:48 +01:00
Matej Bačo 02e740f8b0 Remove builds collection 2025-03-06 15:32:23 +01:00
Matej BačoandGitHub 62b639ce48 Merge pull request #9455 from appwrite/chore-migrate-cancel-deployment-endpoint
Chore: Move cancel build to update deployment status
2025-03-06 14:04:35 +01:00
Matej Bačo 825e9639b1 Move cancel build to deployment endpoint 2025-03-06 12:20:08 +01:00
Matej Bačo 9a8a2b5a49 Upgrade http lib 2025-03-06 09:32:05 +01:00
Matej BačoandGitHub 4428ed1f7d Merge pull request #9445 from appwrite/chore-rename-redeploy-endpoint
Chore: Migrate redeploy endpoint
2025-03-06 09:29:38 +01:00
Christy JacobandGitHub 205024657a Merge pull request #9438 from appwrite/activities-multi-writes
Activities batch writes
2025-03-06 11:40:34 +05:30
Steven NguyenandGitHub fab43a5f83 Merge pull request #9447 from appwrite/pla-2607
Fix blocking of phone sessions when disabled on console
2025-03-05 11:13:40 -08:00
Chirag Aggarwal 36b0475298 chore: update tests 2025-03-05 18:40:41 +00:00
Chirag Aggarwal 0ce4555f70 chore: added auth group to create phone token 2025-03-05 17:42:43 +00:00
Khushboo Verma de5f33f206 keep truncation only during create document 2025-03-05 22:45:48 +05:30
Khushboo Verma 9a44e8130f Add tests for framework, runtime and rendering detection 2025-03-05 22:35:49 +05:30
Matej Bačo 2f3c43d0db Fix failing tests 2025-03-05 13:00:06 +01:00
Matej Bačo 77d27bdd20 Post-merge formatting 2025-03-05 12:33:32 +01:00
Matej Bačo 87a9d72523 Merge branch 'feat-sites' into chore-rename-redeploy-endpoint 2025-03-05 12:33:17 +01:00
Matej Bačo f6674f07e4 Add redeploy tests 2025-03-05 12:29:27 +01:00
Matej Bačo 049ad14121 Fix tests 2025-03-05 11:47:51 +01:00
Matej Bačo a0a82b86dc Migrate redeploy endpoint 2025-03-05 11:29:43 +01:00
Matej BačoandGitHub 326e62334f Merge pull request #9436 from appwrite/chore-rename-activate-endpoint
Chore: Rename deployment activate endpoint
2025-03-05 11:26:00 +01:00
Matej Bačo b29b5da006 Improve code quality 2025-03-05 10:48:26 +01:00
Matej Bačo 46039ded2f Fix rule updating 2025-03-05 10:35:01 +01:00
Matej Bačo dfce78c421 Merge branch 'feat-sites' into chore-rename-activate-endpoint 2025-03-05 10:01:54 +01:00
Matej Bačo ce3bff13dd upgrade http lib 2025-03-05 10:01:50 +01:00
Matej BačoandGitHub a031682596 Merge pull request #9432 from appwrite/chore-add-resource-type-to-sites
Add resource type label in sites endpoints
2025-03-05 09:35:30 +01:00
Khushboo Verma 9b8dd02a88 Don't throw exception from list repos detection 2025-03-05 13:48:44 +05:30
Khushboo Verma bbf37e0a0e Update length to 255 2025-03-05 13:40:15 +05:30
Christy JacobandGitHub a734cadba1 Merge pull request #9443 from appwrite/feat-database-storage-in-stats-resources
Feat: calculate database storage in stats-resources
2025-03-05 12:06:56 +05:30
Khushboo Verma 826b034cd2 Re-add files deleted by mistake 2025-03-05 11:46:31 +05:30
Khushboo Verma 9ee9a8e0ed Resolve merge conflicts 2025-03-05 11:38:28 +05:30
Damodar Lohani 2afb8a14ac Skip in dual writing 2025-03-05 05:27:56 +00:00
Damodar Lohani 6024d01e7b Feat: calculate database storage in stats-resources
- Calculate database storage in stats-resources worker
2025-03-05 05:25:50 +00:00
Christy JacobandGitHub f250f454f7 Merge pull request #9442 from appwrite/fix-model-image-trans
fix: model for image transformations in usage project
2025-03-05 10:21:05 +05:30
Chirag Aggarwal 2c6f731a38 fix: description 2025-03-05 04:49:34 +00:00
Chirag Aggarwal 1d2883f472 chore: fix model for image transformations in usage project 2025-03-05 04:46:06 +00:00
Jake BarnbyandGitHub 8c1a1604a8 Merge pull request #9387 from appwrite/pla-2526
chore: make min/max params optional for attribute update
2025-03-05 16:13:59 +13:00
Jake BarnbyandGitHub ea2fd4b995 Merge pull request #9426 from appwrite/pla-2584
chore: added timeout to deployment builds in tests
2025-03-05 16:11:47 +13:00
Matej Bačo dfc2e87170 Upgrade http library 2025-03-04 21:56:51 +01:00
shimon f2ad3a501e updating audits workers var scope 2025-03-04 20:34:56 +02:00
shimon c443c8fdab updating audits workers var scope 2025-03-04 19:49:37 +02:00
shimon 1838b9c4e8 updating audits workers var scope 2025-03-04 19:49:10 +02:00
shimon 09aa383cf3 updating audits workers var scope 2025-03-04 19:15:00 +02:00
shimon ce054e7088 updating audits workers var scope 2025-03-04 19:12:20 +02:00
shimon 76dc8c29d5 updating audits workers var scope 2025-03-04 19:07:45 +02:00
shimon f761829d60 updating audits workers var scope 2025-03-04 18:49:31 +02:00
shimon 8b4bc7e4a6 updating audits workers var scope 2025-03-04 18:19:23 +02:00
Matej Bačo 520b96f0d9 Finish tests 2025-03-04 16:12:57 +01:00
Matej Bačo ea30d976a8 Fix wrong path, implement tests 2025-03-04 16:04:37 +01:00
Matej Bačo 9b8e4dd862 Rename active deployment path 2025-03-04 15:22:20 +01:00
Matej Bačo ef7b9537f7 Upgrade executor 2025-03-04 15:17:01 +01:00
Matej BačoandGitHub 03c9e57773 Merge pull request #9434 from appwrite/chore-combine-download-endpoints
Chore: Combine download endpoints
2025-03-04 15:10:24 +01:00
Matej Bačo 54413f4c5e Fix bug 2025-03-04 14:31:00 +01:00
Matej Bačo a2abd982cf Backwards compatibility 2025-03-04 14:13:47 +01:00
Matej BačoandGitHub f5a0008445 Merge pull request #9417 from appwrite/feat-screenshot-task
Feat: Screenshot task for templates
2025-03-04 13:56:59 +01:00
Matej Bačo 64183f2946 Fix tests, remove leftovers 2025-03-04 13:45:44 +01:00
Matej Bačo d9eb942e8c Merge deployment download endpoints 2025-03-04 13:43:13 +01:00
Khushboo Verma 84e1b050a9 Truncate commit message to 252 characters 2025-03-04 17:28:06 +05:30
Khushboo Verma e94438927e Add resource type label in sites endpoints 2025-03-04 17:05:09 +05:30
shimon 2a5b3317bf update region 2025-03-04 11:36:45 +02:00
Christy JacobandGitHub 52ba87e77e Merge pull request #9393 from appwrite/add-file-transformation-endpoints
chore: add image transformation stats to usage endpoint
2025-03-04 14:46:14 +05:30
Khushboo Verma 20ad91a906 Simplify logic to fetch versionedRuntime 2025-03-04 13:45:56 +05:30
shimon 19ad2088a0 update region 2025-03-04 10:08:07 +02:00
Chirag Aggarwal 239bebfe2e Merge branch '1.6.x' into add-file-transformation-endpoints 2025-03-04 07:34:43 +00:00
Christy JacobandGitHub eff58459ef Merge pull request #9425 from appwrite/disable-admin-transformedAt
Disable transformedAt update for console users
2025-03-04 12:21:28 +05:30
Christy JacobandGitHub 85456696b8 Merge pull request #9429 from appwrite/fix-dual-writing
Fix: disable dual writing
2025-03-04 11:55:00 +05:30
Damodar Lohani 0659dce935 Fix: disable dual writing 2025-03-04 06:22:58 +00:00
Christy JacobandGitHub d5ab989891 Merge pull request #9339 from appwrite/feat-remove-deprecated-usage-stuff
Remove usage and usage dump in favor of stats-usage and stats-usage-dump
2025-03-04 11:23:29 +05:30
Christy JacobandGitHub 9b18a031d9 Merge pull request #9428 from appwrite/fix-stats-date
Fix: use receivedAt date when available
2025-03-04 11:22:12 +05:30
Damodar Lohani 4d5d30ba7b Fix default value 2025-03-04 05:50:21 +00:00
Damodar Lohani dd5dd4cc43 Same for database metrics 2025-03-04 05:34:02 +00:00
Damodar Lohani 5d61544444 Fix: use receivedAt date when available 2025-03-04 05:31:35 +00:00
Chirag Aggarwal 9a6de87f7d chore: usagetest and migrationsbase 2025-03-03 16:31:41 +00:00
Chirag Aggarwal fe7aeefabf chore: remove redundant param 2025-03-03 16:20:32 +00:00
Chirag Aggarwal fc05a4f1e3 chore: updated to use assertEventually 2025-03-03 16:07:33 +00:00
Matej Bačo 2ae61164d4 Merge branch 'feat-sites' into feat-screenshot-task 2025-03-03 16:45:49 +01:00
Matej BačoandGitHub 774a6af333 Merge pull request #9421 from appwrite/chore-ssr-log-tests
Chore: Add SSR logs test
2025-03-03 16:45:23 +01:00
Matej Bačo 8e03db6c9e Fix tests 2025-03-03 16:42:29 +01:00
Matej Bačo 5dd4348d5c Remove leftover 2025-03-03 16:16:02 +01:00
Matej Bačo 64e2f904c5 Merge branch 'feat-sites' into feat-screenshot-task 2025-03-03 16:05:19 +01:00
Matej Bačo 07ceb1991d Linter fix 2025-03-03 16:04:28 +01:00
Matej Bačo 60f34ced91 Merge branch 'feat-sites' into chore-ssr-log-tests 2025-03-03 15:52:22 +01:00
Matej Bačo 084dcdffd9 Fix tests 2025-03-03 15:52:11 +01:00
Chirag Aggarwal e865ca74d7 chore: added timeout to webhooks base test 2025-03-03 14:41:11 +00:00
Chirag Aggarwal c6b8e649fe chore: added maxtimeout to testChannelExecutions 2025-03-03 14:34:10 +00:00
shimon b314ae8208 disable transformedAt update for console users 2025-03-03 15:19:49 +02:00
Matej Bačo c303aa57ce Fix template CORS 2025-03-03 12:59:36 +01:00
Matej Bačo 2384113a04 Fix flaky tests 2025-03-03 12:44:28 +01:00
Christy JacobandGitHub 32329ef3f9 Merge pull request #9424 from appwrite/revert-9411-lohanidamodar-patch-2
Revert "Fix: stats resources only queue projects accessed in last 3 hours"
2025-03-03 16:25:34 +05:30
Damodar LohaniandGitHub 5becd0a5dc Revert "Fix: stats resources only queue projects accessed in last 3 hours" 2025-03-03 16:04:31 +05:45
Khushboo Verma ef37139592 Resolve merge conflicts 2025-03-03 13:57:29 +05:30
Khushboo Verma 8b8f632abe Add providerRepository model and extend it for framework and runtime 2025-03-03 13:54:07 +05:30
Jake BarnbyandGitHub d85b28aabc Merge pull request #9325 from appwrite/pla-1883
refactor: migrate Realtime::send calls to queueForRealtime
2025-03-03 21:23:55 +13:00
Chirag AggarwalandGitHub 88c8d2aa4c Merge branch '1.6.x' into pla-1883 2025-03-03 13:37:05 +05:30
Chirag Aggarwal 9849e7b232 Merge branch '1.6.x' into add-file-transformation-endpoints 2025-03-01 19:41:25 +00:00
Chirag Aggarwal 6900b717da chore: updated to use logsdb 2025-03-01 17:45:20 +00:00
Chirag Aggarwal aaee99e08b chore: generate specs 2025-03-01 17:19:55 +00:00
Chirag Aggarwal 712c33064a chore: fix sending of transformation stats 2025-03-01 17:18:44 +00:00
Matej Bačo 7e00bc493c Add SSR tests 2025-02-28 18:29:17 +01:00
Matej Bačo 8d47d62d7a Upgrade executor 2025-02-28 17:12:17 +01:00
Matej Bačo ef030f4a08 Improve flaky test 2025-02-28 16:06:11 +01:00
Matej Bačo 580204912c Leftover 2025-02-28 15:20:38 +01:00
Chirag Aggarwal 02de0d2432 chore: fix stats count 2025-02-28 13:29:32 +00:00
Chirag Aggarwal df37462716 chore: fix typing and tests 2025-02-28 13:20:55 +00:00
Matej BačoandGitHub f91e8be136 Merge pull request #9419 from appwrite/feat-function-download
Feat: Build download endpoint in Functions
2025-02-28 12:31:39 +01:00
d75b601a7b Update src/Appwrite/Platform/Modules/Functions/Http/Deployments/Builds/Download/Get.php
Co-authored-by: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com>
2025-02-28 12:10:24 +01:00
Matej Bačo 72d2ba0159 Add missing download endpoints, ensure with tests 2025-02-28 12:04:17 +01:00
Khushboo Verma dc71c50123 Resolve merge conflicts 2025-02-28 16:20:24 +05:30
Matej Bačo d6e7db8900 Fix persistent screenshot 2025-02-28 11:29:42 +01:00
Matej BačoandGitHub 559396295f Merge pull request #9416 from appwrite/feat-move-functions-endpoints-to-modules
Move function endpoints from controller to modules
2025-02-28 10:54:03 +01:00
Matej Bačo dc6143c773 Improve tests 2025-02-28 10:47:48 +01:00
Matej Bačo a1c621fab2 Fix static sites 2025-02-28 10:40:28 +01:00
Matej Bačo 2510cb9687 Avoid 404 race condition during screenshot 2025-02-28 10:18:06 +01:00
Chirag Aggarwal d5cfdc570f chore: updated specs 2025-02-28 08:41:53 +00:00
Matej Bačo 4efa0a7231 Leftover 2025-02-28 09:32:40 +01:00
Chirag Aggarwal e9d8d13fbd chore: added imageTransformations to project usage 2025-02-28 08:28:21 +00:00
Khushboo Verma 4afd9771c6 Remove functions.php 2025-02-27 23:42:43 +05:30
Matej Bačo dd75081609 Formatting fix 2025-02-27 17:46:47 +01:00
Matej Bačo a3c176a2bd Finalize PR 2025-02-27 17:46:41 +01:00
Matej Bačo 8081759c5c Fix failing templates 2025-02-27 17:28:25 +01:00
Matej Bačo bf3b21cdb1 Implement screenshot task and initial run 2025-02-27 15:58:33 +01:00
Khushboo Verma 26a822e4b2 Move all function endpoints to modules structure 2025-02-27 18:53:11 +05:30
Khushboo Verma cede07b520 Add more endpoints to modules 2025-02-27 18:11:47 +05:30
Matej Bačo 92daef51f0 Fix screenshot security 2025-02-27 12:44:22 +01:00
Khushboo Verma 0dbb9dadf6 Move function endpoints from controller to modules 2025-02-27 17:01:15 +05:30
Matej Bačo 496cfa92bc Fix QA instance setup 2025-02-27 10:55:49 +01:00
Chirag Aggarwal f31acd214e chore: remove plan blocking 2025-02-27 09:52:27 +00:00
Matej Bačo ac51fcbf4e Preps for Console SDK 2025-02-27 10:04:11 +01:00
Chirag Aggarwal 388affa3d0 chore: updated naming for subscribers 2025-02-27 07:23:13 +00:00
Chirag Aggarwal 6ad34a7bf7 chore: sdk versions and corresponding docs 2025-02-27 05:05:31 +00:00
loks0n 0bbcdf8268 chore: bump cache 0.12.x 2025-02-26 22:05:09 +00:00
loks0n 02e5b935fe Merge branch 'chore-bump-cache-0.12.x' of https://github.com/appwrite/appwrite into chore-bump-cache-0.12.x 2025-02-26 22:03:04 +00:00
loks0n 611f2cad6a chore: bump cache 0.12.x 2025-02-26 22:02:55 +00:00
Luke B. SilverandGitHub b9d5621bde Merge branch '1.6.x' into chore-bump-cache-0.12.x 2025-02-26 21:57:58 +00:00
Chirag Aggarwal 57c7ebb53d chore: bump sdk 2025-02-26 17:51:00 +00:00
Chirag Aggarwal c79ed286b1 chore: update tests 2025-02-26 17:35:06 +00:00
Chirag Aggarwal 28896081d7 chore: fix forloop 2025-02-26 16:50:12 +00:00
Chirag Aggarwal 7687784515 chore: added fallback to old values in update 2025-02-26 16:41:26 +00:00
loks0n 31d6fe2423 chore: bump cache 0.12.x 2025-02-26 16:40:19 +00:00
loks0n f5947de508 chore: bump cache 0.12.x 2025-02-26 16:38:05 +00:00
Chirag Aggarwal 0ddcb9b14c chore: refactor adapter 2025-02-26 16:24:05 +00:00
Christy JacobandGitHub 1c8ec7ba1f Merge pull request #9406 from appwrite/bump-base-image
chore: bump docker-base
2025-02-26 18:49:25 +05:30
Christy JacobandGitHub e7eedcdeb7 Merge pull request #9397 from appwrite/track-options-requests
Track options requests
2025-02-26 18:48:50 +05:30
Chirag Aggarwal bb5ed1ccc6 chore: bump base to 0.10.1 2025-02-26 10:14:32 +00:00
Eldad Fux ad56782b49 Fixed tests 2025-02-26 10:19:51 +01:00
Chirag Aggarwal ae78e793dd chore: added blocking to file preview endpoint 2025-02-26 08:52:06 +00:00
Christy JacobandGitHub 24613c2e9f Merge pull request #9243 from appwrite/fix-smtp
Fix: email (smtp) to multiple recipients
2025-02-26 12:57:23 +05:30
Eldad Fux ce5a04a37d Merge remote-tracking branch 'origin/1.6.x' into feat-dynamic-regions 2025-02-26 07:52:40 +01:00
Christy JacobandGitHub 718e44adce Merge branch '1.6.x' into track-options-requests 2025-02-26 10:40:10 +05:30
Damodar LohaniandGitHub 1816fae5a3 Merge pull request #9411 from appwrite/lohanidamodar-patch-2
Fix: stats resources only queue projects accessed in last 3 hours
2025-02-26 09:05:22 +05:45
Damodar LohaniandGitHub 7ea108f015 Fix: stats resources only queue projects accessed in last 3 hours 2025-02-26 08:37:36 +05:45
Jake BarnbyandGitHub 69c00d428a Merge pull request #9410 from appwrite/batch-per-project
Batch per project
2025-02-26 14:02:24 +13:00
Jake BarnbyandGitHub e998474b97 Merge branch '1.6.x' into batch-per-project 2025-02-26 14:02:01 +13:00
Jake Barnby 6e82bfe8e7 Update date 2025-02-26 14:00:16 +13:00
Jake Barnby 34d91a6518 Revert "Test increase batch"
This reverts commit 7dfa3193c9.
2025-02-26 13:51:41 +13:00
Jake Barnby 7dfa3193c9 Test increase batch 2025-02-26 13:45:49 +13:00
Matej BačoandGitHub 93d00abfe1 Merge pull request #9314 from appwrite/feat-spa
Feat: SPA support
2025-02-25 22:15:40 +01:00
Eldad Fux e8fb2f8ae1 Changed config format 2025-02-25 20:25:54 +01:00
Matej Bačo d79ab99202 Test fix after merge 2025-02-25 18:22:40 +01:00
Matej Bačo 1e111294df Merge branch 'feat-sites' into feat-spa 2025-02-25 17:57:14 +01:00
Matej BačoandGitHub 1752e8ed83 Merge pull request #9407 from appwrite/fix-sites-device
Fix: deviceForSites
2025-02-25 17:55:49 +01:00
Matej Bačo 22598ae41d Leftover 2025-02-25 17:34:28 +01:00
Matej Bačo a89f591f63 Use deviceForSites properly 2025-02-25 16:42:25 +01:00
Matej BačoandGitHub ac9ac3e279 Merge pull request #9395 from appwrite/fix-apex-rules
Feat: Enhance rules
2025-02-25 15:34:24 +01:00
Matej Bačo 859a9c72e1 Update ProxyCustomServerTest.php 2025-02-25 15:22:24 +01:00
Matej Bačo 19928bd7dc Add delete worker tests for rules 2025-02-25 15:13:59 +01:00
88b3791a24 Update src/Appwrite/Utopia/Response/Model/Rule.php
Co-authored-by: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com>
2025-02-25 14:37:54 +01:00
Matej Bačo 765a0fa891 Merge branch 'feat-sites' into fix-apex-rules 2025-02-25 14:05:08 +01:00
Matej BačoandGitHub fac42f7ad5 Merge pull request #9405 from appwrite/chore-remove-subquery
Chore: Remove subquery
2025-02-25 13:59:25 +01:00
Matej Bačo d7c163be95 PR review changes 2025-02-25 13:52:51 +01:00
Chirag Aggarwal 542e34bc94 chore: bump docker-base 2025-02-25 12:28:05 +00:00
Matej Bačo 16934af49f Fix flaky test 2025-02-25 13:14:33 +01:00
Matej Bačo 29f660cfd6 leftover 2025-02-25 13:04:18 +01:00
Matej Bačo 743ded1e79 Remove domain from deployment model 2025-02-25 13:03:44 +01:00
Matej Bačo 88ae06af57 Improve formatting 2025-02-25 12:53:12 +01:00
Khushboo Verma a54f84fce8 Resolve merge conflicts 2025-02-25 16:20:58 +05:30
Khushboo Verma f830918c7c Add logic to detect rendering strategy and fallback file 2025-02-25 16:19:30 +05:30
Chirag Aggarwal 9f7ba3d4ca Merge branch '1.6.x' into fix-smtp 2025-02-25 09:48:21 +00:00
Matej Bačo 2ba84bf93f Rule search param fix 2025-02-25 10:47:47 +01:00
Jake BarnbyandGitHub 66dc3adb98 Merge pull request #9403 from appwrite/batch-per-project
Log batches per project
2025-02-25 21:46:33 +13:00
Jake Barnby 3a2babc906 Update date 2025-02-25 21:34:46 +13:00
Eldad Fux 697c30f559 Init 2025-02-25 09:31:24 +01:00
Jake Barnby 03f0e382f4 Fix dates 2025-02-25 21:03:37 +13:00
Jake Barnby b272a8b1e7 Pass queries 2025-02-25 20:26:00 +13:00
Chirag Aggarwal 676431c355 chore: shifted to logsDb 2025-02-25 07:16:42 +00:00
Jake Barnby 2924f408b3 Reapply "Remove blocks"
This reverts commit f49346485a.
2025-02-25 19:21:35 +13:00
Jake Barnby b0547015a9 Add temp log date skip 2025-02-25 18:51:11 +13:00
Jake Barnby f49346485a Revert "Remove blocks"
This reverts commit 6f854b5eb6.
2025-02-25 18:39:12 +13:00
Jake Barnby 6f854b5eb6 Remove blocks 2025-02-25 18:18:25 +13:00
Chirag Aggarwal ab6c5c9f8d chore: bump utopia messaging 2025-02-25 04:47:35 +00:00
Chirag Aggarwal 7ac4a5bf27 chore: update naming 2025-02-25 04:43:44 +00:00
Jake Barnby 1f560d896f Fix plural 2025-02-25 16:58:30 +13:00
Jake Barnby 5efd231861 Allow validator to read logs collections from base 2025-02-25 16:56:13 +13:00
Jake Barnby 3f8e1cbedb Fix loop unset 2025-02-25 15:57:04 +13:00
Jake Barnby 08f4ed2b50 Log batches per project 2025-02-25 15:50:10 +13:00
Matej Bačo 474e04479f Linter fix 2025-02-24 18:44:11 +01:00
Matej Bačo 40beecdddc Fix tests 2025-02-24 18:42:20 +01:00
Matej Bačo 427e781b5b Add git domains, improve tests 2025-02-24 16:22:23 +01:00
Matej Bačo 9e909ee3fc Specs update 2025-02-24 12:15:50 +01:00
Matej Bačo eb7daf3edd Finalize rules overhauls 2025-02-24 11:55:59 +01:00
Matej Bačo a56086f8bf Basics of rules rework 2025-02-23 21:34:14 +01:00
Eldad A. FuxandGitHub 392b33ef26 Merge pull request #9398 from appwrite/disable-logs-display
disable logs display
2025-02-23 20:08:55 +01:00
shimon 6bd14d548f composer 2025-02-23 20:58:02 +02:00
shimon 06d22f910c disable logs display 2025-02-23 20:51:38 +02:00
Matej Bačo ae835f6cf0 Fix tests 2025-02-23 17:08:12 +01:00
Christy Jacob 8958070327 chore: linter 2025-02-23 15:48:33 +05:30
Christy Jacob 3f50532c91 chore: remove sleep in functions tests 2025-02-23 15:42:53 +05:30
Christy Jacob 4c49272389 chore: enable assistant 2025-02-23 15:40:54 +05:30
Christy Jacob f25df67002 chore: remove sleep() for usage stats, since batch size is now 1 2025-02-23 15:39:37 +05:30
Christy Jacob 94108e6f3f chore: remove sleep() for usage stats, since batch size is now 1 2025-02-23 15:23:34 +05:30
Christy Jacob f682e4ac6f chore: remoove sleep() for usage stats, since batch size is now 1 2025-02-23 14:56:15 +05:30
Christy Jacob cf41d44de4 fix: general tests 2025-02-23 14:47:57 +05:30
Christy Jacob 30327f86fd feat: enable assistant 2025-02-23 11:39:18 +05:30
Christy Jacob 2359c1adb6 feat: enable assistant 2025-02-23 11:38:59 +05:30
Christy Jacob 12b494982b feat: compute usage for OPTIONS and 4XX errors 2025-02-23 11:37:54 +05:30
Christy Jacob 65dd5fe9b3 feat: compute usage for OPTIONS and 4XX errors 2025-02-23 11:34:28 +05:30
Matej Bačo 666e8f3ec9 Separate proxy rule creation 2025-02-22 18:56:51 +01:00
Matej Bačo aeebdadae1 Add nameservers variable 2025-02-22 18:32:10 +01:00
Matej Bačo 0a25463b8d Apex domain exception + proxy tests 2025-02-22 18:26:51 +01:00
Matej Bačo 7e3b693216 Disable internal httpx 2025-02-21 23:45:45 +01:00
Steven NguyenandGitHub 34d587d7c5 Merge pull request #9122 from gurjeetsinghvirdee/152-sdk-cli-command-update
Fix outdated CLI commands in documentation
2025-02-21 13:59:50 -08:00
Matej Bačo a5fc9463c7 Support for deployment screenshots 2025-02-21 22:35:05 +01:00
Matej Bačo 08ec153585 update specs 2025-02-21 22:14:02 +01:00
Matej BačoandGitHub c8f4667b6a Merge pull request #9366 from appwrite/feat-site-screenshots
Feat: Site screenshots
2025-02-21 22:11:03 +01:00
Matej Bačo f9bc5d0cce Fix tests 2025-02-21 22:10:39 +01:00
Matej Bačo 7397d52c0c Fix tests 2025-02-21 21:41:39 +01:00
Matej Bačo 8661ae6840 Disable banner for screenshots 2025-02-21 20:50:43 +01:00
Matej Bačo 498c1456ed Merge branch 'feat-sites' into feat-site-screenshots 2025-02-21 20:22:50 +01:00
Matej Bačo 2917c66202 Remove unnessessary complexity 2025-02-21 20:21:13 +01:00
Matej Bačo 26c99dca84 Add onelink template 2025-02-21 18:55:59 +01:00
Chirag Aggarwal 0e0bab4c40 chore: updated test 2025-02-21 13:28:49 +00:00
Chirag Aggarwal 4ed4c660d5 chore: added tests for file transformations 2025-02-21 12:53:17 +00:00
Matej Bačo 67d6404c70 Add further templates 2025-02-21 12:46:44 +01:00
Chirag Aggarwal b1629b24ad chore: added file transformation stats to usage endpoint for bucket 2025-02-21 11:44:04 +00:00
Christy JacobandGitHub 9fa13ddfd8 Merge pull request #9391 from appwrite/fix-null-error-on-invite
chore: fix null errors on team invite
2025-02-21 16:09:43 +05:30
Khushboo Verma 1394b4349c Separate response models for list repos 2025-02-21 15:22:15 +05:30
Matej Bačo ede068d5f4 Add react native, vue template 2025-02-21 10:51:53 +01:00
Matej Bačo 1c6204118f PR code review 2025-02-21 10:09:35 +01:00
Matej Bačo cdc3cb23ec React starter template 2025-02-21 09:58:24 +01:00
Khushboo Verma 9d4806c792 Merge branch 'feat-sites' into feat-add-detection-logic 2025-02-21 11:39:06 +05:30
Chirag Aggarwal d6c2dfb915 chore: updated name 2025-02-21 03:27:46 +00:00
Steven NguyenandGitHub f402262ffc Merge pull request #9390 from appwrite/pla-2142
chore: bump utopia-php/image to 0.8.0
2025-02-20 10:44:54 -08:00
Chirag Aggarwal 9d9e44a14f chore: remove redundant check 2025-02-20 17:36:42 +00:00
Chirag Aggarwal 397a6a34ed chore: fix null errors on team invite 2025-02-20 17:30:26 +00:00
Matej Bačo 54d877fe3e PR review fixes 2025-02-20 16:49:20 +01:00
Chirag Aggarwal c660b9d858 chore: fix tests 2025-02-20 14:56:23 +00:00
Chirag Aggarwal f9cc7882aa chore: fix tests 2025-02-20 14:43:21 +00:00
Chirag Aggarwal 4e71e85b5b chore: bump utopia-php/image version 2025-02-20 14:32:34 +00:00
Chirag Aggarwal 077fe10d80 chore: fix tests 2025-02-20 14:12:14 +00:00
Chirag Aggarwal b0ced9b351 chore: updated tests 2025-02-20 13:37:13 +00:00
Matej Bačo c3df0a71e3 Address leftover 2025-02-20 14:34:59 +01:00
Matej Bačo 732e74f114 Finalize screenshot tests 2025-02-20 14:22:30 +01:00
Matej Bačo d941d18e8c WIP: screenshot tests 2025-02-20 13:44:31 +01:00
Matej Bačo 3ccd49e4a5 Rework screenshots to use api key resource from recent 1.6.x merge 2025-02-20 13:44:22 +01:00
Christy JacobandGitHub 6cbcd695d1 Merge pull request #9388 from appwrite/fix-audits-v2
Fix removed audits for shared v2
2025-02-20 18:05:25 +05:30
Matej Bačo 2d761b48d8 Merge branch 'feat-sites' into feat-site-screenshots 2025-02-20 13:17:23 +01:00
Matej BačoandGitHub 556bcbf33b Merge pull request #9382 from appwrite/fix-flaky-tests-sites
Fix: Improve tests OPR setup
2025-02-20 12:57:04 +01:00
Jake Barnby b6166063db Add back remove shared v2 2025-02-21 00:51:29 +13:00
Matej Bačo e6a53a8c15 Enable sites on non-shared tables 2025-02-20 12:33:00 +01:00
Matej Bačo f5f37d6a79 Simplify OPR startup check 2025-02-20 12:25:13 +01:00
Matej Bačo f0d8c7382b Simplify YML file 2025-02-20 12:19:32 +01:00
Chirag Aggarwal ccb7dfa839 chore: added test cases 2025-02-20 11:15:05 +00:00
Chirag Aggarwal 6235a1c729 chore: make min/max params optional for attribute update 2025-02-20 10:33:58 +00:00
Matej Bačo fb19f8d6a6 Run sites in non-shared mode tests 2025-02-20 09:13:50 +01:00
Khushboo Verma 68de687bdf Resolve merge conflicts 2025-02-20 12:57:18 +05:30
Khushboo Verma a7c1bd94ed Add framework detection to list repos 2025-02-20 12:54:26 +05:30
Christy JacobandGitHub 7319b12b51 Merge pull request #9353 from appwrite/feat-messaging-metrics
Feat messaging metrics
2025-02-20 12:25:14 +05:30
Matej Bačo 95aab45cc2 Fix merge issue 2025-02-19 16:01:05 +01:00
Matej Bačo 4a0d33213a Fix tests 2025-02-19 15:50:16 +01:00
Matej Bačo 322b726196 Fix test 2025-02-19 15:37:43 +01:00
Matej Bačo cd25a79694 Improve tests OPR setup 2025-02-19 15:29:42 +01:00
Matej Bačo 47395c5442 Fix failing tests regarding specs and failed builds 2025-02-19 14:58:59 +01:00
Matej Bačo d13e8641fd Allow inactive vcs deployments 2025-02-19 13:39:11 +01:00
Matej Bačo acd1dd2479 Formatting fix 2025-02-19 12:56:27 +01:00
Matej Bačo 3cc1fb6fb4 Post-merge update 2025-02-19 12:55:39 +01:00
Matej Bačo 3932b8bdc1 Merge branch '1.7.x' into feat-sites 2025-02-19 12:54:05 +01:00
Khushboo Verma 3bb4fde7e6 Merge branch 'feat-sites' into feat-add-detection-logic 2025-02-19 17:12:45 +05:30
Matej Bačo 165caef9ab Merge branch '1.6.x' into 1.7.x 2025-02-19 12:40:07 +01:00
Matej BačoandGitHub 055411fbe4 Merge pull request #9380 from appwrite/feat-add-createVcsDeployment
Add createVcsDeployment endpoints for sites and functions
2025-02-19 12:31:25 +01:00
Matej Bačo 63a91e30fa Add reference params 2025-02-19 11:50:25 +01:00
Khushboo Verma f7749bbbef Add createVcsDeployment endpoints for sites and functions 2025-02-19 14:55:44 +05:30
Khushboo Verma c0b574fe9b Update detector library version 2025-02-19 12:19:41 +05:30
Khushboo Verma 34b8453666 Merge branch 'feat-sites' into feat-add-detection-logic 2025-02-18 20:19:11 +05:30
Chirag Aggarwal 55e7633bd1 chore: shift targets to realtime 2025-02-18 14:04:59 +00:00
Chirag Aggarwal 88a6616cf8 chore: fix naming 2025-02-18 13:05:50 +00:00
Chirag Aggarwal 9f7aaf7029 chore: fix warning in database worker 2025-02-18 12:51:19 +00:00
Chirag Aggarwal 235a357ca3 chore: initialized queueForWebhooks in worker init 2025-02-18 11:37:36 +00:00
Chirag AggarwalandGitHub b99d2c3c8c Merge branch '1.6.x' into pla-1883 2025-02-18 16:31:41 +05:30
Christy JacobandGitHub d59d6f70a5 Merge pull request #9303 from appwrite/pla-2428
Add support endpoint url for S3
2025-02-18 16:28:44 +05:30
Chirag Aggarwal ac84de7645 chore: updated variable descriptions 2025-02-18 10:38:13 +00:00
Christy JacobandGitHub 27d2cc9f00 Merge pull request #9348 from ChiragAgg5k/pla-2470
Fix resend team invite if already accepted
2025-02-18 15:10:11 +05:30
Matej Bačo ae1eb53e31 Update specs 2025-02-18 09:31:56 +01:00
Matej BačoandGitHub 3b87b42dac Merge pull request #9352 from appwrite/feat-all-rules-in-proxy
Move rule creation to create rule
2025-02-18 09:28:39 +01:00
Chirag Aggarwal a74c6e0b10 chore: added targets to realtime, refactor webhook queues 2025-02-18 07:58:56 +00:00
Khushboo Verma db8010f7c6 Fix site tests 2025-02-18 13:03:57 +05:30
Khushboo Verma c24cebf6ce Fix site tests 2025-02-18 12:50:09 +05:30
Khushboo Verma 262b152cd9 Add more rule tests 2025-02-18 12:12:12 +05:30
Jake BarnbyandGitHub ae91869e76 Merge pull request #9336 from appwrite/feat-key-segmented-usage
Feat key segmented usage
2025-02-18 18:47:01 +13:00
Jake Barnby 2b29c792ad Merge remote-tracking branch 'origin/1.6.x' into feat-key-segmented-usage 2025-02-18 18:18:00 +13:00
Jake Barnby 3e02b830ac Fix inject 2025-02-18 18:17:52 +13:00
Christy JacobandGitHub f4e9b89195 Merge pull request #9373 from appwrite/pla-2503
Fix Self Hosting functions by adding missed config
2025-02-18 00:37:47 +05:30
Chirag Aggarwal 6ef4e76aa6 Merge branch '1.6.x' into pla-1883 2025-02-17 18:54:41 +00:00
Chirag Aggarwal 227f2c476d Merge branch '1.6.x' into pla-1883 2025-02-17 18:46:05 +00:00
Matej Bačo 2e4a8dec78 Fix CORS 2025-02-17 15:05:19 +01:00
Chirag Aggarwal c1b613e5bd chore: added migration script 2025-02-17 13:55:43 +00:00
Jake Barnby d6b9be8799 Merge remote-tracking branch 'origin/feat-key-segmented-usage' into feat-key-segmented-usage 2025-02-18 02:10:37 +13:00
Jake Barnby 0d79ae33ba Lint 2025-02-18 02:10:05 +13:00
Matej BačoandGitHub 685c141a59 Merge branch '1.6.x' into feat-key-segmented-usage 2025-02-17 14:06:40 +01:00
Jake Barnby ff09f1e62a Remove redundant check 2025-02-18 02:05:13 +13:00
Jake Barnby 07a6d60b01 Remove leftover 2025-02-18 02:02:29 +13:00
Jake Barnby 77e83d5cfb Remove unused injections 2025-02-18 01:49:51 +13:00
Khushboo Verma 2ea18c4761 Fix domain generation 2025-02-17 18:12:29 +05:30
Khushboo Verma 28ef7da231 Fix new site tests 2025-02-17 18:03:13 +05:30
Jake Barnby fe251c443f Remove leftover 2025-02-18 01:32:48 +13:00
Khushboo Verma 76b154bfce Add framework detection to list repos 2025-02-17 17:54:13 +05:30
Matej Bačo c2a60a8569 Screenshot deletion in worker 2025-02-17 13:03:56 +01:00
Khushboo Verma 71103b037f Make switch case simpler 2025-02-17 17:17:27 +05:30
Khushboo Verma 9459c87b50 Re-add correct project tests 2025-02-17 17:15:23 +05:30
Christy JacobandGitHub d0630eae79 Merge pull request #9361 from appwrite/pla-2492
Fix Model Platform is missing response key: store
2025-02-17 17:08:17 +05:30
Jake BarnbyandGitHub d1cf833f15 Merge pull request #9375 from appwrite/feat-worker-batch-delete
Use batch delete in worker
2025-02-18 00:08:26 +13:00
Matej Bačo e5e7c50ca4 previewHostname security 2025-02-17 11:54:07 +01:00
Jake Barnby 1fbfbbf482 Also update database worker delete by group 2025-02-17 23:53:43 +13:00
Jake Barnby ef8520ad2d Format 2025-02-17 23:14:17 +13:00
Jake Barnby 36ce381325 Use batch delete in worker 2025-02-17 22:36:55 +13:00
Matej Bačo 30cb7e8ff2 Todos 2025-02-17 09:47:38 +01:00
Matej Bačo 2f2a743a7f Merge branch 'feat-sites' into feat-all-rules-in-proxy 2025-02-17 09:47:33 +01:00
Khushboo Verma feffab137f Resolve merge conflicts 2025-02-17 14:00:30 +05:30
Khushboo Verma 6155fad3e0 Resolve merge conflicts 2025-02-17 14:00:05 +05:30
Chirag Aggarwal 0dba22c606 chore: updated installations collection 2025-02-17 05:57:30 +00:00
Jake Barnby 6653972e11 Fix disabled metric check 2025-02-17 17:29:12 +13:00
Jake Barnby 390cdaa6a5 Merge remote-tracking branch 'origin/1.6.x' into feat-key-segmented-usage
# Conflicts:
#	composer.lock
2025-02-17 17:12:45 +13:00
Damodar LohaniandGitHub b3067f562f Merge pull request #9370 from appwrite/fix-image-trnasformation-metrics
Fix image trnasformation metrics
2025-02-16 17:29:13 +05:45
Damodar Lohani 3e5e545304 Fix: image transformations metrics 2025-02-16 11:31:46 +00:00
Matej Bačo d1978b102f Dark screenshot, upgrade screnshot image, fix redeploy missing domain 2025-02-15 22:27:16 +01:00
Khushboo Verma b1854fee10 Add helper methods in functionBase 2025-02-15 23:23:02 +05:30
Matej BačoandGitHub 62b1c19357 Merge pull request #9364 from appwrite/feat-template-deployment
Feat: Template deployments
2025-02-15 15:15:13 +01:00
Matej Bačo e1dedd2fbb Remove unnessessary check 2025-02-15 04:41:36 +01:00
Matej Bačo 51e89f5110 Revert "Initial branch rule implementation"
This reverts commit 81a7ba536c.
2025-02-15 04:38:21 +01:00
Matej Bačo 81a7ba536c Initial branch rule implementation 2025-02-15 04:36:38 +01:00
Matej Bačo fb2649ab41 Add leftover 2025-02-15 03:44:40 +01:00
Matej Bačo b746642979 Fix missing response 2025-02-15 02:01:11 +01:00
Matej Bačo a6bcc3ce97 Fix bugs 2025-02-15 01:57:41 +01:00
Matej Bačo b30d9eb8ad Initial screenshot implementation 2025-02-15 01:19:21 +01:00
Matej Bačo 28339f0ed7 createTemplateDeployment for sites and deployments 2025-02-15 00:36:46 +01:00
Matej Bačo da9d442473 Re-add starter templates 2025-02-15 00:34:43 +01:00
Matej Bačo 47a6168137 Update console and templates 2025-02-14 21:42:39 +01:00
Chirag Aggarwal 51438631da chore: added console check to ping 2025-02-14 15:40:08 +00:00
Steven NguyenandGitHub 993c07d7c6 Merge pull request #9360 from appwrite/fix-build-memory-limits
Fix build memory specifications
2025-02-14 07:36:34 -08:00
Matej BačoandGitHub 9222fec7f8 Merge pull request #9359 from appwrite/fix-site-cors
Fix: Site CORS
2025-02-14 12:40:37 +01:00
Matej Bačo 94f3cf7baf Merge branch 'feat-sites' into fix-site-cors 2025-02-14 12:05:21 +01:00
Matej Bačo 399afa1b14 Merge branch 'feat-sites' of github.com:appwrite/appwrite into feat-sites 2025-02-14 12:04:31 +01:00
Matej Bačo 410388a587 Upgrade Console 2025-02-14 12:03:59 +01:00
Matej BačoandGitHub 4bd08642be Merge pull request #9326 from appwrite/feat-preview-branding
Feat: preview branding
2025-02-14 12:03:33 +01:00
Matej Bačo 3ab8503f61 Code quality fixes 2025-02-14 10:36:34 +01:00
Matej Bačo 75320db428 Update transformation lib structure 2025-02-14 10:01:27 +01:00
Matej Bačo 43f0dc0846 Add CORS tests 2025-02-14 09:47:37 +01:00
Bradley Schofield 0f873792ba Fix build memory and add tests to prevent future regressions 2025-02-14 17:16:40 +09:00
Chirag Aggarwal 4c7917687d Merge branch '1.6.x' into pla-1883 2025-02-14 07:16:43 +00:00
Chirag AggarwalandGitHub 9ebb4b9626 Merge branch '1.6.x' into pla-2428 2025-02-14 09:04:30 +05:30
Matej Bačo a10882d7ee Update general.php 2025-02-13 19:59:29 +01:00
Matej Bačo ec05a3d668 Enable CORS for sites 2025-02-13 19:57:41 +01:00
Khushboo Verma 3531d223e2 Fix general tests 2025-02-13 20:27:25 +05:30
Chirag Aggarwal 2457485230 chore: removed redundant exception 2025-02-13 13:16:29 +00:00
Khushboo Verma e87fe7467e Merge branch 'feat-sites' into feat-all-rules-in-proxy 2025-02-13 16:54:12 +05:30
Matej Bačo f6fbc253f7 Update Console 2025-02-13 11:33:22 +01:00
Matej Bačo 313444cb12 Fix envCommands set too late 2025-02-13 11:14:08 +01:00
Jake BarnbyandGitHub 7143bef111 Merge pull request #9356 from appwrite/catch-invalid-index
Fix patch index validation
2025-02-13 22:56:28 +13:00
fogelito e4ae0d463d assertStringContainsString 2025-02-13 11:37:12 +02:00
fogelito 8778e2e666 lint 2025-02-13 11:35:16 +02:00
fogelito 8f212ccd30 in_array 2025-02-13 11:24:13 +02:00
fogelito e8a306253b Fix test 2025-02-13 11:22:40 +02:00
fogelito 4592a1cc36 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into catch-invalid-index 2025-02-13 11:20:52 +02:00
Christy JacobandGitHub 608a2cc67b Merge pull request #9354 from appwrite/fix-image-transformation-metric-time
Fix: metric time was not being written to DB
2025-02-13 14:41:52 +05:30
Khushboo Verma bd58ba32c8 Remove older test 2025-02-13 14:21:52 +05:30
Matej Bačo 80241e37c3 Update tempalte auto-values 2025-02-13 09:47:37 +01:00
fogelito 6abf8ce727 Fix index length test 2025-02-13 10:44:27 +02:00
Jake BarnbyandGitHub ed51a059ba Merge pull request #9355 from appwrite/chore-update-migrations
Chore: Update migrations
2025-02-13 20:59:33 +13:00
Bradley Schofield 43d8374c5c Update migrations 2025-02-13 16:57:32 +09:00
Damodar Lohani d4599e6884 Fix, time was not being written to DB 2025-02-13 06:43:49 +00:00
Damodar Lohani 1e446948e8 Fix error 2025-02-13 05:24:00 +00:00
Damodar Lohani 503b8a0cde spacing 2025-02-13 04:58:14 +00:00
Damodar Lohani 745947621f Feat: count for targets 2025-02-13 04:54:29 +00:00
Damodar Lohani 721b9b9aea remove old events 2025-02-13 00:52:20 +00:00
Damodar LohaniandGitHub 29ffd703db Merge branch '1.6.x' into feat-remove-deprecated-usage-stuff 2025-02-13 06:28:48 +05:45
Khushboo Verma 4b909ed7dc Create rule in function logging test 2025-02-13 00:23:13 +05:30
Khushboo Verma f9ce932ac1 Create site rule 2025-02-13 00:11:43 +05:30
Khushboo Verma f67870925f Resolve merge conflicts 2025-02-13 00:01:18 +05:30
Khushboo Verma f416e39098 Move create rule to module 2025-02-12 23:58:25 +05:30
Christy JacobandGitHub 88c2fe2dd2 Merge pull request #9347 from appwrite/update-audit-logging
feat: batch create abuse logs
2025-02-12 22:35:34 +05:30
Christy Jacob a0482aca7a chore: revert package.json 2025-02-12 22:04:48 +05:30
Christy Jacob 9989137ed4 chore: use private variables for aggregation 2025-02-12 22:01:28 +05:30
Matej BačoandGitHub c4142565aa Merge pull request #8970 from appwrite/feat-console-availability-endpoint
Add new console endpoint to check resource availability
2025-02-12 17:17:05 +01:00
Christy JacobandGitHub 933e762284 Merge pull request #9332 from appwrite/PLA-896
feat(builds): check if function is blocked before building
2025-02-12 21:23:10 +05:30
Matej BačoandGitHub 81bfa5c48d Merge branch 'feat-sites' into feat-preview-branding 2025-02-12 16:35:31 +01:00
Khushboo VermaandGitHub 0106dc7803 Update Get.php 2025-02-12 19:41:55 +05:30
Khushboo Verma 3b0d760065 Increase deployment build timeout 2025-02-12 19:18:16 +05:30
Matej Bačo e0369ec14f Avoid JS link 2025-02-12 14:09:32 +01:00
Jake BarnbyandGitHub 2e3a1cf82c Merge branch '1.6.x' into feat-key-segmented-usage 2025-02-13 01:30:51 +13:00
Khushboo Verma c78701ded7 Increase time to assert 2025-02-12 17:54:03 +05:30
Jake Barnby 3fe1147194 Filter in prepare 2025-02-13 01:07:10 +13:00
Khushboo Verma adb861b785 Use getSiteDomain 2025-02-12 17:29:19 +05:30
Damodar LohaniandGitHub 8922d676c6 Merge pull request #9350 from appwrite/fix-image-metric
Fix: missing periodic metric
2025-02-12 17:25:15 +05:45
Jake Barnby 6dbc8c5464 Allow disabling specific metrics in hooks via keys 2025-02-13 00:19:51 +13:00
Damodar Lohani d2cc5ea932 Fix: missing periodic metric 2025-02-12 10:58:51 +00:00
Chirag Aggarwal d259f21c65 refactor: tests to match the new membership logic 2025-02-12 10:48:32 +00:00
Khushboo Verma aae3b40d16 Refactor console availability endpoint 2025-02-12 16:10:44 +05:30
Matej Bačo 6415009f07 Add SvelteKit Appwrite template 2025-02-12 11:01:26 +01:00
Chirag Aggarwal e435e457de chore: added check for team membership exists 2025-02-12 09:50:13 +00:00
Jake BarnbyandGitHub 4c452417d1 Merge pull request #9338 from appwrite/feat-improve-tests
Only run all table mode tests on db update
2025-02-12 22:34:01 +13:00
Jake Barnby 2449b76676 Format 2025-02-12 21:25:53 +13:00
Jake Barnby 9427b07580 Add expired property directly to key 2025-02-12 21:22:08 +13:00
Christy Jacob 2dffcb29b0 chore: add comment about the unit 2025-02-12 13:09:31 +05:30
Jake BarnbyandGitHub dd03a04d58 Merge branch '1.6.x' into feat-improve-tests 2025-02-12 20:35:13 +13:00
Jake Barnby 775e6ec9cf Fix role setting 2025-02-12 20:34:38 +13:00
Christy Jacob 294f6818fa chore: review comments 2025-02-12 12:23:20 +05:30
Khushboo Verma b46eebb23c Resolve merge conflicts 2025-02-12 11:49:33 +05:30
Christy Jacob 48525ce755 chore: linter 2025-02-12 11:34:39 +05:30
Christy Jacob 978284b36f feat: use smaller batch size on development environments 2025-02-12 11:33:17 +05:30
Jake Barnby 5780ec9547 Make sure key has app role before continuing checks 2025-02-12 18:45:06 +13:00
Christy Jacob 7f706fce5d feat: linter & console logs 2025-02-12 11:09:24 +05:30
Christy Jacob df27e8950b feat: update composer 2025-02-12 11:02:29 +05:30
Christy Jacob 00473d4744 feat: batch create abuse logs 2025-02-12 10:57:43 +05:30
Jake Barnby da2e27650c Merge remote-tracking branch 'origin/1.6.x' into feat-key-segmented-usage 2025-02-12 18:20:28 +13:00
Jake Barnby d4c659f88d Fix key usage default 2025-02-12 18:17:47 +13:00
Jake BarnbyandGitHub c22ece068f Merge pull request #9346 from appwrite/fix-drop-abuse
Fix drop abuse on shared table project delete
2025-02-12 17:41:40 +13:00
Jake Barnby e394532bcd Fix drop abuse on shared table project delete 2025-02-12 17:03:37 +13:00
Christy JacobandGitHub e140603890 Merge pull request #9342 from appwrite/lohanidamodar-patch-2
Fix: missing call for image transformations counting
2025-02-11 22:13:15 +05:30
Christy Jacob 2189ca1469 chore: linter 2025-02-11 16:40:17 +00:00
Matej Bačo 86a1fbe86a Fix preview domains 2025-02-11 16:26:00 +01:00
Matej Bačo 14e4854947 Upgrade Console 2025-02-11 15:18:44 +01:00
Matej BačoandGitHub 1c1f9aee2c Merge pull request #9322 from appwrite/feat-add-secret-to-update-variable
Add secret param to update variable endpoint
2025-02-11 14:50:49 +01:00
Matej Bačo 084b62116f Convert to library approach 2025-02-11 14:26:49 +01:00
Khushboo Verma 3d6351bbe0 Merge branch 'feat-add-secret-to-update-variable' of github.com:appwrite/appwrite into feat-add-secret-to-update-variable 2025-02-11 18:47:31 +05:30
Khushboo Verma 187f4c841e Remove error message validation 2025-02-11 18:46:31 +05:30
Matej BačoandGitHub 15a0c28093 Merge branch 'feat-sites' into feat-add-secret-to-update-variable 2025-02-11 14:14:46 +01:00
Khushboo Verma c440a3933b Fix functions tests 2025-02-11 18:42:18 +05:30
Khushboo Verma 11477d67c9 Address PR comments 2025-02-11 18:20:54 +05:30
Damodar LohaniandGitHub f6aff786f1 Fix: missing call for image transformations counting 2025-02-11 17:59:48 +05:45
Fabian Gruber 8324b789c5 chore(review): remove http status codes from exceptions 2025-02-11 11:00:28 +01:00
Damodar Lohani f2fc45da02 fix format 2025-02-11 09:46:00 +00:00
Fabian Gruber f2ae6e07cb feat(builds): check if function is blocked before building 2025-02-11 10:45:26 +01:00
Jake Barnby 61e65e1eda Skip shared jobs entirely 2025-02-11 22:37:57 +13:00
Damodar LohaniandGitHub 2b2be60e77 Merge branch '1.6.x' into feat-remove-deprecated-usage-stuff 2025-02-11 15:20:23 +05:45
Jake Barnby abaa5c7f48 Only run shared tables tests if database library version changed compared to base 2025-02-11 22:26:39 +13:00
Jake Barnby 704437b5e8 Format 2025-02-11 22:04:52 +13:00
Jake Barnby bed7ab321e Add unit test 2025-02-11 22:02:20 +13:00
Jake Barnby d04a5cab0d Merge remote-tracking branch 'origin/1.6.x' into feat-key-segmented-usage
# Conflicts:
#	composer.lock
2025-02-11 21:33:34 +13:00
Jake Barnby 0634a7eac3 Fix injections 2025-02-11 21:13:01 +13:00
Jake Barnby 1c91604c80 Only disable database reads/writes and network stats 2025-02-11 20:56:39 +13:00
Damodar Lohani 940f4d12af Remove usage and usage dump in favor of stats-usage and stats-usage-dump 2025-02-11 07:52:37 +00:00
Jake BarnbyandGitHub 2902b1bde8 Merge pull request #9329 from appwrite/catch-invalid-index
Catch invalid index
2025-02-11 20:34:10 +13:00
Chirag Aggarwal 5076303c33 chore: refactor realtime queueing in builds worker 2025-02-11 06:06:43 +00:00
Chirag Aggarwal 532160705f chore: refactor realtime queueing in functions worker 2025-02-11 05:50:30 +00:00
Jake Barnby 7490240397 Fix name shadowing 2025-02-11 18:29:42 +13:00
Chirag Aggarwal f666e18154 chore: fix databases worker realtime queueing 2025-02-11 05:00:45 +00:00
Jake Barnby e5a3866065 Fix imports 2025-02-11 17:53:40 +13:00
Jake Barnby 30bc70b9b1 Abstract key decoding and check if usage is enabled 2025-02-11 17:49:22 +13:00
Chirag Aggarwal bcdae7f4e3 chore: refactor certificate realtime, fix database 2025-02-11 04:21:36 +00:00
Chirag Aggarwal 47fbb777ed chore: refactor migrations realtime queue 2025-02-11 04:03:02 +00:00
Chirag Aggarwal 2c4c42de05 docs: fix database worker 2025-02-11 03:53:18 +00:00
Chirag Aggarwal 375f643214 refactor: triggering realtime events with queueForRealtime 2025-02-11 03:29:32 +00:00
Christy JacobandGitHub 2f95b0e2e0 Merge pull request #9272 from appwrite/feat-logs-db
Feat: logs DB
2025-02-10 23:49:48 +05:30
Christy Jacob bfc0b53163 chore: add simple toggle for dual writing 2025-02-10 23:05:34 +05:30
Khushboo Verma f1989d0aba Fix project tests 2025-02-10 22:07:07 +05:30
Khushboo Verma 75219b800a Fix failing tests 2025-02-10 19:59:28 +05:30
Matej Bačo 4c3fa5f246 Update composer.lock 2025-02-10 15:12:55 +01:00
Matej Bačo 06ed493cfe Merge branch '1.6.x' into feat-sites 2025-02-10 15:12:36 +01:00
Matej Bačo 7be0fbf616 Implementation of authorized previews 2025-02-10 15:07:01 +01:00
fogelito c77ca64fc0 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into catch-invalid-index 2025-02-10 15:41:50 +02:00
fogelito 8c3a243a5d Typo 2025-02-10 15:40:45 +02:00
fogelito 7a8688932c Add test 2025-02-10 15:40:21 +02:00
Khushboo Verma 6cf53bbb81 Add E2E variable test for functions 2025-02-10 19:05:27 +05:30
Steven NguyenandGitHub 06e857e5d9 Merge pull request #9321 from appwrite/pla-2453
Fix WEBP File Preview Rendering Issue
2025-02-10 06:33:40 -07:00
Khushboo Verma 3a766bf970 Add E2E test for secret env var 2025-02-10 18:43:31 +05:30
Khushboo Verma f96291af88 Add tests for function variables 2025-02-10 16:24:14 +05:30
Khushboo Verma 8557a9e1b1 Add secret param to update variable in function and projects 2025-02-10 16:06:31 +05:30
Matej Bačo e8af2338ec Add oauth attributes to installation 2025-02-10 11:05:35 +01:00
fogelito 7caab2f9ff IndexException 2025-02-10 10:55:37 +02:00
fogelito 33f55c73a7 Revert cast Index 2025-02-10 10:42:29 +02:00
fogelito edbe0fb72f Bump Database version 0.58.5 2025-02-10 10:40:12 +02:00
fogelito 23a9b519f6 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into catch-invalid-index 2025-02-10 10:37:05 +02:00
Matej Bačo aec9d91a68 Formatting fix 2025-02-10 09:17:59 +01:00
Matej Bačo 950255fab9 Merge branch 'feat-sites' into feat-spa 2025-02-10 09:17:28 +01:00
fogelito a032540b3c IndexException 2025-02-10 10:11:52 +02:00
fogelito 27709e7683 IndexException 2025-02-10 10:04:51 +02:00
fogelito 5b786e2a68 Catch index exception 2025-02-10 09:19:56 +02:00
Khushboo Verma 7c9d6ccde2 Merge branch 'feat-sites' into feat-add-secret-to-update-variable 2025-02-10 12:32:19 +05:30
Christy JacobandGitHub 42a4fe2efc Merge branch '1.6.x' into feat-logs-db 2025-02-10 10:18:09 +05:30
Christy JacobandGitHub 1c6bce0e79 Merge pull request #9330 from appwrite/update-queue-library
chore: update dependencies
2025-02-10 09:54:56 +05:30
Christy Jacob f6c28322c9 chore: update dependencies 2025-02-10 09:30:24 +05:30
fogelito 3092e765cc indexException 2025-02-09 18:34:41 +02:00
Damodar Lohani e8faf2a859 fix worker 2025-02-09 08:52:07 +00:00
Damodar Lohani ec9045b488 add stats-resources health queue 2025-02-09 06:36:59 +00:00
55e30a0ef4 Update src/Appwrite/Platform/Workers/StatsUsageDump.php
Co-authored-by: Christy Jacob <christyjacob4@gmail.com>
2025-02-09 12:19:16 +05:45
Damodar Lohani abd899186d Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db 2025-02-09 05:20:10 +00:00
Damodar Lohani 59516408af revert env update 2025-02-09 05:15:26 +00:00
Matej Bačo 5c286c3334 Implement preview branding 2025-02-08 15:53:55 +01:00
Matej BačoandGitHub f8b27c0b76 Merge pull request #9324 from appwrite/chore-improve-tests
Chore: Improve tsts
2025-02-08 13:23:39 +01:00
Matej Bačo 6e5d4fb358 Fix formatting 2025-02-08 12:18:39 +01:00
Matej Bačo 5e2abc539f Add helper for site domain 2025-02-08 12:16:25 +01:00
Matej Bačo 2f03a33c15 Add template site and domain reclaiming tests 2025-02-08 12:11:09 +01:00
Khushboo Verma 7ce0e3c38c Add strict checks for value of secret 2025-02-08 16:28:04 +05:30
Matej BačoandGitHub e269614a51 Update tests/e2e/Services/Sites/SitesCustomServerTest.php 2025-02-08 10:48:49 +01:00
Matej Bačo 21c224709f Finish SPA integration 2025-02-08 10:36:11 +01:00
Khushboo Verma ac8a29f047 Add site variables tests 2025-02-07 23:27:46 +05:30
Christy JacobandGitHub 859d556461 Merge pull request #9323 from appwrite/revert-9320-revert-9319-revert-9262-fix-redirect-validator-v2
Revert "Restore "feat: custom app schemes"""
2025-02-07 23:09:36 +05:30
Luke B. SilverandGitHub 975393ae48 Revert "Restore "feat: custom app schemes""" 2025-02-07 17:34:58 +00:00
Christy JacobandGitHub 0c096b7434 Merge pull request #9320 from appwrite/revert-9319-revert-9262-fix-redirect-validator-v2
Restore "feat: custom app schemes""
2025-02-07 21:40:13 +05:30
Khushboo Verma 681f4b9eda Change to module structure 2025-02-07 21:29:48 +05:30
loks0n 3d74b651fe test: subdomain case 2025-02-07 15:49:15 +00:00
loks0n 111c28592d chore: fix warning 2025-02-07 15:22:02 +00:00
loks0n 10ab613f3b chore: fix empty schemes 2025-02-07 15:15:54 +00:00
Khushboo Verma 2b46bd2643 Add secret param to update var 2025-02-07 20:36:57 +05:30
Khushboo Verma a322b022eb Rename to getResourceAvailability 2025-02-07 19:25:10 +05:30
Khushboo Verma 0dc43432e2 Update SDK method structure 2025-02-07 19:06:57 +05:30
Khushboo Verma 27de266cb0 Add tests 2025-02-07 18:53:33 +05:30
Matej Bačo 2e048b0895 Upgrade console 2025-02-07 14:10:39 +01:00
Matej Bačo f8bf532fc0 Sync specs 2025-02-07 12:56:31 +01:00
Matej Bačo 210349dc70 Merge branch '1.6.x' into feat-sites 2025-02-07 12:53:52 +01:00
Khushboo Verma eaa4795eb6 Resolve merge conflicts 2025-02-07 16:32:35 +05:30
loks0n 10b88ba194 chore: small improvements 2025-02-07 10:38:36 +00:00
Chirag Aggarwal 768e4c4988 chore: added webp to allowed file inputs 2025-02-07 10:36:41 +00:00
Matej Bačo 293f75954d Post-merge specs update 2025-02-07 11:01:41 +01:00
Matej Bačo f93eb2072c Merge branch '1.6.x' into feat-sites 2025-02-07 11:00:35 +01:00
Luke B. SilverandGitHub 9788a126a8 Revert "Revert "feat: custom app schemes"" 2025-02-07 09:53:26 +00:00
Christy JacobandGitHub ad56994b83 Merge pull request #9319 from appwrite/revert-9262-fix-redirect-validator-v2
Revert "feat: custom app schemes"
2025-02-07 15:23:05 +05:30
Luke B. SilverandGitHub 2af026eabe Revert "feat: custom app schemes" 2025-02-07 09:51:27 +00:00
Chirag Aggarwal 20c01d0e73 chore: added env variable to compose.phtml 2025-02-07 07:57:29 +00:00
Chirag AggarwalandGitHub 989bbbc261 Merge branch '1.6.x' into pla-2428 2025-02-07 13:25:15 +05:30
Khushboo Verma 0a3f284e14 Update composer.json 2025-02-07 11:18:07 +05:30
Khushboo Verma 11ed6b8f47 Resolve merge conflicts 2025-02-07 11:16:30 +05:30
Steven NguyenandGitHub a7b1363644 Merge pull request #9262 from appwrite/fix-redirect-validator-v2
feat: custom app schemes
2025-02-06 18:13:03 -08:00
Steven NguyenandGitHub 1d55bbc0d7 Merge pull request #9271 from appwrite/pla-2009
chore: override getUserAgent function to set forwarded user agent
2025-02-06 17:51:49 -08:00
Steven NguyenandGitHub 1f8448a514 Merge pull request #9228 from ChiragAgg5k/fix-slack-oauth
fix: slack oauth scopes, and updated to v2
2025-02-06 17:22:54 -08:00
Khushboo Verma 8dd99b7d2a Add framework detection to Appwrite 2025-02-06 23:59:43 +05:30
Luke B. SilverandGitHub e6efe5b27e Merge branch '1.6.x' into pla-2428 2025-02-06 13:58:58 +00:00
Matej Bačo df99907120 Update composer.lock 2025-02-06 14:24:08 +01:00
Matej Bačo 7ac83d7a9f Merge branch '1.6.x' into feat-sites 2025-02-06 14:23:50 +01:00
Matej Bačo f2445c2a37 Add SPA tests 2025-02-06 14:22:35 +01:00
Christy JacobandGitHub 7220abe9a4 Merge pull request #9313 from appwrite/queue-0.8.1
fix(schedule-tasks): revert back to direct pool usage
2025-02-06 18:08:42 +05:30
Fabian Gruber 273ea0abcc fix(schedule-tasks): revert back to direct pool usage 2025-02-06 13:18:18 +01:00
loks0n a4c8b74501 chore: revert storage 2025-02-06 11:24:29 +00:00
loks0n b69e78e5bf Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-redirect-validator-v2 2025-02-06 11:22:49 +00:00
Matej Bačo efb30e7f8e Updat deps 2025-02-06 12:19:02 +01:00
Matej Bačo 719a771613 Update version 2025-02-06 12:05:31 +01:00
Christy JacobandGitHub c46c5e4259 Merge pull request #9312 from appwrite/queue-0.8.1
chore: update utopia-php/queue to 0.8.2
2025-02-06 16:34:20 +05:30
Fabian Gruber c02a8d3997 chore: update utopia-php/queue to 0.8.2 2025-02-06 12:02:06 +01:00
Damodar LohaniandGitHub 9e988747d8 Merge branch '1.6.x' into feat-logs-db 2025-02-06 16:02:41 +05:45
Christy JacobandGitHub ec9b609817 Merge pull request #9311 from appwrite/queue-0.8.1
chore: update utopia-php/queue to 0.8.1
2025-02-06 15:11:11 +05:30
Fabian Gruber bb696a6c7b chore: update utopia-php/queue to 0.8.1 2025-02-06 10:38:36 +01:00
Damodar Lohani cd45177558 fix pool empty 2025-02-06 08:06:15 +00:00
Damodar Lohani f6b2d9d937 remove old collections - we only need it in production temporarily 2025-02-06 07:02:07 +00:00
Damodar Lohani c48146b699 fix builds worker 2025-02-06 06:05:53 +00:00
Damodar Lohani c27c3499aa fix endpoint and add test 2025-02-06 04:48:40 +00:00
Damodar Lohani 0a6ebe6661 Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db 2025-02-06 04:40:05 +00:00
Damodar Lohani ae9d3f4703 fix dual writing 2025-02-06 04:40:01 +00:00
Damodar Lohani 2efe1ed9dc new health endpoint 2025-02-06 04:24:04 +00:00
Damodar Lohani c3495dde35 fix key 2025-02-06 04:17:49 +00:00
Damodar Lohani 8da5bfccb6 fix format and test 2025-02-06 03:58:46 +00:00
Damodar Lohani 89aa61b17c fix duplicate constant 2025-02-06 03:37:01 +00:00
Damodar Lohani 87b3f535bd fix renaming 2025-02-06 03:36:53 +00:00
Christy JacobandGitHub a65b0bb32c Merge pull request #9309 from appwrite/fix-certificate-worker-events
fix(certificate worker): events are published without queue name
2025-02-05 23:15:46 +05:30
Fabian Gruber 78dd753e8f fix(certificate worker): events are published without queue name 2025-02-05 18:01:55 +01:00
Matej BačoandGitHub e0131aa749 Merge pull request #9307 from appwrite/chore-http-descriptions
Chore: Deprecate markdown docs refferences
2025-02-05 16:51:49 +01:00
Matej Bačo 5882fda501 Fix site router 2025-02-05 16:17:03 +01:00
Matej Bačo eeed8dbc16 Fix site creation namespace 2025-02-05 14:15:25 +01:00
Christy JacobandGitHub 0ae9a439ee Merge pull request #9308 from appwrite/gql-test-assert-eventually
fix(test): use assertEventually instead of while(true)
2025-02-05 18:32:26 +05:30
Matej Bačo 7239b9d7cc Fix sites 5xx error 2025-02-05 13:56:17 +01:00
Fabian Gruber 213e16050b fix(test): use assertEventually instead of while(true) 2025-02-05 13:40:13 +01:00
Matej Bačo 480c7eac21 Fix usage rename bug 2025-02-05 13:15:17 +01:00
Matej Bačo 412c75ebdd Formatting fix 2025-02-05 12:28:52 +01:00
Matej Bačo f33e4b6f5a Update specs 2025-02-05 12:28:22 +01:00
Matej Bačo 30f34d5764 Deprecate markdown docs refferences 2025-02-05 12:27:20 +01:00
Matej Bačo 2e62837de6 Migrate module names 2025-02-05 11:30:19 +01:00
Damodar Lohani 68c3aa3078 update to use publisher 2025-02-05 09:53:29 +00:00
Damodar Lohani 3e778c0094 update environment variable 2025-02-05 09:53:23 +00:00
Damodar Lohani cf66bee925 Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db 2025-02-05 09:49:11 +00:00
Christy JacobandGitHub 1adb1e23a9 Merge pull request #9287 from appwrite/amqp
feat: add AMQP queues
2025-02-05 15:01:42 +05:30
Fabian Gruber a16f26d378 feat: add AMQP queues 2025-02-05 10:29:33 +01:00
Damodar Lohani 966fc47e25 fix classname 2025-02-05 09:28:44 +00:00
Damodar Lohani 99f23ff25a refactor 2025-02-05 09:27:36 +00:00
Damodar Lohani 6b930129e5 add DAU and WAU metric 2025-02-05 09:26:00 +00:00
Damodar Lohani 292e859133 rename metric 2025-02-05 09:17:27 +00:00
Damodar Lohani 5052fd8528 get latest usageDump and dual write 2025-02-05 09:11:03 +00:00
Damodar Lohani 5b91b5cec1 env to configure dual write 2025-02-05 09:10:45 +00:00
Matej Bačo 3d319e25a9 SDK labels rework 2025-02-05 09:51:14 +01:00
Damodar Lohani 4d43b41482 Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db 2025-02-05 08:17:46 +00:00
Jake BarnbyandGitHub 6bdab7213a Merge pull request #9306 from appwrite/chore-update-database
Chore update database
2025-02-05 20:20:35 +13:00
Bradley Schofield c86afb9933 Update DB Lib 2025-02-05 14:38:16 +09:00
Bradley Schofield b4e61f8587 Merge branch '1.6.x' into chore-update-database 2025-02-05 14:35:31 +09:00
Bradley Schofield fe5b9c9525 Update DB Dependents 2025-02-05 14:35:20 +09:00
Matej Bačo 36c9c002d1 Fix frozen 404 errors 2025-02-04 14:16:17 +01:00
Matej Bačo 7019cea5fa Update specs 2025-02-04 12:34:07 +01:00
Matej BačoandGitHub d30af2c561 Merge pull request #9182 from appwrite/feat-add-tests-for-sites
Add tests for sites
2025-02-04 11:57:02 +01:00
Chirag Aggarwal bfb4cb4a04 chore: added empty check for s3 creds 2025-02-04 09:58:12 +00:00
Matej Bačo d272a474ab Update phpunit.xml 2025-02-04 10:51:44 +01:00
Matej Bačo 66c4003789 Fix site tests 2025-02-04 10:51:33 +01:00
Chirag Aggarwal deb556242e chore: update test 2025-02-04 08:35:26 +00:00
Chirag Aggarwal 6be805fe6e Merge branch '1.6.x' into pla-2428 2025-02-04 08:15:44 +00:00
Chirag Aggarwal fcfef4d474 Merge branch '1.6.x' into pla-2428 2025-02-04 08:12:42 +00:00
Christy JacobandGitHub 5d243de029 Merge pull request #9269 from ChiragAgg5k/pla-2061
chore: added teamName to membership redirect url
2025-02-04 13:07:25 +05:30
Chirag AggarwalandGitHub deeabc2d86 Merge branch '1.6.x' into pla-2009 2025-02-04 10:44:52 +05:30
Chirag Aggarwal a226e2ce79 chore: remove console user access 2025-02-04 05:14:37 +00:00
Chirag Aggarwal e4122e236c chore: added null coalescing operator 2025-02-04 04:59:18 +00:00
Steven NguyenandGitHub 0547dbc454 fix: use github var instead of secret for DOCKERHUB_USERNAME
DOCKERHUB_USERNAME was moved to be a variable since it doesn't need to
be secret.
2025-02-03 22:34:08 +00:00
Matej Bačo c5d4378069 Remove leftover 2025-02-03 16:38:07 +01:00
Matej Bačo 58dc4a0280 Fix tests 2025-02-03 16:33:28 +01:00
Matej Bačo 3ed5e1b65a Merge branch 'feat-sites' into feat-add-tests-for-sites 2025-02-03 14:29:32 +01:00
Matej Bačo 2ad3b68821 Temporarly disable assertion 2025-02-03 13:57:35 +01:00
Matej Bačo f51900a69c Fix more tests 2025-02-03 13:43:35 +01:00
Matej Bačo 0fe072b17b Fix more tests 2025-02-03 12:38:27 +01:00
Matej Bačo 124cff7bf2 temporary disable test 2025-02-03 11:49:20 +01:00
Matej Bačo 3aafceab40 Improve CI/CD flaky tests 2025-02-03 11:38:36 +01:00
Matej Bačo 3b961d18f9 Publish pre-release image 2025-02-03 11:26:28 +01:00
Matej Bačo e311790365 Merge remote-tracking branch 'origin/1.7.x' into feat-sites 2025-02-03 11:04:21 +01:00
Matej Bačo 47f4e67a52 Fixing bug post-merge 2025-02-03 11:03:58 +01:00
Matej Bačo 9f9ce61c3a Post-merge fixes 2025-02-03 10:32:01 +01:00
Matej Bačo f9430d4d20 Merge branch '1.6.x' into fix-site-tests 2025-02-03 10:05:30 +01:00
Matej Bačo d5f1b56b90 Re-add secret after merge 2025-02-03 09:03:18 +00:00
Matej Bačo 1946df83a7 Merge remote-tracking branch 'origin/1.6.x' into 1.7.x 2025-02-03 09:03:04 +00:00
Matej Bačo 59d87a8af1 Fix issues with tests 2025-02-03 09:26:57 +01:00
Jake BarnbyandGitHub e1912c621a Merge pull request #9298 from appwrite/fix-projects-tests
Make sessions limit tests assert eventually
2025-02-03 14:46:31 +13:00
Bradley Schofield bbc527d4a4 Use defaults in assert eventually 2025-02-03 10:19:42 +09:00
Bradley Schofield 50cc28647d Make sessions limit tests assert eventually 2025-02-03 09:53:00 +09:00
Damodar LohaniandGitHub 63c07a456f Merge branch '1.6.x' into feat-logs-db 2025-02-02 07:08:25 +05:45
loks0n 58086fbc74 fix: leftover 2025-01-31 22:15:22 +00:00
Gurjeet Singh VirdeeandGitHub a3324b7453 Merge branch 'main' into 152-sdk-cli-command-update 2025-02-01 03:43:11 +05:30
loks0n 2e8b8367ed fix: localhost case 2025-01-31 22:01:41 +00:00
Steven NguyenandGitHub df017bccb2 chore: bump appwrite version to 1.6.1 2025-01-31 22:00:32 +00:00
loks0n ade25ec845 fix: validator edge case 2025-01-30 18:16:07 +00:00
loks0n 0be400da19 fix: validator description 2025-01-30 17:13:09 +00:00
loks0n 8ab06d053f chore: refactor, dbless approach 2025-01-30 16:58:42 +00:00
loks0n dada8f9bc1 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-redirect-validator-v2 2025-01-30 16:00:50 +00:00
Damodar Lohani 978f22b56d rename transformed metric 2025-01-30 07:15:24 +00:00
Damodar Lohani 71c265d4e8 fix wrong comment 2025-01-30 07:12:15 +00:00
Damodar Lohani d31a358392 Temp: everything to be removed 2025-01-30 07:07:10 +00:00
Damodar Lohani 95845f8c0e update env name 2025-01-30 06:42:57 +00:00
Damodar Lohani 6eb4d3f021 reset dockerfile 2025-01-30 06:40:49 +00:00
Damodar Lohani 074f4417ff image transformations metrics and batch writes 2025-01-30 06:24:10 +00:00
Damodar Lohani da7a234038 update 2025-01-30 05:28:45 +00:00
Damodar Lohani f94d1a5d82 update compose.phtml 2025-01-30 05:24:30 +00:00
Chirag Aggarwal 3a5342ae24 chore: added test cases 2025-01-30 05:05:26 +00:00
Damodar Lohani d0724812d7 fix 2025-01-30 05:05:05 +00:00
Damodar Lohani 6fedefdeda fix 2025-01-30 05:03:41 +00:00
Damodar Lohani cb31e7954e refactor rename 2025-01-30 04:53:53 +00:00
Damodar Lohani 0da3f870f9 refactor: rename 2025-01-30 04:43:16 +00:00
Chirag Aggarwal 6801a46d4e chore: remove unnecessary priviledge check 2025-01-30 04:36:51 +00:00
Damodar Lohani 469dbf0a31 reset usage 2025-01-30 04:33:42 +00:00
Damodar Lohani 3fde465dfa Update stats resources task container 2025-01-30 04:15:03 +00:00
Jake BarnbyandGitHub 41d1af273e Merge pull request #9291 from appwrite/feat-migrations-dynamic-keys
Make migrations use Dynamic keys for destination
2025-01-30 17:12:25 +13:00
Damodar Lohani c2ce273065 update stats resources task to use new queue 2025-01-30 04:10:35 +00:00
Damodar Lohani a05d774370 queue resources to cli 2025-01-30 04:07:44 +00:00
Damodar Lohani e78020d45a stats resources evenet 2025-01-30 04:06:57 +00:00
Damodar Lohani 22ab23d009 feat: Stats resources worker 2025-01-30 04:05:51 +00:00
Damodar Lohani 31ddb6e48f rename collection 2025-01-30 03:51:17 +00:00
Damodar Lohani 21097041f0 refactor: rename usage count to stats resources 2025-01-30 03:50:27 +00:00
Bradley Schofield a4fa0e020a Readd Database Scopes 2025-01-30 12:38:19 +09:00
Bradley Schofield 9f043a1b58 Merge branch '1.6.x' into feat-migrations-dynamic-keys 2025-01-30 11:26:52 +09:00
Bradley Schofield ecaaa4be53 Make migrations use Dynamic keys for destination 2025-01-30 11:23:39 +09:00
loks0n 850bed904a chore: improve validator 2025-01-29 17:52:06 +00:00
loks0n 0457d4d052 Merge branch 'fix-redirect-validator-v2' of https://github.com/appwrite/appwrite into fix-redirect-validator-v2 2025-01-29 17:34:53 +00:00
loks0n 84f3e62908 chore: review changes 2025-01-29 17:34:45 +00:00
Christy JacobandGitHub 505a072bdd Merge pull request #9289 from appwrite/add-transformedAt
Add transformed at
2025-01-29 22:55:26 +05:30
shimonandChristy Jacob 6ef49c8f73 transformedAt for files addition 2025-01-29 22:12:35 +05:30
shimonandChristy Jacob 850737c953 transformedAt for files addition 2025-01-29 22:12:31 +05:30
shimonandChristy Jacob a12fce550a payload debug 2025-01-29 22:12:24 +05:30
Eldad A. FuxandGitHub c4ab6f5aff Merge pull request #9285 from appwrite/LauraDuRy-patch-1
replaced init for cloud link
2025-01-29 12:06:46 +01:00
Khushboo Verma 7be0f4a193 Add rules.read scope to console member 2025-01-29 14:56:01 +05:30
Laura Du RyandGitHub 891c1c4093 Update README.md 2025-01-29 10:04:15 +01:00
Laura Du RyandGitHub 507c8bd3ec Update README.md 2025-01-29 10:02:40 +01:00
Laura Du RyandGitHub 2de4e71662 Update README.md 2025-01-29 09:58:04 +01:00
Christy JacobandGitHub 3d9653a3df Merge pull request #9284 from appwrite/revert-9281-transformedAt-addition
Revert "Transformed at addition"
2025-01-29 14:05:37 +05:30
Shimon NewmanandGitHub f1f660352e Revert "Transformed at addition" 2025-01-29 10:30:35 +02:00
Christy JacobandGitHub 0220144615 Merge pull request #9282 from appwrite/update-sdk-gen
Update sdk generator dependency
2025-01-29 10:27:43 +05:30
Chirag AggarwalandGitHub 2930c32184 Merge branch '1.6.x' into fix-slack-oauth 2025-01-29 09:39:14 +05:30
DarshanandGitHub dbfb158452 Merge branch '1.6.x' into update-sdk-gen 2025-01-29 09:38:10 +05:30
Darshan ccc800762c update: sdk generator dependency. 2025-01-29 09:36:38 +05:30
Steven NguyenandGitHub 8e42b5c97e Merge pull request #9236 from appwrite/docs-clarify-updates-endpoints-2
Docs: clarify update endpoints only work on draft messages
2025-01-28 13:59:14 -08:00
Ebenezer Don 2e438edcc1 regenerate specs 2025-01-28 21:36:42 +00:00
Ebenezer Don 6394a30581 Merge branch '1.6.x' into docs-clarify-updates-endpoints-2 2025-01-28 21:34:08 +00:00
Eldad A. FuxandGitHub e70de37c0b Merge pull request #9281 from appwrite/transformedAt-addition
Transformed at addition
2025-01-28 16:30:32 +01:00
shimon 34f6dab14e transformedAt for files addition 2025-01-28 16:52:04 +02:00
shimon f97b3aaa86 transformedAt for files addition 2025-01-28 16:49:55 +02:00
Eldad A. FuxandGitHub 71013cab08 Merge pull request #9280 from appwrite/update-sdk-gen
Update Sdk Generator dependency
2025-01-28 15:09:43 +01:00
shimon 163f7b8d17 Merge branch '1.6.x' of github.com:appwrite/appwrite into 1.6.x 2025-01-28 16:07:30 +02:00
Darshan 63c841b7a8 update: sdk generator dependency. 2025-01-28 19:37:27 +05:30
Luke B. SilverandGitHub f95504f829 Merge branch '1.6.x' into fix-redirect-validator-v2 2025-01-28 13:34:18 +00:00
Christy JacobandGitHub 425e0c9a6a Merge pull request #9263 from appwrite/add-fast2sms-adapter
feat: add fast2SMS adapter
2025-01-28 16:02:55 +05:30
Christy Jacob 8cf6a4f393 chore: update deps 2025-01-28 15:58:16 +05:30
Christy Jacob 2307160238 Merge branch '1.6.x' of github.com:appwrite/appwrite into add-fast2sms-adapter 2025-01-28 15:57:53 +05:30
Christy JacobandGitHub 2cfa44faba Merge pull request #9276 from appwrite/revert-9255-feat-batch-usage-dump
Revert "Feat batch usage dump"
2025-01-28 15:29:55 +05:30
Jake BarnbyandGitHub 76680bcbcc Revert "Feat batch usage dump" 2025-01-28 22:29:24 +13:00
Christy Jacob 419f3bee1d chore: fix tests 2025-01-28 13:32:10 +05:30
Christy Jacob 8fdf574a69 Merge branch '1.6.x' of github.com:appwrite/appwrite into add-fast2sms-adapter 2025-01-28 13:18:36 +05:30
Damodar Lohani fb5aeb1476 skip some metrics override 2025-01-28 07:19:27 +00:00
Christy Jacob 5593682c3d chore: review comments 2025-01-28 12:24:16 +05:30
Christy Jacob 8ceb6e2c25 chore: review comments 2025-01-28 12:23:18 +05:30
Damodar Lohani d84f6e4ee0 reset database listeners 2025-01-28 06:40:20 +00:00
Christy Jacob 6cef099890 chore: linter 2025-01-28 11:51:11 +05:30
Christy Jacob dfbe3220d8 chore: linter 2025-01-28 11:49:29 +05:30
Christy Jacob bbe52db4ff feat: add geosms adapter 2025-01-28 11:29:15 +05:30
Khushboo Verma fcd920460f Addressed PR comments 2025-01-28 09:53:33 +05:30
Damodar Lohani a85499a4ec Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db 2025-01-28 02:11:01 +00:00
loks0n 46532671d6 chore: specs 2025-01-27 20:44:14 +00:00
loks0n 4320e5bef5 chore: specs 2025-01-27 19:35:09 +00:00
loks0n b070e56226 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-redirect-validator-v2 2025-01-27 19:33:44 +00:00
Eldad A. FuxandGitHub 64567ffd04 Merge pull request #9274 from appwrite/update-specs
Update: Latest sdk specs
2025-01-27 15:40:20 +01:00
Chirag Aggarwal 70c119b9cc chore: added test cases for forwarded user agent 2025-01-27 13:58:46 +00:00
loks0n f369e9100f fix: tests 2025-01-27 13:25:27 +00:00
loks0n c184938a2a fix: tests 2025-01-27 13:02:39 +00:00
Darshan c0dc43fb29 update: specs. 2025-01-27 18:19:07 +05:30
Darshan 5ac95bc103 fix: wrong types on sdk models. 2025-01-27 18:03:31 +05:30
Darshan e9136444d7 update: latest sdk specs. 2025-01-27 17:33:49 +05:30
loks0n dc33c26781 fix: tests 2025-01-27 12:01:18 +00:00
loks0n 3f59c087c8 fix: tests 2025-01-27 11:50:03 +00:00
loks0n d8848e10af fix: build 2025-01-27 11:12:11 +00:00
Luke B. SilverandGitHub c30689d664 Merge branch '1.6.x' into fix-redirect-validator-v2 2025-01-27 11:00:03 +00:00
Luke B. SilverandGitHub bce71d6177 Merge branch '1.6.x' into pla-2009 2025-01-27 10:40:23 +00:00
Eldad A. FuxandGitHub 1db4bf7ae4 Merge pull request #9260 from appwrite/databases-reads-writes
Usage: Databases reads writes
2025-01-27 11:21:52 +01:00
Damodar Lohani 7b588219f9 fix dual writing internal ID conflict 2025-01-27 08:19:03 +00:00
Damodar Lohani 05f99dcdf0 fix wrong arg 2025-01-27 07:46:54 +00:00
Damodar Lohani 3124554403 remove db listeners as counters are now done separately by usage worker 2025-01-27 07:39:33 +00:00
Damodar Lohani 336b0a7c02 rename collection 2025-01-27 07:22:50 +00:00
Damodar Lohani f593498c07 dual writing 2025-01-27 07:15:06 +00:00
Damodar Lohani 55cbab6270 fix format 2025-01-27 06:15:59 +00:00
Damodar Lohani 5d5547c6b9 periodic metric 2025-01-27 06:11:58 +00:00
Damodar Lohani 066273d0db update usage worker for usage count 2025-01-27 04:33:41 +00:00
Damodar Lohani 9955b6b61c usage count container and events 2025-01-27 04:33:33 +00:00
Chirag Aggarwal eea088556d chore: added check for empty forwarded user agent before 2025-01-27 04:15:32 +00:00
Damodar Lohani 5685c8ac25 refactor create collection and create logs db 2025-01-27 02:51:01 +00:00
Damodar Lohani c6360cce06 logs collection config 2025-01-27 02:50:50 +00:00
Damodar Lohani 187ea93f81 Get logs db resource 2025-01-27 02:26:06 +00:00
shimon 7dbb2ce63e Merge branch '1.6.x' of github.com:appwrite/appwrite into 1.6.x 2025-01-26 09:44:21 +02:00
Chirag Aggarwal f74fe4438f chore: override getUserAgent function to set forwarded user agent 2025-01-26 07:11:00 +00:00
Chirag Aggarwal d40fbda04a chore: added teamName to membership redirect url 2025-01-25 17:25:07 +00:00
loks0n b34d64b4d4 fix: tests 2025-01-24 17:58:46 +00:00
loks0n 42cf1fefa5 feat: custom scheme 2025-01-24 16:21:12 +00:00
Christy Jacob 303f7d4845 feat: add fast2SMS adapter 2025-01-24 21:34:00 +05:30
Gurjeet Singh VirdeeandGitHub 8508e6009b refactor: cleaned up syntax by removing unnecessary '=' 2025-01-24 19:13:56 +05:30
shimon 0e5b59e9f0 payload debug 2025-01-24 09:03:39 +02:00
Khushboo Verma 0124d5254c Resolve merge conflicts 2025-01-24 11:21:49 +05:30
Christy JacobandGitHub 923dc9661f Merge pull request #9251 from appwrite/feat-enable-heic
feat: enable heic
2025-01-24 10:49:21 +05:30
loks0n 674f3d83b3 chore: remove comment 2025-01-23 17:22:33 +00:00
loks0n 507d210bcb fix: tests 2025-01-23 17:20:57 +00:00
loks0n f5efc53406 fix: tests 2025-01-23 15:44:03 +00:00
loks0n ff9fb9bb46 Merge branch 'fix-redirect-validator-v2' of https://github.com/appwrite/appwrite into fix-redirect-validator-v2 2025-01-23 15:27:11 +00:00
loks0n 49b71ff43a chore: fmt 2025-01-23 15:27:03 +00:00
Luke B. SilverandGitHub d2a4361e8d Merge branch '1.6.x' into fix-redirect-validator-v2 2025-01-23 15:20:52 +00:00
loks0n 170f3656e1 fix: redirect validator v2 2025-01-23 15:00:54 +00:00
Jake BarnbyandGitHub 786c9d1013 Merge pull request #9261 from appwrite/fix-cloud-tests
Fix cloud tests
2025-01-24 03:24:09 +13:00
Jake Barnby 297098b252 Revert test timing changes 2025-01-24 03:23:25 +13:00
Darshan 3cfd592351 fix: tests further. 2025-01-23 19:35:36 +05:30
Darshan 00a2413366 fix: tests due to additional response vars. 2025-01-23 19:17:20 +05:30
Darshan 784cddcf9b Merge branch '1.6.x' into databases-reads-writes 2025-01-23 18:54:28 +05:30
Darshan 08f2a59766 add: database read, write metrics. 2025-01-23 18:54:02 +05:30
Khushboo Verma 246dc07018 Remove unnecessary check 2025-01-23 18:47:12 +05:30
Jake BarnbyandGitHub 2af7a46aca Merge pull request #9255 from appwrite/feat-batch-usage-dump
Feat batch usage dump
2025-01-24 02:10:54 +13:00
Jake Barnby f849fb9b30 Add project job timing 2025-01-24 02:04:18 +13:00
Jake Barnby 1360c16f65 Partial revert "Add project log"
This partially reverts commit 8097f1607f.
2025-01-24 01:43:25 +13:00
Jake Barnby 8097f1607f Add project log 2025-01-24 01:34:44 +13:00
Jake Barnby 03a8f35082 Ensure wait overlaps aggregation interval 2025-01-24 00:14:30 +13:00
Jake Barnby 5dd3b09ca7 Lint 2025-01-24 00:13:13 +13:00
Jake Barnby 91c319bc50 Remove redundant logs 2025-01-24 00:09:08 +13:00
Jake Barnby 687be05d95 Speed up dev mode usage tests 2025-01-24 00:08:04 +13:00
Jake Barnby fe930d8f64 Fix tests 2025-01-24 00:07:45 +13:00
Jake Barnby 77ae8dcc63 Lint 2025-01-23 23:28:15 +13:00
Jake Barnby 8cd4000751 One write per project 2025-01-23 23:25:10 +13:00
Chirag Aggarwal 6d404ada74 chore: update scopes 2025-01-23 05:36:12 +00:00
Jake Barnby 65c2b99dfe Fix method refs 2025-01-23 18:32:36 +13:00
Jake Barnby 2a03bbf5b8 Update database 2025-01-23 18:20:00 +13:00
Christy JacobandGitHub 85539dfb29 Merge pull request #9253 from appwrite/fix-amazon-oauth
fix: amazon oauth
2025-01-23 10:35:57 +05:30
Jake Barnby 5e9955ed3e Update database 2025-01-23 17:42:12 +13:00
Jake Barnby b56fda0029 Merge remote-tracking branch 'origin/1.6.x' into feat-batch-usage-dump 2025-01-23 17:42:00 +13:00
Jake BarnbyandGitHub 871043a700 Merge pull request #9256 from appwrite/fix-delete-collection-relations
Delete collection before Appwrite's attributes
2025-01-23 17:25:34 +13:00
fogelito ee9bf984c7 Delete collection first 2025-01-22 17:35:30 +02:00
Jake Barnby 343ef4944b Format 2025-01-23 01:57:23 +13:00
Jake Barnby e0eea5b13d Update db 2025-01-23 01:47:06 +13:00
Jake Barnby d533113d86 Update usage dump to upsert documents in batches 2025-01-23 01:44:33 +13:00
Jake BarnbyandGitHub 758d8496c1 Merge pull request #9237 from appwrite/feat-1.6.x-new-sdk-class
Implement new SDK Class on 1.6.x
2025-01-22 20:38:10 +13:00
Bradley Schofield df491f6f46 Fix null deprecation warning 2025-01-22 16:02:56 +09:00
Bradley Schofield 5123cf5f8e Make Method Extendable 2025-01-22 11:08:23 +09:00
Marton SchneiderandGitHub 1683fe0a98 Merge branch 'main' into main 2025-01-21 22:57:53 +01:00
loks0n bc3ac237be fix: add heic input/output 2025-01-21 18:06:20 +00:00
Matej Bačo 3ee67e620c Resolve conflicts 2025-01-21 15:28:37 +00:00
Matej Bačo 9a94023bde Merge remote-tracking branch 'origin/feat-sites' into feat-add-tests-for-sites 2025-01-21 13:41:08 +00:00
Chirag Aggarwal ead7a17645 chore: remove comma 2025-01-21 13:34:45 +00:00
Matej BačoandGitHub 70f1b0c2fc Merge pull request #9193 from appwrite/fix-manual-qa
Fix: Sites manual QA
2025-01-21 14:17:57 +01:00
Matej BačoandGitHub 7009d1edf1 Merge branch 'feat-sites' into fix-manual-qa 2025-01-21 13:50:00 +01:00
Chirag Aggarwal f6385c716e fix: encoding state 2025-01-21 12:17:48 +00:00
loks0n 15aa0e0315 feat: enable heic 2025-01-21 11:09:16 +00:00
Matej Bačo d652a17fd7 Remove unneeded runtime 2025-01-21 09:13:20 +01:00
Christy JacobandGitHub c4053b62e4 Merge pull request #9246 from appwrite/fix-phone-validation
fix: phone number parsing exception handling
2025-01-21 12:42:56 +05:30
Christy JacobandGitHub b4e1101a9b Merge pull request #9211 from appwrite/add-user-types
Update audits to include user type
2025-01-21 12:41:23 +05:30
Chirag Aggarwal 27459cc2c0 chore: added test comment 2025-01-21 07:04:16 +00:00
Christy JacobandGitHub 9c71af219b Merge pull request #9250 from appwrite/chore-remove-error
chore: skipped job instead of throwing error
2025-01-21 12:32:36 +05:30
Darshan bc533aeeaa update: change var name. 2025-01-21 12:11:20 +05:30
Darshan 3c3559aee5 update: apply comment suggestion. 2025-01-21 12:07:03 +05:30
Darshan f8f403a66a remove: comments. 2025-01-21 12:02:08 +05:30
Darshan be2929f07f Merge branch '1.6.x' into add-user-types 2025-01-21 11:56:36 +05:30
Chirag Aggarwal af8cb29bfb chore: added log 2025-01-21 06:21:09 +00:00
Christy JacobandGitHub da07ca5391 Merge pull request #9188 from appwrite/feat-update-sdk-gen
Update SDK Generator versions
2025-01-20 19:26:18 +05:30
Chirag Aggarwal 07630c272d chore: update test 2025-01-20 12:41:57 +00:00
Christy JacobandGitHub 6256a09902 Merge pull request #9233 from ChiragAgg5k/fix-benchmark-test
chore: fix benchmarking test when made from fork
2025-01-20 17:27:25 +05:30
Jake BarnbyandGitHub cf8da3495c Merge branch '1.6.x' into feat-1.6.x-new-sdk-class 2025-01-21 00:50:16 +13:00
Bradley Schofield 336dd824f6 Merge branch '1.6.x' into feat-update-sdk-gen
# Conflicts:
#	composer.lock
2025-01-20 19:38:53 +09:00
Jake BarnbyandGitHub 190b9cdaee Merge pull request #9226 from appwrite/index-dependency-exception
Add index dependency exception
2025-01-20 23:24:50 +13:00
Christy JacobandGitHub d8f572925c Merge pull request #9248 from appwrite/fix-maintenance-job
chore: add missing case for executions
2025-01-20 15:15:39 +05:30
Christy Jacob 2533a95b8b chore: add missing case for executions 2025-01-20 15:13:50 +05:30
fogelito 9c95c162d9 bumb database version 2025-01-20 11:28:48 +02:00
fogelito 0915f23e99 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into index-dependency-exception
# Conflicts:
#	composer.lock
2025-01-20 11:27:20 +02:00
Jake BarnbyandGitHub 26036db5f9 Merge pull request #9247 from appwrite/fix-maintenance-job
Fix maintenance job
2025-01-20 22:03:02 +13:00
Christy Jacob c3e2a3fac2 Merge branch '1.6.x' of github.com:appwrite/appwrite into fix-maintenance-job 2025-01-20 14:31:31 +05:30
Christy Jacob b87c750536 chore: add temporary check to deletes worker to prevent it from throwing an exception 2025-01-20 14:31:22 +05:30
Chirag Aggarwal ca0459046d chore: remove isValidNumber check 2025-01-20 08:33:49 +00:00
Chirag Aggarwal 8fb772340f chore: shifted validation 2025-01-20 08:12:42 +00:00
Bradley Schofield f4c1c72bcf Merge branch '1.6.x' into feat-update-sdk-gen
# Conflicts:
#	composer.lock
2025-01-20 16:51:52 +09:00
Chirag Aggarwal 7315294555 fix: phone number parsing exception handling 2025-01-20 05:44:19 +00:00
Bradley Schofield e7b119abae Merge branch '1.6.x' into feat-1.6.x-new-sdk-class 2025-01-20 14:21:26 +09:00
Jake BarnbyandGitHub 37fc9fdcd3 Merge pull request #9245 from appwrite/chore-update-fetch
Update Fetch to 0.3.0
2025-01-20 16:19:21 +13:00
Bradley Schofield f3b395f3f3 Add remaining missing descriptions and enable the desc check 2025-01-20 12:16:00 +09:00
Bradley SchofieldandGitHub 0408de3253 Update Fetch to 0.3.0 2025-01-20 02:14:29 +00:00
Khushboo Verma e49d9f39a8 Fix usageTest 2025-01-20 01:18:43 +05:30
Khushboo Verma 4a3ea540bf Fix specification tests 2025-01-20 01:01:21 +05:30
fogelito 028cd935d9 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into index-dependency-exception 2025-01-19 08:30:59 +02:00
fogelito fba5060469 Bumb version 2025-01-19 08:30:02 +02:00
fogelito 733434fdb8 formatOptions default 2025-01-19 08:18:22 +02:00
Steven NguyenandGitHub 54a46d7d26 Merge pull request #9218 from ChiragAgg5k/fix-resend-invitation
fix: resend invitation
2025-01-17 12:59:31 -08:00
Ebenezer DonandGitHub bbb6b2d256 Merge branch '1.6.x' into docs-clarify-updates-endpoints-2 2025-01-17 20:52:46 +00:00
Ebenezer Don 45a03822ee remove addition to gitignore 2025-01-17 20:51:50 +00:00
Chirag Aggarwal be5c4b753a fix: syntax 2025-01-17 19:40:33 +00:00
Chirag AggarwalandGitHub 4d86096c20 Merge branch '1.6.x' into fix-slack-oauth 2025-01-18 00:12:38 +05:30
Khushboo VermaandGitHub 04f9e9b62a Merge pull request #8939 from appwrite/feat-delete-rules
Delete rules when site or deployment is deleted
2025-01-17 23:20:40 +05:30
Christy JacobandGitHub d21d18fe18 Merge pull request #9238 from appwrite/fix-maintenance-job
fix: maintenance job missing type
2025-01-17 23:11:15 +05:30
Chirag Aggarwal 1d1b83afb6 chore: review 2025-01-17 17:28:03 +00:00
Christy Jacob dc651f632a fix: maintenance job missing type 2025-01-17 22:55:16 +05:30
Christy Jacob e7d33ebc52 fix: maintenance job missing type 2025-01-17 22:55:00 +05:30
Christy Jacob e4efaf1efa fix: maintenance job missing type 2025-01-17 22:53:31 +05:30
Chirag Aggarwal 0517ebfb4e fix: auth user 2025-01-17 16:19:14 +00:00
Christy JacobandGitHub b81e15f5d4 Merge pull request #9168 from appwrite/optimise-webhook-events
Optimise webhook events
2025-01-17 19:51:02 +05:30
Christy JacobandGitHub b3fb7cfdb6 Merge branch '1.6.x' into optimise-webhook-events 2025-01-17 18:01:37 +05:30
Christy JacobandGitHub 1b53df4a32 Merge pull request #9232 from appwrite/chore-optimise-events-payloads
feat: optimise events payloads
2025-01-17 17:54:42 +05:30
Christy Jacob 5240d0f9c6 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into optimise-webhook-events 2025-01-17 11:48:41 +00:00
Christy Jacob 5b28e7c478 chore: review comments 2025-01-17 11:48:19 +00:00
Luke B. SilverandGitHub 31ab247b08 Merge branch '1.6.x' into fix-benchmark-test 2025-01-17 11:18:01 +00:00
Christy JacobandGitHub ab54280d79 Merge pull request #9235 from appwrite/fix-funciton-usage
fix: function usage
2025-01-17 15:58:06 +05:30
loks0n 40f16fab50 docs: add compression vars to documentation 2025-01-17 10:17:49 +00:00
loks0n e343a1068e fix: linter 2025-01-17 09:55:14 +00:00
Bradley Schofield 02e7f91e59 Address all missing descriptions apart from ones in projects.php 2025-01-17 16:44:25 +09:00
Chirag Aggarwal 55360c3af0 debugging 2025-01-17 07:43:50 +00:00
Chirag Aggarwal 983eee9266 chore: added error handling to user 2025-01-17 07:14:48 +00:00
Chirag Aggarwal 5d3071e084 fix: scopes 2025-01-17 07:05:31 +00:00
Christy Jacob ef0b836987 chore: composer update 2025-01-17 11:19:34 +05:30
Christy Jacob 455bc3370c chore: fix tests 2025-01-17 11:16:21 +05:30
Christy Jacob f66f75b808 chore: review comments 2025-01-17 10:43:02 +05:30
Christy Jacob 458b7bb877 Merge branch '1.6.x' of github.com:appwrite/appwrite into chore-optimise-events-payloads 2025-01-17 10:42:16 +05:30
Christy Jacob a2962b6b95 chore: review comments 2025-01-17 10:42:06 +05:30
Christy Jacob 8bdafb46d6 chore: review comments & refactoring 2025-01-17 10:38:39 +05:30
Bradley Schofield 20e87cb82f Run Linter 2025-01-17 13:39:16 +09:00
Bradley Schofield d5604efef8 Fix actions 2025-01-17 13:38:38 +09:00
Bradley Schofield 95dcb67747 Implement new SDK Class on 1.6.x 2025-01-17 13:31:39 +09:00
Chirag AggarwalandGitHub c098b62d59 Merge branch '1.6.x' into fix-resend-invitation 2025-01-17 09:28:57 +05:30
Chirag Aggarwal a1031ab921 fix: update membership 2025-01-17 03:58:23 +00:00
Ebenezer Don 5cc8d7ced1 Update specs 2025-01-16 18:21:09 +00:00
Luke B. SilverandGitHub 83a911fb88 Merge branch '1.6.x' into fix-funciton-usage 2025-01-16 18:06:19 +00:00
loks0n facdf1a362 chore: revert usage debug 2025-01-16 18:05:49 +00:00
Chirag AggarwalandGitHub d0760aee20 Merge branch '1.6.x' into fix-benchmark-test 2025-01-16 23:18:45 +05:30
loks0n 7db65f46ae feat: add compression toggle env 2025-01-16 17:23:22 +00:00
loks0n f392b5ab45 chore: composer update 2025-01-16 16:01:35 +00:00
fogelito 8c90973b61 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into index-dependency-exception 2025-01-16 17:34:16 +02:00
fogelito 13687f7fc3 Use 1.6.x 2025-01-16 17:33:51 +02:00
fogelito 1b4a96b1fb Remove code from worker 2025-01-16 17:22:53 +02:00
fogelito 0afbfe2f84 INDEX_DEPENDENCY 2025-01-16 17:20:30 +02:00
Ebenezer Don 4e1494d16d docs: clarify update endpoints only work on draft messages 2025-01-16 13:36:21 +00:00
Christy Jacob f52b2d5dcd chore: review comments 2025-01-16 16:59:30 +05:30
Jake BarnbyandGitHub 2b8772fad2 Merge pull request #9060 from appwrite/feat-apns-content-available
Add new push message parameters
2025-01-16 22:21:46 +13:00
Christy Jacob 2a0894f3d1 fix: incorrect project payloads 2025-01-16 13:29:08 +05:30
Christy Jacob e8f97baf26 fix: incorrect project payloads 2025-01-16 13:14:47 +05:30
Chirag Aggarwal e278b8a5a2 chore: added if check 2025-01-16 07:35:43 +00:00
Chirag Aggarwal 8e474676d3 chore: explicitly added token 2025-01-16 06:36:31 +00:00
Chirag Aggarwal 8dc3b4ca60 fix: tests: 2025-01-16 06:15:41 +00:00
Chirag AggarwalandGitHub 098c1e984e Merge branch '1.6.x' into fix-resend-invitation 2025-01-16 11:37:25 +05:30
Christy Jacob 8ea1f436c1 feat: linter 2025-01-16 11:37:02 +05:30
Christy Jacob de6fced412 feat: optimise events payloads 2025-01-16 11:35:22 +05:30
Chirag Aggarwal 23d20b7d02 fix: invited user's name 2025-01-16 04:29:11 +00:00
Chirag Aggarwal 120ceeedad chore: review 2025-01-16 04:27:25 +00:00
loks0n b16b662a21 debug: log usage 2025-01-15 14:53:38 +00:00
Chirag Aggarwal 779510a605 fix: scopes, and updated to v2 2025-01-15 14:49:26 +00:00
fogelito 2ca690ccbd formatting 2025-01-15 16:29:17 +02:00
fogelito c4bdd2fe1b Change to 409 2025-01-15 16:26:57 +02:00
fogelito 098c30cd9a Message null 2025-01-15 14:02:30 +02:00
fogelito cee3da2ef5 Remove previous 2025-01-15 13:55:18 +02:00
fogelito a3bd26d7f5 Return on Dependency 2025-01-15 13:45:48 +02:00
fogelito 6067fb77b7 Return on Dependency 2025-01-15 13:40:41 +02:00
fogelito 9f82cd78fb Update available 2025-01-15 13:20:08 +02:00
fogelito 43db5b4552 catch Dependency 2025-01-15 13:10:03 +02:00
fogelito a1566b8974 composer.lock 2025-01-15 11:46:07 +02:00
fogelito 719c0bf440 composer.lock 2025-01-15 11:45:26 +02:00
fogelito 353637b9a8 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into index-dependency-exception 2025-01-15 11:17:10 +02:00
fogelito 42ef7fd2d8 INDEX_DEPENDENCY 2025-01-15 11:16:10 +02:00
Jake BarnbyandGitHub 2f83bec071 Merge pull request #9225 from appwrite/fix-empty-related-attribute
Add relatedCollection default
2025-01-15 22:08:23 +13:00
fogelito bbeb9d4719 Add relatedCollection default 2025-01-15 10:13:30 +02:00
Jake Barnby c0a0f1016e Revert platform update 2025-01-15 18:36:30 +13:00
Jake Barnby a7f40708a3 Update lock 2025-01-15 15:20:15 +13:00
Jake Barnby 6e7997a8a8 Merge remote-tracking branch 'origin/1.6.x' into feat-apns-content-available
# Conflicts:
#	composer.lock
2025-01-15 15:01:55 +13:00
Darshan 25431adafb address comment: anonymous > guest. 2025-01-14 17:45:49 +05:30
Chirag Aggarwal d43507040c fix: tests 2025-01-14 10:43:48 +00:00
Chirag AggarwalandGitHub eee9c9d693 Merge branch '1.6.x' into fix-resend-invitation 2025-01-14 16:07:22 +05:30
ChiragAgg5k 860c917cf6 fix: increment 2025-01-14 15:48:28 +05:30
ChiragAgg5k 1c7867ee03 fix: not sending mail to appuser 2025-01-14 15:47:05 +05:30
ChiragAgg5k 2571f7d3fc refactor: createdMembership 2025-01-14 15:43:00 +05:30
Khushboo Verma 76a0167700 Remove redundant check 2025-01-14 15:15:18 +05:30
Jake BarnbyandGitHub f54684133d Merge pull request #9208 from appwrite/fix-perplexity-ai-template-scopes
Add missing scope on function template
2025-01-14 21:26:31 +13:00
DarshanandGitHub 99a1c19bad Merge branch '1.6.x' into add-user-types 2025-01-14 13:47:15 +05:30
Darshan fabf581d21 fix: tests. 2025-01-14 13:47:01 +05:30
Jake BarnbyandGitHub d9acec6324 Merge pull request #9220 from appwrite/chore-log-populated-path
Log path with populated parameters
2025-01-14 21:08:22 +13:00
DarshanandGitHub 04b2fc246e Merge branch '1.6.x' into add-user-types 2025-01-14 13:19:51 +05:30
Darshan e9479db0fa add: anonymous user type to audit/activity. 2025-01-14 13:18:11 +05:30
Jake Barnby 3fa78e3c3b Log path with populated parameters 2025-01-14 14:50:40 +13:00
Chirag Aggarwal e6cb17a6cc chore: remove TEAM_INVITE_ALREADY_EXISTS 2025-01-13 18:51:23 +00:00
Chirag Aggarwal b5449a8ca6 fix: resend invitation 2025-01-13 18:25:48 +00:00
Eldad A. FuxandGitHub 4ac21afc90 Merge pull request #9153 from ItzNotABug/split-collections
Split the collection definitions
2025-01-13 14:30:26 +01:00
Darshan 993686c4d1 Merge branch '1.6.x' into 'split-collections'. 2025-01-13 18:13:12 +05:30
Eldad A. FuxandGitHub 2ab6ab8cb2 Merge pull request #9163 from ItzNotABug/add-logs-to-db
Add logs db init for consistency
2025-01-13 13:32:44 +01:00
Jake BarnbyandGitHub 32c95391bf Merge pull request #9214 from appwrite/revert-9213-fix-dead-connections
Revert "Fix dead connections"
2025-01-13 19:28:13 +13:00
Jake BarnbyandGitHub 1cd7c397de Revert "Fix dead connections" 2025-01-13 19:24:58 +13:00
DarshanandGitHub 17311bac6d Merge branch '1.6.x' into add-logs-to-db 2025-01-13 11:20:31 +05:30
DarshanandGitHub d997b558dc update: there are no multiple connections for logs.
As confirmed by Damodar, Logs DB is similar to Console DB. so no multiple connections.
2025-01-13 11:20:17 +05:30
Jake BarnbyandGitHub 9e8ed3e206 Merge pull request #9213 from appwrite/fix-dead-connections
Fix dead connections
2025-01-13 18:26:54 +13:00
Christy JacobandJake Barnby cde1d6e83e Merge pull request #9190 from appwrite/fix-dead-connections
Fix dead connections
# Conflicts:
#	composer.lock
2025-01-13 18:03:40 +13:00
Jake BarnbyandGitHub 7db24443ba Merge pull request #9202 from appwrite/chore-update-database
Update database
2025-01-13 16:43:15 +13:00
Jake Barnby 10e036958a Update libraries 2025-01-13 15:28:30 +13:00
Jake Barnby 00a5b8fbb9 Revert "Update database"
This reverts commit a45e0a59dd.

# Conflicts:
#	composer.lock
2025-01-13 14:58:03 +13:00
Jake Barnby c6dd2dbf40 Merge remote-tracking branch 'origin/1.6.x' into chore-update-database 2025-01-13 14:17:11 +13:00
Khushboo Verma aa130075e8 Add abuse limit 2025-01-13 01:20:13 +05:30
Khushboo Verma dd26a564dc Remove desc as private endpoint 2025-01-13 00:31:45 +05:30
Khushboo Verma 652ab4946d Resolve merge conflict 2025-01-13 00:10:03 +05:30
Darshan 377627118f address comments: change type names. 2025-01-12 18:27:58 +05:30
Darshan f4f0b3f0fe add: userTypeto audit data. 2025-01-12 17:06:27 +05:30
Darshan e237f7c05d address comments: make things less complex. 2025-01-12 16:58:38 +05:30
Darshan 1e62e26ef1 add: userType and keyName to Audits. 2025-01-12 12:42:52 +05:30
Steven NguyenandGitHub 86874cbec1 Merge pull request #9209 from appwrite/fix-9052-delete-session
Ensure user can delete session
2025-01-11 11:09:20 -08:00
Steven NguyenandGitHub f48c843bea fix(users): ensure user can delete session
The session document created by users.createSession() was missing
delete permissions for the user so when the user tried to delete it,
they got a 401 error.

This PR ensure the permissions are added just like if the document was
created from the Account API so that the user has access to delete the
document.
2025-01-11 17:56:36 +00:00
Darshan 4fe2611ccc add: missing scope to template to prevent a crash on console. 2025-01-11 11:07:10 +05:30
Christy JacobandGitHub 9b404db87f Merge pull request #9207 from appwrite/fix-abuse-sms
fix sms usage
2025-01-10 23:07:07 +05:30
loks0n 1695e90399 fix: metric 2025-01-10 17:33:08 +00:00
Steven NguyenandGitHub c2124d6803 Merge pull request #9200 from ChiragAgg5k/fix-email-otp
fix: disabling of email-otp when user wants to
2025-01-10 07:23:20 -08:00
Matej Bačo efe24db5a1 Fix site starting crashes 2025-01-10 15:28:09 +01:00
Christy JacobandGitHub 5dc04ca8ca Merge pull request #9056 from appwrite/PLA-1958
chore: add audit labels to project resources
2025-01-10 17:57:15 +05:30
Fabian GruberandGitHub 26c86d465b Merge branch '1.6.x' into PLA-1958 2025-01-10 13:18:53 +01:00
Christy JacobandGitHub f153e1bebf Merge pull request #9138 from appwrite/fix-installation-oauth-collision
Fix: VCS identity collision
2025-01-10 17:08:31 +05:30
Christy JacobandGitHub a7fdfc629c Merge pull request #9198 from appwrite/feat-project-sms-usage
feat project sms usage
2025-01-10 15:42:00 +05:30
Jake Barnby 428efdede0 Update lock 2025-01-10 22:32:25 +13:00
Christy JacobandGitHub 619b716233 Merge pull request #9192 from ItzNotABug/fix-messaging-test-for-audits
Add assertEventually to messaging provider logs test
2025-01-10 14:50:31 +05:30
Christy JacobandGitHub 595e93e59e Merge branch '1.6.x' into fix-messaging-test-for-audits 2025-01-10 14:50:23 +05:30
Jake Barnby 9e5189fa09 Merge remote-tracking branch 'origin/1.6.x' into chore-update-database
# Conflicts:
#	composer.lock
2025-01-10 22:14:06 +13:00
Chirag AggarwalandGitHub 642eac098c Merge branch '1.6.x' into fix-email-otp 2025-01-10 14:40:28 +05:30
Jake Barnby a45e0a59dd Update database 2025-01-10 22:05:40 +13:00
Jake BarnbyandGitHub 6ebab2f346 Merge pull request #9201 from appwrite/revert-9190-fix-dead-connections
Revert "Fix dead connections"
2025-01-10 20:36:36 +13:00
Jake Barnby b76260ecce Update database 2025-01-10 20:28:50 +13:00
Jake BarnbyandGitHub b88d9c51fb Revert "Fix dead connections" 2025-01-10 20:19:34 +13:00
DarshanandGitHub 4bfd132eee Merge branch '1.6.x' into fix-messaging-test-for-audits 2025-01-10 10:26:30 +05:30
ChiragAgg5k d86984f6cf chore: used config in auth 2025-01-10 08:42:10 +05:30
loks0n ec7f76f9fb fix: stats tests 2025-01-09 21:17:53 +00:00
loks0n a85abdab4a fix: usage tests 2025-01-09 20:11:02 +00:00
loks0n cc7cef59b3 isset over empty 2025-01-09 19:03:25 +00:00
loks0n ee9e4f90c1 chore: specs 2025-01-09 18:57:00 +00:00
loks0n 9687fdb0a5 Merge branch 'feat-project-sms-usage' of https://github.com/appwrite/appwrite into feat-project-sms-usage 2025-01-09 18:33:08 +00:00
loks0n 7c9c3d9214 feat: sms rates 2025-01-09 18:33:07 +00:00
Luke B. SilverandGitHub 7847dfe9c0 Merge branch '1.6.x' into feat-project-sms-usage 2025-01-09 17:20:52 +00:00
Matej Bačo 0f8ce0e93e Fix Sites 2025-01-09 16:59:40 +00:00
loks0n 76e1b27cef fix: create dummy resource 2025-01-09 16:41:24 +00:00
loks0n 651a3d1d62 test: fix 2025-01-09 16:37:26 +00:00
loks0n d068067a98 feat: project sms usage 2025-01-09 16:35:40 +00:00
Matej Bačo 9089eb4228 New specs 2025-01-09 15:44:13 +00:00
Darshan bce68b2202 fix: benchmark test. 2025-01-09 19:45:03 +05:30
Khushboo Verma 8a260ceece Remove unrelated changes to site deletion 2025-01-09 17:41:45 +05:30
Khushboo Verma 426bcffd1a Resolve merge conflicts 2025-01-09 17:25:24 +05:30
Christy JacobandGitHub 4a196562c5 Merge pull request #9191 from ChiragAgg5k/feat-free-sms-limit-authphone 2025-01-08 22:11:34 +05:30
Matej Bačo 9c37c3a740 Fix basic configs 2025-01-08 16:14:33 +00:00
Luke B. SilverandGitHub 16b32a1069 Merge branch '1.6.x' into feat-free-sms-limit-authphone 2025-01-08 14:07:40 +00:00
Christy JacobandGitHub 16b90d723c Merge pull request #9165 from ItzNotABug/add-hostname-to-audits
Add hostname to audits
2025-01-08 19:34:08 +05:30
DarshanandGitHub 2ea3bad502 Merge branch '1.6.x' into add-hostname-to-audits 2025-01-08 19:11:23 +05:30
Darshan 0daf4057f3 fix: benchmark test. 2025-01-08 19:10:30 +05:30
Darshan a82a0a2f15 Merge remote-tracking branch 'origin/fix-messaging-test-for-audits' into fix-messaging-test-for-audits 2025-01-08 18:57:31 +05:30
DarshanandGitHub 11f3c60554 Merge branch '1.6.x' into fix-messaging-test-for-audits 2025-01-08 18:50:13 +05:30
Darshan e3637e4ba5 update: lets clear this test too, it has been a while now. 2025-01-08 18:40:00 +05:30
Matej BačoandGitHub 78c6766baf Merge branch '1.6.x' into fix-installation-oauth-collision 2025-01-08 14:06:45 +01:00
Matej Bačo 4226e92387 Improve DB schema 2025-01-08 13:05:49 +00:00
Darshan addb56ab7d update: shift comment. 2025-01-08 18:24:53 +05:30
Darshan 88755e6d38 update: add sleep to tests. 2025-01-08 18:21:35 +05:30
ChiragAgg5k 2178bb44cd fix: attribute 2025-01-08 17:14:07 +05:30
ChiragAgg5k 1f240ca27a chore: moved non-countrycode tracking outside abuse 2025-01-08 17:09:55 +05:30
ChiragAgg5k ff056fa145 chore: shifted authphone usage tracking to api calls 2025-01-08 17:01:01 +05:30
Khushboo Verma 3c9ea6caba Fix tests 2025-01-08 16:16:26 +05:30
Christy JacobandGitHub 910bd4d8ea Merge pull request #9190 from appwrite/fix-dead-connections
Fix dead connections
2025-01-08 15:00:15 +05:30
Gurjeet Singh VirdeeandGitHub a39341ada8 fix: add missing single quote 2025-01-08 14:48:54 +05:30
Khushboo Verma 857046ecb8 Address PR comments 2025-01-08 13:55:21 +05:30
Jake Barnby 941c9f1905 Add connection health check to http error handler 2025-01-08 21:15:33 +13:00
Jake Barnby 7f6a43cf7b Update to release 2025-01-08 21:00:02 +13:00
Jake Barnby 39f34135f0 Update pools 2025-01-08 20:43:45 +13:00
Bradley SchofieldandGitHub 02ab3c850e Update SDK Generator versions 2025-01-08 06:40:33 +00:00
Jake Barnby 38ee612164 Update pools 2025-01-08 18:39:26 +13:00
Jake Barnby 71b892132b Mark connections as unhealthy on lost connection error from DB 2025-01-08 18:39:06 +13:00
Jake Barnby 2c04ace022 Add connection for project 2025-01-08 18:38:24 +13:00
Jake BarnbyandGitHub f4af241804 Merge pull request #9157 from appwrite/delete-attribute-not-found
Delete attribute No throwing Exception on not found
2025-01-08 16:07:53 +13:00
Jake BarnbyandGitHub 077313fe2d Update src/Appwrite/Platform/Workers/Databases.php 2025-01-08 15:46:35 +13:00
Khushboo Verma f196cfe993 Use ssr-22 runtime 2025-01-07 20:07:23 +05:30
Khushboo Verma 140b850cef More tests 2025-01-07 15:35:31 +05:30
Christy JacobandGitHub b64eb2df38 Merge pull request #9146 from appwrite/feat-rollback-specifications
Set base specification CPUs to 0.5 again
2025-01-07 12:34:23 +05:30
Khushboo Verma 0929ba995a More tests 2025-01-07 02:33:32 +05:30
Eldad A. FuxandGitHub 3b9cbcb671 Merge pull request #9142 from appwrite/usage-db-read-writes-addition
Usage databases api read writes addition
2025-01-06 19:38:41 +01:00
shimon f2cbdbae87 added operations debug header 2025-01-06 19:32:19 +02:00
shimon 347ba4a127 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into usage-db-read-writes-addition 2025-01-06 19:30:20 +02:00
shimon 5c097df56a added operations debug header 2025-01-06 19:07:18 +02:00
shimon c97b48f443 Merge remote-tracking branch 'origin/usage-db-read-writes-addition' into usage-db-read-writes-addition
# Conflicts:
#	app/controllers/api/databases.php
2025-01-06 19:03:32 +02:00
shimon a481e958e3 added operations debug header 2025-01-06 18:57:35 +02:00
fogelito 40b407027e Count changes 2025-01-06 18:51:39 +02:00
shimon b910d795f2 Merge remote-tracking branch 'origin/usage-db-read-writes-addition' into usage-db-read-writes-addition 2025-01-06 18:06:29 +02:00
shimon d64ea97ee6 added operations debug header 2025-01-06 18:06:18 +02:00
fogelito fc03075ef8 Update counts 2025-01-06 18:01:44 +02:00
shimon f70222d41a added operations debug header 2025-01-06 17:19:39 +02:00
shimon 1cfcd53ae3 Merge branch 'usage-db-read-writes-addition' of https://github.com/appwrite/appwrite into usage-db-read-writes-addition 2025-01-06 16:50:54 +02:00
shimon 0814fe49e2 added operations debug header 2025-01-06 16:50:23 +02:00
Eldad A. FuxandGitHub eb8ca0229a Merge pull request #9177 from appwrite/PLA-2158
feat(swoole): allow configuration override of available cpus
2025-01-06 14:18:15 +01:00
Fabian Gruber 1bc419b6a1 feat(swoole): allow configuration override of available cpus 2025-01-06 13:48:01 +01:00
fogelito 895e79e736 Operations 2025-01-06 12:25:56 +02:00
shimon 1a73847c47 added operations debug header 2025-01-06 11:28:26 +02:00
Gurjeet Singh VirdeeandGitHub c451074278 restored the permissions term 2025-01-06 01:29:06 +05:30
Christy Jacob bdb6599087 chore: linter 2025-01-04 12:55:20 +05:30
Christy Jacob 56af9d0991 chore: add todo 2025-01-04 12:51:50 +05:30
Christy Jacob e1c08e33d4 fix: trigger webhooks events only if a project has webhooks 2025-01-04 12:51:42 +05:30
Christy JacobandGitHub b680c5021a Merge pull request #9155 from appwrite/christyjacob4-patch-1
Update general.php
2025-01-04 12:21:17 +05:30
Darshan 7910d5652d fix: collection creation and tests. 2025-01-03 17:20:27 +05:30
Darshan b7651e4f5e address comment: add files/buckets to common. 2025-01-03 15:56:36 +05:30
Darshan 31f8950b45 add: hostname to audits. 2025-01-03 15:30:55 +05:30
Darshan 0203b67b28 add: logs init. 2025-01-03 10:54:56 +05:30
fogelito e8e39dbd56 Revert lock 2025-01-02 17:57:46 +02:00
fogelito bd083ac280 database 0.53.29 2025-01-02 17:54:47 +02:00
fogelito 06a5876f35 No throwing Exception 2025-01-02 17:06:22 +02:00
shimon 4acc2736e4 added operations debug header 2025-01-02 16:46:38 +02:00
shimon c5a49cc537 added operations debug header 2025-01-02 16:45:21 +02:00
Darshan e895fd6e0c address comment, change var and file name. 2025-01-02 19:19:39 +05:30
Christy JacobandGitHub bdb93cd323 Update general.php 2025-01-02 19:03:28 +05:30
shimon 6b45293f78 file transformations usage 2025-01-02 13:55:30 +02:00
shimon 63cf093020 file transformations usage 2025-01-02 13:53:57 +02:00
shimon 504b7276cb composer 2025-01-02 11:02:53 +02:00
shimon e7e095907c composer 2025-01-02 10:44:56 +02:00
shimon c0d48efe18 composer 2025-01-02 10:29:55 +02:00
shimon fbbc9312ea database crud usage addition 2025-01-02 10:09:44 +02:00
shimon 4cc963d296 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into usage-db-read-writes-addition 2025-01-02 10:00:59 +02:00
shimon c7841bb36e database crud usage addition 2025-01-02 09:59:59 +02:00
shimon 42589de95e database crud usage addition 2025-01-02 09:56:14 +02:00
shimon 0f2985cec1 database crud usage addition 2025-01-02 09:19:09 +02:00
Darshan c7b2a90a0c feat: split collections. 2025-01-02 10:18:47 +05:30
Khushboo Verma 6bf9adfb51 Added some sites tests 2025-01-02 02:21:30 +05:30
Steven NguyenandGitHub 4ce919c8c6 chore: update composer.lock after merge 2024-12-31 23:11:00 +00:00
Steven NguyenandGitHub a502b1c566 Merge branch '1.6.x' into feat-apns-content-available 2024-12-31 22:56:15 +00:00
Christy JacobandGitHub a08c71d9d2 Merge pull request #9112 from appwrite/chore-release-client-sdks
chore: release client sdks
2024-12-31 11:43:59 +05:30
Bradley Schofield d3b764a9e2 Set base specification CPUs to 0.5 again 2024-12-30 15:10:27 +00:00
Matej BačoandGitHub 98989d77a2 Merge branch '1.6.x' into fix-installation-oauth-collision 2024-12-30 15:06:32 +01:00
Matej Bačo ba04a7760b Backwards-compatibility 2024-12-30 14:43:28 +01:00
loks0n 8c75203298 chore: bump sdk generator 2024-12-30 11:59:19 +00:00
loks0n dd19936fa5 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into chore-release-client-sdks 2024-12-30 11:55:52 +00:00
loks0n dd0658de19 chore: bump versions 2024-12-30 11:26:11 +00:00
Eldad A. FuxandGitHub 0ab86f4dac Merge pull request #9144 from appwrite/feat-remove-firebase-oauth
Remove firebase OAuth API endpoints
2024-12-30 11:06:25 +01:00
Bradley Schofield 26bac5a2ea Remove firebase OAuth API endpoints 2024-12-30 09:00:52 +00:00
shimon dd13e8b3cf database crud usage addition 2024-12-29 18:02:19 +02:00
shimon 8e17fc69b3 database crud usage addition 2024-12-29 17:57:29 +02:00
shimon 025c9aeeb2 database crud usage addition 2024-12-29 17:53:45 +02:00
shimon c23af8168b database crud usage addition 2024-12-29 17:48:05 +02:00
shimon 58fd0d35bd database crud usage addition 2024-12-29 17:47:52 +02:00
Eldad A. FuxandGitHub daad365667 Merge pull request #9139 from appwrite/fix-remove-abuse-delete-trigger
fix: remove abuse delete trigger
2024-12-27 22:52:52 +01:00
loks0n 4691407a7a chore: bump utopia-php/abuse to 0.46.0 2024-12-27 20:41:30 +00:00
loks0n 769772a0a8 fix: remove abuse delete trigger 2024-12-27 20:30:03 +00:00
Eldad A. FuxandGitHub 8025082464 Merge pull request #9137 from appwrite/chore-remove-abuse-cleanup
chore remove abuse cleanup
2024-12-27 18:27:37 +01:00
Matej Bačo fcb517e679 Fix type error 2024-12-27 13:32:22 +01:00
Matej Bačo 297826a62a Fix git identity collisions 2024-12-27 13:13:14 +01:00
loks0n 53860d2b96 chore: remove abuse cleanup 2024-12-27 10:07:53 +00:00
Eldad A. FuxandGitHub 84e5a5f6cb Merge pull request #9125 from appwrite/webhooks-usage-addition
Added webhooks usage stats
2024-12-24 15:18:42 +01:00
shimon 452a58de94 Reset matrics after enqueueing job via usage event 2024-12-24 15:38:01 +02:00
shimon dae5bf593c add webhooks usage stats 2024-12-24 11:09:41 +02:00
shimon 4b033d8f00 add webhooks usage stats 2024-12-24 10:50:09 +02:00
shimon fe19b0205a add webhooks usage stats 2024-12-23 19:44:10 +02:00
Christy JacobandGitHub 85cbc17996 Merge pull request #9124 from appwrite/migrate-to-redis-abuse
Migrate to redis abuse
2024-12-23 02:29:35 +05:30
Christy Jacob cddace70a4 fix: deletes worker abuse retention type 2024-12-23 01:45:57 +05:30
Christy Jacob 1935c7371a Merge branch '1.6.x' of github.com:appwrite/appwrite into migrate-to-redis-abuse 2024-12-23 01:30:28 +05:30
Christy Jacob 25953732ab fix: deletes worker abuse retention type 2024-12-23 01:30:20 +05:30
Christy JacobandGitHub ef032a7af0 Merge pull request #9121 from appwrite/migrate-to-redis-abuse
chore: use redis adapter for abuse
2024-12-20 22:26:28 +05:30
Gurjeet Singh VirdeeandGitHub cce6222184 docs: update CLI commands in documentation 2024-12-20 22:24:39 +05:30
Christy Jacob e9c8766a23 chore: update abuse library 2024-12-20 21:53:12 +05:30
Christy Jacob 50601bd454 chore: use redis adapter for abuse 2024-12-20 20:14:50 +05:30
Christy JacobandGitHub 0715a8450a Merge pull request #9118 from appwrite/chore-optimise-webhooks-payload
chore: fix attribute name
2024-12-19 21:42:13 +05:30
Christy Jacob e2bdb46d48 chore: fix attribute name 2024-12-19 21:17:27 +05:30
Christy Jacob 718edd37f7 chore: fix attribute name 2024-12-19 21:15:13 +05:30
Christy JacobandGitHub ea4d41d929 Merge pull request #9117 from appwrite/revert-9111-migrate-to-redis-abuse
Revert "chore: initial commit"
2024-12-19 20:28:09 +05:30
Christy JacobandGitHub b97dea7996 Revert "chore: initial commit" 2024-12-19 20:27:54 +05:30
Christy JacobandGitHub 610121d02c Merge pull request #9115 from appwrite/chore-optimise-webhooks-payload
chore: optimise webhooks payload
2024-12-19 17:33:24 +05:30
Christy Jacob 6ec640cfd5 chore: linter 2024-12-19 16:56:17 +05:30
Christy Jacob d03d3c05b4 chore: optimise webhooks payload 2024-12-19 16:52:10 +05:30
Christy Jacob 53d8e2b0c3 chore: optimise webhooks payload 2024-12-19 16:43:05 +05:30
Christy JacobandGitHub 153431246d Merge pull request #9111 from appwrite/migrate-to-redis-abuse
chore: initial commit
2024-12-18 20:59:40 +05:30
Christy Jacob 12cb3b10bd chore: update abuse library 2024-12-18 20:42:29 +05:30
Christy Jacob 5a9dbe9c80 chore: fix realtime test 2024-12-18 20:06:24 +05:30
Christy Jacob d0f04126f3 chore: add missing resources to workers 2024-12-18 19:59:49 +05:30
Christy Jacob 599cc5e19a chore: review comments 2024-12-18 15:57:04 +05:30
Luke B. SilverandGitHub 0e56743dca Merge branch '1.6.x' into chore-release-client-sdks 2024-12-18 10:10:18 +00:00
Christy Jacob 77a8c27153 chore: fix realtime tests 2024-12-18 13:26:31 +05:30
Christy Jacob 911edd9457 chore: linter 2024-12-18 13:08:17 +05:30
Christy Jacob abbb2b544e Merge branch 'migrate-to-redis-abuse' of github.com:appwrite/appwrite into migrate-to-redis-abuse 2024-12-18 12:58:12 +05:30
Christy Jacob f1a089f8c6 feat: fix tests 2024-12-18 12:57:52 +05:30
Christy JacobandGitHub e8a3b87f68 Merge branch '1.6.x' into migrate-to-redis-abuse 2024-12-18 12:46:09 +05:30
Christy Jacob 01393faf0b feat: update abuse library 2024-12-18 11:58:34 +05:30
Christy JacobandGitHub a42fa741b7 Merge pull request #9109 from appwrite/fix-project-accessed-at
Fix: update project accessed at from router and schedulers
2024-12-18 09:56:19 +05:30
Damodar Lohani e24cce4e48 refactor 2024-12-17 14:19:26 +00:00
Damodar Lohani d7d69b63a8 reset worker 2024-12-17 14:15:27 +00:00
Damodar Lohani 2fb9ebe71d update project accessed at in schedules 2024-12-17 14:05:49 +00:00
Damodar Lohani 0cdb2a98be fix db name 2024-12-17 14:05:37 +00:00
Damodar Lohani c7713f58dd remove worker hook 2024-12-17 13:52:58 +00:00
loks0n 47785d9c4d docs: update 2024-12-17 11:58:25 +00:00
loks0n 6372cf59cc chore: composer 2024-12-17 11:54:50 +00:00
Fabian GruberandGitHub 4c7c4d7c7c Merge branch '1.6.x' into PLA-1958 2024-12-17 11:04:20 +01:00
Christy Jacob 52ac358f53 chore: rename variable 2024-12-17 10:23:52 +05:30
Christy Jacob cc867e2859 chore: rename variable 2024-12-17 10:23:09 +05:30
Christy Jacob b55a01c5b3 chore: linter 2024-12-17 10:12:19 +05:30
Christy Jacob ed918e1748 Merge branch '1.6.x' of github.com:appwrite/appwrite into migrate-to-redis-abuse 2024-12-17 10:09:00 +05:30
Christy Jacob 801f311faf feat: cleanup 2024-12-17 10:08:16 +05:30
Christy Jacob 67996a8a14 feat: cleanup 2024-12-17 10:00:45 +05:30
Christy Jacob e8cea70346 feat: cleanup 2024-12-17 10:00:28 +05:30
Damodar Lohani 06c09503df update project rsource 2024-12-17 04:27:28 +00:00
Christy Jacob ee05f3d3bc feat: migrate to redis abuse 2024-12-17 09:49:31 +05:30
Damodar LohaniandGitHub f785602a4d Merge branch '1.6.x' into fix-project-accessed-at 2024-12-17 10:02:20 +05:45
Christy Jacob 396faa56c2 chore: initial commit 2024-12-17 08:21:38 +05:30
Christy JacobandGitHub 8759330896 Merge pull request #9100 from appwrite/feat-upgrade-assistant
feat: upgrade assistant
2024-12-16 19:30:13 +05:30
loks0n a24dc79036 chore: fix endpoint 2024-12-16 12:36:02 +00:00
Damodar Lohani ab4a444154 Fix: project accessed at on workers 2024-12-16 06:40:53 +00:00
Damodar Lohani 515b5904b8 update project accessed at from router 2024-12-16 06:39:25 +00:00
Fabian Gruber 830ad99111 chore: add audit labels to project resources 2024-12-13 14:06:08 +01:00
Christy JacobandGitHub 7ecba8c0f2 Merge pull request #9105 from gewenyu99/docs-create-document
Docs-create-document
2024-12-13 15:52:31 +04:00
Luke B. SilverandGitHub ac03a72610 Merge branch '1.6.x' into feat-upgrade-assistant 2024-12-13 10:17:34 +00:00
Vincent (Wen Yu) Ge 46038c9fef update PR fix quote 2024-12-12 21:27:04 +00:00
Vincent (Wen Yu) Ge bb3143128f Merge branch 'main' into docs-create-document 2024-12-12 21:26:23 +00:00
Christy JacobandGitHub 9c2b78e612 Merge pull request #9102 from appwrite/feat-create-function-abuse-fix
Feat: createFunction abuse labels
2024-12-13 01:10:34 +04:00
Matej Bačo 905b4938a4 Fix failing test 2024-12-12 20:55:33 +00:00
Matej Bačo 8b3f09a981 Env var for function abuse limit 2024-12-12 21:10:22 +01:00
Christy JacobandGitHub a148b624b0 Merge pull request #9104 from appwrite/fix-usage-payload-bug
Usage payload debug
2024-12-13 00:03:06 +04:00
Matej Bačo fcd991fff2 Merge branch 'feat-create-function-abuse-fix' of github.com:appwrite/appwrite into feat-create-function-abuse-fix 2024-12-12 21:00:19 +01:00
Matej Bačo ab7ea056e6 Increase limit 2024-12-12 21:00:04 +01:00
shimon 434aa6d140 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-usage-payload-bug 2024-12-12 21:58:33 +02:00
shimon 01019f5055 Usage payload debug 2024-12-12 21:54:59 +02:00
Matej BačoandGitHub 5a0369ce27 Merge branch '1.6.x' into feat-create-function-abuse-fix 2024-12-12 20:52:39 +01:00
Matej Bačo 04139d6901 Linter fix 2024-12-12 20:52:31 +01:00
Matej Bačo 9c4d0f2a79 Leftover 2024-12-12 20:48:28 +01:00
Matej Bačo a18472507b Add createFunction abuse check + fix abuse 2024-12-12 20:45:49 +01:00
Christy JacobandGitHub 06adb3bcab Merge pull request #9103 from appwrite/fix-usage-payload-bug
Usage payload debug
2024-12-12 23:31:58 +04:00
shimon 177fd92094 Usage payload debug 2024-12-12 21:20:55 +02:00
loks0n bc38fd2640 fix: hide system prompt 2024-12-12 19:04:31 +00:00
loks0n eb2c3cd73f chore: platform bump 2024-12-12 18:55:38 +00:00
Christy JacobandGitHub 796b06fec5 Merge pull request #9101 from appwrite/fix-usage-payload-bug
Usage payload debug
2024-12-12 22:48:50 +04:00
Matej Bačo 6a9eeeb370 Add createFunction abuse labels 2024-12-12 19:39:24 +01:00
shimon 717b06950e Usage payload debug 2024-12-12 20:20:47 +02:00
loks0n a12b758658 feat: upgrade assistant to 0.6,0 2024-12-12 17:11:22 +00:00
Christy JacobandGitHub ef150ac2c0 Merge pull request #9099 from appwrite/fix-usage-payload-bug
Fix usage payload bug
2024-12-12 20:58:12 +04:00
shimon 158954df0b Usage payload debug 2024-12-12 18:55:45 +02:00
shimon c5605ac8be payload bug fix 2024-12-12 17:46:27 +02:00
shimon dc64fe85e9 payload bug fix 2024-12-12 17:46:04 +02:00
Christy JacobandGitHub 653db9d7ad Merge pull request #9098 from appwrite/fix-usage-payload-bug
payload bug fix
2024-12-12 18:57:55 +04:00
shimon 6a28d4eee6 payload bug fix 2024-12-12 16:55:14 +02:00
shimon f6157dd2c0 payload bug fix 2024-12-12 16:44:41 +02:00
Christy JacobandGitHub 9a693ecfb5 Merge pull request #9055 from appwrite/PLA-1990
fix(realtime): decrement connectionCounter only if connection is known
2024-12-12 18:06:32 +04:00
Christy JacobandGitHub 3949ce5f6b Merge pull request #9096 from appwrite/refactor-db-for-console
chore: replace occurrences of dbForConsole to dbForPlatform
2024-12-12 15:15:19 +04:00
Christy JacobandGitHub c2371e14f2 Merge pull request #9097 from appwrite/fix-usage-payload-bug
Fix usage payload bug
2024-12-12 14:37:10 +04:00
shimon ed66e8e41b payload bug fix 2024-12-12 12:36:34 +02:00
shimon 6dcd679412 payload bug fix 2024-12-12 12:34:39 +02:00
shimon b145477114 payload bug fix 2024-12-12 12:30:36 +02:00
Christy Jacob 75b42e134a chore: replace occurrences of dbForConsole to dbForPlatform 2024-12-12 14:30:26 +04:00
Jake BarnbyandGitHub 0c3ed7f81b Merge pull request #9092 from appwrite/migration-throw-error
Migration throw error
2024-12-12 20:01:30 +13:00
Marton Schneider eb2e9eadd7 fix docker-compose.yml 2024-12-11 21:10:21 +01:00
Marton SchneiderandGitHub aaf5ab1948 Merge branch 'appwrite:main' into main 2024-12-11 21:06:52 +01:00
Christy JacobandGitHub f3d6eb09dd Merge pull request #5769 from appwrite/lohanidamodar-patch-2
fix doc comment for filter method
2024-12-11 23:25:51 +04:00
Christy JacobandGitHub a735e969ec Merge pull request #5445 from appwrite/cloud-update-install-link
Add Appwrite Cloud to read me.
2024-12-11 23:10:39 +04:00
Christy JacobandGitHub 3ca1f3065f Merge pull request #7042 from mishmanners/patch-4
Add accessibility features
2024-12-11 23:00:10 +04:00
Christy Jacob 2c9da8a1c4 chore: update PR 2024-12-11 18:59:46 +00:00
Christy Jacob f5f549b520 chore: update PR 2024-12-11 18:58:54 +00:00
Christy Jacob 5da1dd26bc chore: update PR 2024-12-11 18:55:46 +00:00
Christy JacobandGitHub fef9b6dfd3 Merge pull request #5278 from gofenix/readme-cn
update readme-cn some doc
2024-12-11 21:53:32 +04:00
Christy JacobandGitHub 1483e08754 Merge pull request #4848 from olitomas/patch-1
🇮🇸 Added missing Icelandic translations for email strings.
2024-12-11 21:53:13 +04:00
Christy JacobandGitHub 740baec56a Merge pull request #5046 from Yavnik/patch-4
Added RuPay Credit Card Icon in Avatars Service
2024-12-11 21:52:58 +04:00
Christy Jacob c92217afb9 chore: remove console 2024-12-11 17:25:12 +00:00
Christy Jacob db5c29742d Merge branch 'main' of https://github.com/appwrite/appwrite into readme-cn 2024-12-11 17:22:23 +00:00
Christy Jacob 816a203e73 chore: update Chinese readme 2024-12-11 17:21:02 +00:00
Christy JacobandGitHub 363011ee32 Merge branch 'main' into patch-4 2024-12-11 21:08:19 +04:00
Christy JacobandGitHub 51e5b50ae7 Merge branch 'main' into patch-1 2024-12-11 21:07:53 +04:00
Christy JacobandGitHub 342b9f2910 Merge pull request #4313 from tusharxoxoxo/patch-2
Update add-oauth2-provider.md
2024-12-11 21:07:19 +04:00
Christy Jacob 71c21a7bd8 chore: linter 2024-12-11 16:46:24 +00:00
Christy Jacob f8c22a6700 Merge branch 'main' of https://github.com/appwrite/appwrite into patch-4 2024-12-11 16:45:42 +00:00
Christy JacobandGitHub 01465f5c8d Merge branch 'main' into patch-1 2024-12-11 20:36:14 +04:00
Christy JacobandGitHub 7301704762 Merge branch 'main' into patch-2 2024-12-11 20:25:57 +04:00
Christy JacobandGitHub f8b89b2294 Merge pull request #3728 from sashashura/patch-1
GitHub Workflows security hardening
2024-12-11 20:25:22 +04:00
Christy JacobandGitHub 3b93b33dc9 Merge pull request #9076 from appwrite/fix-dont-checkout-git-history
feat: delete git folder
2024-12-11 19:11:04 +04:00
fogelito 17b5b3cf4b Remove comments 2024-12-11 17:06:19 +02:00
fogelito 4984abb0dd tests nulls 2024-12-11 16:58:00 +02:00
fogelito 66c5f959c0 Sentry Console::error 2024-12-11 16:34:13 +02:00
fogelito 142782825d Add throwable migration error 2024-12-11 13:31:17 +02:00
fogelito 071f050aaf Add throwable migration error 2024-12-11 12:57:25 +02:00
Jake Barnby 8531b70089 Update docs 2024-12-11 19:15:29 +13:00
Jake Barnby bb6da36b36 Update versions 2024-12-11 19:15:10 +13:00
Jake Barnby d80731e7db Allow pushing SDK to new branches 2024-12-11 19:14:10 +13:00
loks0n 13157837ec Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-dont-checkout-git-history 2024-12-10 13:27:54 +00:00
Christy JacobandGitHub 203e11053f Merge pull request #9085 from appwrite/update-usage-payload
Update usage-dump payload
2024-12-10 07:22:29 -06:00
shimon 834c237cd5 handling map size 2024-12-10 15:18:21 +02:00
loks0n f2027bad2c chore: bump composer 2024-12-10 13:12:20 +00:00
Jake Barnby 4a49629a34 Map enum 2024-12-11 00:26:58 +13:00
Jake Barnby 478e19f52f Map push priority enum name 2024-12-11 00:26:01 +13:00
Jake Barnby 636dc8fe9f Update specs 2024-12-10 23:53:56 +13:00
Jake Barnby 6c83eba693 Fix badge default to allow sending clear badge notifications 2024-12-10 23:34:24 +13:00
Jake Barnby 30fed93e2a Remove variable variable usage 2024-12-10 23:33:49 +13:00
Jake Barnby f2b202aa52 Update push message builder 2024-12-10 22:53:40 +13:00
Jake Barnby 15855e2406 Fix message search builder subquery 2024-12-10 22:53:03 +13:00
Jake Barnby 8649032b73 Fix badge param type 2024-12-10 22:52:39 +13:00
shimon 5ffb81df43 update usage project attr 2024-12-09 17:42:05 +02:00
Jake Barnby 44d3a4f223 Update specs 2024-12-09 15:42:20 +13:00
Matej Bačo 96956dbda5 Temporary QA server fix 2024-12-06 20:58:01 +01:00
Matej Bačo 15cc64e68b Increase minimal memory 2024-12-06 19:56:46 +01:00
Matej Bačo 65d4bcef47 Fix terminology of env vars 2024-12-06 15:19:45 +01:00
Matej Bačo 5f39affe74 Fix missing build env vars 2024-12-06 15:17:50 +01:00
loks0n 2c87e3f4e5 feat: delete git folder 2024-12-06 13:51:24 +00:00
Jake Barnby 409c8a4d8e Merge branch 'feat-apns-content-available' of github.com:appwrite/appwrite into feat-apns-content-available 2024-12-05 23:12:36 +13:00
Jake Barnby 45f6d9c0b9 Specs 2024-12-05 23:12:06 +13:00
Jake BarnbyandGitHub b36d4c2e2f Merge branch '1.6.x' into feat-apns-content-available 2024-12-05 22:18:59 +13:00
Jake Barnby 5b75fcc398 Update lock 2024-12-05 21:39:43 +13:00
526f54cf06 Update src/Appwrite/Platform/Workers/Messaging.php
Co-authored-by: Damodar Lohani <lohanidamodar@users.noreply.github.com>
2024-12-05 21:09:52 +13:00
Jake BarnbyandGitHub dfb5ff1feb Merge pull request #9066 from appwrite/chore-upgrade-utopia-storage
Chore: upgrade utopia storage
2024-12-05 21:00:07 +13:00
Jake Barnby 98149f56b5 Default empty title and body 2024-12-05 17:20:20 +13:00
Jake Barnby f4917f7bc6 Reorder params 2024-12-05 17:04:11 +13:00
Damodar Lohani 968b16d8bf upgrade utopia storage 2024-12-04 08:38:26 +00:00
Jake Barnby 2934bdbd3b Update messaging 2024-12-04 20:16:13 +13:00
Jake Barnby a461198547 Add critical and priority params 2024-12-04 19:27:55 +13:00
Jake Barnby fa49244b4b Fix param type 2024-12-03 22:50:40 +13:00
Jake Barnby ab900d16d4 Allow apns content available 2024-12-03 17:19:06 +13:00
Matej Bačo ef21ab7f3b Update version for templates 2024-12-02 18:26:36 +01:00
Matej Bačo 554a24e44c Fix double compression 2024-12-02 17:56:52 +01:00
Matej Bačo ee731b8530 Add optional adapter 2024-12-02 17:21:54 +01:00
Matej Bačo dd3f2c6538 Force update specs 2024-12-02 17:01:18 +01:00
Matej BačoandGitHub 5a4958090e Merge pull request #9033 from appwrite/feat-ssr
Feat: Server-side rendering for site frameworks
2024-12-02 16:02:04 +01:00
Matej Bačo cd4f78d619 Update specs 2024-12-02 15:34:39 +01:00
Matej BačoandGitHub eb46ba354a Merge branch 'feat-sites' into feat-ssr 2024-12-02 15:33:12 +01:00
Matej BačoandGitHub f0b3c95035 Merge pull request #9047 from appwrite/feat-site-logs
Logs for sites
2024-12-02 15:31:21 +01:00
Matej Bačo e15fdc493c Fix missing key in specs 2024-12-02 15:28:00 +01:00
Matej Bačo fdff1664ea Add other framework 2024-12-02 15:05:26 +01:00
Khushboo Verma 4bdc9b0c84 Add logs and errors to site logs 2024-12-02 18:48:50 +05:30
Matej Bačo 563031f214 Remove local mount 2024-12-02 14:12:46 +01:00
Khushboo Verma 33273c1be1 Site logs 2024-12-02 18:30:06 +05:30
Matej Bačo 1b95790de3 Add CI/CD logs 2024-12-02 13:56:03 +01:00
Matej Bačo 2ef1cf5da0 bug fixes 2024-12-02 13:45:03 +01:00
Matej Bačo 4a117adb28 Support SSR 2024-12-02 13:20:54 +01:00
Fabian Gruber 6e4b365992 fix(realtime): decrement connectionCounter only if connection is known 2024-12-02 10:39:38 +01:00
Jake BarnbyandGitHub 3ce63b3d7d Merge pull request #9038 from appwrite/1.6.x-fix-delete-attribute
Fix delete notFound attribute
2024-12-02 13:49:42 +13:00
Steven NguyenandGitHub 3954560e30 Merge pull request #9050 from appwrite/1.6.x-db-0.53.20.a
Bomb db 0.53.200
2024-12-01 00:43:27 -08:00
fogelito 8349a7e8f7 lock 2024-12-01 10:17:28 +02:00
fogelito b923893699 0.53.20.hotfix1 2024-12-01 10:11:19 +02:00
Khushboo Verma 86bc775791 Add sites resource type and logs scope 2024-11-29 18:57:10 +05:30
Khushboo Verma 9a57b09b92 Logs for sites 2024-11-29 18:27:51 +05:30
Christy JacobandGitHub 16b5a8507e Merge pull request #9037 from appwrite/lohanidamodar-patch-4
Update storage.php
2024-11-28 12:10:41 +01:00
Christy JacobandGitHub 992808f640 Merge pull request #9039 from appwrite/fix-rules-collection
feat: use environment variable to check rules format
2024-11-28 11:49:50 +01:00
Christy Jacob 4dbf11e236 feat: review comments and linter 2024-11-28 14:33:02 +04:00
Christy Jacob 48d20b2c67 feat: update proxy and certificates files 2024-11-28 14:18:37 +04:00
Christy Jacob 7e98493324 feat: use environment variable to check rules format 2024-11-28 14:08:26 +04:00
fogelito 1054f877a1 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into 1.6.x-fix-delete-attribute 2024-11-28 12:07:40 +02:00
Damodar LohaniandGitHub a4ff1bf3be Update storage.php 2024-11-28 15:47:09 +05:45
fogelito 6be15eee0c try catch not found 2024-11-28 11:59:43 +02:00
Jake BarnbyandGitHub 3d44757e37 Merge pull request #9032 from appwrite/1.6.x-fix-delete-attribute
Remove failed attribute
2024-11-28 16:32:32 +13:00
Jake Barnby 856be8ce0f Merge remote-tracking branch 'origin/1.6.x' into 1.6.x-fix-delete-attribute 2024-11-28 16:14:23 +13:00
Steven NguyenandGitHub 6e09bcf6c6 Bump appwrite version to 1.6.1-RC1 2024-11-27 18:10:28 +00:00
Steven NguyenandGitHub 91be70babf Merge pull request #9034 from appwrite/chore-bump-console-5.2.27
Bump console to version 5.2.27
2024-11-27 09:48:39 -08:00
Steven NguyenandGitHub c062a8f129 Bump console to version 5.2.27 2024-11-27 16:47:32 +00:00
Steven NguyenandGitHub 35005657b9 Merge pull request #9026 from appwrite/feat-1.6.1-release-prep
Prepare 1.6.1 release
2024-11-27 08:44:36 -08:00
fogelito 98864b04e1 fix $options 2024-11-27 18:02:37 +02:00
Matej Bačo 36e3d9c603 WIP: Server-side rendering for sites 2024-11-27 16:27:40 +01:00
fogelito e39c96e6d1 Merge branch '1.6.x' of https://github.com/appwrite/appwrite into 1.6.x-fix-delete-attribute 2024-11-27 14:37:36 +02:00
fogelito ca6cd349fb Remove failed attribute 2024-11-27 14:35:58 +02:00
Christy JacobandGitHub 441e56f445 Merge pull request #8932 from appwrite/fix-preview-domains-development
Fix: Preview domains locally
2024-11-27 13:13:33 +01:00
Christy JacobandGitHub 92faa24d38 Merge pull request #9028 from appwrite/PLA-1913
feat: add more tags to logging
2024-11-26 16:43:46 +01:00
Christy JacobandGitHub 399261bfb1 Merge pull request #9029 from appwrite/1.6.x-fix-restoration
fix restoration
2024-11-26 16:40:38 +01:00
Fabian Gruber f0b6c729c9 feat: add more tags to sentry 2024-11-26 16:13:55 +01:00
fogelito 135ff1a724 bomb migration 0.6.13 2024-11-26 17:05:17 +02:00
Khushboo VermaandGitHub df4c36d71b Merge pull request #9030 from appwrite/chore-sentence-case-templates
Change case to sentence case for site template titles
2024-11-26 20:03:48 +05:30
793eb53790 Update app/config/site-templates.php
Co-authored-by: Matej Bačo <matejbacocom@gmail.com>
2024-11-26 19:59:50 +05:30
Khushboo Verma 6b568e8b7f Change case to sentence case 2024-11-26 19:55:13 +05:30
fogelito 442459f6a4 fix restoration 2024-11-26 16:14:38 +02:00
Christy JacobandGitHub 74c8a664a8 Merge pull request #8838 from appwrite/PLA-1791
feat: move certificate generation to Adapter
2024-11-26 14:24:12 +01:00
Fabian Gruber 98984a8085 refactor: use single adapter 2024-11-26 13:54:52 +01:00
Fabian Gruber 3a9ba8a6ad feat: move certificate generation to Adapter 2024-11-26 13:54:52 +01:00
Christy JacobandGitHub ce35567c05 Merge pull request #9002 from appwrite/fix-project-accessed-at
Fix: update project last activity on init
2024-11-26 13:18:55 +01:00
Damodar Lohani 3a21ed6333 Merge remote-tracking branch 'origin/1.6.x' into fix-project-accessed-at 2024-11-26 11:51:50 +00:00
Damodar Lohani 580a9f331f fix user update 2024-11-26 08:59:03 +00:00
Matej Bačo fec74ee9e4 Fix naming mistake 2024-11-25 18:39:24 +01:00
Matej Bačo 10ef570485 Linter fix 2024-11-25 18:22:49 +01:00
Matej Bačo d719fd9be4 Update enum specs for frameworks 2024-11-25 18:19:18 +01:00
Matej Bačo 135023b3ed Fix start issue 2024-11-25 18:15:12 +01:00
Matej Bačo 2bd2092263 Dart support 2024-11-25 17:48:15 +01:00
Christy JacobandGitHub 33fad2cb23 Merge pull request #9020 from appwrite/chore-bump-console-5.2.25
Bump console to version 5.2.25
2024-11-25 17:24:25 +01:00
Christy JacobandGitHub 533009c1da Merge branch '1.6.x' into chore-bump-console-5.2.25 2024-11-25 17:21:52 +01:00
Steven NguyenandGitHub cb385674a5 Add 1.6.1 to CHANGES.md 2024-11-25 15:58:22 +00:00
Steven NguyenandGitHub fb4c71aebb Merge pull request #9025 from appwrite/fix-tasks-warning
Fix: swoole task warning
2024-11-25 07:07:09 -08:00
Matej Bačo 9d3bc1f80a Fix swoole task warning 2024-11-25 11:04:04 +01:00
Steven NguyenandGitHub 8da2b249b7 Merge pull request #9019 from appwrite/fix-8569-users-create-session-secret
Fix users create session secret
2024-11-22 21:55:28 -08:00
Steven NguyenandGitHub 07b3cbaec9 Bump appwrite version to 1.6.1 2024-11-22 22:47:02 +00:00
Steven NguyenandGitHub 98d78163a2 Bump console to version 5.2.25 2024-11-22 22:39:24 +00:00
Steven NguyenandGitHub 014c613c93 fix: update secret returned from users.createSession()
1. Include at least 1 factor because the minumum number of factors
   required when mfa is disabled is 1.
2. Purge the cached user document to ensure the new session is included
   in subsequent requests for the user.
3. Fix the encoding of the secret to match other parts of the codebase.
2024-11-22 21:52:27 +00:00
Steven NguyenandGitHub 54ec39f513 Merge pull request #9016 from appwrite/feat-safe-workers
Feat: Safe workers
2024-11-22 11:07:18 -08:00
Steven NguyenandGitHub ad235610da Merge pull request #9018 from appwrite/rules-backwards-compatibility
chore: backwards compatibility for 1.6.x
2024-11-22 09:53:09 -08:00
Marton Schneider 3c1e422bb9 change the env var name from _APP_STORAGE_S3_ENDPOINT_URL to _APP_STORAGE_S3_ENDPOINT 2024-11-22 18:21:44 +01:00
Christy Jacob ae7cb36240 chore: linter 2024-11-22 17:18:23 +00:00
Christy Jacob 33dd4df694 chore: backwards compatibility for 1.6.x 2024-11-22 17:16:51 +00:00
Marton Schneider 4d90ff06fd Merge remote-tracking branch 'upstream/main' 2024-11-22 18:16:44 +01:00
Matej Bačo eee7d0422c Fix paths 2024-11-22 15:45:28 +01:00
Matej Bačo 2fcfd1d7c9 Add safe workers 2024-11-22 13:57:42 +00:00
Matej Bačo 0d314c00a6 Add more defaults to frameworks 2024-11-22 14:55:52 +01:00
Matej Bačo a5fc2e0ef7 Add missing frameworks 2024-11-22 14:15:37 +01:00
Matej Bačo e168ab9ffc Update default frameworks 2024-11-22 14:08:07 +01:00
Matej Bačo 644c18fc69 Update specs 2024-11-22 12:20:12 +01:00
Matej Bačo 57717f4690 Separate starter templates, add demo URLs 2024-11-22 12:19:59 +01:00
Matej Bačo c46a9bdb45 Add all starters 2024-11-22 11:58:54 +01:00
Matej Bačo d431b53434 Switch to official starter template for sites 2024-11-22 11:52:33 +01:00
Matej Bačo 18d9ebaab3 Add template fallback file 2024-11-21 21:43:06 +01:00
Matej Bačo 40e343d17d Fix response model missing fallbackFile 2024-11-20 15:02:26 +01:00
Matej Bačo f6122157c7 Ensure latest specs after merges 2024-11-20 14:37:47 +01:00
Matej BačoandGitHub cbaad2dfb9 Merge pull request #8995 from appwrite/feat-add-fallbackFile-attribute
Add fallbackFile for SPA
2024-11-20 14:33:28 +01:00
Matej BačoandGitHub c509ec56bd Merge branch 'feat-sites' into feat-add-fallbackFile-attribute 2024-11-20 14:33:19 +01:00
Matej BačoandGitHub a25b786fca Merge pull request #9010 from appwrite/chore-add-site-domains-var
Add _APP_DOMAIN_SITES to console variables
2024-11-20 14:33:02 +01:00
Matej Bačo 06224aa34e formatting fix 2024-11-20 14:19:15 +01:00
Matej Bačo 4bcbd49d6d Formatting fix 2024-11-20 14:18:43 +01:00
Matej BačoandGitHub 09e2ded206 Merge branch 'feat-sites' into feat-add-fallbackFile-attribute 2024-11-20 14:14:28 +01:00
Matej BačoandGitHub 4a8c063d51 Merge branch 'feat-sites' into chore-add-site-domains-var 2024-11-20 14:13:39 +01:00
Matej Bačo 2e9e6d38e2 Fix site URLs 2024-11-20 13:48:42 +01:00
Matej Bačo 53917d6d90 Update specs 2024-11-20 12:25:28 +01:00
Matej Bačo d20714eed6 Merge branch 'feat-sites' into chore-add-site-domains-var 2024-11-20 12:21:13 +01:00
Matej Bačo 2f328bf4cf Fix double rule IDs 2024-11-20 12:20:29 +01:00
Matej Bačo e3c4cdb040 Update template-runtimes.php 2024-11-20 12:10:09 +01:00
Matej Bačo c8cf645414 Merge branch '1.6.x' into feat-sites 2024-11-20 12:07:13 +01:00
Khushboo Verma aa47d9f07a Add _APP_OPTIONS_FORCE_HTTPS to console vars 2024-11-20 16:12:35 +05:30
Khushboo Verma 338559967a Update var count in tests 2024-11-20 14:52:03 +05:30
Khushboo Verma a736a42e26 Update test 2024-11-20 14:46:04 +05:30
Khushboo Verma 00c6549610 Add _APP_DOMAIN_SITES to console variables 2024-11-20 14:44:22 +05:30
Matej BačoandGitHub 510d871379 Merge pull request #9001 from appwrite/chore-move-preview-url-to-create-deployment
Create preview url rule when deployment is created
2024-11-20 09:52:03 +01:00
Damodar Lohani c33c5732e0 move accessed at to init 2024-11-20 04:29:57 +00:00
Damodar Lohani 2da2b5bb7f reset error hook 2024-11-20 04:25:37 +00:00
Damodar Lohani e8079cfd29 lint 2024-11-19 06:59:30 +00:00
Damodar LohaniandGitHub 842e23220a update project last activity on error hook 2024-11-19 07:51:50 +05:45
Khushboo Verma 43e2d7454a Create preview url rule when deployment is created 2024-11-18 20:27:07 +05:30
Matej BačoandGitHub b2cd20bf29 Merge pull request #8934 from appwrite/fix-bandwidth-calculation
Fix: bandwidth calculation
2024-11-18 11:16:51 +01:00
Khushboo Verma cb359e40ba Add fallbackFile for SPA 2024-11-18 00:23:45 +05:30
Khushboo Verma 7836e48559 Use resourceId in the endpoint url 2024-11-17 22:45:03 +05:30
Khushboo Verma d95cdc3296 WIP: Add new console endpoint 2024-11-13 21:46:07 +05:30
Khushboo Verma 2ad0428727 Merge 1.6.x into feat-sites 2024-11-13 13:18:21 +05:30
Khushboo Verma ba74ffd4bf Address PR comments 2024-11-11 11:48:26 +05:30
Khushboo Verma b88cd8e544 Add subdomain param in functions and tests 2024-11-07 21:55:41 +05:30
Khushboo Verma a031b54feb Add sitesBase test file 2024-11-07 00:04:26 +05:30
Khushboo Verma 081cf5c6aa Delete rules when site or deployment is deleted 2024-11-06 23:35:30 +05:30
Matej Bačo c9e6ef8202 Rename based on PR reviews 2024-11-06 16:05:58 +00:00
Matej Bačo 87cfd7df3b Remove leftover 2024-11-06 11:39:44 +00:00
Matej Bačo ca887f018e fix domain execution response size 2024-11-06 11:29:24 +00:00
Matej Bačo 54c24b24e6 Improve preview domains local development flow 2024-11-06 10:52:43 +00:00
Matej BačoandGitHub 6874b4f6fb Merge pull request #8885 from appwrite/feat-add-sites-comments
Feat add sites comments
2024-10-28 15:47:16 +01:00
Matej BačoandGitHub eeba650f6c Merge branch 'feat-sites' into feat-add-sites-comments 2024-10-28 15:43:46 +01:00
Matej Bačo 54b07e6b99 Add protocol 2024-10-28 15:24:34 +01:00
Khushboo Verma dc8b9478ee Fix builds 2024-10-28 15:20:36 +01:00
Torsten DittmannandGitHub d97b02add9 Merge pull request #8884 from appwrite/fix-sites-get-template
Fix: sites get template missing key
2024-10-28 15:07:10 +01:00
Matej Bačo 8427ade0fa Fix sites get template missing key 2024-10-28 15:04:48 +01:00
Khushboo Verma 44d6a0dea1 Merge branch 'feat-add-sites-comments' of github.com:appwrite/appwrite into feat-add-sites-comments 2024-10-28 15:02:00 +01:00
Khushboo Verma f710ce266b Merge branch 'feat-sites' into feat-add-sites-comments 2024-10-28 14:54:08 +01:00
Matej Bačo 45dc9a39d9 Get preview URL 2024-10-28 14:53:06 +01:00
Matej Bačo d703a118c4 Merge branch 'feat-sites' into feat-add-sites-comments 2024-10-28 14:52:07 +01:00
Matej Bačo c20e580a9e Fix missing params in VCS comment flow 2024-10-28 14:45:18 +01:00
Matej Bačo 9b4de5d7bf Fix comments 2024-10-28 14:39:12 +01:00
Matej BačoandGitHub 7c9f396b40 Merge pull request #8883 from appwrite/feat-sites-logs-styled
Feat: Styled&timestamped logs
2024-10-28 14:35:30 +01:00
Matej Bačo 31b9f2b4f9 Fix comments 2024-10-28 14:19:44 +01:00
Khushboo Verma 6ff15f9b53 WIP: GitHub Comments for Sites 2024-10-28 14:00:23 +01:00
Matej BačoandGitHub 1ebd6c252c Merge branch 'feat-sites' into feat-sites-logs-styled 2024-10-28 12:27:06 +01:00
Matej BačoandGitHub 8424351d49 Merge pull request #8882 from appwrite/fix-sites-logs-realtime
Fix: sites deployment logs realtime
2024-10-28 12:26:54 +01:00
Matej Bačo 0c4e597819 Implemented styled and timestamped logs, fix cosistency 2024-10-28 12:22:34 +01:00
Matej BačoandGitHub d1917d1a2b Merge branch 'feat-sites' into fix-sites-logs-realtime 2024-10-28 12:08:27 +01:00
Matej Bačo bb3503f0c4 Fix sites deployment logs realtime 2024-10-28 12:00:06 +01:00
Torsten DittmannandGitHub 7c22776254 Merge pull request #8880 from appwrite/fix-deployment-domains
Fix: deployment domain incorrect
2024-10-28 11:59:21 +01:00
Matej BačoandGitHub 2294586371 Merge branch 'feat-sites' into fix-deployment-domains 2024-10-28 11:21:08 +01:00
Torsten DittmannandGitHub b7f519f86e Merge pull request #8879 from appwrite/fix-check-domain-availability
Throw exception for error
2024-10-28 11:19:04 +01:00
Matej Bačo febd5294f4 Ensure function executor is ready 2024-10-28 11:18:15 +01:00
Matej Bačo 690a23fe89 Fix deployments showing wrong domains 2024-10-28 11:17:44 +01:00
Khushboo Verma 39c1a88dae Throw exception for error 2024-10-28 10:55:58 +01:00
Khushboo VermaandGitHub d0808e0c1a Merge pull request #8878 from appwrite/fix-sites-notice
Fix: unwanted notice
2024-10-27 22:11:50 +01:00
Matej Bačo 34fd22e4e9 Fix unwanted object instead of array 2024-10-27 21:49:44 +01:00
Matej Bačo d4fb0d37c2 Fix notice 2024-10-27 21:44:59 +01:00
Matej BačoandGitHub fd02ca00f0 Merge pull request #8877 from appwrite/feat-preview-deployments
Feat: Implement preview deployments
2024-10-27 21:25:27 +01:00
Matej Bačo 8a53d02d0c Remove leftover 2024-10-27 21:25:12 +01:00
Matej Bačo 58ee53876b Implement preview deployments 2024-10-27 21:10:53 +01:00
Matej BačoandGitHub 853b730def Merge pull request #8875 from appwrite/chore-add-build-runtime
Add build and serve runtime to updateSite
2024-10-27 19:17:13 +01:00
Khushboo Verma be5fdbfd4f Add build and serve runtime to updateSite 2024-10-27 18:54:20 +01:00
Khushboo VermaandGitHub e6d123b5e8 Merge pull request #8873 from appwrite/chore-rename-common-vars-to-compute
Use compute vars for functions and sites
2024-10-27 18:35:27 +01:00
Khushboo Verma d8a844a2f9 Fix functions tests 2024-10-27 18:14:47 +01:00
Khushboo Verma dd87cdbebf Fix remaining vars 2024-10-27 18:04:40 +01:00
Khushboo Verma 4c1881324e Use compute vars for functions and sites 2024-10-27 17:22:45 +01:00
Matej BačoandGitHub bd27a36d16 Merge pull request #8872 from appwrite/fix-site-leftovers
Fix: leftover structure
2024-10-27 16:58:12 +01:00
Matej Bačo 2f999ba3db Fix crashing containers 2024-10-27 16:34:49 +01:00
Matej Bačo d8ec390cd6 Merge branch 'feat-sites' into fix-site-leftovers 2024-10-27 16:22:53 +01:00
Matej Bačo 7a0e7bfb95 Add runtimes to templates 2024-10-27 16:15:49 +01:00
Khushboo VermaandGitHub da7ae6b953 Merge pull request #8863 from appwrite/feat-sites-endpoints
Add timeout and add sites scopes
2024-10-27 16:15:00 +01:00
Khushboo Verma 2dead545f0 Resolve PR comments 2024-10-27 15:51:17 +01:00
Matej Bačo 9c566ec17c Merge branch 'feat-sites' into fix-site-leftovers 2024-10-27 15:49:53 +01:00
Matej Bačo 385fe303cc Fix leftover fields and attributes 2024-10-27 15:48:39 +01:00
Khushboo Verma 81e3709d25 Remove scopes from updateSite endpoint 2024-10-27 15:48:06 +01:00
Khushboo Verma 7f17efcdd8 Resolve merge conflicts 2024-10-27 15:43:52 +01:00
Khushboo VermaandGitHub a566ac1078 Merge pull request #8865 from appwrite/feat-check-domain-availability
Add custom domain param in create site endpoint
2024-10-27 15:38:14 +01:00
Khushboo Verma 44e76b4eaa Add a todo 2024-10-27 15:35:18 +01:00
Khushboo Verma e7e1cfa12e Update desc 2024-10-27 15:32:29 +01:00
Khushboo Verma 77a70cad71 Add endpoint to check subdomain availability 2024-10-27 15:31:00 +01:00
Khushboo Verma 0c2db53ee8 Address PR Comments 2024-10-27 14:11:53 +01:00
Khushboo Verma 83807ed247 Fix projects tests 2024-10-27 12:56:56 +01:00
Khushboo Verma 302a135e5a Fix health tests 2024-10-27 11:52:22 +01:00
Khushboo Verma 6b2160f388 Fix vcs deployments 2024-10-27 11:33:56 +01:00
Khushboo Verma 86a68c50bc Rename subdomain 2024-10-27 11:32:43 +01:00
Khushboo Verma e2e7d6578c Resolve merge conflicts 2024-10-27 11:30:17 +01:00
Matej BačoandGitHub a171e17666 Merge pull request #8860 from appwrite/feat-sites-static
Feat: Static sites
2024-10-26 21:26:48 +02:00
Matej Bačo d8610e0f2a Upgrade executor to fix tests 2024-10-26 18:57:37 +00:00
Matej Bačo 93222bf3f9 Fix response format; formatting 2024-10-26 20:47:43 +02:00
Matej Bačo ea6765c68a Support static sites 2024-10-26 18:43:30 +02:00
Khushboo Verma 6ac81dea19 Check if subdomain exists before creating site 2024-10-26 18:34:58 +02:00
Khushboo Verma e4dd9bc9f9 Use custom domain in create site endpoint 2024-10-26 17:07:15 +02:00
Khushboo Verma 03d4d4c8fa Add build env vars for sites 2024-10-26 12:29:42 +02:00
Khushboo Verma fcc51d3352 Add sites build timeout env var 2024-10-26 11:14:55 +02:00
Khushboo Verma 08630cd686 Add timeout and add sites scopes 2024-10-26 11:01:14 +02:00
Matej Bačo 9295a4e7ce Update depenrencies 2024-10-25 19:25:51 +02:00
Matej BačoandGitHub 826a1a02a2 Merge pull request #8844 from appwrite/feat-site-endpointsa
Add new endpoints in HTTP structure
2024-10-25 18:46:11 +02:00
Khushboo Verma 4ed08cefa7 Fix getTemplate endpoint 2024-10-25 18:04:32 +02:00
Khushboo Verma 1a33a0c4d1 Fix range and frameworks 2024-10-25 16:23:29 +02:00
Khushboo Verma 4d3d710211 Add missing group to templates API 2024-10-25 16:05:45 +02:00
Khushboo Verma ac93e70dd2 Update listframeworks endpoint 2024-10-25 15:56:28 +02:00
Khushboo Verma dd3ffbb391 Add getTemplate endpoint for sites 2024-10-25 14:55:09 +02:00
Khushboo Verma 9d1d101586 Update VCS endpoin to work for both functions and sites 2024-10-25 14:41:14 +02:00
Khushboo VermaandGitHub 32da7b8fe2 Merge pull request #8852 from appwrite/fix-sites-commands-and-hardcoded
fix: commands and todos
2024-10-25 11:59:02 +02:00
Torsten Dittmann 41484113a0 chore: add comments 2024-10-25 10:55:31 +02:00
Torsten Dittmann 5d6a8be66d fix: function command 2024-10-24 19:43:12 +02:00
Torsten Dittmann aba3a31663 fix: deployment/deploymentId 2024-10-24 19:28:20 +02:00
Torsten Dittmann 8950f71b0a revert: comments 2024-10-24 19:24:24 +02:00
Torsten Dittmann 54d3668693 fix: todos for sites 2024-10-24 19:20:00 +02:00
Khushboo Verma b16169f867 Add secret to templateVariable model 2024-10-24 18:09:43 +02:00
Khushboo Verma bbd589f6a8 Add download build endpoint to sites 2024-10-24 18:02:26 +02:00
Khushboo Verma 765d8241f2 Add secret param to site variables 2024-10-24 16:32:53 +02:00
Khushboo Verma 8e041ddeb6 Merge branch 'feat-sites' into feat-site-endpointsa 2024-10-24 15:24:37 +02:00
Khushboo Verma a4a7fe0c48 Merge branch '1.7.x' into feat-sites 2024-10-24 15:24:25 +02:00
Khushboo Verma a247fc3b48 Merge branch 'feat-site-endpointsa' of github.com:appwrite/appwrite into feat-site-endpointsa 2024-10-24 15:22:16 +02:00
Khushboo Verma d876085f6d Add usage endpoints 2024-10-24 15:21:40 +02:00
Torsten DittmannandGitHub bba9c3d57a Merge pull request #8831 from appwrite/feat-add-secret-environment-vars
Add secret attribute to variables
2024-10-24 12:53:10 +02:00
Khushboo VermaandGitHub 944e971124 Merge pull request #8849 from appwrite/feat-site-static-runtime
feat: static runtime
2024-10-24 12:38:57 +02:00
Torsten Dittmann e512ab1816 Merge branch 'feat-site-static-runtime' of https://github.com/appwrite/appwrite into feat-site-static-runtime 2024-10-24 12:19:19 +02:00
Torsten Dittmann 83b5aecbfd chore: add todo comment 2024-10-24 12:19:10 +02:00
Khushboo Verma 2f9d00fc07 Update the description for secret var 2024-10-24 12:08:33 +02:00
Khushboo VermaandGitHub 23b57692ec Merge branch 'feat-site-endpointsa' into feat-site-static-runtime 2024-10-24 12:06:02 +02:00
Khushboo Verma 8bda7f1e1e Add listSiteTemplates endpoint and response models 2024-10-24 11:47:09 +02:00
Khushboo Verma 12bddc3b1f Change secret type to bool 2024-10-24 10:59:47 +02:00
Khushboo Verma 8f5fa84996 Add variable endpoints for sites 2024-10-24 10:49:43 +02:00
Khushboo VermaandGitHub 3af34f078c Merge branch 'feat-site-endpointsa' into feat-site-static-runtime 2024-10-23 18:37:45 +02:00
Torsten Dittmann 57e596fea2 feat: static runtime for site 2024-10-23 18:36:26 +02:00
Khushboo Verma 9793cf4ece Add all deployment endpoints for sites 2024-10-23 17:07:28 +02:00
Khushboo Verma a4bdc23aef Add more endpoints and models for sites 2024-10-23 12:19:07 +02:00
Khushboo Verma 4240089d41 Add create deployment endpoint 2024-10-22 19:45:49 +02:00
Khushboo VermaandGitHub 09ebfac307 Merge pull request #8843 from appwrite/fix-builds-worker
fix: builds worker new structure
2024-10-22 18:57:37 +02:00
Torsten Dittmann 89b6291488 fix: khusboo review comments 2024-10-22 18:56:34 +02:00
Torsten Dittmann 1434b6bbff fix: builds worker new structure 2024-10-22 18:03:40 +02:00
Torsten DittmannandGitHub de164ff936 Merge pull request #8842 from appwrite/fix-workers
Fix workers
2024-10-22 17:37:01 +02:00
Torsten Dittmann a8e2fb1ee5 Merge branch 'feat-sites' of https://github.com/appwrite/appwrite into fix-workers 2024-10-22 17:35:54 +02:00
Torsten Dittmann 7da8b44c63 chore: run formatter 2024-10-22 17:35:24 +02:00
Torsten Dittmann 8f0c1a4224 fix: gitignore 2024-10-22 17:34:22 +02:00
Torsten Dittmann c57cb3d2d9 fix: workers 2024-10-22 17:33:33 +02:00
Torsten DittmannandGitHub 5172189e36 Merge pull request #8839 from appwrite/feat-add-sites-endpoints
Move functions endpoints to modules
2024-10-22 17:31:43 +02:00
Khushboo Verma 6c6723e181 Refactor callback 2024-10-22 17:10:50 +02:00
Khushboo Verma 5b0a05b4b3 Create site endpoint working 2024-10-22 17:01:38 +02:00
Khushboo Verma 87cbd8fbf3 Move create function, create deployment to modules 2024-10-22 13:00:10 +02:00
Torsten DittmannandGitHub 9060250806 Merge pull request #8832 from appwrite/feat-add-sites-collection
Add new collection
2024-10-21 19:08:34 +02:00
Khushboo Verma bc63c3b383 Add sites collection 2024-10-21 19:01:37 +02:00
Khushboo Verma a503803725 Add secret attribute to variables 2024-10-21 16:33:57 +02:00
Marton Schneider 5a2f06fb83 add support endpoint URL for S3 2023-11-18 13:02:47 +01:00
Michelle "MishManners®™" ManneringandGitHub 3211867f6a Accessibility for README-CN
Add accessibility features based on: https://github.blog/2023-10-26-5-tips-for-making-your-github-profile-page-accessible/
2023-10-30 10:46:17 +11:00
Michelle "MishManners®™" ManneringandGitHub d1c5ec4585 Add accessibility to CONTRIBUTING
Add accessibility features based on: https://github.blog/2023-10-26-5-tips-for-making-your-github-profile-page-accessible/
2023-10-30 10:44:24 +11:00
Michelle "MishManners®™" ManneringandGitHub f90034a510 Add accessibility to README
Add accessibility features based on: https://github.blog/2023-10-26-5-tips-for-making-your-github-profile-page-accessible/
2023-10-30 10:39:46 +11:00
Damodar LohaniandGitHub 701f0bbd4d fix doc comment for filter method 2023-07-05 11:51:45 +05:45
Vincent (Wen Yu) Ge c0bea3d833 change links from install -> self-hosting 2023-04-27 19:08:12 +00:00
Vincent (Wen Yu) Ge 53a9c87f42 Update links in readme to include appwrite cloud 2023-04-27 19:01:01 +00:00
Vincent (Wen Yu) Ge 03bfed4e25 Update create-document description and improve error message for unknown attribute. 2023-04-24 22:54:01 +00:00
zhenfeng-zhu 96359b8f6a update readme-cn some doc 2023-03-25 18:03:01 +08:00
Tushar DahiyaandGitHub 16c7aa230d Merge branch 'appwrite:master' into patch-2 2023-03-09 22:27:09 +05:30
Yavnik SharmaandGitHub 5ea1268107 Added rupay.png 2023-02-03 18:24:17 +05:30
Yavnik SharmaandGitHub c856ffef45 Delete old rupay.png 2023-02-03 18:23:41 +05:30
Yavnik SharmaandGitHub 6509f19773 Merge branch 'appwrite:master' into patch-4 2023-02-03 18:08:06 +05:30
Yavnik SharmaandGitHub 8ec13eb221 Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:53:58 +05:30
Yavnik SharmaandGitHub 19f965befe Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:53:32 +05:30
Yavnik SharmaandGitHub 4077dc48b4 Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:53:04 +05:30
Yavnik SharmaandGitHub 14f38343f5 Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:52:36 +05:30
Yavnik SharmaandGitHub dd04c005aa Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:52:01 +05:30
Yavnik SharmaandGitHub 0328134cbc Added Rupay in Get Credit Card Icon Documentation 2023-01-26 17:51:33 +05:30
Yavnik SharmaandGitHub a65f3b1f4a Added rupay.png file 2023-01-26 17:50:49 +05:30
Yavnik SharmaandGitHub 11c93f800f Added rupay 2023-01-26 17:49:11 +05:30
Óli TómasandGitHub c673662a34 🇮🇸 Added missing Icelandic translations for email strings. 2022-12-12 19:19:36 +00:00
Tushar DahiyaandGitHub 092322ff4e Update add-oauth2-provider.md 2022-10-07 09:27:56 +05:30
AlexandGitHub e4d8d38c6e Update codeql-analysis.yml
Signed-off-by: sashashura <93376818+sashashura@users.noreply.github.com>
2022-08-29 11:34:32 +01:00
975 changed files with 61780 additions and 36205 deletions
+7
View File
@@ -0,0 +1,7 @@
reviews:
auto_review:
base_branches:
- main
- 1.6.x
- 1.7.x
- feat-sites # temporary until merged to 1.7.x
+18 -11
View File
@@ -18,11 +18,13 @@ _APP_SYSTEM_RESPONSE_FORMAT=
_APP_OPTIONS_ABUSE=disabled
_APP_OPTIONS_ROUTER_PROTECTION=disabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS=disabled
_APP_OPTIONS_COMPUTE_FORCE_HTTPS=disabled
_APP_OPENSSL_KEY_V1=your-secret-key
_APP_DOMAIN=traefik
_APP_DOMAIN_FUNCTIONS=functions.localhost
_APP_DOMAIN_TARGET=localhost
_APP_DOMAIN_SITES=sites.localhost
_APP_DOMAIN_TARGET=test.appwrite.io
_APP_RULES_FORMAT=md5
_APP_REDIS_HOST=redis
_APP_REDIS_PORT=6379
_APP_REDIS_PASS=
@@ -38,6 +40,7 @@ _APP_STORAGE_S3_ACCESS_KEY=
_APP_STORAGE_S3_SECRET=
_APP_STORAGE_S3_REGION=us-east-1
_APP_STORAGE_S3_BUCKET=
_APP_STORAGE_S3_ENDPOINT=
_APP_STORAGE_DO_SPACES_ACCESS_KEY=
_APP_STORAGE_DO_SPACES_SECRET=
_APP_STORAGE_DO_SPACES_REGION=us-east-1
@@ -67,17 +70,18 @@ _APP_SMS_FROM=+123456789
_APP_SMS_PROJECTS_DENY_LIST=
_APP_STORAGE_LIMIT=30000000
_APP_STORAGE_PREVIEW_LIMIT=20000000
_APP_FUNCTIONS_SIZE_LIMIT=30000000
_APP_FUNCTIONS_TIMEOUT=900
_APP_FUNCTIONS_BUILD_TIMEOUT=900
_APP_FUNCTIONS_CPUS=8
_APP_FUNCTIONS_MEMORY=8192
_APP_FUNCTIONS_INACTIVE_THRESHOLD=600
_APP_FUNCTIONS_MAINTENANCE_INTERVAL=600
_APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes
_APP_COMPUTE_SIZE_LIMIT=30000000
_APP_COMPUTE_TIMEOUT=900
_APP_COMPUTE_BUILD_TIMEOUT=900
_APP_COMPUTE_CPUS=8
_APP_COMPUTE_MEMORY=8192
_APP_COMPUTE_INACTIVE_THRESHOLD=600
_APP_COMPUTE_MAINTENANCE_INTERVAL=600
_APP_COMPUTE_RUNTIMES_NETWORK=runtimes
_APP_EXECUTOR_SECRET=your-secret-key
_APP_EXECUTOR_HOST=http://proxy/v1
_APP_EXECUTOR_HOST=http://exc1/v1
_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1
_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29
_APP_MAINTENANCE_INTERVAL=86400
_APP_MAINTENANCE_DELAY=
_APP_MAINTENANCE_RETENTION_CACHE=2592000
@@ -85,6 +89,7 @@ _APP_MAINTENANCE_RETENTION_EXECUTION=1209600
_APP_MAINTENANCE_RETENTION_ABUSE=86400
_APP_MAINTENANCE_RETENTION_AUDIT=1209600
_APP_USAGE_AGGREGATION_INTERVAL=30
_APP_STATS_RESOURCES_INTERVAL=3600
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000
_APP_MAINTENANCE_RETENTION_SCHEDULES=86400
_APP_USAGE_STATS=enabled
@@ -108,3 +113,5 @@ _APP_MESSAGE_EMAIL_TEST_DSN=
_APP_MESSAGE_PUSH_TEST_DSN=
_APP_WEBHOOK_MAX_FAILED_ATTEMPTS=10
_APP_PROJECT_REGIONS=default
_APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000
_APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main
+5
View File
@@ -13,8 +13,13 @@ on:
schedule:
- cron: '0 16 * * 0'
permissions:
contents: read
jobs:
analyze:
permissions:
security-events: write
name: Analyze
runs-on: ubuntu-latest
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
+16
View File
@@ -0,0 +1,16 @@
name: "Static code analysis"
on: [pull_request]
jobs:
lint:
name: CodeQL
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Run CodeQL
run: |
docker run --rm -v $PWD:/app composer:2.6 sh -c \
"composer install --profile --ignore-platform-reqs && composer check"
+116 -6
View File
@@ -8,9 +8,33 @@ env:
IMAGE: appwrite-dev
CACHE_KEY: appwrite-dev-${{ github.event.pull_request.head.sha }}
on: [pull_request]
on: [ pull_request ]
jobs:
check_database_changes:
name: Check if utopia-php/database changed
runs-on: ubuntu-latest
outputs:
database_changed: ${{ steps.check.outputs.database_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch base branch
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Check for utopia-php/database changes
id: check
run: |
if git diff origin/${{ github.event.pull_request.base.ref }} HEAD -- composer.lock | grep -q '"name": "utopia-php/database"'; then
echo "Database version changed, going to run all mode tests."
echo "database_changed=true" >> "$GITHUB_ENV"
echo "database_changed=true" >> "$GITHUB_OUTPUT"
else
echo "database_changed=false" >> "$GITHUB_ENV"
echo "database_changed=false" >> "$GITHUB_OUTPUT"
fi
setup:
name: Setup & Build Appwrite Image
runs-on: ubuntu-latest
@@ -66,6 +90,9 @@ jobs:
docker compose up -d
sleep 10
- name: Logs
run: docker compose logs appwrite
- name: Doctor
run: docker compose exec -T appwrite doctor
@@ -95,6 +122,14 @@ jobs:
docker load --input /tmp/${{ env.IMAGE }}.tar
docker compose up -d
sleep 10
- name: Wait for Open Runtimes
timeout-minutes: 3
run: |
while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do
echo "Waiting for Executor to come online"
sleep 1
done
- name: Run General Tests
run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/General --debug
@@ -103,6 +138,72 @@ jobs:
name: E2E Service Test
runs-on: ubuntu-latest
needs: setup
strategy:
fail-fast: false
matrix:
service: [
Account,
Avatars,
Console,
Databases,
Functions,
FunctionsSchedule,
GraphQL,
Health,
Locale,
Projects,
Realtime,
Sites,
Proxy,
Storage,
Teams,
Users,
Webhooks,
VCS,
Messaging,
Migrations
]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Load Cache
uses: actions/cache@v4
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
fail-on-cache-miss: true
- name: Load and Start Appwrite
run: |
docker load --input /tmp/${{ env.IMAGE }}.tar
docker compose up -d
sleep 30
- name: Wait for Open Runtimes
timeout-minutes: 3
run: |
while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do
echo "Waiting for Executor to come online"
sleep 1
done
- name: Run ${{ matrix.service }} tests with Project table mode
run: |
echo "Using project tables"
export _APP_DATABASE_SHARED_TABLES=
export _APP_DATABASE_SHARED_TABLES_V1=
docker compose exec -T \
-e _APP_DATABASE_SHARED_TABLES \
-e _APP_DATABASE_SHARED_TABLES_V1 \
appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug
e2e_shared_mode_test:
name: E2E Shared Mode Service Test
runs-on: ubuntu-latest
needs: [ setup, check_database_changes ]
if: needs.check_database_changes.outputs.database_changed == 'true'
strategy:
fail-fast: false
matrix:
@@ -119,6 +220,8 @@ jobs:
Locale,
Projects,
Realtime,
Sites,
Proxy,
Storage,
Teams,
Users,
@@ -128,7 +231,6 @@ jobs:
Migrations
]
tables-mode: [
'Project',
'Shared V1',
'Shared V2',
]
@@ -150,6 +252,14 @@ jobs:
docker compose up -d
sleep 30
- name: Wait for Open Runtimes
timeout-minutes: 3
run: |
while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do
echo "Waiting for Executor to come online"
sleep 1
done
- name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode
run: |
if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then
@@ -160,10 +270,6 @@ jobs:
echo "Using shared tables V2"
export _APP_DATABASE_SHARED_TABLES=database_db_main
export _APP_DATABASE_SHARED_TABLES_V1=
else
echo "Using project tables"
export _APP_DATABASE_SHARED_TABLES=
export _APP_DATABASE_SHARED_TABLES_V1=
fi
docker compose exec -T \
@@ -175,6 +281,8 @@ jobs:
name: Benchmark
runs-on: ubuntu-latest
needs: setup
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -235,6 +343,7 @@ jobs:
path: benchmark.json
retention-days: 7
- name: Find Comment
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@v3
id: fc
with:
@@ -242,6 +351,7 @@ jobs:
comment-author: 'github-actions[bot]'
body-includes: Benchmark results
- name: Comment on PR
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
+2 -1
View File
@@ -3,6 +3,7 @@
/node_modules/
/tests/resources/storage/
/tests/resources/functions/**/code.tar.gz
/tests/resources/sites/**/code.tar.gz
/app/sdks/*
/.idea/
!/.idea/workspace.xml
@@ -16,4 +17,4 @@ dev/yasd_init.php
.phpunit.result.cache
Makefile
appwrite.json
/.zed/
/.zed/
+114
View File
@@ -1,3 +1,117 @@
# Version 1.6.1
## What's Changed
### Notable changes
* Remove JPEG fallback for webp by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8746
* Add heic and avif support by @lohanidamodar in https://github.com/appwrite/appwrite/pull/7718
* Add new runtimes by @Meldiron in https://github.com/appwrite/appwrite/pull/8771
* Remove audits deletion by @shimonewman in https://github.com/appwrite/appwrite/pull/8766
* Bump assistant by @loks0n in https://github.com/appwrite/appwrite/pull/8801
* Change max queries values to 500 by @fogelito in https://github.com/appwrite/appwrite/pull/8802
* Allow '.wav' as 'audio/x-wav' as well by @basert in https://github.com/appwrite/appwrite/pull/8846
* Use 1 instead of 0.5 cpu for default function specification by @loks0n in https://github.com/appwrite/appwrite/pull/8848
* Update function runtimes by @christyjacob4 in https://github.com/appwrite/appwrite/pull/8781
* Add a realtime heartbeat by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/8943
### Fixes
* Trigger functions event only if event is not paused by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8526
* Update docker-compose to restart usage-dump by @feschaffa in https://github.com/appwrite/appwrite/pull/8642
* Fix typo in scheduler base by @fogelito in https://github.com/appwrite/appwrite/pull/8691
* Add domain and force HTTPS env vars to mail worker by @stnguyen90 in https://github.com/appwrite/appwrite/pull/8722
* Fix webp by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8732
* Ignore junction tables by @fogelito in https://github.com/appwrite/appwrite/pull/8728
* Fix logger throwing fatal error by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8724
* Fix missing protocol for testing SMTP by @byawitz in https://github.com/appwrite/appwrite/pull/8749
* Make create execution async loose by @loks0n in https://github.com/appwrite/appwrite/pull/8707
* Fix invalid cursor value by @fogelito in https://github.com/appwrite/appwrite/pull/8109
* Fix target deletes by @abnegate in https://github.com/appwrite/appwrite/pull/8833
* Fix translation commas by @loks0n in https://github.com/appwrite/appwrite/pull/8892
* Fix Migrations having source creds being overwritten and add Migration tests by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8897
* Fix validator usage for updating string size by @abnegate in https://github.com/appwrite/appwrite/pull/8890
* Fix create user event not triggering by @loks0n in https://github.com/appwrite/appwrite/pull/8718
* Improve error handling and logging in the database worker by @fogelito in https://github.com/appwrite/appwrite/pull/8944
* Remove inaccurate info about leaving the URL parameter empty by @ebenezerdon in https://github.com/appwrite/appwrite/pull/8963
* Ensure indexes are updated when updating an attribute key by @fogelito in https://github.com/appwrite/appwrite/pull/8971
* Remove duplicate dart-2.16 runtime template by @stnguyen90 in https://github.com/appwrite/appwrite/pull/8972
* Fix team invites with existing session by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/9006
* Improve handling of HTTP requests by dispatching to safe workers by @Meldiron in https://github.com/appwrite/appwrite/pull/9016
* Fix users create session secret by @stnguyen90 in https://github.com/appwrite/appwrite/pull/9019
* Fix swoole task warning by @Meldiron in https://github.com/appwrite/appwrite/pull/9025
### Miscellaneous
* Update Init copy by @adityaoberai in https://github.com/appwrite/appwrite/pull/8557
* Fix security scan permissions and comment by @EVDOG4LIFE in https://github.com/appwrite/appwrite/pull/8525
* Add Trivy security scans by @btme0011 in https://github.com/appwrite/appwrite/pull/6876
* Update database stack by @abnegate in https://github.com/appwrite/appwrite/pull/8564
* Bump database by @abnegate in https://github.com/appwrite/appwrite/pull/8573
* Sync main with 1.5.x by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8589
* Add AWS to one-click installs by @byawitz in https://github.com/appwrite/appwrite/pull/8593
* Update Init copy in readme by @adityaoberai in https://github.com/appwrite/appwrite/pull/8618
* Sync main into 1.6.x by @stnguyen90 in https://github.com/appwrite/appwrite/pull/8685
* Sync 1.6.x into main by @stnguyen90 in https://github.com/appwrite/appwrite/pull/8686
* Feat coroutines by @Meldiron in https://github.com/appwrite/appwrite/pull/7826
* Sync main into 1.6.x by @Meldiron in https://github.com/appwrite/appwrite/pull/8719
* Sentence casing endpoint API reference by @choir241 in https://github.com/appwrite/appwrite/pull/8617
* DB storage metrics by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8404
* Fix exception thrown when optional array attribute does not exist by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8391
* Add projects channels to realtime by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/8735
* Base for console roles support by @lohanidamodar in https://github.com/appwrite/appwrite/pull/8565
* Remove DB disk storage calculation by @christyjacob4 in https://github.com/appwrite/appwrite/pull/8745
* Messaging adapter default values by @shimonewman in https://github.com/appwrite/appwrite/pull/8742
* Add payload response type by @loks0n in https://github.com/appwrite/appwrite/pull/8720
* Fix flaky functions tests by @loks0n in https://github.com/appwrite/appwrite/pull/8682
* Migrations Backups by @fogelito in https://github.com/appwrite/appwrite/pull/8186
* Add test for response and request filters by @vermakhushboo in https://github.com/appwrite/appwrite/pull/8697
* Bump version in SECURITY.md by @EVDOG4LIFE in https://github.com/appwrite/appwrite/pull/8755
* Add originalId attribute to databases collection by @fogelito in https://github.com/appwrite/appwrite/pull/8764
* Fix Walter References by @ItzNotABug in https://github.com/appwrite/appwrite/pull/8757
* Update database by @abnegate in https://github.com/appwrite/appwrite/pull/8769
* Move new attributes by @abnegate in https://github.com/appwrite/appwrite/pull/8777
* Add ping endpoint by @loks0n in https://github.com/appwrite/appwrite/pull/8761
* Fix GitHub action caching by @loks0n in https://github.com/appwrite/appwrite/pull/8772
* Chore release ruby SDK by @abnegate in https://github.com/appwrite/appwrite/pull/8767
* Call migration success on success by @abnegate in https://github.com/appwrite/appwrite/pull/8782
* Update utopia-php/system to 0.9.0 by @basert in https://github.com/appwrite/appwrite/pull/8780
* Move createDocument from api to worker by @vermakhushboo in https://github.com/appwrite/appwrite/pull/8776
* Add missing indexes by @christyjacob4 in https://github.com/appwrite/appwrite/pull/8803
* Update database by @abnegate in https://github.com/appwrite/appwrite/pull/8809
* Fix typo in BLR region by @stnguyen90 in https://github.com/appwrite/appwrite/pull/8756
* Add tests for project variables by @vermakhushboo in https://github.com/appwrite/appwrite/pull/8815
* Replace 'Expires' with 'Cache-Control: private' header to avoid CDN caching by @basert in https://github.com/appwrite/appwrite/pull/8836
* Allow blocking based on resource attributes by @basert in https://github.com/appwrite/appwrite/pull/8812
* Check if resource is blocked inside functions worker by @basert in https://github.com/appwrite/appwrite/pull/8855
* Fix missing allow attribute by @abnegate in https://github.com/appwrite/appwrite/pull/8889
* Revert function execution order by @basert in https://github.com/appwrite/appwrite/pull/8857
* Use resource type constants by @basert in https://github.com/appwrite/appwrite/pull/8895
* Update Database lib by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8680
* Update database by @abnegate in https://github.com/appwrite/appwrite/pull/8917
* Update database by @abnegate in https://github.com/appwrite/appwrite/pull/8923
* Update database for transaction counter fixes with retries by @abnegate in https://github.com/appwrite/appwrite/pull/8927
* Validate string permissions by @fogelito in https://github.com/appwrite/appwrite/pull/8929
* Add PubSub adapter support by @basert in https://github.com/appwrite/appwrite/pull/8905
* List memberships as client by @loks0n in https://github.com/appwrite/appwrite/pull/8913
* Fix XDebug Extension not being removed by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8891
* Update database by @abnegate in https://github.com/appwrite/appwrite/pull/8946
* Use utopia compression by @loks0n in https://github.com/appwrite/appwrite/pull/8938
* Make compression minimum size configurable by @loks0n in https://github.com/appwrite/appwrite/pull/8947
* Revert "Update database" by @christyjacob4 in https://github.com/appwrite/appwrite/pull/8949
* Fix setpaused by @loks0n in https://github.com/appwrite/appwrite/pull/8948
* Use getDocument instead of find() for rules by @christyjacob4 in https://github.com/appwrite/appwrite/pull/8951
* Remove double fetch from migrations worker by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8956
* Fix memberships privacy MFA by @loks0n in https://github.com/appwrite/appwrite/pull/8969
* Add telemetry by @basert in https://github.com/appwrite/appwrite/pull/8960
* Send migration errors individually by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/8959
* Add console sdk previews by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/8990
* Unset index length by @fogelito in https://github.com/appwrite/appwrite/pull/8978
* Update base to 0.9.5 by @basert in https://github.com/appwrite/appwrite/pull/9005
* Sync main into 1.6.x by @TorstenDittmann in https://github.com/appwrite/appwrite/pull/9011
* Improved shared tables V2 by @abnegate in https://github.com/appwrite/appwrite/pull/9013
* Ensure backwards compatibility for 1.6.x by @christyjacob4 in https://github.com/appwrite/appwrite/pull/9018
# Version 1.6.0
## What's Changed
+47 -13
View File
@@ -1,6 +1,6 @@
# Contributing
We would ❤️ you to contribute to Appwrite and help make it better! We want contributing to Appwrite to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, and new docs, as well as updates and tweaks, blog posts, workshops, and more.
We would :heart: you to contribute to Appwrite and help make it better! We want contributing to Appwrite to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, and new docs, as well as updates and tweaks, blog posts, workshops, and more.
## Here for Hacktoberfest?
If you're here to contribute during Hacktoberfest, we're so happy to see you here. Appwrite has been a long-time participant of Hacktoberfest and we welcome you, whatever your experience level. This year, we're **only taking contributions for issues tagged** `hacktoberfest`, so we can focus our resources to support your contributions.
@@ -9,13 +9,13 @@ You can [find issues using this query](https://github.com/search?q=org%3Aappwrit
## How to Start?
If you are worried or dont know where to start, check out the next section that explains what kind of help we could use and where you can get involved. You can send your questions to [@appwrite](https://twitter.com/appwrite) on Twitter or to anyone from the [Appwrite team on Discord](https://appwrite.io/discord). You can also submit an issue, and a maintainer can guide you!
If you are worried or dont know where to start, check out the next section that explains what kind of help we could use and where you can get involved. You can send your questions to [@appwrite on Twitter](https://twitter.com/appwrite) or to anyone from the [Appwrite team on Discord](https://appwrite.io/discord). You can also submit an issue, and a maintainer can guide you!
## Code of Conduct
Help us keep Appwrite open and inclusive. Please read and follow our [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md).
## Submit a Pull Request 🚀
## Submit a Pull Request :rocket:
Branch naming convention is as following
@@ -65,13 +65,13 @@ Now, go a step further by running the linter using the following command to manu
composer lint <your file path>
```
This will give you a list of errors to rectify. If you need more information on the errors, you can pass in additional command line arguments to get more verbose information. More lists of available arguments can be found [here](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage). A very useful command line argument is `--report=diff`. This will give you the expected changes by the linter for easy fixing of formatting issues.
This will give you a list of errors to rectify. If you need more information on the errors, you can pass in additional command line arguments to get more verbose information. More lists of available arguments can be found [on PHP_Codesniffer usage Wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage). A very useful command line argument is `--report=diff`. This will give you the expected changes by the linter for easy fixing of formatting issues.
```bash
composer lint --report=diff <your file path>
```
5. Push changes to GitHub.
5. Push changes to GitHub
```
$ git push origin [name_of_your_new_branch]
@@ -163,6 +163,28 @@ Other containes should be named the same as their service, for example `redis` s
- [Encryption](https://medium.com/searchencrypt/what-is-encryption-how-does-it-work-e8f20e340537#:~:text=Encryption%20is%20a%20process%20that,%2C%20or%20decrypt%2C%20the%20information.)
- [Hashing](https://searchsqlserver.techtarget.com/definition/hashing#:~:text=Hashing%20is%20the%20transformation%20of,it%20using%20the%20original%20value.)
## Modules
As Appwrite grows, we noticed approach of having all service endpoints in `app/controllers/api/[service].php` is not maintainable. Not only it creates massive files, it also doesnt contain all product's features such as workers or tasks. While there might still be some occurances of those controller files, we avoid it in all new development, and gradually migrate existing controllers to **HTTP modules**.
### HTTP Endpoints
Every endpoint file follows below structure, making it consistent with HTTP REST endpoint path:
```
src/Appwrite/Platform/Modules/[service]/Http/[resource]/[action].php
```
Tips and tricks:
1. If endpoint doesn't have resource, use service name as resource name too
> Example: `Modules/Sites/Http/Sites/Get.php`
2. If there are multiple resources, use then all in folder structure
> Example: `Modules/Sites/Http/Deployments/Builds/Create.php`
3. Action can only be `Get`, `Create`, `Update`, `Delete` or `XList`
## Architecture
Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures.
@@ -301,7 +323,7 @@ Adding a new dependency should have vital value for the product with minimum pos
## Introducing New Features
We would 💖 you to contribute to Appwrite, but we also want to ensure Appwrite is loyal to its vision and mission statement 🙏.
We would :sparkling_heart: you to contribute to Appwrite, but we also want to ensure Appwrite is loyal to its vision and mission statement :pray:.
For us to find the right balance, please open an issue explaining your ideas before introducing a new pull request.
@@ -367,7 +389,7 @@ In file `app/controllers/shared/api.php` On the database listener, add to an exi
```php
case $document->getCollection() === 'teams':
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_TEAMS, $value); // per project
break;
```
@@ -379,10 +401,10 @@ In that case you need also to handle children removal using addReduce() method c
```php
case $document->getCollection() === 'buckets': //buckets
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_BUCKETS, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
$queueForStatsUsage
->addReduce($document);
}
break;
@@ -428,16 +450,16 @@ public function __construct()
->inject('dbForProject')
->inject('queueForFunctions')
->inject('queueForEvents')
->inject('queueForUsage')
->inject('queueForStatsUsage')
->inject('log')
->callback(fn (Message $message, Database $dbForProject, Func $queueForFunctions, Event $queueForEvents, Usage $queueForUsage, Log $log) => $this->action($message, $dbForProject, $queueForFunctions, $queueForEvents, $queueForUsage, $log));
->callback(fn (Message $message, Database $dbForProject, Func $queueForFunctions, Event $queueForEvents, StatsUsage $queueForStatsUsage, Log $log) => $this->action($message, $dbForProject, $queueForFunctions, $queueForEvents, $queueForStatsUsage, $log));
}
```
and then trigger the queue with the new metric like so:
```php
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_BUILDS, 1)
->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0))
->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000)
@@ -613,6 +635,18 @@ If you need to clear the cache, you can do so by running the following command:
docker compose exec redis redis-cli FLUSHALL
```
## Using preview domains locally
Appwrite Functions are automatically given a domain you can visit to execute the function. This domain has format `[SOMETHING].functions.localhost` unless you changed `_APP_DOMAIN_FUNCTIONS` environment variable. This default value works great when running Appwrite locally, but it can be impossible to use preview domains with Cloud woekspaces such as Gitpod or GitHub Codespaces.
To use preview domains on Cloud workspaces, you can visit hostname provided by them, and supply function's preview domain as URL parameter:
```
https://8080-appwrite-appwrite-mjeb3ebilwv.ws-eu116.gitpod.io/ping?preview=672b3c7eab1ac523ccf5.functions.localhost
```
The path was set to `/ping` intentionally. Visiting `/` for preview domains might trigger Console background worker, and trigger redirect to Console without our preview URL param. Visiting different path ensures this doesnt happen.
## Tutorials
From time to time, our team will add tutorials that will help contributors find their way in the Appwrite source code. Below is a list of currently available tutorials:
@@ -628,7 +662,7 @@ Pull requests are great, but there are many other ways you can help Appwrite.
### Blogging & Speaking
Blogging, speaking about, or creating tutorials about one of Appwrites many features are great ways to get the word out about Appwrite. Mention [@appwrite](https://twitter.com/appwrite) on Twitter and/or [email team@appwrite.io](mailto:team@appwrite.io) so we can give pointers and tips and help you spread the word by promoting your content on the different Appwrite communication channels. Please add your blog posts and videos of talks to our [Awesome Appwrite](https://github.com/appwrite/awesome-appwrite) repo on GitHub.
Blogging, speaking about, or creating tutorials about one of Appwrites many features are great ways to get the word out about Appwrite. Mention [@appwrite on Twitter](https://twitter.com/appwrite) and/or [email team@appwrite.io](mailto:team@appwrite.io) so we can give pointers and tips and help you spread the word by promoting your content on the different Appwrite communication channels. Please add your blog posts and videos of talks to our [Awesome Appwrite](https://github.com/appwrite/awesome-appwrite) repo on GitHub.
### Presenting at Meetups
+6 -3
View File
@@ -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 appwrite/base:0.9.5 AS final
FROM appwrite/base:0.10.1 AS final
LABEL maintainer="team@appwrite.io"
@@ -68,6 +68,7 @@ RUN chmod +x /usr/local/bin/doctor && \
chmod +x /usr/local/bin/sdks && \
chmod +x /usr/local/bin/specs && \
chmod +x /usr/local/bin/ssl && \
chmod +x /usr/local/bin/screenshot && \
chmod +x /usr/local/bin/test && \
chmod +x /usr/local/bin/upgrade && \
chmod +x /usr/local/bin/vars && \
@@ -85,8 +86,10 @@ RUN chmod +x /usr/local/bin/doctor && \
chmod +x /usr/local/bin/worker-messaging && \
chmod +x /usr/local/bin/worker-migrations && \
chmod +x /usr/local/bin/worker-webhooks && \
chmod +x /usr/local/bin/worker-usage && \
chmod +x /usr/local/bin/worker-usage-dump
chmod +x /usr/local/bin/worker-stats-usage && \
chmod +x /usr/local/bin/worker-stats-usage-dump && \
chmod +x /usr/local/bin/stats-resources && \
chmod +x /usr/local/bin/worker-stats-resources
# Letsencrypt Permissions
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
+61 -25
View File
@@ -1,8 +1,8 @@
> 好消息!Appwrite 云现已进入公开测试版!立即访问 cloud.appwrite.io 注册,体验无忧的托管服务。今天就加入我们的云端吧!☁️🎉
> 好消息!Appwrite 云现已进入公开测试版!立即访问 cloud.appwrite.io 注册,体验无忧的托管服务。今天就加入我们的云端吧!:cloud: :tada:
<br />
<p align="center">
<a href="https://appwrite.io" target="_blank"><img src="./public/images/banner.png" alt="Appwrite Logo"></a>
<a href="https://appwrite.io" target="_blank"><img src="./public/images/banner.png" alt="Appwrite banner with logo and slogan build like a team of hundreds""></a>
<br />
<br />
<b>适用于[Flutter/Vue/Angular/React/iOS/Android/* 等等平台 *]的完整后端服务</b>
@@ -36,6 +36,8 @@ Appwrite 可以提供给开发者用户验证,外部授权,用户数据读
内容:
- [开始](#开始)
- [安装](#安装)
- [Unix](#unix)
- [Windows](#windows)
@@ -54,6 +56,9 @@ Appwrite 可以提供给开发者用户验证,外部授权,用户数据读
- [订阅我们](#订阅我们)
- [版权说明](#版权说明)
## 开始
要轻松开始使用Appwrite,您可以[**免费注册Appwrite Cloud**](https://cloud.appwrite.io/)。在Appwrite Cloud公开测试版期间,您可以完全免费使用Appwrite,而且我们不会收集您的信用卡信息。
## 安装
Appwrite 的容器化服务器只需要一行指令就可以运行。您可以使用 docker-compose 在本地主机上运行 Appwrite,也可以在任何其他容器化工具(如 [Kubernetes](https://kubernetes.io/docs/home/)、[Docker Swarm](https://docs.docker.com/engine/swarm/) 或 [Rancher](https://rancher.com/docs/))上运行 Appwrite。
@@ -67,7 +72,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.6.0
appwrite/appwrite:1.6.2
```
### Windows
@@ -79,7 +84,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.6.0
appwrite/appwrite:1.6.2
```
#### PowerShell
@@ -89,7 +94,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.6.0
appwrite/appwrite:1.6.2
```
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
@@ -98,7 +103,42 @@ docker run -it --rm `
### 从旧版本升级
如果您从旧版本升级 Appwrite 服务器,则应在设置完成后使用 Appwrite 迁移工具。有关这方面的更多信息,请查看 [安装文档](https://appwrite.io/docs/installation)。
如果您从旧版本升级 Appwrite 服务器,则应在设置完成后使用 Appwrite 迁移工具。有关这方面的更多信息,请查看 [安装文档](https://appwrite.io/docs/self-hosting)。
## 一键配置
除了在本地运行 Appwrite,您还可以使用预配置的设置启动 Appwrite。这样可以让您快速启动并运行 Appwrite,而无需在本地计算机上安装 Docker。
请从以下提供商中选择一个:
<table border="0">
<tr>
<td align="center" width="100" height="100">
<a href="https://marketplace.digitalocean.com/apps/appwrite">
<img width="50" height="39" src="public/images/integrations/digitalocean-logo.svg" alt="DigitalOcean Logo" />
<br /><sub><b>DigitalOcean</b></sub></a>
</a>
</td>
<td align="center" width="100" height="100">
<a href="https://gitpod.io/#https://github.com/appwrite/integration-for-gitpod">
<img width="50" height="39" src="public/images/integrations/gitpod-logo.svg" alt="Gitpod Logo" />
<br /><sub><b>Gitpod</b></sub></a>
</a>
</td>
<td align="center" width="100" height="100">
<a href="https://www.linode.com/marketplace/apps/appwrite/appwrite/">
<img width="50" height="39" src="public/images/integrations/akamai-logo.svg" alt="Akamai Logo" />
<br /><sub><b>Akamai Compute</b></sub></a>
</a>
</td>
<td align="center" width="100" height="100">
<a href="https://aws.amazon.com/marketplace/pp/prodview-2hiaeo2px4md6">
<img width="50" height="39" src="public/images/integrations/aws-logo.svg" alt="AWS Logo" />
<br /><sub><b>AWS Marketplace</b></sub></a>
</a>
</td>
</tr>
</table>
## 入门
@@ -146,29 +186,25 @@ docker run -it --rm `
以下是当前支持的平台和语言列表。如果您想帮助我们为您选择的平台添加支持,您可以访问我们的 [SDK 生成器](https://github.com/appwrite/sdk-generator) 项目并查看我们的 [贡献指南](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md)。
#### 客户端
- &nbsp; [Web](https://github.com/appwrite/sdk-for-web) (由 Appwrite 团队维护)
- &nbsp; [Flutter](https://github.com/appwrite/sdk-for-flutter) (由 Appwrite 团队维护)
- &nbsp; [Apple](https://github.com/appwrite/sdk-for-apple) (由 Appwrite 团队维护)
- ✅ &nbsp; [Android](https://github.com/appwrite/sdk-for-android) (由 Appwrite 团队维护)
- ✅ &nbsp; [React Native](https://github.com/appwrite/sdk-for-react-native) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Web](https://github.com/appwrite/sdk-for-web) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Flutter](https://github.com/appwrite/sdk-for-flutter) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Apple](https://github.com/appwrite/sdk-for-apple) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Android](https://github.com/appwrite/sdk-for-android) (由 Appwrite 团队维护)
#### 服务器
- &nbsp; [NodeJS](https://github.com/appwrite/sdk-for-node) (由 Appwrite 团队维护)
- &nbsp; [PHP](https://github.com/appwrite/sdk-for-php) (由 Appwrite 团队维护)
- &nbsp; [Dart](https://github.com/appwrite/sdk-for-dart) (由 Appwrite 团队维护)
- &nbsp; [Deno](https://github.com/appwrite/sdk-for-deno) (由 Appwrite 团队维护)
- &nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) (由 Appwrite 团队维护)
- &nbsp; [Python](https://github.com/appwrite/sdk-for-python) (由 Appwrite 团队维护)
- &nbsp; [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (由 Appwrite 团队维护)
- &nbsp; [Swift](https://github.com/appwrite/sdk-for-swift) (由 Appwrite 团队维护)
- ✅ &nbsp; [.NET](https://github.com/appwrite/sdk-for-dotnet) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [NodeJS](https://github.com/appwrite/sdk-for-node) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [PHP](https://github.com/appwrite/sdk-for-php) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Dart](https://github.com/appwrite/sdk-for-dart) - (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Deno](https://github.com/appwrite/sdk-for-deno) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Python](https://github.com/appwrite/sdk-for-python) (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Kotlin](https://github.com/appwrite/sdk-for-kotlin) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [Apple](https://github.com/appwrite/sdk-for-apple) - **公测** (由 Appwrite 团队维护)
* :white_check_mark: &nbsp; [.NET](https://github.com/appwrite/sdk-for-dotnet) - **公测** (由 Appwrite 团队维护)
#### 开发者社区
- ✅ &nbsp; [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (维护者 [Michael Gangolf](https://github.com/m1ga/))
- ✅ &nbsp; [Godot Engine](https://github.com/GodotNuts/appwrite-sdk) (维护者 [fenix-hub @GodotNuts](https://github.com/fenix-hub))
* :white_check_mark: &nbsp; [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (维护者 [Michael Gangolf](https://github.com/m1ga/))
* :white_check_mark: &nbsp; [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)!
+40 -38
View File
@@ -1,8 +1,8 @@
> Appwrite Init has concluded! You can check out all the latest announcements [on our Init website](https://appwrite.io/init) 🚀
> [Get started with Appwrite](https://apwr.dev/appcloud)
<br />
<p align="center">
<a href="https://appwrite.io" target="_blank"><img src="./public/images/banner.png" alt="Appwrite Logo"></a>
<a href="https://appwrite.io" target="_blank"><img src="./public/images/banner.png" alt="Appwrite banner, with logo and text saying "Build Like a Team of Hundreds"></a>
<br />
<br />
<b>Appwrite is a backend platform for developing Web, Mobile, and Flutter applications. Built with the open source community and optimized for developer experience in the coding languages you love.</b>
@@ -12,11 +12,11 @@
<!-- [![Build Status](https://img.shields.io/travis/com/appwrite/appwrite?style=flat-square)](https://travis-ci.com/appwrite/appwrite) -->
[![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)
[![X Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![We're Hiring label](https://img.shields.io/static/v1?label=We're&message=Hiring&color=blue&style=flat-square)](https://appwrite.io/company/careers)
[![Hacktoberfest label](https://img.shields.io/static/v1?label=hacktoberfest&message=ready&color=191120&style=flat-square)](https://hacktoberfest.appwrite.io)
[![Discord label](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord?r=Github)
[![Build Status label](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)
[![X Account label](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
<!-- [![Docker Pulls](https://img.shields.io/docker/pulls/appwrite/appwrite?color=f02e65&style=flat-square)](https://hub.docker.com/r/appwrite/appwrite) -->
<!-- [![Translate](https://img.shields.io/badge/translate-f02e65?style=flat-square)](docs/tutorials/add-translations.md) -->
@@ -24,11 +24,9 @@
English | [简体中文](README-CN.md)
[**Announcing Appwrite Cloud Public Beta! Sign up today!**](https://cloud.appwrite.io)
Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker<nobr> microservices. Appwrite abstracts the complexity and repetitiveness required to build a modern backend API from scratch and allows you to build secure apps faster.
Using Appwrite, you can easily integrate your app with user authentication and multiple sign-in methods, a database for storing and querying users and team data, storage and file management, image manipulation, Cloud Functions, and [more services](https://appwrite.io/docs).
Using Appwrite, you can easily integrate your app with user authentication and multiple sign-in methods, a database for storing and querying users and team data, storage and file management, image manipulation, Cloud Functions, messaging, and [more services](https://appwrite.io/docs).
<p align="center">
<br />
@@ -37,13 +35,14 @@ Using Appwrite, you can easily integrate your app with user authentication and m
<br />
</p>
![Appwrite](public/images/github.png)
![Appwrite project dashboard showing various Appwrite features](public/images/github.png)
Find out more at: [https://appwrite.io](https://appwrite.io)
Find out more at: [https://appwrite.io](https://appwrite.io).
Table of Contents:
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Self-Hosting](#self-hosting)
- [Unix](#unix)
- [Windows](#windows)
- [CMD](#cmd)
@@ -51,7 +50,7 @@ Table of Contents:
- [Upgrade from an Older Version](#upgrade-from-an-older-version)
- [One-Click Setups](#one-click-setups)
- [Getting Started](#getting-started)
- [Services](#services)
- [Products](#products)
- [SDKs](#sdks)
- [Client](#client)
- [Server](#server)
@@ -62,11 +61,14 @@ Table of Contents:
- [Follow Us](#follow-us)
- [License](#license)
## Installation
## Getting Started
The easiest way to get started with Appwrite is by [signing up for Appwrite Cloud](https://cloud.appwrite.io/). While Appwrite Cloud is in public beta, you can build with Appwrite completely free, and we won't collect you credit card information.
## Self-Hosting
Appwrite is designed to run in a containerized environment. Running your server is as easy as running one command from your terminal. You can either run Appwrite on your localhost using docker-compose or on any other container orchestration tool, such as [Kubernetes](https://kubernetes.io/docs/home/), [Docker Swarm](https://docs.docker.com/engine/swarm/), or [Rancher](https://rancher.com/docs/).
The easiest way to start running your Appwrite server is by running our docker-compose file. Before running the installation command, make sure you have [Docker](https://www.docker.com/products/docker-desktop) installed on your machine:
Before running the installation command, make sure you have [Docker](https://www.docker.com/products/docker-desktop) installed on your machine:
### Unix
@@ -75,7 +77,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.6.0
appwrite/appwrite:1.6.2
```
### Windows
@@ -87,7 +89,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.6.0
appwrite/appwrite:1.6.2
```
#### PowerShell
@@ -97,7 +99,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.6.0
appwrite/appwrite:1.6.2
```
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.
@@ -106,7 +108,7 @@ For advanced production and custom installation, check out our Docker [environme
### Upgrade from an Older Version
If you are upgrading your Appwrite server from an older version, you should use the Appwrite migration tool once your setup is completed. For more information regarding this, check out the [Installation Docs](https://appwrite.io/docs/installation).
If you are upgrading your Appwrite server from an older version, you should use the Appwrite migration tool once your setup is completed. For more information regarding this, check out the [Installation Docs](https://appwrite.io/docs/self-hosting).
## One-Click Setups
@@ -192,34 +194,34 @@ Below is a list of currently supported platforms and languages. If you would lik
#### Client
- &nbsp; [Web](https://github.com/appwrite/sdk-for-web) (Maintained by the Appwrite Team)
- &nbsp; [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team)
- &nbsp; [Apple](https://github.com/appwrite/sdk-for-apple) (Maintained by the Appwrite Team)
- &nbsp; [Android](https://github.com/appwrite/sdk-for-android) (Maintained by the Appwrite Team)
- &nbsp; [React Native](https://github.com/appwrite/sdk-for-react-native) - **Beta** (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Web](https://github.com/appwrite/sdk-for-web) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Apple](https://github.com/appwrite/sdk-for-apple) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Android](https://github.com/appwrite/sdk-for-android) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [React Native](https://github.com/appwrite/sdk-for-react-native) - **Beta** (Maintained by the Appwrite Team)
#### Server
- &nbsp; [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team)
- &nbsp; [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team)
- &nbsp; [Dart](https://github.com/appwrite/sdk-for-dart) (Maintained by the Appwrite Team)
- &nbsp; [Deno](https://github.com/appwrite/sdk-for-deno) (Maintained by the Appwrite Team)
- &nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) (Maintained by the Appwrite Team)
- &nbsp; [Python](https://github.com/appwrite/sdk-for-python) (Maintained by the Appwrite Team)
- &nbsp; [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (Maintained by the Appwrite Team)
- &nbsp; [Swift](https://github.com/appwrite/sdk-for-swift) (Maintained by the Appwrite Team)
- &nbsp; [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Beta** (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Dart](https://github.com/appwrite/sdk-for-dart) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Deno](https://github.com/appwrite/sdk-for-deno) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Python](https://github.com/appwrite/sdk-for-python) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Kotlin](https://github.com/appwrite/sdk-for-kotlin) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [Swift](https://github.com/appwrite/sdk-for-swift) (Maintained by the Appwrite Team)
- :white_check_mark: &nbsp; [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Beta** (Maintained by the Appwrite Team)
#### Community
- &nbsp; [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (Maintained by [Michael Gangolf](https://github.com/m1ga/))
- &nbsp; [Godot Engine](https://github.com/GodotNuts/appwrite-sdk) (Maintained by [fenix-hub @GodotNuts](https://github.com/fenix-hub))
- :white_check_mark: &nbsp; [Appcelerator Titanium](https://github.com/m1ga/ti.appwrite) (Maintained by [Michael Gangolf](https://github.com/m1ga/))
- :white_check_mark: &nbsp; [Godot Engine](https://github.com/GodotNuts/appwrite-sdk) (Maintained by [fenix-hub @GodotNuts](https://github.com/fenix-hub))
Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)!
## Architecture
![Appwrite Architecture](docs/specs/overview.drawio.svg)
![Appwrite Architecture showing how Appwrite is built and the services and tools it uses](docs/specs/overview.drawio.svg)
Appwrite uses a microservices architecture that was designed for easy scaling and delegation of responsibilities. In addition, Appwrite supports multiple APIs, such as REST, WebSocket, and GraphQL to allow you to interact with your resources by leveraging your existing knowledge and protocols of choice.
@@ -229,7 +231,7 @@ The Appwrite API layer was designed to be extremely fast by leveraging in-memory
All code contributions, including those of people having commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.
We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md).
We truly :heart: pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md).
## Security
+70 -26
View File
@@ -5,6 +5,8 @@ require_once __DIR__ . '/init.php';
use Appwrite\Event\Certificate;
use Appwrite\Event\Delete;
use Appwrite\Event\Func;
use Appwrite\Event\StatsResources;
use Appwrite\Event\StatsUsage;
use Appwrite\Platform\Appwrite;
use Appwrite\Runtimes\Runtimes;
use Utopia\Cache\Adapter\Sharding;
@@ -19,12 +21,12 @@ use Utopia\DSN\DSN;
use Utopia\Logger\Log;
use Utopia\Platform\Service;
use Utopia\Pools\Group;
use Utopia\Queue\Connection;
use Utopia\Queue\Publisher;
use Utopia\Registry\Registry;
use Utopia\System\System;
// overwriting runtimes to be architectur agnostic for CLI
Config::setParam('runtimes', (new Runtimes('v4'))->getAll(supported: false));
// overwriting runtimes to be architecture agnostic for CLI
Config::setParam('runtimes', (new Runtimes('v5'))->getAll(supported: false));
// require controllers after overwriting runtimes
require_once __DIR__ . '/controllers/general.php';
@@ -41,8 +43,7 @@ CLI::setResource('cache', function ($pools) {
$adapters[] = $pools
->get($value)
->pop()
->getResource()
;
->getResource();
}
return new Cache(new Sharding($adapters));
@@ -52,7 +53,7 @@ CLI::setResource('pools', function (Registry $register) {
return $register->get('pools');
}, ['register']);
CLI::setResource('dbForConsole', function ($pools, $cache) {
CLI::setResource('dbForPlatform', function ($pools, $cache) {
$sleep = 3;
$maxAttempts = 5;
$attempts = 0;
@@ -67,9 +68,9 @@ CLI::setResource('dbForConsole', function ($pools, $cache) {
->pop()
->getResource();
$dbForConsole = new Database($dbAdapter, $cache);
$dbForPlatform = new Database($dbAdapter, $cache);
$dbForConsole
$dbForPlatform
->setNamespace('_console')
->setMetadata('host', \gethostname())
->setMetadata('project', 'console');
@@ -78,7 +79,7 @@ CLI::setResource('dbForConsole', function ($pools, $cache) {
$collections = Config::getParam('collections', [])['console'];
$last = \array_key_last($collections);
if (!($dbForConsole->exists($dbForConsole->getDatabase(), $last))) { /** TODO cache ready variable using registry */
if (!($dbForPlatform->exists($dbForPlatform->getDatabase(), $last))) { /** TODO cache ready variable using registry */
throw new Exception('Tables not ready yet.');
}
@@ -94,15 +95,19 @@ CLI::setResource('dbForConsole', function ($pools, $cache) {
throw new Exception("Console is not ready yet. Please try again later.");
}
return $dbForConsole;
return $dbForPlatform;
}, ['pools', 'cache']);
CLI::setResource('getProjectDB', function (Group $pools, Database $dbForConsole, $cache) {
CLI::setResource('console', function () {
return new Document(Config::getParam('console'));
}, []);
CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) {
$databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools
return function (Document $project) use ($pools, $dbForConsole, $cache, &$databases) {
return function (Document $project) use ($pools, $dbForPlatform, $cache, &$databases) {
if ($project->isEmpty() || $project->getId() === 'console') {
return $dbForConsole;
return $dbForPlatform;
}
try {
@@ -158,20 +163,59 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForConsole,
return $database;
};
}, ['pools', 'dbForConsole', 'cache']);
}, ['pools', 'dbForPlatform', 'cache']);
CLI::setResource('queue', function (Group $pools) {
return $pools->get('queue')->pop()->getResource();
CLI::setResource('getLogsDB', function (Group $pools, Cache $cache) {
$database = null;
return function (?Document $project = null) use ($pools, $cache, $database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$database
->setSharedTables(true)
->setNamespace('logsV1')
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_TASK)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
// set tenant
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
}
return $database;
};
}, ['pools', 'cache']);
CLI::setResource('queueForStatsUsage', function (Connection $publisher) {
return new StatsUsage($publisher);
}, ['publisher']);
CLI::setResource('queueForStatsResources', function (Publisher $publisher) {
return new StatsResources($publisher);
}, ['publisher']);
CLI::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
}, ['pools']);
CLI::setResource('queueForFunctions', function (Connection $queue) {
return new Func($queue);
}, ['queue']);
CLI::setResource('queueForDeletes', function (Connection $queue) {
return new Delete($queue);
}, ['queue']);
CLI::setResource('queueForCertificates', function (Connection $queue) {
return new Certificate($queue);
}, ['queue']);
CLI::setResource('queueForFunctions', function (Publisher $publisher) {
return new Func($publisher);
}, ['publisher']);
CLI::setResource('queueForDeletes', function (Publisher $publisher) {
return new Delete($publisher);
}, ['publisher']);
CLI::setResource('queueForCertificates', function (Publisher $publisher) {
return new Certificate($publisher);
}, ['publisher']);
CLI::setResource('logError', function (Registry $register) {
return function (Throwable $error, string $namespace, string $action) use ($register) {
$logger = $register->get('logger');
@@ -181,7 +225,7 @@ CLI::setResource('logError', function (Registry $register) {
$log = new Log();
$log->setNamespace($namespace);
$log->setServer(\gethostname());
$log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$log->setVersion($version);
$log->setType(Log::TYPE_ERROR);
$log->setMessage($error->getMessage());
+2 -1
View File
@@ -16,5 +16,6 @@ return [
'union-china-pay' => ['name' => 'Union China Pay', 'path' => __DIR__ . '/credit-cards/union-china-pay.png'],
'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']
'maestro' => ['name' => 'Maestro', 'path' => __DIR__ . '/credit-cards/maestro.png'],
'rupay' => ['name' => 'Rupay', 'path' => __DIR__ . '/credit-cards/rupay.png']
];
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

+17 -6147
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+126
View File
@@ -0,0 +1,126 @@
<?php
use Utopia\Database\Database;
use Utopia\Database\Helpers\ID;
return [
'collections' => [
'$collection' => ID::custom('databases'),
'$id' => ID::custom('collections'),
'name' => 'Collections',
'attributes' => [
[
'$id' => ID::custom('databaseInternalId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('databaseId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => Database::LENGTH_KEY,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
[
'$id' => ID::custom('name'),
'type' => Database::VAR_STRING,
'size' => 256,
'required' => true,
'signed' => true,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('enabled'),
'type' => Database::VAR_BOOLEAN,
'signed' => true,
'size' => 0,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
[
'$id' => ID::custom('documentSecurity'),
'type' => Database::VAR_BOOLEAN,
'signed' => true,
'size' => 0,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
[
'$id' => ID::custom('attributes'),
'type' => Database::VAR_STRING,
'size' => 1000000,
'required' => false,
'signed' => true,
'array' => false,
'filters' => ['subQueryAttributes'],
],
[
'$id' => ID::custom('indexes'),
'type' => Database::VAR_STRING,
'size' => 1000000,
'required' => false,
'signed' => true,
'array' => false,
'filters' => ['subQueryIndexes'],
],
[
'$id' => ID::custom('search'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
],
'indexes' => [
[
'$id' => ID::custom('_fulltext_search'),
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['search'],
'lengths' => [],
'orders' => [],
],
[
'$id' => ID::custom('_key_name'),
'type' => Database::INDEX_KEY,
'attributes' => ['name'],
'lengths' => [256],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_enabled'),
'type' => Database::INDEX_KEY,
'attributes' => ['enabled'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_documentSecurity'),
'type' => Database::INDEX_KEY,
'attributes' => ['documentSecurity'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
],
]
];
+94
View File
@@ -0,0 +1,94 @@
<?php
use Utopia\Database\Database;
use Utopia\Database\Helpers\ID;
$logsCollection = [];
$logsCollection['stats'] = [
'$collection' => ID::custom(Database::METADATA),
'$id' => ID::custom('stats'),
'name' => 'stats',
'attributes' => [
[
'$id' => ID::custom('metric'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 255,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('region'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 255,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('value'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 8,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('time'),
'type' => Database::VAR_DATETIME,
'format' => '',
'size' => 0,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
'filters' => ['datetime'],
],
[
'$id' => ID::custom('period'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 4,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
],
'indexes' => [
[
'$id' => ID::custom('_key_time'),
'type' => Database::INDEX_KEY,
'attributes' => ['time'],
'lengths' => [],
'orders' => [Database::ORDER_DESC],
],
[
'$id' => ID::custom('_key_period_time'),
'type' => Database::INDEX_KEY,
'attributes' => ['period', 'time'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_metric_period_time'),
'type' => Database::INDEX_UNIQUE,
'attributes' => ['metric', 'period', 'time'],
'lengths' => [],
'orders' => [Database::ORDER_DESC],
],
],
];
return $logsCollection;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
<?php
/**
* Initializes console project document.
*/
use Appwrite\Auth\Auth;
use Appwrite\Network\Validator\Origin;
use Utopia\Database\Helpers\ID;
use Utopia\System\System;
$console = [
'$id' => ID::custom('console'),
'$internalId' => ID::custom('console'),
'name' => 'Appwrite',
'$collection' => ID::custom('projects'),
'description' => 'Appwrite core engine',
'logo' => '',
'teamId' => null,
'webhooks' => [],
'keys' => [],
'platforms' => [
[
'$collection' => ID::custom('platforms'),
'name' => 'Localhost',
'type' => Origin::CLIENT_TYPE_WEB,
'hostname' => 'localhost',
], // Current host is added on app init
],
'region' => 'fra',
'legalName' => '',
'legalCountry' => '',
'legalState' => '',
'legalCity' => '',
'legalAddress' => '',
'legalTaxId' => '',
'auths' => [
'mockNumbers' => [],
'invites' => System::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled',
'limit' => (System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG, // 1 Year in seconds
'sessionAlerts' => System::getEnv('_APP_CONSOLE_SESSION_ALERTS', 'disabled') === 'enabled'
],
'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [],
'authWhitelistIPs' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [],
'oAuthProviders' => [
'githubEnabled' => true,
'githubSecret' => System::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''),
'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '')
],
];
return $console;
+43 -7
View File
@@ -349,11 +349,6 @@ return [
'description' => 'Team with the requested ID could not be found.',
'code' => 404,
],
Exception::TEAM_INVITE_ALREADY_EXISTS => [
'name' => Exception::TEAM_INVITE_ALREADY_EXISTS,
'description' => 'User has already been invited or is already a member of this team',
'code' => 409,
],
Exception::TEAM_INVITE_NOT_FOUND => [
'name' => Exception::TEAM_INVITE_NOT_FOUND,
'description' => 'The requested team invitation could not be found.',
@@ -361,7 +356,7 @@ return [
],
Exception::TEAM_INVALID_SECRET => [
'name' => Exception::TEAM_INVALID_SECRET,
'description' => 'The team invitation secret is invalid. Please request a new invitation and try again.',
'description' => 'The team invitation secret is invalid. Please request a new invitation and try again.',
'code' => 401,
],
Exception::TEAM_MEMBERSHIP_MISMATCH => [
@@ -380,6 +375,13 @@ return [
'code' => 409,
],
/** Console */
Exception::RESOURCE_ALREADY_EXISTS => [
'name' => Exception::RESOURCE_ALREADY_EXISTS,
'description' => 'Resource with the requested ID already exists. Please choose a different ID and try again.',
'code' => 409,
],
/** Membership */
Exception::MEMBERSHIP_NOT_FOUND => [
'name' => Exception::MEMBERSHIP_NOT_FOUND,
@@ -525,7 +527,7 @@ return [
'code' => 404,
],
Exception::FUNCTION_ENTRYPOINT_MISSING => [
'name' => Exception::FUNCTION_RUNTIME_UNSUPPORTED,
'name' => Exception::FUNCTION_ENTRYPOINT_MISSING,
'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,
],
@@ -539,6 +541,23 @@ return [
'description' => 'Function Template with the requested ID could not be found.',
'code' => 404,
],
Exception::FUNCTION_RUNTIME_NOT_DETECTED => [
'name' => Exception::FUNCTION_RUNTIME_NOT_DETECTED,
'description' => 'Function runtime could not be detected.',
'code' => 400,
],
/** Sites */
Exception::SITE_NOT_FOUND => [
'name' => Exception::SITE_NOT_FOUND,
'description' => 'Site with the requested ID could not be found.',
'code' => 404,
],
Exception::SITE_TEMPLATE_NOT_FOUND => [
'name' => Exception::SITE_TEMPLATE_NOT_FOUND,
'description' => 'Site Template with the requested ID could not be found.',
'code' => 404,
],
/** Builds */
Exception::BUILD_NOT_FOUND => [
@@ -582,6 +601,13 @@ return [
'code' => 400,
],
/** Logs */
Exception::LOG_NOT_FOUND => [
'name' => Exception::LOG_NOT_FOUND,
'description' => 'Log with the requested ID could not be found.',
'code' => 404,
],
/** Databases */
Exception::DATABASE_NOT_FOUND => [
'name' => Exception::DATABASE_NOT_FOUND,
@@ -731,6 +757,11 @@ return [
'description' => 'Index invalid.',
'code' => 400,
],
Exception::INDEX_DEPENDENCY => [
'name' => Exception::INDEX_DEPENDENCY,
'description' => 'Attribute cannot be renamed or deleted. Please remove the associated index first.',
'code' => 409,
],
/** Project Errors */
Exception::PROJECT_NOT_FOUND => [
@@ -844,6 +875,11 @@ return [
'description' => 'Variable with the same ID already exists in this project. Try again with a different ID.',
'code' => 409,
],
Exception::VARIABLE_CANNOT_UNSET_SECRET => [
'name' => Exception::VARIABLE_CANNOT_UNSET_SECRET,
'description' => 'Secret variables cannot be marked as non-secret. Please re-create the variable if this is your intention.',
'code' => 400,
],
Exception::GRAPHQL_NO_QUERY => [
'name' => Exception::GRAPHQL_NO_QUERY,
'description' => 'Param "query" is not optional.',
+28
View File
@@ -217,6 +217,34 @@ return [
],
]
],
'sites' => [
'$model' => Response::MODEL_SITE,
'$resource' => true,
'$description' => 'This event triggers on any sites event.',
'deployments' => [
'$model' => Response::MODEL_DEPLOYMENT,
'$resource' => true,
'$description' => 'This event triggers on any deployments event.',
'create' => [
'$description' => 'This event triggers when a deployment is created.',
],
'delete' => [
'$description' => 'This event triggers when a deployment is deleted.'
],
'update' => [
'$description' => 'This event triggers when a deployment is updated.'
],
],
'create' => [
'$description' => 'This event triggers when a site is created.'
],
'delete' => [
'$description' => 'This event triggers when a site is deleted.',
],
'update' => [
'$description' => 'This event triggers when a site is updated.',
]
],
'functions' => [
'$model' => Response::MODEL_FUNCTION,
'$resource' => true,
+278
View File
@@ -0,0 +1,278 @@
<?php
/**
* List of Appwrite Sites supported frameworks
*/
use Utopia\Config\Config;
$templateRuntimes = Config::getParam('template-runtimes');
function getVersions(array $versions, string $prefix)
{
return array_map(function ($version) use ($prefix) {
return $prefix . '-' . $version;
}, $versions);
}
return [
'analog' => [
'key' => 'analog',
'name' => 'Analog',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/analog/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/analog/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist/analog',
'startCommand' => 'bash helpers/analog/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist/analog/public',
'startCommand' => 'bash helpers/server.sh',
'fallbackFile' => 'index.html'
]
]
],
'angular' => [
'key' => 'angular',
'name' => 'Angular',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/angular/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/angular/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist/angular',
'startCommand' => 'bash helpers/angular/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist/angular/browser',
'startCommand' => 'bash helpers/server.sh',
'fallbackFile' => 'index.csr.html'
]
]
],
'nextjs' => [
'key' => 'nextjs',
'name' => 'Next.js',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/next-js/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/next-js/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './.next',
'startCommand' => 'bash helpers/next-js/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './out',
'startCommand' => 'bash helpers/server.sh',
]
]
],
'react' => [
'key' => 'react',
'name' => 'React',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist',
'startCommand' => 'bash helpers/server.sh',
'fallbackFile' => 'index.html'
]
]
],
'nuxt' => [
'key' => 'nuxt',
'name' => 'Nuxt',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/nuxt/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/nuxt/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './.output',
'startCommand' => 'bash helpers/nuxt/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run generate',
'installCommand' => 'npm install',
'outputDirectory' => './output/public',
'startCommand' => 'bash helpers/server.sh',
]
]
],
'vue' => [
'key' => 'vue',
'name' => 'Vue.js',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist',
'startCommand' => 'bash helpers/server.sh',
'fallbackFile' => 'index.html'
]
]
],
'sveltekit' => [
'key' => 'sveltekit',
'name' => 'SvelteKit',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/sveltekit/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/sveltekit/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './build',
'startCommand' => 'bash helpers/sveltekit/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './build',
'startCommand' => 'bash helpers/server.sh',
]
]
],
'astro' => [
'key' => 'astro',
'name' => 'Astro',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/astro/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/astro/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist',
'startCommand' => 'bash helpers/astro/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist',
'startCommand' => 'bash helpers/server.sh',
]
]
],
'remix' => [
'key' => 'remix',
'name' => 'Remix',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'bundleCommand' => 'bash /usr/local/server/helpers/remix/bundle.sh',
'envCommand' => 'source /usr/local/server/helpers/remix/env.sh',
'adapters' => [
'ssr' => [
'key' => 'ssr',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './build',
'startCommand' => 'bash helpers/remix/server.sh',
],
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './build/client',
'startCommand' => 'bash helpers/server.sh',
]
]
],
'flutter' => [
'key' => 'flutter',
'name' => 'Flutter',
'screenshotSleep' => 5000,
'buildRuntime' => 'flutter-3.29',
'runtimes' => getVersions($templateRuntimes['FLUTTER']['versions'], 'flutter'),
'adapters' => [
'static' => [
'key' => 'static',
'buildCommand' => 'flutter build web',
'installCommand' => '',
'outputDirectory' => './build/web',
'startCommand' => 'bash helpers/server.sh',
],
],
],
'vite' => [
'key' => 'vite',
'name' => 'Vite',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
'key' => 'static',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
'outputDirectory' => './dist',
'startCommand' => 'bash helpers/server.sh',
],
]
],
'other' => [
'key' => 'other',
'name' => 'Other',
'screenshotSleep' => 3000,
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
'key' => 'static',
'buildCommand' => '',
'installCommand' => '',
'outputDirectory' => './',
'startCommand' => 'bash helpers/server.sh',
],
]
],
];
+42 -7
View File
@@ -1,11 +1,46 @@
<?php
/**
* Continent codes with names and approximate central coordinates
*
* Coordinates represent approximate geographical centers of each continent
* Note: These are simplified centroids and may not represent the exact geographical center
*/
return [
'AF',
'AN',
'AS',
'EU',
'NA',
'OC',
'SA',
'AF' => [
'name' => 'Africa',
'latitude' => 8.7832,
'longitude' => 34.5085
],
'AN' => [
'name' => 'Antarctica',
'latitude' => -82.8628,
'longitude' => 135.0000
],
'AS' => [
'name' => 'Asia',
'latitude' => 34.0479,
'longitude' => 100.6197
],
'EU' => [
'name' => 'Europe',
'latitude' => 54.5260,
'longitude' => 15.2551
],
'NA' => [
'name' => 'North America',
'latitude' => 54.5260,
'longitude' => -105.2551
],
'OC' => [
'name' => 'Oceania',
'latitude' => -22.7359,
'longitude' => 140.0188
],
'SA' => [
'name' => 'South America',
'latitude' => -8.7832,
'longitude' => -55.4915
],
];
+199 -198
View File
@@ -1,209 +1,210 @@
<?php
/**
* ISO 3166 standard country codes
* ISO 3166 standard country codes with country names and coordinates
* https://www.iso.org/iso-3166-country-codes.html
*
* Source:
* https://www.iso.org/obp/ui/#search/code/
* Coordinates source: Natural Earth Data (approximate country centroids)
*/
return [
'AF',
'AO',
'AL',
'AD',
'AE',
'AR',
'AM',
'AG',
'AU',
'AT',
'AZ',
'BI',
'BE',
'BJ',
'BF',
'BD',
'BG',
'BH',
'BS',
'BA',
'BY',
'BZ',
'BO',
'BR',
'BB',
'BN',
'BT',
'BW',
'CF',
'CA',
'CH',
'CL',
'CN',
'CI',
'CM',
'CD',
'CG',
'CO',
'KM',
'CV',
'CR',
'CU',
'CY',
'CZ',
'DE',
'DJ',
'DM',
'DK',
'DO',
'DZ',
'EC',
'EG',
'ER',
'ES',
'EE',
'ET',
'FI',
'FJ',
'FR',
'FM',
'GA',
'GB',
'GE',
'GH',
'GN',
'GM',
'GW',
'GQ',
'GR',
'GD',
'GT',
'GY',
'HK',
'HN',
'HR',
'HT',
'HU',
'ID',
'IN',
'IE',
'IR',
'IQ',
'IS',
'IL',
'IT',
'JM',
'JO',
'JP',
'KZ',
'KE',
'KG',
'KH',
'KI',
'KN',
'KR',
'KW',
'LA',
'LB',
'LR',
'LY',
'LC',
'LI',
'LK',
'LS',
'LT',
'LU',
'LV',
'MA',
'MC',
'MD',
'MG',
'MV',
'MX',
'MH',
'MK',
'ML',
'MT',
'MM',
'ME',
'MN',
'MZ',
'MR',
'MU',
'MW',
'MY',
'NA',
'NE',
'NG',
'NI',
'NL',
'NO',
'NP',
'NR',
'NZ',
'OM',
'PK',
'PS',
'PA',
'PE',
'PH',
'PW',
'PG',
'PL',
'KP',
'PT',
'PY',
'QA',
'RO',
'RU',
'RW',
'SA',
'SD',
'SN',
'SG',
'SB',
'SL',
'SV',
'SM',
'SO',
'RS',
'SS',
'ST',
'SR',
'SK',
'SI',
'SE',
'SZ',
'SC',
'SY',
'TD',
'TG',
'TH',
'TJ',
'TM',
'TL',
'TO',
'TT',
'TN',
'TR',
'TV',
'TZ',
'TW',
'UG',
'UA',
'UY',
'US',
'UZ',
'VA',
'VC',
'VE',
'VN',
'VU',
'WS',
'YE',
'ZA',
'ZM',
'ZW',
'AF' => ['name' => 'Afghanistan', 'latitude' => 33.0, 'longitude' => 66.0],
'AO' => ['name' => 'Angola', 'latitude' => -12.5, 'longitude' => 18.5],
'AL' => ['name' => 'Albania', 'latitude' => 41.0, 'longitude' => 20.0],
'AD' => ['name' => 'Andorra', 'latitude' => 42.5, 'longitude' => 1.6],
'AE' => ['name' => 'United Arab Emirates', 'latitude' => 24.0, 'longitude' => 54.0],
'AR' => ['name' => 'Argentina', 'latitude' => -34.0, 'longitude' => -64.0],
'AM' => ['name' => 'Armenia', 'latitude' => 40.0, 'longitude' => 45.0],
'AG' => ['name' => 'Antigua and Barbuda', 'latitude' => 17.05, 'longitude' => -61.8],
'AU' => ['name' => 'Australia', 'latitude' => -25.0, 'longitude' => 135.0],
'AT' => ['name' => 'Austria', 'latitude' => 47.3, 'longitude' => 13.3],
'AZ' => ['name' => 'Azerbaijan', 'latitude' => 40.5, 'longitude' => 47.5],
'BI' => ['name' => 'Burundi', 'latitude' => -3.5, 'longitude' => 30.0],
'BE' => ['name' => 'Belgium', 'latitude' => 50.8, 'longitude' => 4.0],
'BJ' => ['name' => 'Benin', 'latitude' => 9.5, 'longitude' => 2.25],
'BF' => ['name' => 'Burkina Faso', 'latitude' => 13.0, 'longitude' => -2.0],
'BD' => ['name' => 'Bangladesh', 'latitude' => 24.0, 'longitude' => 90.0],
'BG' => ['name' => 'Bulgaria', 'latitude' => 43.0, 'longitude' => 25.0],
'BH' => ['name' => 'Bahrain', 'latitude' => 26.0, 'longitude' => 50.5],
'BS' => ['name' => 'Bahamas', 'latitude' => 24.25, 'longitude' => -76.0],
'BA' => ['name' => 'Bosnia and Herzegovina', 'latitude' => 44.0, 'longitude' => 18.0],
'BY' => ['name' => 'Belarus', 'latitude' => 53.0, 'longitude' => 28.0],
'BZ' => ['name' => 'Belize', 'latitude' => 17.25, 'longitude' => -88.75],
'BO' => ['name' => 'Bolivia', 'latitude' => -17.0, 'longitude' => -65.0],
'BR' => ['name' => 'Brazil', 'latitude' => -10.0, 'longitude' => -55.0],
'BB' => ['name' => 'Barbados', 'latitude' => 13.17, 'longitude' => -59.53],
'BN' => ['name' => 'Brunei', 'latitude' => 4.5, 'longitude' => 114.67],
'BT' => ['name' => 'Bhutan', 'latitude' => 27.5, 'longitude' => 90.5],
'BW' => ['name' => 'Botswana', 'latitude' => -22.0, 'longitude' => 24.0],
'CF' => ['name' => 'Central African Republic', 'latitude' => 7.0, 'longitude' => 21.0],
'CA' => ['name' => 'Canada', 'latitude' => 60.0, 'longitude' => -95.0],
'CH' => ['name' => 'Switzerland', 'latitude' => 47.0, 'longitude' => 8.0],
'CL' => ['name' => 'Chile', 'latitude' => -30.0, 'longitude' => -71.0],
'CN' => ['name' => 'China', 'latitude' => 35.0, 'longitude' => 105.0],
'CI' => ['name' => 'Côte d\'Ivoire', 'latitude' => 8.0, 'longitude' => -5.0],
'CM' => ['name' => 'Cameroon', 'latitude' => 6.0, 'longitude' => 12.0],
'CD' => ['name' => 'Democratic Republic of the Congo', 'latitude' => -2.5, 'longitude' => 23.5],
'CG' => ['name' => 'Republic of the Congo', 'latitude' => -1.0, 'longitude' => 15.0],
'CO' => ['name' => 'Colombia', 'latitude' => 4.0, 'longitude' => -72.0],
'KM' => ['name' => 'Comoros', 'latitude' => -12.17, 'longitude' => 44.25],
'CV' => ['name' => 'Cape Verde', 'latitude' => 16.0, 'longitude' => -24.0],
'CR' => ['name' => 'Costa Rica', 'latitude' => 10.0, 'longitude' => -84.0],
'CU' => ['name' => 'Cuba', 'latitude' => 21.5, 'longitude' => -80.0],
'CY' => ['name' => 'Cyprus', 'latitude' => 35.0, 'longitude' => 33.0],
'CZ' => ['name' => 'Czech Republic', 'latitude' => 49.75, 'longitude' => 15.5],
'DE' => ['name' => 'Germany', 'latitude' => 51.0, 'longitude' => 9.0],
'DJ' => ['name' => 'Djibouti', 'latitude' => 11.5, 'longitude' => 43.0],
'DM' => ['name' => 'Dominica', 'latitude' => 15.42, 'longitude' => -61.33],
'DK' => ['name' => 'Denmark', 'latitude' => 56.0, 'longitude' => 10.0],
'DO' => ['name' => 'Dominican Republic', 'latitude' => 19.0, 'longitude' => -70.67],
'DZ' => ['name' => 'Algeria', 'latitude' => 28.0, 'longitude' => 3.0],
'EC' => ['name' => 'Ecuador', 'latitude' => -2.0, 'longitude' => -77.5],
'EG' => ['name' => 'Egypt', 'latitude' => 27.0, 'longitude' => 30.0],
'ER' => ['name' => 'Eritrea', 'latitude' => 15.0, 'longitude' => 39.0],
'ES' => ['name' => 'Spain', 'latitude' => 40.0, 'longitude' => -4.0],
'EE' => ['name' => 'Estonia', 'latitude' => 59.0, 'longitude' => 26.0],
'ET' => ['name' => 'Ethiopia', 'latitude' => 8.0, 'longitude' => 38.0],
'FI' => ['name' => 'Finland', 'latitude' => 64.0, 'longitude' => 26.0],
'FJ' => ['name' => 'Fiji', 'latitude' => -18.0, 'longitude' => 175.0],
'FR' => ['name' => 'France', 'latitude' => 46.0, 'longitude' => 2.0],
'FM' => ['name' => 'Micronesia', 'latitude' => 6.92, 'longitude' => 158.25],
'GA' => ['name' => 'Gabon', 'latitude' => -1.0, 'longitude' => 11.75],
'GB' => ['name' => 'United Kingdom', 'latitude' => 54.0, 'longitude' => -2.0],
'GE' => ['name' => 'Georgia', 'latitude' => 42.0, 'longitude' => 43.5],
'GH' => ['name' => 'Ghana', 'latitude' => 8.0, 'longitude' => -2.0],
'GN' => ['name' => 'Guinea', 'latitude' => 11.0, 'longitude' => -10.0],
'GM' => ['name' => 'Gambia', 'latitude' => 13.47, 'longitude' => -16.57],
'GW' => ['name' => 'Guinea-Bissau', 'latitude' => 12.0, 'longitude' => -15.0],
'GQ' => ['name' => 'Equatorial Guinea', 'latitude' => 2.0, 'longitude' => 10.0],
'GR' => ['name' => 'Greece', 'latitude' => 39.0, 'longitude' => 22.0],
'GD' => ['name' => 'Grenada', 'latitude' => 12.12, 'longitude' => -61.67],
'GT' => ['name' => 'Guatemala', 'latitude' => 15.5, 'longitude' => -90.25],
'GY' => ['name' => 'Guyana', 'latitude' => 5.0, 'longitude' => -59.0],
'HK' => ['name' => 'Hong Kong', 'latitude' => 22.25, 'longitude' => 114.17],
'HN' => ['name' => 'Honduras', 'latitude' => 15.0, 'longitude' => -86.5],
'HR' => ['name' => 'Croatia', 'latitude' => 45.17, 'longitude' => 15.5],
'HT' => ['name' => 'Haiti', 'latitude' => 19.0, 'longitude' => -72.42],
'HU' => ['name' => 'Hungary', 'latitude' => 47.0, 'longitude' => 20.0],
'ID' => ['name' => 'Indonesia', 'latitude' => -5.0, 'longitude' => 120.0],
'IN' => ['name' => 'India', 'latitude' => 20.0, 'longitude' => 77.0],
'IE' => ['name' => 'Ireland', 'latitude' => 53.0, 'longitude' => -8.0],
'IR' => ['name' => 'Iran', 'latitude' => 32.0, 'longitude' => 53.0],
'IQ' => ['name' => 'Iraq', 'latitude' => 33.0, 'longitude' => 44.0],
'IS' => ['name' => 'Iceland', 'latitude' => 65.0, 'longitude' => -18.0],
'IL' => ['name' => 'Israel', 'latitude' => 31.5, 'longitude' => 34.75],
'IT' => ['name' => 'Italy', 'latitude' => 42.83, 'longitude' => 12.83],
'JM' => ['name' => 'Jamaica', 'latitude' => 18.25, 'longitude' => -77.5],
'JO' => ['name' => 'Jordan', 'latitude' => 31.0, 'longitude' => 36.0],
'JP' => ['name' => 'Japan', 'latitude' => 36.0, 'longitude' => 138.0],
'KZ' => ['name' => 'Kazakhstan', 'latitude' => 48.0, 'longitude' => 68.0],
'KE' => ['name' => 'Kenya', 'latitude' => 1.0, 'longitude' => 38.0],
'KG' => ['name' => 'Kyrgyzstan', 'latitude' => 41.0, 'longitude' => 75.0],
'KH' => ['name' => 'Cambodia', 'latitude' => 13.0, 'longitude' => 105.0],
'KI' => ['name' => 'Kiribati', 'latitude' => 1.42, 'longitude' => 173.0],
'KN' => ['name' => 'Saint Kitts and Nevis', 'latitude' => 17.33, 'longitude' => -62.75],
'KR' => ['name' => 'South Korea', 'latitude' => 37.0, 'longitude' => 127.5],
'KW' => ['name' => 'Kuwait', 'latitude' => 29.34, 'longitude' => 47.66],
'LA' => ['name' => 'Laos', 'latitude' => 18.0, 'longitude' => 105.0],
'LB' => ['name' => 'Lebanon', 'latitude' => 33.83, 'longitude' => 35.83],
'LR' => ['name' => 'Liberia', 'latitude' => 6.5, 'longitude' => -9.5],
'LY' => ['name' => 'Libya', 'latitude' => 25.0, 'longitude' => 17.0],
'LC' => ['name' => 'Saint Lucia', 'latitude' => 13.88, 'longitude' => -61.13],
'LI' => ['name' => 'Liechtenstein', 'latitude' => 47.17, 'longitude' => 9.53],
'LK' => ['name' => 'Sri Lanka', 'latitude' => 7.0, 'longitude' => 81.0],
'LS' => ['name' => 'Lesotho', 'latitude' => -29.5, 'longitude' => 28.5],
'LT' => ['name' => 'Lithuania', 'latitude' => 56.0, 'longitude' => 24.0],
'LU' => ['name' => 'Luxembourg', 'latitude' => 49.75, 'longitude' => 6.17],
'LV' => ['name' => 'latitudevia', 'latitude' => 57.0, 'longitude' => 25.0],
'MA' => ['name' => 'Morocco', 'latitude' => 32.0, 'longitude' => -5.0],
'MC' => ['name' => 'Monaco', 'latitude' => 43.73, 'longitude' => 7.4],
'MD' => ['name' => 'Moldova', 'latitude' => 47.0, 'longitude' => 29.0],
'MG' => ['name' => 'Madagascar', 'latitude' => -20.0, 'longitude' => 47.0],
'MV' => ['name' => 'Maldives', 'latitude' => 3.25, 'longitude' => 73.0],
'MX' => ['name' => 'Mexico', 'latitude' => 23.0, 'longitude' => -102.0],
'MH' => ['name' => 'Marshall Islands', 'latitude' => 9.0, 'longitude' => 168.0],
'MK' => ['name' => 'North Macedonia', 'latitude' => 41.83, 'longitude' => 22.0],
'ML' => ['name' => 'Mali', 'latitude' => 17.0, 'longitude' => -4.0],
'MT' => ['name' => 'Malta', 'latitude' => 35.83, 'longitude' => 14.58],
'MM' => ['name' => 'Myanmar', 'latitude' => 22.0, 'longitude' => 98.0],
'ME' => ['name' => 'Montenegro', 'latitude' => 42.5, 'longitude' => 19.3],
'MN' => ['name' => 'Mongolia', 'latitude' => 46.0, 'longitude' => 105.0],
'MZ' => ['name' => 'Mozambique', 'latitude' => -18.25, 'longitude' => 35.0],
'MR' => ['name' => 'Mauritania', 'latitude' => 20.0, 'longitude' => -12.0],
'MU' => ['name' => 'Mauritius', 'latitude' => -20.28, 'longitude' => 57.55],
'MW' => ['name' => 'Malawi', 'latitude' => -13.5, 'longitude' => 34.0],
'MY' => ['name' => 'Malaysia', 'latitude' => 2.5, 'longitude' => 112.5],
'NA' => ['name' => 'Namibia', 'latitude' => -22.0, 'longitude' => 17.0],
'NE' => ['name' => 'Niger', 'latitude' => 16.0, 'longitude' => 8.0],
'NG' => ['name' => 'Nigeria', 'latitude' => 10.0, 'longitude' => 8.0],
'NI' => ['name' => 'Nicaragua', 'latitude' => 13.0, 'longitude' => -85.0],
'NL' => ['name' => 'Netherlands', 'latitude' => 52.5, 'longitude' => 5.75],
'NO' => ['name' => 'Norway', 'latitude' => 62.0, 'longitude' => 10.0],
'NP' => ['name' => 'Nepal', 'latitude' => 28.0, 'longitude' => 84.0],
'NR' => ['name' => 'Nauru', 'latitude' => -0.53, 'longitude' => 166.92],
'NZ' => ['name' => 'New Zealand', 'latitude' => -41.0, 'longitude' => 174.0],
'OM' => ['name' => 'Oman', 'latitude' => 21.0, 'longitude' => 57.0],
'PK' => ['name' => 'Pakistan', 'latitude' => 30.0, 'longitude' => 70.0],
'PS' => ['name' => 'Palestine', 'latitude' => 31.9, 'longitude' => 35.2],
'PA' => ['name' => 'Panama', 'latitude' => 9.0, 'longitude' => -80.0],
'PE' => ['name' => 'Peru', 'latitude' => -10.0, 'longitude' => -76.0],
'PH' => ['name' => 'Philippines', 'latitude' => 13.0, 'longitude' => 122.0],
'PW' => ['name' => 'Palau', 'latitude' => 7.5, 'longitude' => 134.5],
'PG' => ['name' => 'Papua New Guinea', 'latitude' => -6.0, 'longitude' => 147.0],
'PL' => ['name' => 'Poland', 'latitude' => 52.0, 'longitude' => 20.0],
'KP' => ['name' => 'North Korea', 'latitude' => 40.0, 'longitude' => 127.0],
'PT' => ['name' => 'Portugal', 'latitude' => 39.5, 'longitude' => -8.0],
'PY' => ['name' => 'Paraguay', 'latitude' => -23.0, 'longitude' => -58.0],
'QA' => ['name' => 'Qatar', 'latitude' => 25.5, 'longitude' => 51.25],
'RO' => ['name' => 'Romania', 'latitude' => 46.0, 'longitude' => 25.0],
'RU' => ['name' => 'Russia', 'latitude' => 60.0, 'longitude' => 100.0],
'RW' => ['name' => 'Rwanda', 'latitude' => -2.0, 'longitude' => 30.0],
'SA' => ['name' => 'Saudi Arabia', 'latitude' => 25.0, 'longitude' => 45.0],
'SD' => ['name' => 'Sudan', 'latitude' => 15.0, 'longitude' => 30.0],
'SN' => ['name' => 'Senegal', 'latitude' => 14.0, 'longitude' => -14.0],
'SG' => ['name' => 'Singapore', 'latitude' => 1.37, 'longitude' => 103.8],
'SB' => ['name' => 'Solomon Islands', 'latitude' => -8.0, 'longitude' => 159.0],
'SL' => ['name' => 'Sierra Leone', 'latitude' => 8.5, 'longitude' => -11.5],
'SV' => ['name' => 'El Salvador', 'latitude' => 13.83, 'longitude' => -88.92],
'SM' => ['name' => 'San Marino', 'latitude' => 43.77, 'longitude' => 12.42],
'SO' => ['name' => 'Somalia', 'latitude' => 10.0, 'longitude' => 49.0],
'RS' => ['name' => 'Serbia', 'latitude' => 44.0, 'longitude' => 21.0],
'SS' => ['name' => 'South Sudan', 'latitude' => 8.0, 'longitude' => 30.0],
'ST' => ['name' => 'São Tomé and Príncipe', 'latitude' => 1.0, 'longitude' => 7.0],
'SR' => ['name' => 'Suriname', 'latitude' => 4.0, 'longitude' => -56.0],
'SK' => ['name' => 'Slovakia', 'latitude' => 48.67, 'longitude' => 19.5],
'SI' => ['name' => 'Slovenia', 'latitude' => 46.0, 'longitude' => 15.0],
'SE' => ['name' => 'Sweden', 'latitude' => 62.0, 'longitude' => 15.0],
'SZ' => ['name' => 'Eswatini', 'latitude' => -26.5, 'longitude' => 31.5],
'SC' => ['name' => 'Seychelles', 'latitude' => -4.58, 'longitude' => 55.67],
'SY' => ['name' => 'Syria', 'latitude' => 35.0, 'longitude' => 38.0],
'TD' => ['name' => 'Chad', 'latitude' => 15.0, 'longitude' => 19.0],
'TG' => ['name' => 'Togo', 'latitude' => 8.0, 'longitude' => 1.17],
'TH' => ['name' => 'Thailand', 'latitude' => 15.0, 'longitude' => 100.0],
'TJ' => ['name' => 'Tajikistan', 'latitude' => 39.0, 'longitude' => 71.0],
'TM' => ['name' => 'Turkmenistan', 'latitude' => 40.0, 'longitude' => 60.0],
'TL' => ['name' => 'Timor-Leste', 'latitude' => -8.83, 'longitude' => 125.92],
'TO' => ['name' => 'Tonga', 'latitude' => -20.0, 'longitude' => -175.0],
'TT' => ['name' => 'Trinidad and Tobago', 'latitude' => 11.0, 'longitude' => -61.0],
'TN' => ['name' => 'Tunisia', 'latitude' => 34.0, 'longitude' => 9.0],
'TR' => ['name' => 'Turkey', 'latitude' => 39.0, 'longitude' => 35.0],
'TV' => ['name' => 'Tuvalu', 'latitude' => -8.0, 'longitude' => 178.0],
'TZ' => ['name' => 'Tanzania', 'latitude' => -6.0, 'longitude' => 35.0],
'TW' => ['name' => 'Taiwan', 'latitude' => 23.5, 'longitude' => 121.0],
'UG' => ['name' => 'Uganda', 'latitude' => 1.0, 'longitude' => 32.0],
'UA' => ['name' => 'Ukraine', 'latitude' => 49.0, 'longitude' => 32.0],
'UY' => ['name' => 'Uruguay', 'latitude' => -33.0, 'longitude' => -56.0],
'US' => ['name' => 'United States', 'latitude' => 38.0, 'longitude' => -97.0],
'UZ' => ['name' => 'Uzbekistan', 'latitude' => 41.0, 'longitude' => 64.0],
'VA' => ['name' => 'Vatican City', 'latitude' => 41.9, 'longitude' => 12.45],
'VC' => ['name' => 'Saint Vincent and the Grenadines', 'latitude' => 13.25, 'longitude' => -61.2],
'VE' => ['name' => 'Venezuela', 'latitude' => 8.0, 'longitude' => -66.0],
'VN' => ['name' => 'Vietnam', 'latitude' => 16.0, 'longitude' => 106.0],
'VU' => ['name' => 'Vanuatu', 'latitude' => -16.0, 'longitude' => 167.0],
'WS' => ['name' => 'Samoa', 'latitude' => -13.58, 'longitude' => -172.33],
'YE' => ['name' => 'Yemen', 'latitude' => 15.0, 'longitude' => 48.0],
'ZA' => ['name' => 'South Africa', 'latitude' => -29.0, 'longitude' => 24.0],
'ZM' => ['name' => 'Zambia', 'latitude' => -15.0, 'longitude' => 30.0],
'ZW' => ['name' => 'Zimbabwe', 'latitude' => -20.0, 'longitude' => 30.0],
];
+16 -16
View File
@@ -11,7 +11,7 @@ return [
[
'key' => 'web',
'name' => 'Web',
'version' => '16.0.2',
'version' => '17.0.1',
'url' => 'https://github.com/appwrite/sdk-for-web',
'package' => 'https://www.npmjs.com/package/appwrite',
'enabled' => true,
@@ -59,7 +59,7 @@ return [
[
'key' => 'flutter',
'name' => 'Flutter',
'version' => '13.0.0',
'version' => '15.0.0',
'url' => 'https://github.com/appwrite/sdk-for-flutter',
'package' => 'https://pub.dev/packages/appwrite',
'enabled' => true,
@@ -77,7 +77,7 @@ return [
[
'key' => 'apple',
'name' => 'Apple',
'version' => '7.0.0',
'version' => '9.0.0',
'url' => 'https://github.com/appwrite/sdk-for-apple',
'package' => 'https://github.com/appwrite/sdk-for-apple',
'enabled' => true,
@@ -112,7 +112,7 @@ return [
[
'key' => 'android',
'name' => 'Android',
'version' => '6.0.0',
'version' => '6.1.0',
'url' => 'https://github.com/appwrite/sdk-for-android',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android',
'enabled' => true,
@@ -134,7 +134,7 @@ return [
[
'key' => 'react-native',
'name' => 'React Native',
'version' => '0.5.0',
'version' => '0.7.1',
'url' => 'https://github.com/appwrite/sdk-for-react-native',
'package' => 'https://npmjs.com/package/react-native-appwrite',
'enabled' => true,
@@ -217,7 +217,7 @@ return [
[
'key' => 'cli',
'name' => 'Command Line',
'version' => '6.0.0',
'version' => '6.2.2',
'url' => 'https://github.com/appwrite/sdk-for-cli',
'package' => 'https://www.npmjs.com/package/appwrite-cli',
'enabled' => true,
@@ -245,7 +245,7 @@ return [
[
'key' => 'nodejs',
'name' => 'Node.js',
'version' => '14.1.0',
'version' => '15.0.1',
'url' => 'https://github.com/appwrite/sdk-for-node',
'package' => 'https://www.npmjs.com/package/node-appwrite',
'enabled' => true,
@@ -263,7 +263,7 @@ return [
[
'key' => 'deno',
'name' => 'Deno',
'version' => '12.1.0',
'version' => '12.2.0',
'url' => 'https://github.com/appwrite/sdk-for-deno',
'package' => 'https://deno.land/x/appwrite',
'enabled' => true,
@@ -281,7 +281,7 @@ return [
[
'key' => 'php',
'name' => 'PHP',
'version' => '12.1.0',
'version' => '12.2.0',
'url' => 'https://github.com/appwrite/sdk-for-php',
'package' => 'https://packagist.org/packages/appwrite/appwrite',
'enabled' => true,
@@ -299,7 +299,7 @@ return [
[
'key' => 'python',
'name' => 'Python',
'version' => '6.1.0',
'version' => '9.0.2',
'url' => 'https://github.com/appwrite/sdk-for-python',
'package' => 'https://pypi.org/project/appwrite/',
'enabled' => true,
@@ -317,7 +317,7 @@ return [
[
'key' => 'ruby',
'name' => 'Ruby',
'version' => '12.1.1',
'version' => '12.2.0',
'url' => 'https://github.com/appwrite/sdk-for-ruby',
'package' => 'https://rubygems.org/gems/appwrite',
'enabled' => true,
@@ -335,7 +335,7 @@ return [
[
'key' => 'go',
'name' => 'Go',
'version' => '0.2.0',
'version' => '0.3.0',
'url' => 'https://github.com/appwrite/sdk-for-go',
'package' => 'https://github.com/appwrite/sdk-for-go',
'enabled' => true,
@@ -353,7 +353,7 @@ return [
[
'key' => 'dotnet',
'name' => '.NET',
'version' => '0.10.1',
'version' => '0.11.0',
'url' => 'https://github.com/appwrite/sdk-for-dotnet',
'package' => 'https://www.nuget.org/packages/Appwrite',
'enabled' => true,
@@ -371,7 +371,7 @@ return [
[
'key' => 'dart',
'name' => 'Dart',
'version' => '12.1.0',
'version' => '14.0.0',
'url' => 'https://github.com/appwrite/sdk-for-dart',
'package' => 'https://pub.dev/packages/dart_appwrite',
'enabled' => true,
@@ -389,7 +389,7 @@ return [
[
'key' => 'kotlin',
'name' => 'Kotlin',
'version' => '6.1.0',
'version' => '6.2.0',
'url' => 'https://github.com/appwrite/sdk-for-kotlin',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin',
'enabled' => true,
@@ -411,7 +411,7 @@ return [
[
'key' => 'swift',
'name' => 'Swift',
'version' => '6.1.0',
'version' => '8.0.0',
'url' => 'https://github.com/appwrite/sdk-for-swift',
'package' => 'https://github.com/appwrite/sdk-for-swift',
'enabled' => true,
+1 -65
View File
@@ -3,72 +3,8 @@
return [
'default' => [
'$id' => 'default',
'name' => 'Frankfurt',
'name' => 'default',
'disabled' => false,
'flag' => 'de',
'default' => true,
],
'fra' => [
'$id' => 'fra',
'name' => 'Frankfurt',
'disabled' => false,
'flag' => 'de',
'default' => true,
],
'nyc' => [
'$id' => 'nyc',
'name' => 'New York',
'disabled' => true,
'flag' => 'us',
'default' => true,
],
'sfo' => [
'$id' => 'sfo',
'name' => 'San Francisco',
'disabled' => true,
'flag' => 'us',
'default' => true,
],
'blr' => [
'$id' => 'blr',
'name' => 'Bengaluru',
'disabled' => true,
'flag' => 'in',
'default' => true,
],
'lon' => [
'$id' => 'lon',
'name' => 'London',
'disabled' => true,
'flag' => 'gb',
'default' => true,
],
'ams' => [
'$id' => 'ams',
'name' => 'Amsterdam',
'disabled' => true,
'flag' => 'nl',
'default' => true,
],
'sgp' => [
'$id' => 'sgp',
'name' => 'Singapore',
'disabled' => true,
'flag' => 'sg',
'default' => true,
],
'tor' => [
'$id' => 'tor',
'name' => 'Toronto',
'disabled' => true,
'flag' => 'ca',
'default' => true,
],
'syd' => [
'$id' => 'syd',
'name' => 'Sydney',
'disabled' => true,
'flag' => 'au',
'default' => true,
],
];
+5
View File
@@ -26,6 +26,7 @@ $member = [
'subscribers.write',
'subscribers.read',
'assistant.read',
'rules.read'
];
$admins = [
@@ -58,6 +59,10 @@ $admins = [
'health.read',
'functions.read',
'functions.write',
'sites.read',
'sites.write',
'log.read',
'log.write',
'execution.read',
'execution.write',
'rules.read',
+1 -1
View File
@@ -6,4 +6,4 @@
use Appwrite\Runtimes\Runtimes;
return (new Runtimes('v4'))->getAll();
return (new Runtimes('v5'))->getAll();
+12
View File
@@ -64,6 +64,18 @@ return [ // List of publicly visible scopes
'functions.write' => [
'description' => 'Access to create, update, and delete your project\'s functions and code deployments',
],
'sites.read' => [
'description' => 'Access to read your project\'s sites and deployments',
],
'sites.write' => [
'description' => 'Access to create, update, and delete your project\'s sites and deployments',
],
'log.read' => [
'description' => 'Access to read your site\'s logs',
],
'log.write' => [
'description' => 'Access to update, and delete your site\'s logs',
],
'execution.read' => [
'description' => 'Access to read your project\'s execution logs',
],
+14 -1
View File
@@ -173,12 +173,25 @@ return [
'optional' => false,
'icon' => '',
],
'sites' => [
'key' => 'sites',
'name' => 'Sites',
'subtitle' => 'The Sites Service allows you view, create and manage your web applications.',
'description' => '/docs/services/sites.md',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/sites',
'tests' => false,
'optional' => true,
'icon' => '', // TODO: Update icon later
],
'functions' => [
'key' => 'functions',
'name' => 'Functions',
'subtitle' => 'The Functions Service allows you view, create and manage your Cloud Functions.',
'description' => '/docs/services/functions.md',
'controller' => 'api/functions.php',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/functions',
@@ -1,12 +1,12 @@
<?php
use Appwrite\Functions\Specification;
use Appwrite\Platform\Modules\Compute\Specification;
return [
Specification::S_05VCPU_512MB => [
'slug' => Specification::S_05VCPU_512MB,
'memory' => 512,
'cpus' => 1 // TODO: revert this, it's a temporary change to test function performance.
'cpus' => 0.5
],
Specification::S_1VCPU_512MB => [
'slug' => Specification::S_1VCPU_512MB,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -1,8 +1,11 @@
<?php
return [ // Accepted inputs files
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
return [
// Accepted inputs files
"jpg" => "image/jpeg",
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"png" => "image/png",
"heic" => "image/heic",
"webp" => "image/webp",
];
+52 -51
View File
@@ -1,70 +1,71 @@
<?php
return [
'image/jpeg',
'image/jpeg',
'image/gif',
'image/png',
'image/webp',
// 'image/heic',
'image/avif',
"image/jpeg",
"image/jpeg",
"image/gif",
"image/png",
"image/webp",
"image/heic",
"image/heic-sequence",
"image/avif",
// Video Files
'video/mp4',
'video/x-flv',
'video/webm',
'application/x-mpegURL',
'video/MP2T',
'video/3gpp',
'video/quicktime',
'video/x-msvideo',
'video/x-ms-wmv',
"video/mp4",
"video/x-flv",
"video/webm",
"application/x-mpegURL",
"video/MP2T",
"video/3gpp",
"video/quicktime",
"video/x-msvideo",
"video/x-ms-wmv",
// Audio Files
'audio/basic', // au snd RFC 2046
'auido/L24', // Linear PCM RFC 3190
'audio/mid', // mid rmi
'audio/mpeg', // mp3 RFC 3003
'audio/mp4', // mp4 audio
'audio/x-aiff', // aif aifc aiff
'audio/x-mpegurl', // m3u
'audio/vnd.rn-realaudio', // ra ram
'audio/ogg', // Ogg Vorbis RFC 5334
'audio/vorbis', // Vorbis RFC 5215
'audio/vnd.wav', // wav RFC 2361
'audio/x-wav', // php reads .wav as this - https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
'audio/aac', //AAC audio
'audio/x-hx-aac-adts', // AAC audio
"audio/basic", // au snd RFC 2046
"auido/L24", // Linear PCM RFC 3190
"audio/mid", // mid rmi
"audio/mpeg", // mp3 RFC 3003
"audio/mp4", // mp4 audio
"audio/x-aiff", // aif aifc aiff
"audio/x-mpegurl", // m3u
"audio/vnd.rn-realaudio", // ra ram
"audio/ogg", // Ogg Vorbis RFC 5334
"audio/vorbis", // Vorbis RFC 5215
"audio/vnd.wav", // wav RFC 2361
"audio/x-wav", // php reads .wav as this - https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
"audio/aac", //AAC audio
"audio/x-hx-aac-adts", // AAC audio
// Microsoft Word
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.ms-word.document.macroEnabled.12',
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
"application/vnd.ms-word.document.macroEnabled.12",
// Microsoft Excel
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/vnd.ms-excel.sheet.macroEnabled.12',
'application/vnd.ms-excel.template.macroEnabled.12',
'application/vnd.ms-excel.addin.macroEnabled.12',
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
"application/vnd.ms-excel.sheet.macroEnabled.12",
"application/vnd.ms-excel.template.macroEnabled.12",
"application/vnd.ms-excel.addin.macroEnabled.12",
"application/vnd.ms-excel.sheet.binary.macroEnabled.12",
// Microsoft Power Point
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'application/vnd.ms-powerpoint.template.macroEnabled.12',
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/vnd.openxmlformats-officedocument.presentationml.template",
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
"application/vnd.ms-powerpoint.addin.macroEnabled.12",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
"application/vnd.ms-powerpoint.template.macroEnabled.12",
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
// Microsoft Access
'application/vnd.ms-access',
"application/vnd.ms-access",
// Adobe PDF
'application/pdf',
"application/pdf",
];
+9 -9
View File
@@ -1,12 +1,12 @@
<?php
return [ // Accepted outputs files
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'webp' => 'image/webp',
// 'heic' => 'image/heic',
// 'heics' => 'image/heic',
'avif' => 'image/avif'
return [
// Accepted outputs files
"jpg" => "image/jpeg",
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"png" => "image/png",
"webp" => "image/webp",
"heic" => "image/heic",
"avif" => "image/avif",
];
+40
View File
@@ -0,0 +1,40 @@
<?php
return [
'NODE' => [
'name' => 'node',
'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5']
],
'PYTHON' => [
'name' => 'python',
'versions' => ['3.12', '3.11', '3.10', '3.9', '3.8']
],
'DART' => [
'name' => 'dart',
'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16']
],
'GO' => [
'name' => 'go',
'versions' => ['1.23']
],
'PHP' => [
'name' => 'php',
'versions' => ['8.3', '8.2', '8.1', '8.0']
],
'DENO' => [
'name' => 'deno',
'versions' => ['2.0', '1.46', '1.40', '1.35', '1.24', '1.21']
],
'BUN' => [
'name' => 'bun',
'versions' => ['1.1', '1.0']
],
'RUBY' => [
'name' => 'ruby',
'versions' => ['3.3', '3.2', '3.1', '3.0']
],
'FLUTTER' => [
'name' => 'flutter',
'versions' => ['3.24']
],
];
@@ -1,39 +1,8 @@
<?php
const TEMPLATE_RUNTIMES = [
'NODE' => [
'name' => 'node',
'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5']
],
'PYTHON' => [
'name' => 'python',
'versions' => ['3.12', '3.11', '3.10', '3.9', '3.8']
],
'DART' => [
'name' => 'dart',
'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16']
],
'GO' => [
'name' => 'go',
'versions' => ['1.23']
],
'PHP' => [
'name' => 'php',
'versions' => ['8.3', '8.2', '8.1', '8.0']
],
'DENO' => [
'name' => 'deno',
'versions' => ['2.0', '1.46', '1.40', '1.35', '1.24', '1.21']
],
'BUN' => [
'name' => 'bun',
'versions' => ['1.1', '1.0']
],
'RUBY' => [
'name' => 'ruby',
'versions' => ['3.3', '3.2', '3.1', '3.0']
],
];
use Utopia\Config\Config;
$templateRuntimes = Config::getParam('template-runtimes');
function getRuntimes($runtime, $commands, $entrypoint, $providerRootDirectory, $versionsDenyList = [])
{
@@ -62,24 +31,24 @@ return [
'timeout' => 15,
'useCases' => ['starter'],
'runtimes' => [
...getRuntimes(TEMPLATE_RUNTIMES['NODE'], 'npm install', 'src/main.js', 'node/starter'),
...getRuntimes($templateRuntimes['NODE'], 'npm install', 'src/main.js', 'node/starter'),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/starter'
),
...getRuntimes(TEMPLATE_RUNTIMES['DART'], 'dart pub get', 'lib/main.dart', 'dart/starter'),
...getRuntimes(TEMPLATE_RUNTIMES['GO'], '', 'main.go', 'go/starter'),
...getRuntimes($templateRuntimes['DART'], 'dart pub get', 'lib/main.dart', 'dart/starter'),
...getRuntimes($templateRuntimes['GO'], '', 'main.go', 'go/starter'),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/starter'
),
...getRuntimes(TEMPLATE_RUNTIMES['DENO'], 'deno cache src/main.ts', 'src/main.ts', 'deno/starter'),
...getRuntimes(TEMPLATE_RUNTIMES['BUN'], 'bun install', 'src/main.ts', 'bun/starter'),
...getRuntimes(TEMPLATE_RUNTIMES['RUBY'], 'bundle install', 'lib/main.rb', 'ruby/starter'),
...getRuntimes($templateRuntimes['DENO'], 'deno cache src/main.ts', 'src/main.ts', 'deno/starter'),
...getRuntimes($templateRuntimes['BUN'], 'bun install', 'src/main.ts', 'bun/starter'),
...getRuntimes($templateRuntimes['RUBY'], 'bundle install', 'lib/main.rb', 'ruby/starter'),
],
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.',
'vcsProvider' => 'github',
@@ -101,7 +70,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-upstash-vector'
@@ -145,7 +114,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-redis-labs'
@@ -188,7 +157,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-neo4j-auradb'
@@ -240,7 +209,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-mongo-atlas'
@@ -277,7 +246,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-neon-postgres'
@@ -344,25 +313,25 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/prompt-chatgpt'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/prompt_chatgpt'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/prompt-chatgpt'
),
...getRuntimes(
TEMPLATE_RUNTIMES['DART'],
$templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/prompt_chatgpt'
@@ -405,19 +374,19 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/discord-command-bot'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt && python src/setup.py',
'src/main.py',
'python/discord_command_bot'
),
...getRuntimes(
TEMPLATE_RUNTIMES['GO'],
$templateRuntimes['GO'],
'',
'main.go',
'go/discord-command-bot'
@@ -468,7 +437,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/analyze-with-perspectiveapi'
@@ -504,19 +473,19 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/censor-with-redact'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/censor_with_redact'
),
...getRuntimes(
TEMPLATE_RUNTIMES['DART'],
$templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/censor_with_redact'
@@ -550,7 +519,7 @@ return [
'timeout' => 15,
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(TEMPLATE_RUNTIMES['NODE'], 'npm install', 'src/main.js', 'node/generate-pdf')
...getRuntimes($templateRuntimes['NODE'], 'npm install', 'src/main.js', 'node/generate-pdf')
],
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/generate-pdf">file</a>.',
'vcsProvider' => 'github',
@@ -573,7 +542,7 @@ return [
'useCases' => ['dev-tools'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/github-issue-bot'
@@ -616,7 +585,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/url-shortener'
@@ -667,19 +636,19 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-algolia'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/sync_with_algolia'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/sync-with-algolia'
@@ -748,31 +717,31 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-meilisearch'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/sync-with-meilisearch'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/sync-with-meilisearch'
),
...getRuntimes(
TEMPLATE_RUNTIMES['BUN'],
$templateRuntimes['BUN'],
'bun install',
'src/main.ts',
'bun/sync-with-meilisearch'
),
...getRuntimes(
TEMPLATE_RUNTIMES['RUBY'],
$templateRuntimes['RUBY'],
'bundle install',
'lib/main.rb',
'ruby/sync-with-meilisearch'
@@ -841,37 +810,37 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/whatsapp-with-vonage'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/whatsapp_with_vonage'
),
...getRuntimes(
TEMPLATE_RUNTIMES['DART'],
$templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/whatsapp-with-vonage'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/whatsapp-with-vonage'
),
...getRuntimes(
TEMPLATE_RUNTIMES['BUN'],
$templateRuntimes['BUN'],
'bun install',
'src/main.ts',
'bun/whatsapp-with-vonage'
),
...getRuntimes(
TEMPLATE_RUNTIMES['RUBY'],
$templateRuntimes['RUBY'],
'bundle install',
'lib/main.rb',
'ruby/whatsapp-with-vonage'
@@ -927,7 +896,7 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/push-notification-with-fcm'
@@ -983,19 +952,19 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/email-contact-form'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PYTHON'],
$templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/email_contact_form'
),
...getRuntimes(
TEMPLATE_RUNTIMES['PHP'],
$templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/email-contact-form'
@@ -1066,7 +1035,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/subscriptions-with-stripe'
@@ -1107,7 +1076,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/payments-with-stripe'
@@ -1164,7 +1133,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/text-generation-with-huggingface'
@@ -1198,7 +1167,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/language-translation-with-huggingface'
@@ -1232,7 +1201,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/image-classification-with-huggingface'
@@ -1290,7 +1259,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/object-detection-with-huggingface'
@@ -1348,7 +1317,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/speech-recognition-with-huggingface'
@@ -1406,7 +1375,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/text-to-speech-with-huggingface'
@@ -1464,7 +1433,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-replicate'
@@ -1499,7 +1468,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-together-ai'
@@ -1541,7 +1510,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/chat-with-perplexity-ai'
@@ -1567,7 +1536,8 @@ return [
'required' => false,
'type' => 'number'
]
]
],
'scopes' => []
],
[
'icon' => 'icon-chip',
@@ -1581,7 +1551,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-replicate'
@@ -1616,7 +1586,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-pinecone'
@@ -1679,7 +1649,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/rag-with-langchain'
@@ -1742,7 +1712,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/speak-with-elevenlabs'
@@ -1797,7 +1767,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/speak-with-lmnt'
@@ -1838,7 +1808,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/chat-with-anyscale'
@@ -1879,7 +1849,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/music-generation-with-huggingface'
@@ -1921,7 +1891,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-fal-ai'
@@ -1956,7 +1926,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/subscriptions-with-lemon-squeezy'
@@ -2011,7 +1981,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
TEMPLATE_RUNTIMES['NODE'],
$templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/payments-with-lemon-squeezy'
+844
View File
@@ -0,0 +1,844 @@
<?php
use Utopia\System\System;
/**
* List of Appwrite Sites templates
*/
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = System::getEnv('_APP_DOMAIN');
// TODO: Development override
if (System::getEnv('_APP_ENV') === 'development') {
$hostname = 'localhost';
}
$url = $protocol . '://' . $hostname;
const TEMPLATE_FRAMEWORKS = [
'SVELTEKIT' => [
'key' => 'sveltekit',
'name' => 'SvelteKit',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './build',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => '',
],
'NEXTJS' => [
'key' => 'nextjs',
'name' => 'Next.js',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './.next',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => '',
],
'NUXT' => [
'key' => 'nuxt',
'name' => 'Nuxt',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './.output',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => '',
],
'REMIX' => [
'key' => 'remix',
'name' => 'Remix',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './build',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => '',
],
'ASTRO' => [
'key' => 'astro',
'name' => 'Astro',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './dist',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => '',
],
'FLUTTER' => [
'key' => 'flutter',
'name' => 'Flutter',
'installCommand' => '',
'buildCommand' => 'flutter build web',
'outputDirectory' => './build/web',
'buildRuntime' => 'flutter-3.29',
'adapter' => 'static',
'fallbackFile' => '',
],
'OTHER' => [
'key' => 'other',
'name' => 'Other',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'fallbackFile' => 'index.html',
],
'VITE' => [
'key' => 'vite',
'name' => 'Vite',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist',
],
'REACT' => [
'key' => 'react',
'name' => 'React',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist',
'fallbackFile' => 'index.html',
],
'ANGULAR' => [
'key' => 'angular',
'name' => 'Angular',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist/angular/browser',
'fallbackFile' => 'index.html',
],
'VUE' => [
'key' => 'vue',
'name' => 'Vue.js',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist',
'fallbackFile' => 'index.html',
],
'OTHER' => [
'key' => 'other',
'name' => 'Other',
'installCommand' => '',
'buildCommand' => '',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './',
],
];
function getFramework(string $frameworkEnum, array $overrides)
{
$settings = \array_merge(TEMPLATE_FRAMEWORKS[$frameworkEnum], $overrides);
return $settings;
}
return [
[
'key' => 'nxt-lnk',
'name' => 'Nxt Lnk',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/nxt-lnk-dark.png',
'screenshotLight' => $url . '/images/sites/templates/nxt-lnk-light.png',
'frameworks' => [
getFramework('NEXTJS', [
'providerRootDirectory' => './nextjs/nxtlnk',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'magic-portfolio',
'name' => 'Magic Portfolio',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/magic-portfolio-dark.png',
'screenshotLight' => $url . '/images/sites/templates/magic-portfolio-light.png',
'frameworks' => [
getFramework('NEXTJS', [
'providerRootDirectory' => './nextjs/magic-portfolio',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'littlelink',
'name' => 'LittleLink',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/littlelink-dark.png',
'screenshotLight' => $url . '/images/sites/templates/littlelink-light.png',
'frameworks' => [
getFramework('OTHER', [
'providerRootDirectory' => './other/littlelink',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'logspot',
'name' => 'Logspot',
'useCases' => ['blog'],
'screenshotDark' => $url . '/images/sites/templates/logspot-dark.png',
'screenshotLight' => $url . '/images/sites/templates/logspot-light.png',
'frameworks' => [
getFramework('NUXT', [
'providerRootDirectory' => './nuxt/logspot',
'buildCommand' => 'npm run generate',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'astro-nano',
'name' => 'Astro Nano',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/astro-nano-dark.png',
'screenshotLight' => $url . '/images/sites/templates/astro-nano-light.png',
'frameworks' => [
getFramework('ASTRO', [
'providerRootDirectory' => './astro/nano',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'astro-starlight',
'name' => 'Astro Starlight',
'useCases' => ['documentation'],
'screenshotDark' => $url . '/images/sites/templates/astro-starlight-dark.png',
'screenshotLight' => $url . '/images/sites/templates/astro-starlight-light.png',
'frameworks' => [
getFramework('ASTRO', [
'providerRootDirectory' => './astro/starlight',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'astro-sphere',
'name' => 'Astro Sphere',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/astro-sphere-dark.png',
'screenshotLight' => $url . '/images/sites/templates/astro-sphere-light.png',
'frameworks' => [
getFramework('ASTRO', [
'providerRootDirectory' => './astro/sphere',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'astro-starlog',
'name' => 'Astro Starlog',
'useCases' => ['blog'],
'screenshotDark' => $url . '/images/sites/templates/astro-starlog-dark.png',
'screenshotLight' => $url . '/images/sites/templates/astro-starlog-light.png',
'frameworks' => [
getFramework('ASTRO', [
'providerRootDirectory' => './astro/starlog',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'onelink',
'name' => 'Onelink',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/onelink-dark.png',
'screenshotLight' => $url . '/images/sites/templates/onelink-light.png',
'frameworks' => [
getFramework('NUXT', [
'providerRootDirectory' => './nuxt/onelink',
'buildCommand' => 'npm run generate',
'outputDirectory' => './dist',
'adapter' => 'static',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
[
'key' => 'starter-for-flutter',
'name' => 'Flutter starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-flutter-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-flutter-light.png',
'frameworks' => [
getFramework('FLUTTER', [
'providerRootDirectory' => './',
'buildCommand' => 'bash build.sh',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-flutter',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'APPWRITE_PUBLIC_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-js',
'name' => 'JavaScript starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-js-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-js-light.png',
'frameworks' => [
getFramework('VITE', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-js',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'VITE_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-angular',
'name' => 'Angular starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-angular-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-angular-light.png',
'frameworks' => [
getFramework('ANGULAR', [
'providerRootDirectory' => './',
'outputDirectory' => './dist/angular-starter-kit-for-appwrite/browser',
'buildCommand' => 'bash prepare-env.sh && npm run build'
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-angular',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-svelte',
'name' => 'Svelte starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-svelte-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-svelte-light.png',
'frameworks' => [
getFramework('SVELTEKIT', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-svelte',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'PUBLIC_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'PUBLIC_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'PUBLIC_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-react',
'name' => 'React starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-react-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-react-light.png',
'frameworks' => [
getFramework('REACT', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-react',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'VITE_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-vue',
'name' => 'Vue starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-vue-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-vue-light.png',
'frameworks' => [
getFramework('VUE', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-vue',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'VITE_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'VITE_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-react-native',
'name' => 'React Native starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-react-native-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-react-native-light.png',
'frameworks' => [
getFramework('REACT', [
'providerRootDirectory' => './',
'fallbackFile' => '+not-found.html',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-react-native',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'EXPO_PUBLIC_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'EXPO_PUBLIC_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'EXPO_PUBLIC_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-nextjs',
'name' => 'Next.js starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-nextjs-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-nextjs-light.png',
'frameworks' => [
getFramework('NEXTJS', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-nextjs',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'NEXT_PUBLIC_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'NEXT_PUBLIC_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'NEXT_PUBLIC_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'starter-for-nuxt',
'name' => 'Nuxt starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/starter-for-nuxt-dark.png',
'screenshotLight' => $url . '/images/sites/templates/starter-for-nuxt-light.png',
'frameworks' => [
getFramework('NUXT', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'starter-for-nuxt',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'NUXT_PUBLIC_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'NUXT_PUBLIC_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
[
'name' => 'NUXT_PUBLIC_APPWRITE_PROJECT_NAME',
'description' => 'Your Appwrite project name',
'value' => '{projectName}',
'placeholder' => '{projectName}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'template-for-event',
'name' => 'Event template',
'useCases' => ['events'],
'screenshotDark' => $url . '/images/sites/templates/template-for-event-dark.png',
'screenshotLight' => $url . '/images/sites/templates/template-for-event-light.png',
'frameworks' => [
getFramework('NEXTJS', [
'providerRootDirectory' => './',
'installCommand' => 'pnpm install',
'buildCommand' => 'npm run build',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'template-for-event',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'NEXT_PUBLIC_APPWRITE_FUNCTION_PROJECT_ID',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'NEXT_PUBLIC_APPWRITE_FUNCTION_API_ENDPOINT',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'template-for-portfolio',
'name' => 'Portfolio template',
'useCases' => ['portfolio'],
'screenshotDark' => $url . '/images/sites/templates/template-for-portfolio-dark.png',
'screenshotLight' => $url . '/images/sites/templates/template-for-portfolio-light.png',
'frameworks' => [
getFramework('NEXTJS', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'template-for-portfolio',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => []
],
[
'key' => 'template-for-store',
'name' => 'Store template',
'useCases' => ['ecommerce'],
'screenshotDark' => $url . '/images/sites/templates/template-for-store-dark.png',
'screenshotLight' => $url . '/images/sites/templates/template-for-store-light.png',
'frameworks' => [
getFramework('SVELTEKIT', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'template-for-store',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => [
[
'name' => 'STRIPE_SECRET_KEY',
'description' => 'Your Stripe secret key',
'value' => 'disabled',
'placeholder' => 'sk_.....',
'required' => false,
'type' => 'password'
],
[
'name' => 'PUBLIC_APPWRITE_ENDPOINT',
'description' => 'Endpoint of Appwrite server',
'value' => '{apiEndpoint}',
'placeholder' => '{apiEndpoint}',
'required' => true,
'type' => 'text'
],
[
'name' => 'PUBLIC_APPWRITE_PROJECT_ID',
'description' => 'Your Appwrite project ID',
'value' => '{projectId}',
'placeholder' => '{projectId}',
'required' => true,
'type' => 'text'
],
]
],
[
'key' => 'template-for-blog',
'name' => 'Blog template',
'useCases' => ['blog'],
'screenshotDark' => $url . '/images/sites/templates/template-for-blog-dark.png',
'screenshotLight' => $url . '/images/sites/templates/template-for-blog-light.png',
'frameworks' => [
getFramework('SVELTEKIT', [
'providerRootDirectory' => './',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'template-for-blog',
'providerOwner' => 'appwrite',
'providerVersion' => '0.1.*',
'variables' => []
],
[
'key' => 'astro-starter',
'name' => 'Astro starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/astro-starter-dark.png',
'screenshotLight' => $url . '/images/sites/templates/astro-starter-light.png',
'frameworks' => [
getFramework('ASTRO', [
'providerRootDirectory' => './astro/starter',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.2.*',
'variables' => [],
],
[
'key' => 'remix-starter',
'name' => 'Remix starter',
'useCases' => ['starter'],
'screenshotDark' => $url . '/images/sites/templates/remix-starter-dark.png',
'screenshotLight' => $url . '/images/sites/templates/remix-starter-light.png',
'frameworks' => [
getFramework('REMIX', [
'providerRootDirectory' => './remix/starter',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.2.*',
'variables' => [],
],
];
+30 -4
View File
@@ -268,6 +268,24 @@ return [
'question' => '',
'filter' => ''
],
[
'name' => '_APP_COMPRESSION_ENABLED',
'description' => 'This option allows you to enable or disable the response compression for the Appwrite API. It\'s enabled by default with value "enabled", and to disable it, pass value "disabled".',
'introduction' => '1.6.0',
'default' => 'enabled',
'required' => false,
'question' => '',
'filter' => ''
],
[
'name' => '_APP_COMPRESSION_MIN_SIZE_BYTES',
'description' => 'This option allows you to set the minimum size in bytes for the response compression to be applied. The default value is 1024 bytes.',
'introduction' => '1.6.0',
'default' => 1024,
'required' => false,
'question' => '',
'filter' => ''
]
],
],
[
@@ -554,7 +572,7 @@ return [
],
[
'name' => '_APP_STORAGE_S3_ACCESS_KEY',
'description' => 'AWS S3 storage access key. Required when the storage adapter is set to S3. You can get your access key from your AWS console',
'description' => 'S3 storage access key. Required when the storage adapter is set to S3. You can get your access key from your S3 storage provider',
'introduction' => '0.13.0',
'default' => '',
'required' => false,
@@ -562,7 +580,7 @@ return [
],
[
'name' => '_APP_STORAGE_S3_SECRET',
'description' => 'AWS S3 storage secret key. Required when the storage adapter is set to S3. You can get your secret key from your AWS console.',
'description' => 'S3 storage secret key. Required when the storage adapter is set to S3. You can get your secret key from your S3 storage provider.',
'introduction' => '0.13.0',
'default' => '',
'required' => false,
@@ -570,7 +588,7 @@ return [
],
[
'name' => '_APP_STORAGE_S3_REGION',
'description' => 'AWS S3 storage region. Required when storage adapter is set to S3. You can find your region info for your bucket from AWS console.',
'description' => 'S3 storage region. Required when storage adapter is set to S3. You can find your region info for your bucket from your S3 storage provider.',
'introduction' => '0.13.0',
'default' => 'us-east-1',
'required' => false,
@@ -578,12 +596,20 @@ return [
],
[
'name' => '_APP_STORAGE_S3_BUCKET',
'description' => 'AWS S3 storage bucket. Required when storage adapter is set to S3. You can create buckets in your AWS console.',
'description' => 'S3 storage bucket. Required when storage adapter is set to S3. You can create buckets in your S3 storage provider.',
'introduction' => '0.13.0',
'default' => '',
'required' => false,
'question' => '',
],
[
'name' => '_APP_STORAGE_S3_ENDPOINT',
'description' => 'S3 storage endpoint. Required when using S3 storage providers other than AWS.',
'introduction' => '0.16.2',
'default' => '',
'required' => false,
'question' => '',
],
[
'name' => '_APP_STORAGE_DO_SPACES_ACCESS_KEY',
'description' => 'DigitalOcean spaces access key. Required when the storage adapter is set to DOSpaces. You can get your access key from your DigitalOcean console.',
File diff suppressed because it is too large Load Diff
+118 -64
View File
@@ -1,6 +1,11 @@
<?php
use Appwrite\Extend\Exception;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\MethodType;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\URL\URL as URLParse;
use Appwrite\Utopia\Response;
use chillerlan\QRCode\QRCode;
@@ -61,9 +66,9 @@ $avatarCallback = function (string $type, string $code, int $width, int $height,
unset($image);
};
$getUserGitHub = function (string $userId, Document $project, Database $dbForProject, Database $dbForConsole, ?Logger $logger) {
$getUserGitHub = function (string $userId, Document $project, Database $dbForProject, Database $dbForPlatform, ?Logger $logger) {
try {
$user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId));
$user = Authorization::skip(fn () => $dbForPlatform->getDocument('users', $userId));
$sessions = $user->getAttribute('sessions', []);
@@ -122,7 +127,7 @@ $getUserGitHub = function (string $userId, Document $project, Database $dbForPro
do {
$previousAccessToken = $gitHubSession->getAttribute('providerAccessToken');
$user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId));
$user = Authorization::skip(fn () => $dbForPlatform->getDocument('users', $userId));
$sessions = $user->getAttribute('sessions', []);
$gitHubSession = new Document();
@@ -164,13 +169,20 @@ App::get('/v1/avatars/credit-cards/:code')
->label('scope', 'avatars.read')
->label('cache', true)
->label('cache.resource', 'avatar/credit-card')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getCreditCard')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-credit-card.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE_PNG)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getCreditCard',
description: '/docs/references/avatars/get-credit-card.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE_PNG
))
->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-credit-cards'))), 'Credit Card Code. Possible values: ' . \implode(', ', \array_keys(Config::getParam('avatar-credit-cards'))) . '.')
->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
@@ -184,13 +196,20 @@ App::get('/v1/avatars/browsers/:code')
->label('scope', 'avatars.read')
->label('cache', true)
->label('cache.resource', 'avatar/browser')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getBrowser')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-browser.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE_PNG)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getBrowser',
description: '/docs/references/avatars/get-browser.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE_PNG
))
->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-browsers'))), 'Browser Code.')
->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
@@ -204,13 +223,20 @@ App::get('/v1/avatars/flags/:code')
->label('scope', 'avatars.read')
->label('cache', true)
->label('cache.resource', 'avatar/flag')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFlag')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-flag.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE_PNG)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getFlag',
description: '/docs/references/avatars/get-flag.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE_PNG
))
->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-flags'))), 'Country Code. ISO Alpha-2 country code format.')
->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
@@ -224,13 +250,20 @@ App::get('/v1/avatars/image')
->label('scope', 'avatars.read')
->label('cache', true)
->label('cache.resource', 'avatar/image')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getImage')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-image.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getImage',
description: '/docs/references/avatars/get-image.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE
))
->param('url', '', new URL(['http', 'https']), 'Image URL which you want to crop.')
->param('width', 400, new Range(0, 2000), 'Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.', true)
->param('height', 400, new Range(0, 2000), 'Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.', true)
@@ -287,13 +320,20 @@ App::get('/v1/avatars/favicon')
->label('scope', 'avatars.read')
->label('cache', true)
->label('cache.resource', 'avatar/favicon')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFavicon')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-favicon.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getFavicon',
description: '/docs/references/avatars/get-favicon.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE
))
->param('url', '', new URL(['http', 'https']), 'Website URL which you want to fetch the favicon from.')
->inject('response')
->action(function (string $url, Response $response) {
@@ -430,13 +470,20 @@ App::get('/v1/avatars/qr')
->desc('Get QR code')
->groups(['api', 'avatars'])
->label('scope', 'avatars.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getQR')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-qr.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE_PNG)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getQR',
description: '/docs/references/avatars/get-qr.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE_PNG
))
->param('text', '', new Text(512), 'Plain text to be converted to QR code image.')
->param('size', 400, new Range(1, 1000), 'QR code size. Pass an integer between 1 to 1000. Defaults to 400.', true)
->param('margin', 1, new Range(0, 10), 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true)
@@ -471,13 +518,20 @@ App::get('/v1/avatars/initials')
->groups(['api', 'avatars'])
->label('scope', 'avatars.read')
->label('cache.resource', 'avatar/initials')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getInitials')
->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-initials.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE_PNG)
->label('sdk', new Method(
namespace: 'avatars',
name: 'getInitials',
description: '/docs/references/avatars/get-initials.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
type: MethodType::LOCATION,
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::IMAGE_PNG
))
->param('name', '', new Text(128), 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true)
->param('width', 500, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 500, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
@@ -565,14 +619,14 @@ App::get('/v1/cards/cloud')
->inject('user')
->inject('project')
->inject('dbForProject')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('response')
->inject('heroes')
->inject('contributors')
->inject('employees')
->inject('logger')
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId));
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForPlatform->getDocument('users', $userId));
if ($user->isEmpty() && empty($mock)) {
throw new Exception(Exception::USER_NOT_FOUND);
@@ -583,7 +637,7 @@ App::get('/v1/cards/cloud')
$email = $user->getAttribute('email', '');
$createdAt = new \DateTime($user->getCreatedAt());
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForConsole, $logger);
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger);
$githubName = $gitHub['name'] ?? '';
$githubId = $gitHub['id'] ?? '';
@@ -772,14 +826,14 @@ App::get('/v1/cards/cloud-back')
->inject('user')
->inject('project')
->inject('dbForProject')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('response')
->inject('heroes')
->inject('contributors')
->inject('employees')
->inject('logger')
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId));
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForPlatform->getDocument('users', $userId));
if ($user->isEmpty() && empty($mock)) {
throw new Exception(Exception::USER_NOT_FOUND);
@@ -789,7 +843,7 @@ App::get('/v1/cards/cloud-back')
$userId = $user->getId();
$email = $user->getAttribute('email', '');
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForConsole, $logger);
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger);
$githubId = $gitHub['id'] ?? '';
$isHero = \array_key_exists($email, $heroes);
@@ -850,14 +904,14 @@ App::get('/v1/cards/cloud-og')
->inject('user')
->inject('project')
->inject('dbForProject')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('response')
->inject('heroes')
->inject('contributors')
->inject('employees')
->inject('logger')
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId));
->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForPlatform, Response $response, array $heroes, array $contributors, array $employees, ?Logger $logger) use ($getUserGitHub) {
$user = Authorization::skip(fn () => $dbForPlatform->getDocument('users', $userId));
if ($user->isEmpty() && empty($mock)) {
throw new Exception(Exception::USER_NOT_FOUND);
@@ -872,7 +926,7 @@ App::get('/v1/cards/cloud-og')
$email = $user->getAttribute('email', '');
$createdAt = new \DateTime($user->getCreatedAt());
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForConsole, $logger);
$gitHub = $getUserGitHub($user->getId(), $project, $dbForProject, $dbForPlatform, $logger);
$githubName = $gitHub['name'] ?? '';
$githubId = $gitHub['id'] ?? '';
+36 -16
View File
@@ -1,6 +1,10 @@
<?php
use Appwrite\Extend\Exception;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Database\Document;
@@ -21,13 +25,19 @@ App::get('/v1/console/variables')
->desc('Get variables')
->groups(['api', 'projects'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'console')
->label('sdk.method', 'variables')
->label('sdk.description', '/docs/references/console/variables.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_CONSOLE_VARIABLES)
->label('sdk', new Method(
namespace: 'console',
name: 'variables',
description: '/docs/references/console/variables.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_CONSOLE_VARIABLES,
)
],
contentType: ContentType::JSON
))
->inject('response')
->action(function (Response $response) {
$isDomainEnabled = !empty(System::getEnv('_APP_DOMAIN', ''))
@@ -46,11 +56,14 @@ App::get('/v1/console/variables')
$variables = new Document([
'_APP_DOMAIN_TARGET' => System::getEnv('_APP_DOMAIN_TARGET'),
'_APP_STORAGE_LIMIT' => +System::getEnv('_APP_STORAGE_LIMIT'),
'_APP_FUNCTIONS_SIZE_LIMIT' => +System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT'),
'_APP_COMPUTE_SIZE_LIMIT' => +System::getEnv('_APP_COMPUTE_SIZE_LIMIT'),
'_APP_USAGE_STATS' => System::getEnv('_APP_USAGE_STATS'),
'_APP_VCS_ENABLED' => $isVcsEnabled,
'_APP_DOMAIN_ENABLED' => $isDomainEnabled,
'_APP_ASSISTANT_ENABLED' => $isAssistantEnabled
'_APP_ASSISTANT_ENABLED' => $isAssistantEnabled,
'_APP_DOMAIN_SITES' => System::getEnv('_APP_DOMAIN_SITES'),
'_APP_OPTIONS_FORCE_HTTPS' => System::getEnv('_APP_OPTIONS_FORCE_HTTPS'),
'_APP_DOMAINS_NAMESERVERS' => System::getEnv('_APP_DOMAINS_NAMESERVERS'),
]);
$response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES);
@@ -60,18 +73,25 @@ App::post('/v1/console/assistant')
->desc('Ask query')
->groups(['api', 'assistant'])
->label('scope', 'assistant.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'assistant')
->label('sdk.method', 'chat')
->label('sdk.description', '/docs/references/assistant/chat.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_TEXT)
->label('sdk', new Method(
namespace: 'assistant',
name: 'chat',
description: '/docs/references/assistant/chat.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::TEXT
))
->label('abuse-limit', 15)
->label('abuse-key', 'userId:{userId}')
->param('prompt', '', new Text(2000), 'Prompt. A string containing questions asked to the AI assistant.')
->inject('response')
->action(function (string $prompt, Response $response) {
$ch = curl_init('http://appwrite-assistant:3003/');
$ch = curl_init('http://appwrite-assistant:3003/v1/models/assistant/prompt');
$responseHeaders = [];
$query = json_encode(['prompt' => $prompt]);
$headers = ['accept: text/event-stream'];
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+49 -29
View File
@@ -5,6 +5,10 @@ use Appwrite\Extend\Exception;
use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\GraphQL\Promises\Adapter;
use Appwrite\GraphQL\Schema;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\MethodType;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use GraphQL\Error\DebugFlag;
@@ -38,13 +42,19 @@ App::get('/v1/graphql')
->desc('GraphQL endpoint')
->groups(['graphql'])
->label('scope', 'graphql')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'graphql')
->label('sdk.hide', true)
->label('sdk.description', '/docs/references/graphql/get.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_ANY)
->label('sdk', new Method(
namespace: 'graphql',
name: 'get',
auth: [AuthType::KEY, AuthType::SESSION, AuthType::JWT],
hide: true,
description: '/docs/references/graphql/get.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_ANY,
)
]
))
->label('abuse-limit', 60)
->label('abuse-time', 60)
->param('query', '', new Text(0, 0), 'The query to execute.')
@@ -78,17 +88,22 @@ App::post('/v1/graphql/mutation')
->desc('GraphQL endpoint')
->groups(['graphql'])
->label('scope', 'graphql')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'graphql')
->label('sdk.method', 'mutation')
->label('sdk.methodType', 'graphql')
->label('sdk.description', '/docs/references/graphql/post.md')
->label('sdk.parameters', [
'query' => ['default' => [], 'validator' => new JSON(), 'description' => 'The query or queries to execute.', 'optional' => false],
])
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_ANY)
->label('sdk', new Method(
namespace: 'graphql',
name: 'mutation',
auth: [AuthType::KEY, AuthType::SESSION, AuthType::JWT],
description: '/docs/references/graphql/post.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_ANY,
)
],
type: MethodType::GRAPHQL,
additionalParameters: [
'query' => ['default' => [], 'validator' => new JSON(), 'description' => 'The query or queries to execute.', 'optional' => false],
],
))
->label('abuse-limit', 60)
->label('abuse-time', 60)
->inject('request')
@@ -123,17 +138,22 @@ App::post('/v1/graphql')
->desc('GraphQL endpoint')
->groups(['graphql'])
->label('scope', 'graphql')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'graphql')
->label('sdk.method', 'query')
->label('sdk.methodType', 'graphql')
->label('sdk.description', '/docs/references/graphql/post.md')
->label('sdk.parameters', [
'query' => ['default' => [], 'validator' => new JSON(), 'description' => 'The query or queries to execute.', 'optional' => false],
])
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_ANY)
->label('sdk', new Method(
namespace: 'graphql',
name: 'query',
auth: [AuthType::KEY, AuthType::SESSION, AuthType::JWT],
description: '/docs/references/graphql/post.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_ANY,
)
],
type: MethodType::GRAPHQL,
additionalParameters: [
'query' => ['default' => [], 'validator' => new JSON(), 'description' => 'The query or queries to execute.', 'optional' => false],
],
))
->label('abuse-limit', 60)
->label('abuse-time', 60)
->inject('request')
+372 -275
View File
@@ -3,14 +3,18 @@
use Appwrite\ClamAV\Network;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Config\Config;
use Utopia\Database\Document;
use Utopia\Domains\Validator\PublicDomain;
use Utopia\Pools\Group;
use Utopia\Queue\Client;
use Utopia\Queue\Connection;
use Utopia\Queue\Publisher;
use Utopia\Queue\Queue;
use Utopia\Registry\Registry;
use Utopia\Storage\Device;
use Utopia\Storage\Device\Local;
@@ -26,13 +30,19 @@ App::get('/v1/health')
->desc('Get HTTP')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/health/get.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
namespace: 'health',
name: 'get',
auth: [AuthType::KEY],
description: '/docs/references/health/get.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->action(function (Response $response) {
@@ -49,9 +59,6 @@ App::get('/v1/health/version')
->desc('Get version')
->groups(['api', 'health'])
->label('scope', 'public')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_VERSION)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'version' => APP_VERSION_STABLE ]), Response::MODEL_HEALTH_VERSION);
@@ -61,13 +68,19 @@ App::get('/v1/health/db')
->desc('Get DB')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getDB')
->label('sdk.description', '/docs/references/health/get-db.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getDB',
description: '/docs/references/health/get-db.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
@@ -115,13 +128,19 @@ App::get('/v1/health/cache')
->desc('Get cache')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getCache')
->label('sdk.description', '/docs/references/health/get-cache.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getCache',
description: '/docs/references/health/get-cache.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
@@ -169,74 +188,23 @@ App::get('/v1/health/cache')
]), Response::MODEL_HEALTH_STATUS_LIST);
});
App::get('/v1/health/queue')
->desc('Get queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueue')
->label('sdk.description', '/docs/references/health/get-queue.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
$output = [];
$configs = [
'Queue' => Config::getParam('pools-queue'),
];
foreach ($configs as $key => $config) {
foreach ($config as $database) {
$checkStart = \microtime(true);
try {
/** @var Connection $adapter */
$adapter = $pools->get($database)->pop()->getResource();
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'pass',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} else {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
}
} catch (\Throwable $th) {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
}
}
}
$response->dynamic(new Document([
'statuses' => $output,
'total' => count($output),
]), Response::MODEL_HEALTH_STATUS_LIST);
});
App::get('/v1/health/pubsub')
->desc('Get pubsub')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getPubSub')
->label('sdk.description', '/docs/references/health/get-pubsub.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getPubSub',
description: '/docs/references/health/get-pubsub.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
@@ -288,13 +256,19 @@ App::get('/v1/health/time')
->desc('Get time')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getTime')
->label('sdk.description', '/docs/references/health/get-time.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_TIME)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getTime',
description: '/docs/references/health/get-time.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_TIME,
)
],
contentType: ContentType::JSON
))
->inject('response')
->action(function (Response $response) {
@@ -345,21 +319,26 @@ App::get('/v1/health/queue/webhooks')
->desc('Get webhooks queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueWebhooks')
->label('sdk.description', '/docs/references/health/get-queue-webhooks.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueWebhooks',
description: '/docs/references/health/get-queue-webhooks.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::WEBHOOK_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::WEBHOOK_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -372,21 +351,26 @@ App::get('/v1/health/queue/logs')
->desc('Get logs queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueLogs')
->label('sdk.description', '/docs/references/health/get-queue-logs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueLogs',
description: '/docs/references/health/get-queue-logs.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::AUDITS_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::AUDITS_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -399,13 +383,19 @@ App::get('/v1/health/certificate')
->desc('Get the SSL certificate for a domain')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getCertificate')
->label('sdk.description', '/docs/references/health/get-certificate.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_CERTIFICATE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getCertificate',
description: '/docs/references/health/get-certificate.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_CERTIFICATE,
)
],
contentType: ContentType::JSON
))
->param('domain', null, new Multiple([new Domain(), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name')
->inject('response')
->action(function (string $domain, Response $response) {
@@ -449,21 +439,26 @@ App::get('/v1/health/queue/certificates')
->desc('Get certificates queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueCertificates')
->label('sdk.description', '/docs/references/health/get-queue-certificates.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueCertificates',
description: '/docs/references/health/get-queue-certificates.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::CERTIFICATES_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::CERTIFICATES_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -476,21 +471,26 @@ App::get('/v1/health/queue/builds')
->desc('Get builds queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueBuilds')
->label('sdk.description', '/docs/references/health/get-queue-builds.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueBuilds',
description: '/docs/references/health/get-queue-builds.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::BUILDS_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::BUILDS_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -503,22 +503,27 @@ App::get('/v1/health/queue/databases')
->desc('Get databases queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueDatabases')
->label('sdk.description', '/docs/references/health/get-queue-databases.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueDatabases',
description: '/docs/references/health/get-queue-databases.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('name', 'database_db_main', new Text(256), 'Queue name for which to check the queue size', true)
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (string $name, int|string $threshold, Connection $queue, Response $response) {
->action(function (string $name, int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client($name, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue($name));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -531,21 +536,26 @@ App::get('/v1/health/queue/deletes')
->desc('Get deletes queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueDeletes')
->label('sdk.description', '/docs/references/health/get-queue-deletes.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueDeletes',
description: '/docs/references/health/get-queue-deletes.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::DELETE_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::DELETE_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -558,21 +568,26 @@ App::get('/v1/health/queue/mails')
->desc('Get mails queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMails')
->label('sdk.description', '/docs/references/health/get-queue-mails.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueMails',
description: '/docs/references/health/get-queue-mails.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::MAILS_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::MAILS_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -585,21 +600,26 @@ App::get('/v1/health/queue/messaging')
->desc('Get messaging queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMessaging')
->label('sdk.description', '/docs/references/health/get-queue-messaging.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueMessaging',
description: '/docs/references/health/get-queue-messaging.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::MESSAGING_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::MESSAGING_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -612,21 +632,26 @@ App::get('/v1/health/queue/migrations')
->desc('Get migrations queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMigrations')
->label('sdk.description', '/docs/references/health/get-queue-migrations.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueMigrations',
description: '/docs/references/health/get-queue-migrations.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::MIGRATIONS_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::MIGRATIONS_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -639,21 +664,26 @@ App::get('/v1/health/queue/functions')
->desc('Get functions queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueFunctions')
->label('sdk.description', '/docs/references/health/get-queue-functions.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueFunctions',
description: '/docs/references/health/get-queue-functions.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::FUNCTIONS_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -662,25 +692,30 @@ App::get('/v1/health/queue/functions')
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/usage')
->desc('Get usage queue')
App::get('/v1/health/queue/stats-resources')
->desc('Get stats resources queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueUsage')
->label('sdk.description', '/docs/references/health/get-queue-usage.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueStatsResources',
description: '/docs/references/health/get-queue-stats-resources.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::USAGE_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::STATS_RESOURCES_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -689,25 +724,62 @@ App::get('/v1/health/queue/usage')
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
});
App::get('/v1/health/queue/usage-dump')
App::get('/v1/health/queue/stats-usage')
->desc('Get stats usage queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueUsage',
description: '/docs/references/health/get-queue-stats-usage.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$size = $publisher->getQueueSize(new Queue(Event::STATS_USAGE_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
});
App::get('/v1/health/queue/stats-usage-dump')
->desc('Get usage dump queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueUsageDump')
->label('sdk.description', '/docs/references/health/get-queue-usage-dump.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getQueueStatsUsageDump',
description: '/docs/references/health/get-queue-stats-usage-dump.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('queue')
->inject('publisher')
->inject('response')
->action(function (int|string $threshold, Connection $queue, Response $response) {
->action(function (int|string $threshold, Publisher $publisher, Response $response) {
$threshold = \intval($threshold);
$client = new Client(Event::USAGE_DUMP_QUEUE_NAME, $queue);
$size = $client->getQueueSize();
$size = $publisher->getQueueSize(new Queue(Event::STATS_USAGE_DUMP_QUEUE_NAME));
if ($size >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
@@ -720,13 +792,19 @@ App::get('/v1/health/storage/local')
->desc('Get local storage')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getStorageLocal')
->label('sdk.description', '/docs/references/health/get-storage-local.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getStorageLocal',
description: '/docs/references/health/get-storage-local.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->action(function (Response $response) {
@@ -763,19 +841,26 @@ App::get('/v1/health/storage')
->desc('Get storage')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getStorage')
->label('sdk.description', '/docs/references/health/get-storage.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getStorage',
description: '/docs/references/health/get-storage.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_STATUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->inject('deviceForFiles')
->inject('deviceForFunctions')
->inject('deviceForSites')
->inject('deviceForBuilds')
->action(function (Response $response, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds) {
$devices = [$deviceForFiles, $deviceForFunctions, $deviceForBuilds];
->action(function (Response $response, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForSites, Device $deviceForBuilds) {
$devices = [$deviceForFiles, $deviceForFunctions, $deviceForSites, $deviceForBuilds];
$checkStart = \microtime(true);
foreach ($devices as $device) {
@@ -804,13 +889,19 @@ App::get('/v1/health/anti-virus')
->desc('Get antivirus')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getAntivirus')
->label('sdk.description', '/docs/references/health/get-storage-anti-virus.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_ANTIVIRUS)
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getAntivirus',
description: '/docs/references/health/get-storage-anti-virus.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_ANTIVIRUS,
)
],
contentType: ContentType::JSON
))
->inject('response')
->action(function (Response $response) {
@@ -843,17 +934,28 @@ App::get('/v1/health/queue/failed/:name')
->desc('Get number of failed queue jobs')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getFailedJobs')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
name: 'getFailedJobs',
description: '/docs/references/health/get-failed-queue-jobs.md',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('name', '', new WhiteList([
Event::DATABASE_QUEUE_NAME,
Event::DELETE_QUEUE_NAME,
Event::AUDITS_QUEUE_NAME,
Event::MAILS_QUEUE_NAME,
Event::FUNCTIONS_QUEUE_NAME,
Event::USAGE_QUEUE_NAME,
Event::USAGE_DUMP_QUEUE_NAME,
Event::STATS_RESOURCES_QUEUE_NAME,
Event::STATS_USAGE_QUEUE_NAME,
Event::STATS_USAGE_DUMP_QUEUE_NAME,
Event::WEBHOOK_QUEUE_NAME,
Event::CERTIFICATES_QUEUE_NAME,
Event::BUILDS_QUEUE_NAME,
@@ -861,17 +963,12 @@ App::get('/v1/health/queue/failed/:name')
Event::MIGRATIONS_QUEUE_NAME
]), 'The name of the queue')
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->label('sdk.description', '/docs/references/health/get-failed-queue-jobs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->inject('queue')
->action(function (string $name, int|string $threshold, Response $response, Connection $queue) {
->inject('publisher')
->action(function (string $name, int|string $threshold, Response $response, Publisher $publisher) {
$threshold = \intval($threshold);
$client = new Client($name, $queue);
$failed = $client->countFailedJobs();
$failed = $publisher->getQueueSize(new Queue($name), failedJobs: true);
if ($failed >= $threshold) {
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue failed jobs threshold hit. Current size is {$failed} and threshold is {$threshold}.");
+101 -74
View File
@@ -1,5 +1,8 @@
<?php
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use MaxMind\Db\Reader;
@@ -12,15 +15,18 @@ App::get('/v1/locale')
->desc('Get user locale')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/locale/get-locale.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LOCALE)
->label('sdk.offline.model', '/localed')
->label('sdk.offline.key', 'current')
->label('sdk', new Method(
namespace: 'locale',
name: 'get',
description: '/docs/references/locale/get-locale.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_LOCALE,
)
]
))
->inject('request')
->inject('response')
->inject('locale')
@@ -72,15 +78,18 @@ App::get('/v1/locale/codes')
->desc('List locale codes')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listCodes')
->label('sdk.description', '/docs/references/locale/list-locale-codes.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LOCALE_CODE_LIST)
->label('sdk.offline.model', '/locale/localeCode')
->label('sdk.offline.key', 'current')
->label('sdk', new Method(
namespace: 'locale',
name: 'listCodes',
description: '/docs/references/locale/list-locale-codes.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_LOCALE_CODE_LIST,
)
]
))
->inject('response')
->action(function (Response $response) {
$codes = Config::getParam('locale-codes');
@@ -94,19 +103,22 @@ App::get('/v1/locale/countries')
->desc('List countries')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listCountries')
->label('sdk.description', '/docs/references/locale/list-countries.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_COUNTRY_LIST)
->label('sdk.offline.model', '/locale/countries')
->label('sdk.offline.response.key', 'code')
->label('sdk', new Method(
namespace: 'locale',
name: 'listCountries',
description: '/docs/references/locale/list-countries.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_COUNTRY_LIST,
)
]
))
->inject('response')
->inject('locale')
->action(function (Response $response, Locale $locale) {
$list = Config::getParam('locale-countries'); /* @var $list array */
$list = array_keys(Config::getParam('locale-countries')); /* @var $list array */
$output = [];
foreach ($list as $value) {
@@ -127,15 +139,18 @@ App::get('/v1/locale/countries/eu')
->desc('List EU countries')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listCountriesEU')
->label('sdk.description', '/docs/references/locale/list-countries-eu.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_COUNTRY_LIST)
->label('sdk.offline.model', '/locale/countries/eu')
->label('sdk.offline.response.key', 'code')
->label('sdk', new Method(
namespace: 'locale',
name: 'listCountriesEU',
description: '/docs/references/locale/list-countries-eu.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_COUNTRY_LIST,
)
]
))
->inject('response')
->inject('locale')
->action(function (Response $response, Locale $locale) {
@@ -162,15 +177,18 @@ App::get('/v1/locale/countries/phones')
->desc('List countries phone codes')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listCountriesPhones')
->label('sdk.description', '/docs/references/locale/list-countries-phones.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PHONE_LIST)
->label('sdk.offline.model', '/locale/countries/phones')
->label('sdk.offline.response.key', 'countryCode')
->label('sdk', new Method(
namespace: 'locale',
name: 'listCountriesPhones',
description: '/docs/references/locale/list-countries-phones.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PHONE_LIST,
)
]
))
->inject('response')
->inject('locale')
->action(function (Response $response, Locale $locale) {
@@ -196,19 +214,22 @@ App::get('/v1/locale/continents')
->desc('List continents')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listContinents')
->label('sdk.description', '/docs/references/locale/list-continents.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_CONTINENT_LIST)
->label('sdk.offline.model', '/locale/continents')
->label('sdk.offline.response.key', 'code')
->label('sdk', new Method(
namespace: 'locale',
name: 'listContinents',
description: '/docs/references/locale/list-continents.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_CONTINENT_LIST,
)
]
))
->inject('response')
->inject('locale')
->action(function (Response $response, Locale $locale) {
$list = Config::getParam('locale-continents');
$list = array_keys(Config::getParam('locale-continents'));
foreach ($list as $value) {
$output[] = new Document([
@@ -228,15 +249,18 @@ App::get('/v1/locale/currencies')
->desc('List currencies')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listCurrencies')
->label('sdk.description', '/docs/references/locale/list-currencies.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_CURRENCY_LIST)
->label('sdk.offline.model', '/locale/currencies')
->label('sdk.offline.response.key', 'code')
->label('sdk', new Method(
namespace: 'locale',
name: 'listCurrencies',
description: '/docs/references/locale/list-currencies.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_CURRENCY_LIST,
)
]
))
->inject('response')
->action(function (Response $response) {
$list = Config::getParam('locale-currencies');
@@ -251,15 +275,18 @@ App::get('/v1/locale/languages')
->desc('List languages')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'listLanguages')
->label('sdk.description', '/docs/references/locale/list-languages.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LANGUAGE_LIST)
->label('sdk.offline.model', '/locale/languages')
->label('sdk.offline.response.key', 'code')
->label('sdk', new Method(
namespace: 'locale',
name: 'listLanguages',
description: '/docs/references/locale/list-languages.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_LANGUAGE_LIST,
)
]
))
->inject('response')
->action(function (Response $response) {
$list = Config::getParam('locale-languages');
File diff suppressed because it is too large Load Diff
+153 -558
View File
@@ -1,17 +1,16 @@
<?php
use Appwrite\Auth\OAuth2\Firebase as OAuth2Firebase;
use Appwrite\Event\Event;
use Appwrite\Event\Migration;
use Appwrite\Extend\Exception;
use Appwrite\Permission;
use Appwrite\Role;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Migrations;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Helpers\ID;
@@ -22,9 +21,7 @@ use Utopia\Migration\Sources\Appwrite;
use Utopia\Migration\Sources\Firebase;
use Utopia\Migration\Sources\NHost;
use Utopia\Migration\Sources\Supabase;
use Utopia\System\System;
use Utopia\Validator\ArrayList;
use Utopia\Validator\Host;
use Utopia\Validator\Integer;
use Utopia\Validator\Text;
use Utopia\Validator\URL;
@@ -38,17 +35,22 @@ App::post('/v1/migrations/appwrite')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createAppwriteMigration')
->label('sdk.description', '/docs/references/migrations/migration-appwrite.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'createAppwriteMigration',
description: '/docs/references/migrations/migration-appwrite.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_ACCEPTED,
model: Response::MODEL_MIGRATION,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Appwrite::getSupportedResources())), 'List of resources to migrate')
->param('endpoint', '', new URL(), "Source's Appwrite Endpoint")
->param('projectId', '', new UID(), "Source's Project ID")
->param('apiKey', '', new Text(512), "Source's API Key")
->param('endpoint', '', new URL(), 'Source Appwrite endpoint')
->param('projectId', '', new UID(), 'Source Project ID')
->param('apiKey', '', new Text(512), 'Source API Key')
->inject('response')
->inject('dbForProject')
->inject('project')
@@ -87,122 +89,25 @@ App::post('/v1/migrations/appwrite')
->dynamic($migration, Response::MODEL_MIGRATION);
});
App::post('/v1/migrations/firebase/oauth')
->groups(['api', 'migrations'])
->desc('Migrate Firebase data (OAuth)')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createFirebaseOAuthMigration')
->label('sdk.description', '/docs/references/migrations/migration-firebase.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->param('resources', [], new ArrayList(new WhiteList(Firebase::getSupportedResources())), 'List of resources to migrate')
->param('projectId', '', new Text(65536), 'Project ID of the Firebase Project')
->inject('response')
->inject('dbForProject')
->inject('dbForConsole')
->inject('project')
->inject('user')
->inject('queueForEvents')
->inject('queueForMigrations')
->inject('request')
->action(function (array $resources, string $projectId, Response $response, Database $dbForProject, Database $dbForConsole, Document $project, Document $user, Event $queueForEvents, Migration $queueForMigrations, Request $request) {
$firebase = new OAuth2Firebase(
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
);
$identity = $dbForConsole->findOne('identities', [
Query::equal('provider', ['firebase']),
Query::equal('userInternalId', [$user->getInternalId()]),
]);
if ($identity->isEmpty()) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$accessToken = $identity->getAttribute('providerAccessToken');
$refreshToken = $identity->getAttribute('providerRefreshToken');
$accessTokenExpiry = $identity->getAttribute('providerAccessTokenExpiry');
$isExpired = new \DateTime($accessTokenExpiry) < new \DateTime('now');
if ($isExpired) {
$firebase->refreshTokens($refreshToken);
$accessToken = $firebase->getAccessToken('');
$refreshToken = $firebase->getRefreshToken('');
$verificationId = $firebase->getUserID($accessToken);
if (empty($verificationId)) {
throw new Exception(Exception::GENERAL_RATE_LIMIT_EXCEEDED, 'Another request is currently refreshing OAuth token. Please try again.');
}
$identity = $identity
->setAttribute('providerAccessToken', $accessToken)
->setAttribute('providerRefreshToken', $refreshToken)
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$firebase->getAccessTokenExpiry('')));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
}
if ($identity->getAttribute('secrets')) {
$serviceAccount = $identity->getAttribute('secrets');
} else {
$firebase->cleanupServiceAccounts($accessToken, $projectId);
$serviceAccount = $firebase->createServiceAccount($accessToken, $projectId);
$identity = $identity
->setAttribute('secrets', json_encode($serviceAccount));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
}
$migration = $dbForProject->createDocument('migrations', new Document([
'$id' => ID::unique(),
'status' => 'pending',
'stage' => 'init',
'source' => Firebase::getName(),
'destination' => Appwrite::getName(),
'credentials' => [
'serviceAccount' => json_encode($serviceAccount),
],
'resources' => $resources,
'statusCounters' => '{}',
'resourceData' => '{}',
'errors' => []
]));
$queueForEvents->setParam('migrationId', $migration->getId());
// Trigger Transfer
$queueForMigrations
->setMigration($migration)
->setProject($project)
->setUser($user)
->trigger();
$response
->setStatusCode(Response::STATUS_CODE_ACCEPTED)
->dynamic($migration, Response::MODEL_MIGRATION);
});
App::post('/v1/migrations/firebase')
->groups(['api', 'migrations'])
->desc('Migrate Firebase data (Service Account)')
->desc('Migrate Firebase data')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createFirebaseMigration')
->label('sdk.description', '/docs/references/migrations/migration-firebase.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'createFirebaseMigration',
description: '/docs/references/migrations/migration-firebase.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_ACCEPTED,
model: Response::MODEL_MIGRATION,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Firebase::getSupportedResources())), 'List of resources to migrate')
->param('serviceAccount', '', new Text(65536), 'JSON of the Firebase service account credentials')
->inject('response')
@@ -257,13 +162,18 @@ App::post('/v1/migrations/supabase')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createSupabaseMigration')
->label('sdk.description', '/docs/references/migrations/migration-supabase.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'createSupabaseMigration',
description: '/docs/references/migrations/migration-supabase.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_ACCEPTED,
model: Response::MODEL_MIGRATION,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Supabase::getSupportedResources(), true)), 'List of resources to migrate')
->param('endpoint', '', new URL(), 'Source\'s Supabase Endpoint')
->param('apiKey', '', new Text(512), 'Source\'s API Key')
@@ -318,13 +228,18 @@ App::post('/v1/migrations/nhost')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createNHostMigration')
->label('sdk.description', '/docs/references/migrations/migration-nhost.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'createNHostMigration',
description: '/docs/references/migrations/migration-nhost.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_ACCEPTED,
model: Response::MODEL_MIGRATION,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(NHost::getSupportedResources())), 'List of resources to migrate')
->param('subdomain', '', new Text(512), 'Source\'s Subdomain')
->param('region', '', new Text(512), 'Source\'s Region')
@@ -379,13 +294,18 @@ App::get('/v1/migrations')
->groups(['api', 'migrations'])
->desc('List migrations')
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'list')
->label('sdk.description', '/docs/references/migrations/list-migrations.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_LIST)
->label('sdk', new Method(
namespace: 'migrations',
name: 'list',
description: '/docs/references/migrations/list-migrations.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION_LIST,
)
]
))
->param('queries', [], new Migrations(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Migrations::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
@@ -438,13 +358,18 @@ App::get('/v1/migrations/:migrationId')
->groups(['api', 'migrations'])
->desc('Get migration')
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/migrations/get-migration.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'get',
description: '/docs/references/migrations/get-migration.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION,
)
]
))
->param('migrationId', '', new UID(), 'Migration unique ID.')
->inject('response')
->inject('dbForProject')
@@ -462,13 +387,18 @@ App::get('/v1/migrations/appwrite/report')
->groups(['api', 'migrations'])
->desc('Generate a report on Appwrite data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'getAppwriteReport')
->label('sdk.description', '/docs/references/migrations/migration-appwrite-report.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
->label('sdk', new Method(
namespace: 'migrations',
name: 'getAppwriteReport',
description: '/docs/references/migrations/migration-appwrite-report.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION_REPORT,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Appwrite::getSupportedResources())), 'List of resources to migrate')
->param('endpoint', '', new URL(), "Source's Appwrite Endpoint")
->param('projectID', '', new Text(512), "Source's Project ID")
@@ -504,13 +434,18 @@ App::get('/v1/migrations/firebase/report')
->groups(['api', 'migrations'])
->desc('Generate a report on Firebase data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'getFirebaseReport')
->label('sdk.description', '/docs/references/migrations/migration-firebase-report.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
->label('sdk', new Method(
namespace: 'migrations',
name: 'getFirebaseReport',
description: '/docs/references/migrations/migration-firebase-report.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION_REPORT,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Firebase::getSupportedResources())), 'List of resources to migrate')
->param('serviceAccount', '', new Text(65536), 'JSON of the Firebase service account credentials')
->inject('response')
@@ -547,379 +482,22 @@ App::get('/v1/migrations/firebase/report')
->dynamic(new Document($report), Response::MODEL_MIGRATION_REPORT);
});
App::get('/v1/migrations/firebase/report/oauth')
->groups(['api', 'migrations'])
->desc('Generate a report on Firebase data using OAuth')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'getFirebaseReportOAuth')
->label('sdk.description', '/docs/references/migrations/migration-firebase-report.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
->param('resources', [], new ArrayList(new WhiteList(Firebase::getSupportedResources())), 'List of resources to migrate')
->param('projectId', '', new Text(65536), 'Project ID')
->inject('response')
->inject('request')
->inject('user')
->inject('dbForConsole')
->action(function (array $resources, string $projectId, Response $response, Request $request, Document $user, Database $dbForConsole) {
$firebase = new OAuth2Firebase(
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
);
$identity = $dbForConsole->findOne('identities', [
Query::equal('provider', ['firebase']),
Query::equal('userInternalId', [$user->getInternalId()]),
]);
if ($identity->isEmpty()) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$accessToken = $identity->getAttribute('providerAccessToken');
$refreshToken = $identity->getAttribute('providerRefreshToken');
$accessTokenExpiry = $identity->getAttribute('providerAccessTokenExpiry');
if (empty($accessToken) || empty($refreshToken) || empty($accessTokenExpiry)) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
if (System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$isExpired = new \DateTime($accessTokenExpiry) < new \DateTime('now');
if ($isExpired) {
$firebase->refreshTokens($refreshToken);
$accessToken = $firebase->getAccessToken('');
$refreshToken = $firebase->getRefreshToken('');
$verificationId = $firebase->getUserID($accessToken);
if (empty($verificationId)) {
throw new Exception(Exception::GENERAL_RATE_LIMIT_EXCEEDED, 'Another request is currently refreshing OAuth token. Please try again.');
}
$identity = $identity
->setAttribute('providerAccessToken', $accessToken)
->setAttribute('providerRefreshToken', $refreshToken)
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$firebase->getAccessTokenExpiry('')));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
}
// Get Service Account
if ($identity->getAttribute('secrets')) {
$serviceAccount = $identity->getAttribute('secrets');
} else {
$firebase->cleanupServiceAccounts($accessToken, $projectId);
$serviceAccount = $firebase->createServiceAccount($accessToken, $projectId);
$identity = $identity
->setAttribute('secrets', json_encode($serviceAccount));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
}
$firebase = new Firebase($serviceAccount);
try {
$report = $firebase->report($resources);
} catch (\Throwable $e) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Source Error: ' . $e->getMessage());
}
$response
->setStatusCode(Response::STATUS_CODE_OK)
->dynamic(new Document($report), Response::MODEL_MIGRATION_REPORT);
});
App::get('/v1/migrations/firebase/connect')
->desc('Authorize with Firebase')
->groups(['api', 'migrations'])
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'createFirebaseAuth')
->label('sdk.description', '')
->label('sdk.response.code', Response::STATUS_CODE_MOVED_PERMANENTLY)
->label('sdk.response.type', Response::CONTENT_TYPE_HTML)
->label('sdk.methodType', 'webAuth')
->label('sdk.hide', true)
->param('redirect', '', fn ($clients) => new Host($clients), 'URL to redirect back to your Firebase authorization. Only console hostnames are allowed.', true, ['clients'])
->param('projectId', '', new UID(), 'Project ID')
->inject('response')
->inject('request')
->inject('user')
->inject('dbForConsole')
->action(function (string $redirect, string $projectId, Response $response, Request $request, Document $user, Database $dbForConsole) {
$state = \json_encode([
'projectId' => $projectId,
'redirect' => $redirect,
]);
$prefs = $user->getAttribute('prefs', []);
$prefs['migrationState'] = $state;
$user->setAttribute('prefs', $prefs);
$dbForConsole->updateDocument('users', $user->getId(), $user);
$oauth2 = new OAuth2Firebase(
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
);
$url = $oauth2->getLoginURL();
$response
->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
->addHeader('Pragma', 'no-cache')
->redirect($url);
});
App::get('/v1/migrations/firebase/redirect')
->desc('Capture and receive data on Firebase authorization')
->groups(['api', 'migrations'])
->label('scope', 'public')
->label('error', __DIR__ . '/../../views/general/error.phtml')
->param('code', '', new Text(2048), 'OAuth2 code. This is a temporary code that the will be later exchanged for an access token.', true)
->inject('user')
->inject('project')
->inject('request')
->inject('response')
->inject('dbForConsole')
->action(function (string $code, Document $user, Document $project, Request $request, Response $response, Database $dbForConsole) {
$state = $user['prefs']['migrationState'] ?? '{}';
$prefs['migrationState'] = '';
$user->setAttribute('prefs', $prefs);
$dbForConsole->updateDocument('users', $user->getId(), $user);
if (empty($state)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Installation requests from organisation members for the Appwrite Google App are currently unsupported.');
}
$state = \json_decode($state, true);
$redirect = $state['redirect'] ?? '';
$projectId = $state['projectId'] ?? '';
$project = $dbForConsole->getDocument('projects', $projectId);
if (empty($redirect)) {
$redirect = $request->getProtocol() . '://' . $request->getHostname() . '/console/project-$projectId/settings/migrations';
}
if ($project->isEmpty()) {
$response
->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
->addHeader('Pragma', 'no-cache')
->redirect($redirect);
return;
}
// OAuth Authroization
if (!empty($code)) {
$oauth2 = new OAuth2Firebase(
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
);
$accessToken = $oauth2->getAccessToken($code);
$refreshToken = $oauth2->getRefreshToken($code);
$accessTokenExpiry = $oauth2->getAccessTokenExpiry($code);
$email = $oauth2->getUserEmail($accessToken);
$oauth2ID = $oauth2->getUserID($accessToken);
if (empty($accessToken)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to get access token.');
}
if (empty($refreshToken)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to get refresh token.');
}
if (empty($accessTokenExpiry)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to get access token expiry.');
}
// Makes sure this email is not already used in another identity
$identity = $dbForConsole->findOne('identities', [
Query::equal('providerEmail', [$email]),
]);
if (!$identity->isEmpty()) {
if ($identity->getAttribute('userInternalId', '') !== $user->getInternalId()) {
throw new Exception(Exception::USER_EMAIL_ALREADY_EXISTS);
}
}
if (!$identity->isEmpty()) {
$identity = $identity
->setAttribute('providerAccessToken', $accessToken)
->setAttribute('providerRefreshToken', $refreshToken)
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$accessTokenExpiry));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
} else {
$identity = $dbForConsole->createDocument('identities', new Document([
'$id' => ID::unique(),
'$permissions' => [
Permission::read(Role::any()),
Permission::update(Role::user($user->getId())),
Permission::delete(Role::user($user->getId())),
],
'userInternalId' => $user->getInternalId(),
'userId' => $user->getId(),
'provider' => 'firebase',
'providerUid' => $oauth2ID,
'providerEmail' => $email,
'providerAccessToken' => $accessToken,
'providerRefreshToken' => $refreshToken,
'providerAccessTokenExpiry' => DateTime::addSeconds(new \DateTime(), (int)$accessTokenExpiry),
]));
}
} else {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Missing OAuth2 code.');
}
$response
->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
->addHeader('Pragma', 'no-cache')
->redirect($redirect);
});
App::get('/v1/migrations/firebase/projects')
->desc('List Firebase projects')
->groups(['api', 'migrations'])
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'listFirebaseProjects')
->label('sdk.description', '')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_FIREBASE_PROJECT_LIST)
->inject('user')
->inject('response')
->inject('project')
->inject('dbForConsole')
->inject('request')
->action(function (Document $user, Response $response, Document $project, Database $dbForConsole, Request $request) {
$firebase = new OAuth2Firebase(
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
);
$identity = $dbForConsole->findOne('identities', [
Query::equal('provider', ['firebase']),
Query::equal('userInternalId', [$user->getInternalId()]),
]);
if ($identity->isEmpty()) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$accessToken = $identity->getAttribute('providerAccessToken');
$refreshToken = $identity->getAttribute('providerRefreshToken');
$accessTokenExpiry = $identity->getAttribute('providerAccessTokenExpiry');
if (empty($accessToken) || empty($refreshToken) || empty($accessTokenExpiry)) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
if (System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
try {
$isExpired = new \DateTime($accessTokenExpiry) < new \DateTime('now');
if ($isExpired) {
try {
$firebase->refreshTokens($refreshToken);
} catch (\Throwable $e) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$accessToken = $firebase->getAccessToken('');
$refreshToken = $firebase->getRefreshToken('');
$verificationId = $firebase->getUserID($accessToken);
if (empty($verificationId)) {
throw new Exception(Exception::GENERAL_RATE_LIMIT_EXCEEDED, 'Another request is currently refreshing OAuth token. Please try again.');
}
$identity = $identity
->setAttribute('providerAccessToken', $accessToken)
->setAttribute('providerRefreshToken', $refreshToken)
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$firebase->getAccessTokenExpiry('')));
$dbForConsole->updateDocument('identities', $identity->getId(), $identity);
}
$projects = $firebase->getProjects($accessToken);
$output = [];
foreach ($projects as $project) {
$output[] = [
'displayName' => $project['displayName'],
'projectId' => $project['projectId'],
];
}
} catch (\Throwable $e) {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
}
$response->dynamic(new Document([
'projects' => $output,
'total' => count($output),
]), Response::MODEL_MIGRATION_FIREBASE_PROJECT_LIST);
});
App::get('/v1/migrations/firebase/deauthorize')
->desc('Revoke Appwrite\'s authorization to access Firebase projects')
->groups(['api', 'migrations'])
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'deleteFirebaseAuth')
->label('sdk.description', '')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->inject('user')
->inject('response')
->inject('dbForConsole')
->action(function (Document $user, Response $response, Database $dbForConsole) {
$identity = $dbForConsole->findOne('identities', [
Query::equal('provider', ['firebase']),
Query::equal('userInternalId', [$user->getInternalId()]),
]);
if ($identity->isEmpty()) {
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN, 'Not authenticated with Firebase'); //TODO: Replace with USER_IDENTITY_NOT_FOUND
}
$dbForConsole->deleteDocument('identities', $identity->getId());
$response->noContent();
});
App::get('/v1/migrations/supabase/report')
->groups(['api', 'migrations'])
->desc('Generate a report on Supabase Data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'getSupabaseReport')
->label('sdk.description', '/docs/references/migrations/migration-supabase-report.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
->label('sdk', new Method(
namespace: 'migrations',
name: 'getSupabaseReport',
description: '/docs/references/migrations/migration-supabase-report.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION_REPORT,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(Supabase::getSupportedResources(), true)), 'List of resources to migrate')
->param('endpoint', '', new URL(), 'Source\'s Supabase Endpoint.')
->param('apiKey', '', new Text(512), 'Source\'s API Key.')
@@ -956,13 +534,18 @@ App::get('/v1/migrations/nhost/report')
->groups(['api', 'migrations'])
->desc('Generate a report on NHost Data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'getNHostReport')
->label('sdk.description', '/docs/references/migrations/migration-nhost-report.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
->label('sdk', new Method(
namespace: 'migrations',
name: 'getNHostReport',
description: '/docs/references/migrations/migration-nhost-report.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MIGRATION_REPORT,
)
]
))
->param('resources', [], new ArrayList(new WhiteList(NHost::getSupportedResources())), 'List of resources to migrate.')
->param('subdomain', '', new Text(512), 'Source\'s Subdomain.')
->param('region', '', new Text(512), 'Source\'s Region.')
@@ -1002,13 +585,18 @@ App::patch('/v1/migrations/:migrationId')
->label('event', 'migrations.[migrationId].retry')
->label('audits.event', 'migration.retry')
->label('audits.resource', 'migrations/{request.migrationId}')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'retry')
->label('sdk.description', '/docs/references/migrations/retry-migration.md')
->label('sdk.response.code', Response::STATUS_CODE_ACCEPTED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MIGRATION)
->label('sdk', new Method(
namespace: 'migrations',
name: 'retry',
description: '/docs/references/migrations/retry-migration.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_ACCEPTED,
model: Response::MODEL_MIGRATION,
)
]
))
->param('migrationId', '', new UID(), 'Migration unique ID.')
->inject('response')
->inject('dbForProject')
@@ -1047,12 +635,19 @@ App::delete('/v1/migrations/:migrationId')
->label('event', 'migrations.[migrationId].delete')
->label('audits.event', 'migrationId.delete')
->label('audits.resource', 'migrations/{request.migrationId}')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
->label('sdk.method', 'delete')
->label('sdk.description', '/docs/references/migrations/delete-migration.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'migrations',
name: 'delete',
description: '/docs/references/migrations/delete-migration.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('migrationId', '', new UID(), 'Migration ID.')
->inject('response')
->inject('dbForProject')
+160 -52
View File
@@ -1,6 +1,10 @@
<?php
use Appwrite\Extend\Exception;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Database\Database;
@@ -13,6 +17,7 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Datetime as DateTimeValidator;
use Utopia\Database\Validator\UID;
use Utopia\Validator\Boolean;
use Utopia\Validator\Text;
use Utopia\Validator\WhiteList;
@@ -20,23 +25,34 @@ App::get('/v1/project/usage')
->desc('Get project usage stats')
->groups(['api', 'usage'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'getUsage')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_USAGE_PROJECT)
->label('sdk', new Method(
namespace: 'project',
name: 'getUsage',
description: '/docs/references/project/get-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_USAGE_PROJECT,
)
]
))
->param('startDate', '', new DateTimeValidator(), 'Starting date for the usage')
->param('endDate', '', new DateTimeValidator(), 'End date for the usage')
->param('period', '1d', new WhiteList(['1h', '1d']), 'Period used', true)
->inject('response')
->inject('project')
->inject('dbForProject')
->action(function (string $startDate, string $endDate, string $period, Response $response, Database $dbForProject) {
->inject('getLogsDB')
->inject('smsRates')
->action(function (string $startDate, string $endDate, string $period, Response $response, Document $project, Database $dbForProject, callable $getLogsDB, array $smsRates) {
$stats = $total = $usage = [];
$format = 'Y-m-d 00:00:00';
$firstDay = (new DateTime($startDate))->format($format);
$lastDay = (new DateTime($endDate))->format($format);
$dbForLogs = call_user_func($getLogsDB, $project);
$metrics = [
'total' => [
METRIC_EXECUTIONS,
@@ -49,7 +65,10 @@ App::get('/v1/project/usage')
METRIC_FILES_STORAGE,
METRIC_DATABASES_STORAGE,
METRIC_DEPLOYMENTS_STORAGE,
METRIC_BUILDS_STORAGE
METRIC_BUILDS_STORAGE,
METRIC_DATABASES_OPERATIONS_READS,
METRIC_DATABASES_OPERATIONS_WRITES,
METRIC_FILES_IMAGES_TRANSFORMED,
],
'period' => [
METRIC_NETWORK_REQUESTS,
@@ -59,7 +78,10 @@ App::get('/v1/project/usage')
METRIC_EXECUTIONS,
METRIC_DATABASES_STORAGE,
METRIC_EXECUTIONS_MB_SECONDS,
METRIC_BUILDS_MB_SECONDS
METRIC_BUILDS_MB_SECONDS,
METRIC_DATABASES_OPERATIONS_READS,
METRIC_DATABASES_OPERATIONS_WRITES,
METRIC_FILES_IMAGES_TRANSFORMED,
]
];
@@ -78,9 +100,11 @@ App::get('/v1/project/usage')
'1d' => 'Y-m-d\T00:00:00.000P',
};
Authorization::skip(function () use ($dbForProject, $firstDay, $lastDay, $period, $metrics, $limit, &$total, &$stats) {
Authorization::skip(function () use ($dbForProject, $dbForLogs, $firstDay, $lastDay, $period, $metrics, $limit, &$total, &$stats) {
foreach ($metrics['total'] as $metric) {
$result = $dbForProject->findOne('stats', [
$db = ($metric === METRIC_FILES_IMAGES_TRANSFORMED) ? $dbForLogs : $dbForProject;
$result = $db->findOne('stats', [
Query::equal('metric', [$metric]),
Query::equal('period', ['inf'])
]);
@@ -88,7 +112,9 @@ App::get('/v1/project/usage')
}
foreach ($metrics['period'] as $metric) {
$results = $dbForProject->find('stats', [
$db = ($metric === METRIC_FILES_IMAGES_TRANSFORMED) ? $dbForLogs : $dbForProject;
$results = $db->find('stats', [
Query::equal('metric', [$metric]),
Query::equal('period', [$period]),
Query::greaterThanEqual('time', $firstDay),
@@ -257,6 +283,46 @@ App::get('/v1/project/usage')
];
}, $dbForProject->find('functions'));
// This total is includes free and paid SMS usage
$authPhoneTotal = Authorization::skip(fn () => $dbForProject->sum('stats', 'value', [
Query::equal('metric', [METRIC_AUTH_METHOD_PHONE]),
Query::equal('period', ['1d']),
Query::greaterThanEqual('time', $firstDay),
Query::lessThan('time', $lastDay),
]));
// This estimate is only for paid SMS usage
$authPhoneMetrics = Authorization::skip(fn () => $dbForProject->find('stats', [
Query::startsWith('metric', METRIC_AUTH_METHOD_PHONE . '.'),
Query::equal('period', ['1d']),
Query::greaterThanEqual('time', $firstDay),
Query::lessThan('time', $lastDay),
]));
$authPhoneEstimate = 0.0;
$authPhoneCountryBreakdown = [];
foreach ($authPhoneMetrics as $metric) {
$parts = explode('.', $metric->getAttribute('metric'));
$countryCode = $parts[3] ?? null;
if ($countryCode === null) {
continue;
}
$value = $metric->getAttribute('value', 0);
if (isset($smsRates[$countryCode])) {
$authPhoneEstimate += $value * $smsRates[$countryCode];
}
$authPhoneCountryBreakdown[] = [
'name' => $countryCode,
'value' => $value,
'estimate' => isset($smsRates[$countryCode])
? $value * $smsRates[$countryCode]
: 0.0,
];
}
// merge network inbound + outbound
$projectBandwidth = [];
foreach ($usage[METRIC_NETWORK_INBOUND] as $item) {
@@ -295,14 +361,21 @@ App::get('/v1/project/usage')
'functionsStorageTotal' => $total[METRIC_DEPLOYMENTS_STORAGE] + $total[METRIC_BUILDS_STORAGE],
'buildsStorageTotal' => $total[METRIC_BUILDS_STORAGE],
'deploymentsStorageTotal' => $total[METRIC_DEPLOYMENTS_STORAGE],
'databasesReadsTotal' => $total[METRIC_DATABASES_OPERATIONS_READS],
'databasesWritesTotal' => $total[METRIC_DATABASES_OPERATIONS_WRITES],
'executionsBreakdown' => $executionsBreakdown,
'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown,
'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown,
'bucketsBreakdown' => $bucketsBreakdown,
'databasesReads' => $usage[METRIC_DATABASES_OPERATIONS_READS],
'databasesWrites' => $usage[METRIC_DATABASES_OPERATIONS_WRITES],
'databasesStorageBreakdown' => $databasesStorageBreakdown,
'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown,
'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown,
'functionsStorageBreakdown' => $functionsStorageBreakdown,
'authPhoneTotal' => $authPhoneTotal,
'authPhoneEstimate' => $authPhoneEstimate,
'authPhoneCountryBreakdown' => $authPhoneCountryBreakdown,
'imageTransformations' => $usage[METRIC_FILES_IMAGES_TRANSFORMED],
'imageTransformationsTotal' => $total[METRIC_FILES_IMAGES_TRANSFORMED],
]), Response::MODEL_USAGE_PROJECT);
});
@@ -313,20 +386,26 @@ App::post('/v1/project/variables')
->groups(['api'])
->label('scope', 'projects.write')
->label('audits.event', 'variable.create')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'createVariable')
->label('sdk.description', '/docs/references/project/create-variable.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_VARIABLE)
->label('sdk', new Method(
namespace: 'project',
name: 'createVariable',
description: '/docs/references/project/create-variable.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_VARIABLE,
)
]
))
->param('key', null, new Text(Database::LENGTH_KEY), 'Variable key. Max length: ' . Database::LENGTH_KEY . ' chars.', false)
->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', false)
->param('secret', true, new Boolean(), 'Secret variables can be updated or deleted, but only projects can read them during build and runtime.', true)
->inject('project')
->inject('response')
->inject('dbForProject')
->inject('dbForConsole')
->action(function (string $key, string $value, Document $project, Response $response, Database $dbForProject, Database $dbForConsole) {
->inject('dbForPlatform')
->action(function (string $key, string $value, bool $secret, Document $project, Response $response, Database $dbForProject, Database $dbForPlatform) {
$variableId = ID::unique();
$variable = new Document([
@@ -341,6 +420,7 @@ App::post('/v1/project/variables')
'resourceType' => 'project',
'key' => $key,
'value' => $value,
'secret' => $secret,
'search' => implode(' ', [$variableId, $key, 'project']),
]);
@@ -367,13 +447,18 @@ App::get('/v1/project/variables')
->desc('List variables')
->groups(['api'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'listVariables')
->label('sdk.description', '/docs/references/project/list-variables.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_VARIABLE_LIST)
->label('sdk', new Method(
namespace: 'project',
name: 'listVariables',
description: '/docs/references/project/list-variables.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_VARIABLE_LIST,
)
]
))
->inject('response')
->inject('dbForProject')
->action(function (Response $response, Database $dbForProject) {
@@ -392,13 +477,18 @@ App::get('/v1/project/variables/:variableId')
->desc('Get variable')
->groups(['api'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'getVariable')
->label('sdk.description', '/docs/references/project/get-variable.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_VARIABLE)
->label('sdk', new Method(
namespace: 'project',
name: 'getVariable',
description: '/docs/references/project/get-variable.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_VARIABLE,
)
]
))
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->inject('response')
->inject('project')
@@ -416,29 +506,40 @@ App::put('/v1/project/variables/:variableId')
->desc('Update variable')
->groups(['api'])
->label('scope', 'projects.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'updateVariable')
->label('sdk.description', '/docs/references/project/update-variable.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_VARIABLE)
->label('sdk', new Method(
namespace: 'project',
name: 'updateVariable',
description: '/docs/references/project/update-variable.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_VARIABLE,
)
]
))
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->param('key', null, new Text(255), 'Variable key. Max length: 255 chars.', false)
->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', true)
->param('secret', null, new Boolean(), 'Secret variables can be updated or deleted, but only projects can read them during build and runtime.', true)
->inject('project')
->inject('response')
->inject('dbForProject')
->inject('dbForConsole')
->action(function (string $variableId, string $key, ?string $value, Document $project, Response $response, Database $dbForProject, Database $dbForConsole) {
->inject('dbForPlatform')
->action(function (string $variableId, string $key, ?string $value, ?bool $secret, Document $project, Response $response, Database $dbForProject, Database $dbForPlatform) {
$variable = $dbForProject->getDocument('variables', $variableId);
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceType') !== 'project') {
throw new Exception(Exception::VARIABLE_NOT_FOUND);
}
if ($variable->getAttribute('secret') === true && $secret === false) {
throw new Exception(Exception::VARIABLE_CANNOT_UNSET_SECRET);
}
$variable
->setAttribute('key', $key)
->setAttribute('value', $value ?? $variable->getAttribute('value'))
->setAttribute('secret', $secret ?? $variable->getAttribute('secret'))
->setAttribute('search', implode(' ', [$variableId, $key, 'project']));
try {
@@ -462,12 +563,19 @@ App::delete('/v1/project/variables/:variableId')
->desc('Delete variable')
->groups(['api'])
->label('scope', 'projects.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'project')
->label('sdk.method', 'deleteVariable')
->label('sdk.description', '/docs/references/project/delete-variable.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'project',
name: 'deleteVariable',
description: '/docs/references/project/delete-variable.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->inject('project')
->inject('response')
File diff suppressed because it is too large Load Diff
+72 -172
View File
@@ -5,6 +5,10 @@ use Appwrite\Event\Delete;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
use Appwrite\Network\Validator\CNAME;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Rules;
use Appwrite\Utopia\Response;
use Utopia\App;
@@ -17,152 +21,30 @@ use Utopia\Database\Validator\UID;
use Utopia\Domains\Domain;
use Utopia\Logger\Log;
use Utopia\System\System;
use Utopia\Validator\Domain as ValidatorDomain;
use Utopia\Validator\Text;
use Utopia\Validator\WhiteList;
App::post('/v1/proxy/rules')
->groups(['api', 'proxy'])
->desc('Create rule')
->label('scope', 'rules.write')
->label('event', 'rules.[ruleId].create')
->label('audits.event', 'rule.create')
->label('audits.resource', 'rule/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
->label('sdk.method', 'createRule')
->label('sdk.description', '/docs/references/proxy/create-rule.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PROXY_RULE)
->param('domain', null, new ValidatorDomain(), 'Domain name.')
->param('resourceType', null, new WhiteList(['api', 'function']), 'Action definition for the rule. Possible values are "api", "function"')
->param('resourceId', '', new UID(), 'ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.', true)
->inject('response')
->inject('project')
->inject('queueForCertificates')
->inject('queueForEvents')
->inject('dbForConsole')
->inject('dbForProject')
->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForConsole, Database $dbForProject) {
$mainDomain = System::getEnv('_APP_DOMAIN', '');
if ($domain === $mainDomain) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.');
}
$functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', '');
if ($functionsDomain != '' && str_ends_with($domain, $functionsDomain)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your functions domain or it\'s subdomain to specific resource. Please use different domain.');
}
if ($domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please pick another one.');
}
$ruleId = md5($domain);
$document = $dbForConsole->getDocument('rules', $ruleId);
if (!$document->isEmpty()) {
if ($document->getAttribute('projectId') === $project->getId()) {
$resourceType = $document->getAttribute('resourceType');
$resourceId = $document->getAttribute('resourceId');
$message = "Domain already assigned to '{$resourceType}' service";
if (!empty($resourceId)) {
$message .= " with ID '{$resourceId}'";
}
$message .= '.';
} else {
$message = 'Domain already assigned to different project.';
}
throw new Exception(Exception::RULE_ALREADY_EXISTS, $message);
}
$resourceInternalId = '';
if ($resourceType == 'function') {
if (empty($resourceId)) {
throw new Exception(Exception::FUNCTION_NOT_FOUND);
}
$function = $dbForProject->getDocument('functions', $resourceId);
if ($function->isEmpty()) {
throw new Exception(Exception::RULE_RESOURCE_NOT_FOUND);
}
$resourceInternalId = $function->getInternalId();
}
try {
$domain = new Domain($domain);
} catch (\Throwable) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Domain may not start with http:// or https://.');
}
$ruleId = md5($domain->get());
$rule = new Document([
'$id' => $ruleId,
'projectId' => $project->getId(),
'projectInternalId' => $project->getInternalId(),
'domain' => $domain->get(),
'resourceType' => $resourceType,
'resourceId' => $resourceId,
'resourceInternalId' => $resourceInternalId,
'certificateId' => '',
]);
$status = 'created';
$functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS');
if (!empty($functionsDomain) && \str_ends_with($domain->get(), $functionsDomain)) {
$status = 'verified';
}
if ($status === 'created') {
$target = new Domain(System::getEnv('_APP_DOMAIN_TARGET', ''));
$validator = new CNAME($target->get()); // Verify Domain with DNS records
if ($validator->isValid($domain->get())) {
$status = 'verifying';
$queueForCertificates
->setDomain(new Document([
'domain' => $rule->getAttribute('domain')
]))
->trigger();
}
}
$rule->setAttribute('status', $status);
$rule = $dbForConsole->createDocument('rules', $rule);
$queueForEvents->setParam('ruleId', $rule->getId());
$rule->setAttribute('logs', '');
$response
->setStatusCode(Response::STATUS_CODE_CREATED)
->dynamic($rule, Response::MODEL_PROXY_RULE);
});
App::get('/v1/proxy/rules')
->groups(['api', 'proxy'])
->desc('List rules')
->label('scope', 'rules.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
->label('sdk.method', 'listRules')
->label('sdk.description', '/docs/references/proxy/list-rules.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PROXY_RULE_LIST)
->label('sdk', new Method(
namespace: 'proxy',
name: 'listRules',
description: '/docs/references/proxy/list-rules.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PROXY_RULE_LIST,
)
]
))
->param('queries', [], new Rules(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Rules::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('project')
->inject('dbForConsole')
->action(function (array $queries, string $search, Response $response, Document $project, Database $dbForConsole) {
->inject('dbForPlatform')
->action(function (array $queries, string $search, Response $response, Document $project, Database $dbForPlatform) {
try {
$queries = Query::parseQueries($queries);
} catch (QueryException $e) {
@@ -191,7 +73,7 @@ App::get('/v1/proxy/rules')
}
$ruleId = $cursor->getValue();
$cursorDocument = $dbForConsole->getDocument('rules', $ruleId);
$cursorDocument = $dbForPlatform->getDocument('rules', $ruleId);
if ($cursorDocument->isEmpty()) {
throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Rule '{$ruleId}' for the 'cursor' value not found.");
@@ -202,16 +84,16 @@ App::get('/v1/proxy/rules')
$filterQueries = Query::groupByType($queries)['filters'];
$rules = $dbForConsole->find('rules', $queries);
$rules = $dbForPlatform->find('rules', $queries);
foreach ($rules as $rule) {
$certificate = $dbForConsole->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$certificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$rule->setAttribute('logs', $certificate->getAttribute('logs', ''));
$rule->setAttribute('renewAt', $certificate->getAttribute('renewDate', ''));
}
$response->dynamic(new Document([
'rules' => $rules,
'total' => $dbForConsole->count('rules', $filterQueries, APP_LIMIT_COUNT),
'total' => $dbForPlatform->count('rules', $filterQueries, APP_LIMIT_COUNT),
]), Response::MODEL_PROXY_RULE_LIST);
});
@@ -219,25 +101,30 @@ App::get('/v1/proxy/rules/:ruleId')
->groups(['api', 'proxy'])
->desc('Get rule')
->label('scope', 'rules.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
->label('sdk.method', 'getRule')
->label('sdk.description', '/docs/references/proxy/get-rule.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PROXY_RULE)
->label('sdk', new Method(
namespace: 'proxy',
name: 'getRule',
description: '/docs/references/proxy/get-rule.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PROXY_RULE,
)
]
))
->param('ruleId', '', new UID(), 'Rule ID.')
->inject('response')
->inject('project')
->inject('dbForConsole')
->action(function (string $ruleId, Response $response, Document $project, Database $dbForConsole) {
$rule = $dbForConsole->getDocument('rules', $ruleId);
->inject('dbForPlatform')
->action(function (string $ruleId, Response $response, Document $project, Database $dbForPlatform) {
$rule = $dbForPlatform->getDocument('rules', $ruleId);
if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) {
throw new Exception(Exception::RULE_NOT_FOUND);
}
$certificate = $dbForConsole->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$certificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$rule->setAttribute('logs', $certificate->getAttribute('logs', ''));
$rule->setAttribute('renewAt', $certificate->getAttribute('renewDate', ''));
@@ -251,26 +138,33 @@ App::delete('/v1/proxy/rules/:ruleId')
->label('event', 'rules.[ruleId].delete')
->label('audits.event', 'rules.delete')
->label('audits.resource', 'rule/{request.ruleId}')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
->label('sdk.method', 'deleteRule')
->label('sdk.description', '/docs/references/proxy/delete-rule.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'proxy',
name: 'deleteRule',
description: '/docs/references/proxy/delete-rule.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('ruleId', '', new UID(), 'Rule ID.')
->inject('response')
->inject('project')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('queueForDeletes')
->inject('queueForEvents')
->action(function (string $ruleId, Response $response, Document $project, Database $dbForConsole, Delete $queueForDeletes, Event $queueForEvents) {
$rule = $dbForConsole->getDocument('rules', $ruleId);
->action(function (string $ruleId, Response $response, Document $project, Database $dbForPlatform, Delete $queueForDeletes, Event $queueForEvents) {
$rule = $dbForPlatform->getDocument('rules', $ruleId);
if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) {
throw new Exception(Exception::RULE_NOT_FOUND);
}
$dbForConsole->deleteDocument('rules', $rule->getId());
$dbForPlatform->deleteDocument('rules', $rule->getId());
$queueForDeletes
->setType(DELETE_TYPE_DOCUMENT)
@@ -288,21 +182,27 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
->label('event', 'rules.[ruleId].update')
->label('audits.event', 'rule.update')
->label('audits.resource', 'rule/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
->label('sdk.method', 'updateRuleVerification')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PROXY_RULE)
->label('sdk', new Method(
namespace: 'proxy',
name: 'updateRuleVerification',
description: '/docs/references/proxy/update-rule-verification.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PROXY_RULE,
)
]
))
->param('ruleId', '', new UID(), 'Rule ID.')
->inject('response')
->inject('queueForCertificates')
->inject('queueForEvents')
->inject('project')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('log')
->action(function (string $ruleId, Response $response, Certificate $queueForCertificates, Event $queueForEvents, Document $project, Database $dbForConsole, Log $log) {
$rule = $dbForConsole->getDocument('rules', $ruleId);
->action(function (string $ruleId, Response $response, Certificate $queueForCertificates, Event $queueForEvents, Document $project, Database $dbForPlatform, Log $log) {
$rule = $dbForPlatform->getDocument('rules', $ruleId);
if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) {
throw new Exception(Exception::RULE_NOT_FOUND);
@@ -332,7 +232,7 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
throw new Exception(Exception::RULE_VERIFICATION_FAILED);
}
$dbForConsole->updateDocument('rules', $rule->getId(), $rule->setAttribute('status', 'verifying'));
$dbForPlatform->updateDocument('rules', $rule->getId(), $rule->setAttribute('status', 'verifying'));
// Issue a TLS certificate when domain is verified
$queueForCertificates
@@ -343,7 +243,7 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
$queueForEvents->setParam('ruleId', $rule->getId());
$certificate = $dbForConsole->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$certificate = $dbForPlatform->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$rule->setAttribute('logs', $certificate->getAttribute('logs', ''));
$response->dynamic($rule, Response::MODEL_PROXY_RULE);
+224 -116
View File
@@ -8,6 +8,11 @@ use Appwrite\Event\Delete;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
use Appwrite\OpenSSL\OpenSSL;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\MethodType;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries\Buckets;
use Appwrite\Utopia\Database\Validator\Queries\Files;
@@ -15,6 +20,7 @@ use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Duplicate as DuplicateException;
use Utopia\Database\Exception\NotFound as NotFoundException;
@@ -54,13 +60,18 @@ App::post('/v1/storage/buckets')
->label('event', 'buckets.[bucketId].create')
->label('audits.event', 'bucket.create')
->label('audits.resource', 'bucket/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'createBucket')
->label('sdk.description', '/docs/references/storage/create-bucket.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_BUCKET)
->label('sdk', new Method(
namespace: 'storage',
name: 'createBucket',
description: '/docs/references/storage/create-bucket.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_BUCKET,
)
]
))
->param('bucketId', '', new CustomId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Bucket name')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
@@ -74,13 +85,14 @@ App::post('/v1/storage/buckets')
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) {
->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) {
$bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId;
// Map aggregate permissions into the multiple permissions they represent.
$permissions = Permission::aggregate($permissions);
$compression ??= Compression::NONE;
$encryption ??= true;
try {
$files = (Config::getParam('collections', [])['buckets'] ?? [])['files'] ?? [];
if (empty($files)) {
@@ -150,13 +162,18 @@ App::get('/v1/storage/buckets')
->groups(['api', 'storage'])
->label('scope', 'buckets.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'listBuckets')
->label('sdk.description', '/docs/references/storage/list-buckets.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_BUCKET_LIST)
->label('sdk', new Method(
namespace: 'storage',
name: 'listBuckets',
description: '/docs/references/storage/list-buckets.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_BUCKET_LIST,
)
]
))
->param('queries', [], new Buckets(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Buckets::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
@@ -211,13 +228,18 @@ App::get('/v1/storage/buckets/:bucketId')
->groups(['api', 'storage'])
->label('scope', 'buckets.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getBucket')
->label('sdk.description', '/docs/references/storage/get-bucket.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_BUCKET)
->label('sdk', new Method(
namespace: 'storage',
name: 'getBucket',
description: '/docs/references/storage/get-bucket.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_BUCKET,
)
]
))
->param('bucketId', '', new UID(), 'Bucket unique ID.')
->inject('response')
->inject('dbForProject')
@@ -240,13 +262,18 @@ App::put('/v1/storage/buckets/:bucketId')
->label('event', 'buckets.[bucketId].update')
->label('audits.event', 'bucket.update')
->label('audits.resource', 'bucket/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'updateBucket')
->label('sdk.description', '/docs/references/storage/update-bucket.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_BUCKET)
->label('sdk', new Method(
namespace: 'storage',
name: 'updateBucket',
description: '/docs/references/storage/update-bucket.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_BUCKET,
)
]
))
->param('bucketId', '', new UID(), 'Bucket unique ID.')
->param('name', null, new Text(128), 'Bucket name', false)
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
@@ -260,7 +287,7 @@ App::put('/v1/storage/buckets/:bucketId')
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, ?int $maximumFileSize, array $allowedFileExtensions, ?string $compression, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) {
->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, ?int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) {
$bucket = $dbForProject->getDocument('buckets', $bucketId);
if ($bucket->isEmpty()) {
@@ -305,12 +332,19 @@ App::delete('/v1/storage/buckets/:bucketId')
->label('audits.event', 'bucket.delete')
->label('event', 'buckets.[bucketId].delete')
->label('audits.resource', 'bucket/{request.bucketId}')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'deleteBucket')
->label('sdk.description', '/docs/references/storage/delete-bucket.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'storage',
name: 'deleteBucket',
description: '/docs/references/storage/delete-bucket.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('bucketId', '', new UID(), 'Bucket unique ID.')
->inject('response')
->inject('dbForProject')
@@ -351,15 +385,20 @@ App::post('/v1/storage/buckets/:bucketId/files')
->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId},chunkId:{chunkId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'createFile')
->label('sdk.description', '/docs/references/storage/create-file.md')
->label('sdk.request.type', 'multipart/form-data')
->label('sdk.methodType', 'upload')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_FILE)
->label('sdk', new Method(
namespace: 'storage',
name: 'createFile',
description: '/docs/references/storage/create-file.md',
type: MethodType::UPLOAD,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
requestType: 'multipart/form-data',
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_FILE,
)
]
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new CustomId(), 'File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('file', [], new File(), 'Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).', skipValidation: true)
@@ -715,13 +754,18 @@ App::get('/v1/storage/buckets/:bucketId/files')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'listFiles')
->label('sdk.description', '/docs/references/storage/list-files.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_FILE_LIST)
->label('sdk', new Method(
namespace: 'storage',
name: 'listFiles',
description: '/docs/references/storage/list-files.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_FILE_LIST,
)
]
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('queries', [], new Files(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Files::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
@@ -807,13 +851,18 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFile')
->label('sdk.description', '/docs/references/storage/get-file.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_FILE)
->label('sdk', new Method(
namespace: 'storage',
name: 'getFile',
description: '/docs/references/storage/get-file.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_FILE,
)
]
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File ID.')
->inject('response')
@@ -858,13 +907,20 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
->label('cache', true)
->label('cache.resourceType', 'bucket/{request.bucketId}')
->label('cache.resource', 'file/{request.fileId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFilePreview')
->label('sdk.description', '/docs/references/storage/get-file-preview.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE)
->label('sdk.methodType', 'location')
->label('sdk', new Method(
namespace: 'storage',
name: 'getFilePreview',
description: '/docs/references/storage/get-file-preview.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE
)
],
type: MethodType::LOCATION,
contentType: ContentType::IMAGE
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File ID')
->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true)
@@ -878,14 +934,11 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
->param('rotation', 0, new Range(-360, 360), 'Preview image rotation in degrees. Pass an integer between -360 and 360.', true)
->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true)
->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true)
->inject('request')
->inject('response')
->inject('project')
->inject('dbForProject')
->inject('mode')
->inject('deviceForFiles')
->inject('deviceForLocal')
->action(function (string $bucketId, string $fileId, int $width, int $height, string $gravity, int $quality, int $borderWidth, string $borderColor, int $borderRadius, float $opacity, int $rotation, string $background, string $output, Request $request, Response $response, Document $project, Database $dbForProject, string $mode, Device $deviceForFiles, Device $deviceForLocal) {
->action(function (string $bucketId, string $fileId, int $width, int $height, string $gravity, int $quality, int $borderWidth, string $borderColor, int $borderRadius, float $opacity, int $rotation, string $background, string $output, Response $response, Database $dbForProject, Device $deviceForFiles, Device $deviceForLocal) {
if (!\extension_loaded('imagick')) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing');
@@ -1013,11 +1066,19 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$contentType = (\array_key_exists($output, $outputs)) ? $outputs[$output] : $outputs['jpg'];
//Do not update transformedAt if it's a console user
if (!Auth::isPrivilegedUser(Authorization::getRoles())) {
$transformedAt = $file->getAttribute('transformedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) {
$file->setAttribute('transformedAt', DateTime::now());
Authorization::skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file));
}
}
$response
->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days
->setContentType($contentType)
->file($data)
;
->file($data);
unset($image);
});
@@ -1028,13 +1089,20 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/download')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileDownload')
->label('sdk.description', '/docs/references/storage/get-file-download.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', '*/*')
->label('sdk.methodType', 'location')
->label('sdk', new Method(
namespace: 'storage',
name: 'getFileDownload',
description: '/docs/references/storage/get-file-download.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE
)
],
type: MethodType::LOCATION,
contentType: ContentType::ANY,
))
->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File ID.')
->inject('request')
@@ -1169,13 +1237,20 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/view')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileView')
->label('sdk.description', '/docs/references/storage/get-file-view.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', '*/*')
->label('sdk.methodType', 'location')
->label('sdk', new Method(
namespace: 'storage',
name: 'getFileView',
description: '/docs/references/storage/get-file-view.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_NONE,
)
],
type: MethodType::LOCATION,
contentType: ContentType::ANY,
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File ID.')
->inject('response')
@@ -1482,13 +1557,18 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId')
->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'updateFile')
->label('sdk.description', '/docs/references/storage/update-file.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_FILE)
->label('sdk', new Method(
namespace: 'storage',
name: 'updateFile',
description: '/docs/references/storage/update-file.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_FILE,
)
]
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File unique ID.')
->param('name', null, new Text(255), 'Name of the file', true)
@@ -1591,12 +1671,19 @@ App::delete('/v1/storage/buckets/:bucketId/files/:fileId')
->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'deleteFile')
->label('sdk.description', '/docs/references/storage/delete-file.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'storage',
name: 'deleteFile',
description: '/docs/references/storage/delete-file.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
->param('fileId', '', new UID(), 'File ID.')
->inject('response')
@@ -1683,12 +1770,18 @@ App::get('/v1/storage/usage')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getUsage')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_USAGE_STORAGE)
->label('sdk', new Method(
namespace: 'storage',
name: 'getUsage',
description: '/docs/references/storage/get-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_USAGE_STORAGE,
)
]
))
->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true)
->inject('response')
->inject('dbForProject')
@@ -1763,18 +1856,27 @@ App::get('/v1/storage/:bucketId/usage')
->groups(['api', 'storage'])
->label('scope', 'files.read')
->label('resourceType', RESOURCE_TYPE_BUCKETS)
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getBucketUsage')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_USAGE_BUCKETS)
->label('sdk', new Method(
namespace: 'storage',
name: 'getBucketUsage',
description: '/docs/references/storage/get-bucket-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_USAGE_BUCKETS,
)
]
))
->param('bucketId', '', new UID(), 'Bucket ID.')
->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true)
->inject('response')
->inject('project')
->inject('dbForProject')
->action(function (string $bucketId, string $range, Response $response, Database $dbForProject) {
->inject('getLogsDB')
->action(function (string $bucketId, string $range, Response $response, Document $project, Database $dbForProject, callable $getLogsDB) {
$dbForLogs = call_user_func($getLogsDB, $project);
$bucket = $dbForProject->getDocument('buckets', $bucketId);
if ($bucket->isEmpty()) {
@@ -1787,12 +1889,16 @@ App::get('/v1/storage/:bucketId/usage')
$metrics = [
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES),
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_STORAGE),
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED),
];
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats, &$total) {
Authorization::skip(function () use ($dbForProject, $dbForLogs, $bucket, $days, $metrics, &$stats) {
foreach ($metrics as $metric) {
$result = $dbForProject->findOne('stats', [
$db = ($metric === str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED))
? $dbForLogs
: $dbForProject;
$result = $db->findOne('stats', [
Query::equal('metric', [$metric]),
Query::equal('period', ['inf'])
]);
@@ -1800,7 +1906,7 @@ App::get('/v1/storage/:bucketId/usage')
$stats[$metric]['total'] = $result['value'] ?? 0;
$limit = $days['limit'];
$period = $days['period'];
$results = $dbForProject->find('stats', [
$results = $db->find('stats', [
Query::equal('metric', [$metric]),
Query::equal('period', [$period]),
Query::limit($limit),
@@ -1841,5 +1947,7 @@ App::get('/v1/storage/:bucketId/usage')
'filesStorageTotal' => $usage[$metrics[1]]['total'],
'files' => $usage[$metrics[0]]['data'],
'storage' => $usage[$metrics[1]]['data'],
'imageTransformations' => $usage[$metrics[2]]['data'],
'imageTransformationsTotal' => $usage[$metrics[2]]['total'],
]), Response::MODEL_USAGE_BUCKETS);
});
+264 -157
View File
@@ -8,16 +8,23 @@ use Appwrite\Event\Delete;
use Appwrite\Event\Event;
use Appwrite\Event\Mail;
use Appwrite\Event\Messaging;
use Appwrite\Event\StatsUsage;
use Appwrite\Extend\Exception;
use Appwrite\Network\Validator\Email;
use Appwrite\Platform\Workers\Deletes;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Template\Template;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries\Memberships;
use Appwrite\Utopia\Database\Validator\Queries\Teams;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use libphonenumber\PhoneNumberUtil;
use MaxMind\Db\Reader;
use Utopia\Abuse\Abuse;
use Utopia\App;
use Utopia\Audit\Audit;
use Utopia\Config\Config;
@@ -53,13 +60,18 @@ App::post('/v1/teams')
->label('scope', 'teams.write')
->label('audits.event', 'team.create')
->label('audits.resource', 'team/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'create')
->label('sdk.description', '/docs/references/teams/create-team.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TEAM)
->label('sdk', new Method(
namespace: 'teams',
name: 'create',
description: '/docs/references/teams/create-team.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_TEAM,
)
]
))
->param('teamId', '', new CustomId(), 'Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', null, new Text(128), 'Team name. Max length: 128 chars.')
->param('roles', ['owner'], new ArrayList(new Key(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 32 characters long.', true)
@@ -138,14 +150,18 @@ App::get('/v1/teams')
->desc('List teams')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'list')
->label('sdk.description', '/docs/references/teams/list-teams.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TEAM_LIST)
->label('sdk.offline.model', '/teams')
->label('sdk', new Method(
namespace: 'teams',
name: 'list',
description: '/docs/references/teams/list-teams.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_TEAM_LIST,
)
]
))
->param('queries', [], new Teams(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Teams::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
@@ -202,15 +218,18 @@ App::get('/v1/teams/:teamId')
->desc('Get team')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/teams/get-team.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TEAM)
->label('sdk.offline.model', '/teams')
->label('sdk.offline.key', '{teamId}')
->label('sdk', new Method(
namespace: 'teams',
name: 'get',
description: '/docs/references/teams/get-team.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_TEAM,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->inject('response')
->inject('dbForProject')
@@ -229,14 +248,18 @@ App::get('/v1/teams/:teamId/prefs')
->desc('Get team preferences')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'getPrefs')
->label('sdk.description', '/docs/references/teams/get-team-prefs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PREFERENCES)
->label('sdk.offline.model', '/teams/{teamId}/prefs')
->label('sdk', new Method(
namespace: 'teams',
name: 'getPrefs',
description: '/docs/references/teams/get-team-prefs.md',
auth: [AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PREFERENCES,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->inject('response')
->inject('dbForProject')
@@ -260,15 +283,18 @@ App::put('/v1/teams/:teamId')
->label('scope', 'teams.write')
->label('audits.event', 'team.update')
->label('audits.resource', 'team/{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateName')
->label('sdk.description', '/docs/references/teams/update-team-name.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TEAM)
->label('sdk.offline.model', '/teams')
->label('sdk.offline.key', '{teamId}')
->label('sdk', new Method(
namespace: 'teams',
name: 'updateName',
description: '/docs/references/teams/update-team-name.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_TEAM,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('name', null, new Text(128), 'New team name. Max length: 128 chars.')
->inject('requestTimestamp')
@@ -304,14 +330,18 @@ App::put('/v1/teams/:teamId/prefs')
->label('audits.event', 'team.update')
->label('audits.resource', 'team/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updatePrefs')
->label('sdk.description', '/docs/references/teams/update-team-prefs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PREFERENCES)
->label('sdk.offline.model', '/teams/{teamId}/prefs')
->label('sdk', new Method(
namespace: 'teams',
name: 'updatePrefs',
description: '/docs/references/teams/update-team-prefs.md',
auth: [AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_PREFERENCES,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('prefs', '', new Assoc(), 'Prefs key-value JSON object.')
->inject('response')
@@ -339,12 +369,19 @@ App::delete('/v1/teams/:teamId')
->label('scope', 'teams.write')
->label('audits.event', 'team.delete')
->label('audits.resource', 'team/{request.teamId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'delete')
->label('sdk.description', '/docs/references/teams/delete-team.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'teams',
name: 'delete',
description: '/docs/references/teams/delete-team.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('teamId', '', new UID(), 'Team ID.')
->inject('response')
->inject('getProjectDB')
@@ -390,13 +427,18 @@ App::post('/v1/teams/:teamId/memberships')
->label('audits.event', 'membership.create')
->label('audits.resource', 'team/{request.teamId}')
->label('audits.userId', '{request.userId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'createMembership')
->label('sdk.description', '/docs/references/teams/create-team-membership.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
->label('sdk', new Method(
namespace: 'teams',
name: 'createMembership',
description: '/docs/references/teams/create-team-membership.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_MEMBERSHIP,
)
]
))
->label('abuse-limit', 10)
->param('teamId', '', new UID(), 'Team ID.')
->param('email', '', new Email(), 'Email of the new team member.', true)
@@ -423,13 +465,16 @@ App::post('/v1/teams/:teamId/memberships')
->inject('queueForMails')
->inject('queueForMessaging')
->inject('queueForEvents')
->action(function (string $teamId, string $email, string $userId, string $phone, array $roles, string $url, string $name, Response $response, Document $project, Document $user, Database $dbForProject, Locale $locale, Mail $queueForMails, Messaging $queueForMessaging, Event $queueForEvents) {
$isAPIKey = Auth::isAppUser(Authorization::getRoles());
->inject('timelimit')
->inject('queueForStatsUsage')
->inject('plan')
->action(function (string $teamId, string $email, string $userId, string $phone, array $roles, string $url, string $name, Response $response, Document $project, Document $user, Database $dbForProject, Locale $locale, Mail $queueForMails, Messaging $queueForMessaging, Event $queueForEvents, callable $timelimit, StatsUsage $queueForStatsUsage, array $plan) {
$isAppUser = Auth::isAppUser(Authorization::getRoles());
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$url = htmlentities($url);
if (empty($url)) {
if (!$isAPIKey && !$isPrivilegedUser) {
if (!$isAppUser && !$isPrivilegedUser) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'URL is required');
}
}
@@ -437,15 +482,13 @@ App::post('/v1/teams/:teamId/memberships')
if (empty($userId) && empty($email) && empty($phone)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'At least one of userId, email, or phone is required');
}
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$isAppUser = Auth::isAppUser(Authorization::getRoles());
if (!$isPrivilegedUser && !$isAppUser && empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED);
}
$email = \strtolower($email);
$name = (empty($name)) ? $email : $name;
$name = empty($name) ? $email : $name;
$team = $dbForProject->getDocument('teams', $teamId);
if ($team->isEmpty()) {
@@ -464,7 +507,7 @@ App::post('/v1/teams/:teamId/memberships')
}
$email = $invitee->getAttribute('email', '');
$phone = $invitee->getAttribute('phone', '');
$name = empty($name) ? $invitee->getAttribute('name', '') : $name;
$name = $invitee->getAttribute('name', '') ?: $name;
} elseif (!empty($email)) {
$invitee = $dbForProject->findOne('users', [Query::equal('email', [$email])]); // Get user by email address
if (!$invitee->isEmpty() && !empty($phone) && $invitee->getAttribute('phone', '') !== $phone) {
@@ -540,49 +583,61 @@ App::post('/v1/teams/:teamId/memberships')
throw new Exception(Exception::USER_UNAUTHORIZED, 'User is not allowed to send invitations for this team');
}
$secret = Auth::tokenGenerator();
$membershipId = ID::unique();
$membership = new Document([
'$id' => $membershipId,
'$permissions' => [
Permission::read(Role::any()),
Permission::update(Role::user($invitee->getId())),
Permission::update(Role::team($team->getId(), 'owner')),
Permission::delete(Role::user($invitee->getId())),
Permission::delete(Role::team($team->getId(), 'owner')),
],
'userId' => $invitee->getId(),
'userInternalId' => $invitee->getInternalId(),
'teamId' => $team->getId(),
'teamInternalId' => $team->getInternalId(),
'roles' => $roles,
'invited' => DateTime::now(),
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::now() : null,
'confirm' => ($isPrivilegedUser || $isAppUser),
'secret' => Auth::hash($secret),
'search' => implode(' ', [$membershipId, $invitee->getId()])
$membership = $dbForProject->findOne('memberships', [
Query::equal('userInternalId', [$invitee->getInternalId()]),
Query::equal('teamInternalId', [$team->getInternalId()]),
]);
if ($isPrivilegedUser || $isAppUser) { // Allow admin to create membership
try {
$membership = Authorization::skip(fn () => $dbForProject->createDocument('memberships', $membership));
} catch (Duplicate $th) {
throw new Exception(Exception::TEAM_INVITE_ALREADY_EXISTS);
}
$secret = Auth::tokenGenerator();
if ($membership->isEmpty()) {
$membershipId = ID::unique();
$membership = new Document([
'$id' => $membershipId,
'$permissions' => [
Permission::read(Role::any()),
Permission::update(Role::user($invitee->getId())),
Permission::update(Role::team($team->getId(), 'owner')),
Permission::delete(Role::user($invitee->getId())),
Permission::delete(Role::team($team->getId(), 'owner')),
],
'userId' => $invitee->getId(),
'userInternalId' => $invitee->getInternalId(),
'teamId' => $team->getId(),
'teamInternalId' => $team->getInternalId(),
'roles' => $roles,
'invited' => DateTime::now(),
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::now() : null,
'confirm' => ($isPrivilegedUser || $isAppUser),
'secret' => Auth::hash($secret),
'search' => implode(' ', [$membershipId, $invitee->getId()])
]);
$membership = ($isPrivilegedUser || $isAppUser) ?
Authorization::skip(fn () => $dbForProject->createDocument('memberships', $membership)) :
$dbForProject->createDocument('memberships', $membership);
Authorization::skip(fn () => $dbForProject->increaseDocumentAttribute('teams', $team->getId(), 'total', 1));
$dbForProject->purgeCachedDocument('users', $invitee->getId());
} else {
try {
$membership = $dbForProject->createDocument('memberships', $membership);
} catch (Duplicate $th) {
throw new Exception(Exception::TEAM_INVITE_ALREADY_EXISTS);
} elseif ($membership->getAttribute('confirm') === false) {
$membership->setAttribute('secret', Auth::hash($secret));
$membership->setAttribute('invited', DateTime::now());
if ($isPrivilegedUser || $isAppUser) {
$membership->setAttribute('joined', DateTime::now());
$membership->setAttribute('confirm', true);
}
$membership = ($isPrivilegedUser || $isAppUser) ?
Authorization::skip(fn () => $dbForProject->updateDocument('memberships', $membership->getId(), $membership)) :
$dbForProject->updateDocument('memberships', $membership->getId(), $membership);
} else {
throw new Exception(Exception::MEMBERSHIP_ALREADY_CONFIRMED);
}
if ($isPrivilegedUser || $isAppUser) {
$dbForProject->purgeCachedDocument('users', $invitee->getId());
} else {
$url = Template::parseURL($url);
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['membershipId' => $membership->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId]);
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['membershipId' => $membership->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId, 'teamName' => $team->getAttribute('name')]);
$url = Template::unParseURL($url);
if (!empty($email)) {
$projectName = $project->isEmpty() ? 'Console' : $project->getAttribute('name', '[APP-NAME]');
@@ -650,7 +705,7 @@ App::post('/v1/teams/:teamId/memberships')
'owner' => $user->getAttribute('name'),
'direction' => $locale->getText('settings.direction'),
/* {{user}}, {{team}}, {{redirect}} and {{project}} are required in default and custom templates */
'user' => $user->getAttribute('name'),
'user' => $name,
'team' => $team->getAttribute('name'),
'redirect' => $url,
'project' => $projectName
@@ -660,10 +715,10 @@ App::post('/v1/teams/:teamId/memberships')
->setSubject($subject)
->setBody($body)
->setRecipient($invitee->getAttribute('email'))
->setName($invitee->getAttribute('name'))
->setName($invitee->getAttribute('name', ''))
->setVariables($emailVariables)
->trigger()
;
->trigger();
} elseif (!empty($phone)) {
if (empty(System::getEnv('_APP_SMS_PROVIDER'))) {
throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured');
@@ -691,6 +746,27 @@ App::post('/v1/teams/:teamId/memberships')
->setMessage($messageDoc)
->setRecipients([$phone])
->setProviderType('SMS');
if (isset($plan['authPhone'])) {
$timelimit = $timelimit('organization:{organizationId}', $plan['authPhone'], 30 * 24 * 60 * 60); // 30 days
$timelimit
->setParam('{organizationId}', $project->getAttribute('teamId'));
$abuse = new Abuse($timelimit);
if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') {
$helper = PhoneNumberUtil::getInstance();
$countryCode = $helper->parse($phone)->getCountryCode();
if (!empty($countryCode)) {
$queueForStatsUsage
->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
}
}
$queueForStatsUsage
->addMetric(METRIC_AUTH_METHOD_PHONE, 1)
->setProject($project)
->trigger();
}
}
}
@@ -715,14 +791,18 @@ App::get('/v1/teams/:teamId/memberships')
->desc('List team memberships')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'listMemberships')
->label('sdk.description', '/docs/references/teams/list-team-members.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP_LIST)
->label('sdk.offline.model', '/teams/{teamId}/memberships')
->label('sdk', new Method(
namespace: 'teams',
name: 'listMemberships',
description: '/docs/references/teams/list-team-members.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MEMBERSHIP_LIST,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('queries', [], new Memberships(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Memberships::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
@@ -849,15 +929,18 @@ App::get('/v1/teams/:teamId/memberships/:membershipId')
->desc('Get team membership')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'getMembership')
->label('sdk.description', '/docs/references/teams/get-team-member.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
->label('sdk.offline.model', '/teams/{teamId}/memberships')
->label('sdk.offline.key', '{membershipId}')
->label('sdk', new Method(
namespace: 'teams',
name: 'getMembership',
description: '/docs/references/teams/get-team-member.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MEMBERSHIP,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('membershipId', '', new UID(), 'Membership ID.')
->inject('response')
@@ -932,13 +1015,18 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId')
->label('scope', 'teams.write')
->label('audits.event', 'membership.update')
->label('audits.resource', 'team/{request.teamId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateMembership')
->label('sdk.description', '/docs/references/teams/update-team-membership.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
->label('sdk', new Method(
namespace: 'teams',
name: 'updateMembership',
description: '/docs/references/teams/update-team-membership.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MEMBERSHIP,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('membershipId', '', new UID(), 'Membership ID.')
->param('roles', [], function (Document $project) {
@@ -1015,13 +1103,18 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
->label('audits.event', 'membership.update')
->label('audits.resource', 'team/{request.teamId}')
->label('audits.userId', '{request.userId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateMembershipStatus')
->label('sdk.description', '/docs/references/teams/update-team-membership-status.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
->label('sdk', new Method(
namespace: 'teams',
name: 'updateMembershipStatus',
description: '/docs/references/teams/update-team-membership-status.md',
auth: [AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_MEMBERSHIP,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('membershipId', '', new UID(), 'Membership ID.')
->param('userId', '', new UID(), 'User ID.')
@@ -1167,12 +1260,19 @@ App::delete('/v1/teams/:teamId/memberships/:membershipId')
->label('scope', 'teams.write')
->label('audits.event', 'membership.delete')
->label('audits.resource', 'team/{request.teamId}')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'deleteMembership')
->label('sdk.description', '/docs/references/teams/delete-team-membership.md')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->label('sdk', new Method(
namespace: 'teams',
name: 'deleteMembership',
description: '/docs/references/teams/delete-team-membership.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_NOCONTENT,
model: Response::MODEL_NONE,
)
],
contentType: ContentType::NONE
))
->param('teamId', '', new UID(), 'Team ID.')
->param('membershipId', '', new UID(), 'Membership ID.')
->inject('response')
@@ -1230,13 +1330,18 @@ App::get('/v1/teams/:teamId/logs')
->desc('List team logs')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'listLogs')
->label('sdk.description', '/docs/references/teams/get-team-logs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LOG_LIST)
->label('sdk', new Method(
namespace: 'teams',
name: 'listLogs',
description: '/docs/references/teams/get-team-logs.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_LOG_LIST,
)
]
))
->param('teamId', '', new UID(), 'Team ID.')
->param('queries', [], new Queries([new Limit(), new Offset()]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
@@ -1257,13 +1362,15 @@ App::get('/v1/teams/:teamId/logs')
throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage());
}
$grouped = Query::groupByType($queries);
$limit = $grouped['limit'] ?? APP_LIMIT_COUNT;
$offset = $grouped['offset'] ?? 0;
// Temp fix for logs
$queries[] = Query::or([
Query::greaterThan('$createdAt', DateTime::format(new \DateTime('2025-02-26T01:30+00:00'))),
Query::lessThan('$createdAt', DateTime::format(new \DateTime('2025-02-13T00:00+00:00'))),
]);
$audit = new Audit($dbForProject);
$resource = 'team/' . $team->getId();
$logs = $audit->getLogsByResource($resource, $limit, $offset);
$logs = $audit->getLogsByResource($resource, $queries);
$output = [];
@@ -1310,7 +1417,7 @@ App::get('/v1/teams/:teamId/logs')
}
}
$response->dynamic(new Document([
'total' => $audit->countLogsByResource($resource),
'total' => $audit->countLogsByResource($resource, $queries),
'logs' => $output,
]), Response::MODEL_LOG_LIST);
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -24,7 +24,7 @@ App::get('/v1/mock/tests/general/oauth2')
->groups(['mock'])
->label('scope', 'public')
->label('docs', false)
->label('sdk.mock', true)
->label('mock', true)
->param('client_id', '', new Text(100), 'OAuth2 Client ID.')
->param('redirect_uri', '', new Host(['localhost']), 'OAuth2 Redirect URI.') // Important to deny an open redirect attack
->param('scope', '', new Text(100), 'OAuth2 scope list.')
@@ -40,7 +40,7 @@ App::get('/v1/mock/tests/general/oauth2/token')
->groups(['mock'])
->label('scope', 'public')
->label('docs', false)
->label('sdk.mock', true)
->label('mock', true)
->param('client_id', '', new Text(100), 'OAuth2 Client ID.')
->param('client_secret', '', new Text(100), 'OAuth2 scope list.')
->param('grant_type', 'authorization_code', new WhiteList(['refresh_token', 'authorization_code']), 'OAuth2 Grant Type.', true)
@@ -162,15 +162,15 @@ App::post('/v1/mock/api-key-unprefixed')
->label('docs', false)
->param('projectId', '', new UID(), 'Project ID.')
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, Response $response, Database $dbForConsole) {
->inject('dbForPlatform')
->action(function (string $projectId, Response $response, Database $dbForPlatform) {
$isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development';
if (!$isDevelopment) {
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
}
$project = $dbForConsole->getDocument('projects', $projectId);
$project = $dbForPlatform->getDocument('projects', $projectId);
if ($project->isEmpty()) {
throw new Exception(Exception::PROJECT_NOT_FOUND);
@@ -195,9 +195,9 @@ App::post('/v1/mock/api-key-unprefixed')
'secret' => \bin2hex(\random_bytes(128)),
]);
$key = $dbForConsole->createDocument('keys', $key);
$key = $dbForPlatform->createDocument('keys', $key);
$dbForConsole->purgeCachedDocument('projects', $project->getId());
$dbForPlatform->purgeCachedDocument('projects', $project->getId());
$response
->setStatusCode(Response::STATUS_CODE_CREATED)
@@ -214,15 +214,15 @@ App::get('/v1/mock/github/callback')
->inject('gitHub')
->inject('project')
->inject('response')
->inject('dbForConsole')
->action(function (string $providerInstallationId, string $projectId, GitHub $github, Document $project, Response $response, Database $dbForConsole) {
->inject('dbForPlatform')
->action(function (string $providerInstallationId, string $projectId, GitHub $github, Document $project, Response $response, Database $dbForPlatform) {
$isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development';
if (!$isDevelopment) {
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
}
$project = $dbForConsole->getDocument('projects', $projectId);
$project = $dbForPlatform->getDocument('projects', $projectId);
if ($project->isEmpty()) {
$error = 'Project with the ID from state could not be found.';
@@ -256,7 +256,7 @@ App::get('/v1/mock/github/callback')
'personal' => false
]);
$installation = $dbForConsole->createDocument('installations', $installation);
$installation = $dbForPlatform->createDocument('installations', $installation);
}
$response->json([
+209 -187
View File
@@ -1,8 +1,7 @@
<?php
use Ahc\Jwt\JWT;
use Ahc\Jwt\JWTException;
use Appwrite\Auth\Auth;
use Appwrite\Auth\Key;
use Appwrite\Auth\MFA\Type\TOTP;
use Appwrite\Event\Audit;
use Appwrite\Event\Build;
@@ -12,14 +11,14 @@ use Appwrite\Event\Event;
use Appwrite\Event\Func;
use Appwrite\Event\Messaging;
use Appwrite\Event\Realtime;
use Appwrite\Event\Usage;
use Appwrite\Event\StatsUsage;
use Appwrite\Event\Webhook;
use Appwrite\Extend\Exception;
use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\SDK\Method;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\Database\TimeLimit;
use Utopia\App;
use Utopia\Cache\Adapter\Filesystem;
use Utopia\Cache\Cache;
@@ -29,7 +28,7 @@ use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Validator\Authorization;
use Utopia\Queue\Connection;
use Utopia\Queue\Publisher;
use Utopia\System\System;
use Utopia\Validator\WhiteList;
@@ -59,7 +58,7 @@ $parseLabel = function (string $label, array $responsePayload, array $requestPar
return $label;
};
$eventDatabaseListener = function (Document $document, Response $response, Event $queueForEvents, Func $queueForFunctions, Webhook $queueForWebhooks, Realtime $queueForRealtime) {
$eventDatabaseListener = function (Document $project, Document $document, Response $response, Event $queueForEvents, Func $queueForFunctions, Webhook $queueForWebhooks, Realtime $queueForRealtime) {
// Only trigger events for user creation with the database listener.
if ($document->getCollection() !== 'users') {
return;
@@ -75,20 +74,23 @@ $eventDatabaseListener = function (Document $document, Response $response, Event
->from($queueForEvents)
->trigger();
$queueForWebhooks
->from($queueForEvents)
->trigger();
if ($queueForEvents->getProject()->getId() === 'console') {
return;
/** Trigger webhooks events only if a project has them enabled */
if (!empty($project->getAttribute('webhooks'))) {
$queueForWebhooks
->from($queueForEvents)
->trigger();
}
$queueForRealtime
->from($queueForEvents)
->trigger();
/** Trigger realtime events only for non console events */
if ($queueForEvents->getProject()->getId() !== 'console') {
$queueForRealtime
->from($queueForEvents)
->trigger();
}
};
$usageDatabaseListener = function (string $event, Document $document, Usage $queueForUsage) {
$usageDatabaseListener = function (string $event, Document $document, StatsUsage $queueForStatsUsage) {
$value = 1;
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$value = -1;
@@ -96,80 +98,81 @@ $usageDatabaseListener = function (string $event, Document $document, Usage $que
switch (true) {
case $document->getCollection() === 'teams':
$queueForUsage
->addMetric(METRIC_TEAMS, $value); // per project
$queueForStatsUsage->addMetric(METRIC_TEAMS, $value); // per project
break;
case $document->getCollection() === 'users':
$queueForUsage
->addMetric(METRIC_USERS, $value); // per project
$queueForStatsUsage->addMetric(METRIC_USERS, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
->addReduce($document);
$queueForStatsUsage->addReduce($document);
}
break;
case $document->getCollection() === 'sessions': // sessions
$queueForUsage
->addMetric(METRIC_SESSIONS, $value); //per project
$queueForStatsUsage->addMetric(METRIC_SESSIONS, $value); //per project
break;
case $document->getCollection() === 'databases': // databases
$queueForUsage
->addMetric(METRIC_DATABASES, $value); // per project
$queueForStatsUsage->addMetric(METRIC_DATABASES, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
->addReduce($document);
$queueForStatsUsage->addReduce($document);
}
break;
case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections
$parts = explode('_', $document->getCollection());
$databaseInternalId = $parts[1] ?? 0;
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_COLLECTIONS, $value) // per project
->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), $value)
;
->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), $value);
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
->addReduce($document);
$queueForStatsUsage->addReduce($document);
}
break;
case str_starts_with($document->getCollection(), 'database_') && str_contains($document->getCollection(), '_collection_'): //documents
$parts = explode('_', $document->getCollection());
$databaseInternalId = $parts[1] ?? 0;
$collectionInternalId = $parts[3] ?? 0;
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_DOCUMENTS, $value) // per project
->addMetric(str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), $value) // per database
->addMetric(str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$databaseInternalId, $collectionInternalId], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS), $value); // per collection
break;
case $document->getCollection() === 'buckets': //buckets
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_BUCKETS, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
$queueForStatsUsage
->addReduce($document);
}
break;
case str_starts_with($document->getCollection(), 'bucket_'): // files
$parts = explode('_', $document->getCollection());
$bucketInternalId = $parts[1];
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_FILES, $value) // per project
->addMetric(METRIC_FILES_STORAGE, $document->getAttribute('sizeOriginal') * $value) // per project
->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES), $value) // per bucket
->addMetric(str_replace('{bucketInternalId}', $bucketInternalId, METRIC_BUCKET_ID_FILES_STORAGE), $document->getAttribute('sizeOriginal') * $value); // per bucket
break;
case $document->getCollection() === 'functions':
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_FUNCTIONS, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForUsage
$queueForStatsUsage
->addReduce($document);
}
break;
case $document->getCollection() === 'sites':
$queueForStatsUsage
->addMetric(METRIC_SITES, $value); // per project
if ($event === Database::EVENT_DOCUMENT_DELETE) {
$queueForStatsUsage
->addReduce($document);
}
break;
case $document->getCollection() === 'deployments':
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_DEPLOYMENTS, $value) // per project
->addMetric(METRIC_DEPLOYMENTS_STORAGE, $document->getAttribute('size') * $value) // per project
->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getAttribute('resourceType'), $document->getAttribute('resourceInternalId')], METRIC_FUNCTION_ID_DEPLOYMENTS), $value) // per function
@@ -184,127 +187,96 @@ App::init()
->groups(['api'])
->inject('utopia')
->inject('request')
->inject('dbForConsole')
->inject('dbForPlatform')
->inject('dbForProject')
->inject('queueForAudits')
->inject('project')
->inject('user')
->inject('session')
->inject('servers')
->inject('mode')
->inject('team')
->action(function (App $utopia, Request $request, Database $dbForConsole, Document $project, Document $user, ?Document $session, array $servers, string $mode, Document $team) {
->inject('apiKey')
->action(function (App $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, Audit $queueForAudits, Document $project, Document $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey) {
$route = $utopia->getRoute();
if ($project->isEmpty()) {
throw new Exception(Exception::PROJECT_NOT_FOUND);
}
/** Default role */
$roles = Config::getParam('roles', []);
$role = ($user->isEmpty())
$role = $user->isEmpty()
? Role::guests()->toString()
: Role::users()->toString();
/** Allowed Scopes for the role */
$scopes = $roles[$role]['scopes'];
$apiKey = $request->getHeader('x-appwrite-key', '');
// API Key authentication
if (!empty($apiKey)) {
// Do not allow API key and session to be set at the same time
if (!$user->isEmpty()) {
throw new Exception(Exception::USER_API_KEY_AND_SESSION_SET);
}
// Remove after migration
if (!\str_contains($apiKey, '_')) {
$keyType = API_KEY_STANDARD;
$authKey = $apiKey;
} else {
[ $keyType, $authKey ] = \explode('_', $apiKey, 2);
if ($apiKey->isExpired()) {
throw new Exception(Exception::PROJECT_KEY_EXPIRED);
}
if ($keyType === API_KEY_DYNAMIC) {
// Dynamic key
$role = $apiKey->getRole();
$scopes = $apiKey->getScopes();
$jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 0);
// Disable authorization checks for API keys
Authorization::setDefaultStatus(false);
try {
$payload = $jwtObj->decode($authKey);
} catch (JWTException $error) {
throw new Exception(Exception::API_KEY_EXPIRED);
}
if ($apiKey->getRole() === Auth::USER_ROLE_APPS) {
$user = new Document([
'$id' => '',
'status' => true,
'type' => Auth::ACTIVITY_TYPE_APP,
'email' => 'app.' . $project->getId() . '@service.' . $request->getHostname(),
'password' => '',
'name' => $apiKey->getName(),
]);
$projectId = $payload['projectId'] ?? '';
$tokenScopes = $payload['scopes'] ?? [];
$queueForAudits->setUser($user);
}
// JWT includes project ID for better security
if ($projectId === $project->getId()) {
$user = new Document([
'$id' => '',
'status' => true,
'email' => 'app.' . $project->getId() . '@service.' . $request->getHostname(),
'password' => '',
'name' => $project->getAttribute('name', 'Untitled'),
]);
if ($apiKey->getType() === API_KEY_STANDARD) {
$dbKey = $project->find(
key: 'secret',
find: $request->getHeader('x-appwrite-key', ''),
subject: 'keys'
);
$role = Auth::USER_ROLE_APPS;
$scopes = \array_merge($roles[$role]['scopes'], $tokenScopes);
if ($dbKey) {
$accessedAt = $dbKey->getAttribute('accessedAt', '');
Authorization::setRole(Auth::USER_ROLE_APPS);
Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys.
}
} elseif ($keyType === API_KEY_STANDARD) {
// No underline means no prefix. Backwards compatibility.
// Regular key
// Check if given key match project API keys
$key = $project->find('secret', $apiKey, 'keys');
if ($key) {
$user = new Document([
'$id' => '',
'status' => true,
'email' => 'app.' . $project->getId() . '@service.' . $request->getHostname(),
'password' => '',
'name' => $project->getAttribute('name', 'Untitled'),
]);
$role = Auth::USER_ROLE_APPS;
$scopes = \array_merge($roles[$role]['scopes'], $key->getAttribute('scopes', []));
$expire = $key->getAttribute('expire');
if (!empty($expire) && $expire < DateTime::formatTz(DateTime::now())) {
throw new Exception(Exception::PROJECT_KEY_EXPIRED);
}
Authorization::setRole(Auth::USER_ROLE_APPS);
Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys.
$accessedAt = $key->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCESS)) > $accessedAt) {
$key->setAttribute('accessedAt', DateTime::now());
$dbForConsole->updateDocument('keys', $key->getId(), $key);
$dbForConsole->purgeCachedDocument('projects', $project->getId());
$dbKey->setAttribute('accessedAt', DateTime::now());
$dbForPlatform->updateDocument('keys', $dbKey->getId(), $dbKey);
$dbForPlatform->purgeCachedDocument('projects', $project->getId());
}
$sdkValidator = new WhiteList($servers, true);
$sdk = $request->getHeader('x-sdk-name', 'UNKNOWN');
if ($sdkValidator->isValid($sdk)) {
$sdks = $key->getAttribute('sdks', []);
$sdks = $dbKey->getAttribute('sdks', []);
if (!in_array($sdk, $sdks)) {
array_push($sdks, $sdk);
$key->setAttribute('sdks', $sdks);
$sdks[] = $sdk;
$dbKey->setAttribute('sdks', $sdks);
/** Update access time as well */
$key->setAttribute('accessedAt', Datetime::now());
$dbForConsole->updateDocument('keys', $key->getId(), $key);
$dbForConsole->purgeCachedDocument('projects', $project->getId());
$dbKey->setAttribute('accessedAt', Datetime::now());
$dbForPlatform->updateDocument('keys', $dbKey->getId(), $dbKey);
$dbForPlatform->purgeCachedDocument('projects', $project->getId());
}
}
$queueForAudits->setUser($user);
}
}
}
// Admin User Authentication
} // Admin User Authentication
elseif (($project->getId() === 'console' && !$team->isEmpty() && !$user->isEmpty()) || ($project->getId() !== 'console' && !$user->isEmpty() && $mode === APP_MODE_ADMIN)) {
$teamId = $team->getId();
$adminRoles = [];
@@ -320,7 +292,7 @@ App::init()
throw new Exception(Exception::USER_UNAUTHORIZED);
}
$scopes = []; // reset scope if admin
$scopes = []; // Reset scope if admin
foreach ($adminRoles as $role) {
$scopes = \array_merge($scopes, $roles[$role]['scopes']);
}
@@ -335,25 +307,57 @@ App::init()
Authorization::setRole($authRole);
}
/** Do not allow access to disabled services */
$service = $route->getLabel('sdk.namespace', '');
if (!empty($service)) {
// Update project last activity
if (!$project->isEmpty() && $project->getId() !== 'console') {
$accessedAt = $project->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) {
$project->setAttribute('accessedAt', DateTime::now());
Authorization::skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $project));
}
}
// Update user last activity
if (!empty($user->getId())) {
$accessedAt = $user->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_USER_ACCESS)) > $accessedAt) {
$user->setAttribute('accessedAt', DateTime::now());
if (APP_MODE_ADMIN !== $mode) {
$dbForProject->updateDocument('users', $user->getId(), $user);
} else {
$dbForPlatform->updateDocument('users', $user->getId(), $user);
}
}
}
/**
* @var ?Method $method
*/
$method = $route->getLabel('sdk', false);
if (\is_array($method)) {
$method = $method[0];
}
if (!empty($method)) {
$namespace = $method->getNamespace();
if (
array_key_exists($service, $project->getAttribute('services', []))
&& !$project->getAttribute('services', [])[$service]
array_key_exists($namespace, $project->getAttribute('services', []))
&& !$project->getAttribute('services', [])[$namespace]
&& !(Auth::isPrivilegedUser(Authorization::getRoles()) || Auth::isAppUser(Authorization::getRoles()))
) {
throw new Exception(Exception::GENERAL_SERVICE_DISABLED);
}
}
/** Do now allow access if scope is not allowed */
// Do now allow access if scope is not allowed
$scope = $route->getLabel('scope', 'none');
if (!\in_array($scope, $scopes)) {
throw new Exception(Exception::GENERAL_UNAUTHORIZED_SCOPE, $user->getAttribute('email', 'User') . ' (role: ' . \strtolower($roles[$role]['label']) . ') missing scope (' . $scope . ')');
}
/** Do not allow access to blocked accounts */
// Do not allow access to blocked accounts
if (false === $user->getAttribute('status')) { // Account is blocked
throw new Exception(Exception::USER_BLOCKED);
}
@@ -383,17 +387,19 @@ App::init()
->inject('response')
->inject('project')
->inject('user')
->inject('queue')
->inject('publisher')
->inject('queueForEvents')
->inject('queueForMessaging')
->inject('queueForAudits')
->inject('queueForDeletes')
->inject('queueForDatabase')
->inject('queueForBuilds')
->inject('queueForUsage')
->inject('queueForStatsUsage')
->inject('dbForProject')
->inject('timelimit')
->inject('mode')
->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Connection $queue, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Usage $queueForUsage, Database $dbForProject, string $mode) use ($usageDatabaseListener, $eventDatabaseListener) {
->inject('apiKey')
->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, string $mode, ?Key $apiKey) use ($usageDatabaseListener, $eventDatabaseListener) {
$route = $utopia->getRoute();
@@ -416,7 +422,7 @@ App::init()
foreach ($abuseKeyLabel as $abuseKey) {
$start = $request->getContentRangeStart();
$end = $request->getContentRangeEnd();
$timeLimit = new TimeLimit($abuseKey, $route->getLabel('abuse-limit', 0), $route->getLabel('abuse-time', 3600), $dbForProject);
$timeLimit = $timelimit($abuseKey, $route->getLabel('abuse-limit', 0), $route->getLabel('abuse-time', 3600));
$timeLimit
->setParam('{projectId}', $project->getId())
->setParam('{userId}', $user->getId())
@@ -424,7 +430,7 @@ App::init()
->setParam('{ip}', $request->getIP())
->setParam('{url}', $request->getHostname() . $route->getPath())
->setParam('{method}', $request->getMethod())
->setParam('{chunkId}', (int) ($start / ($end + 1 - $start)));
->setParam('{chunkId}', (int)($start / ($end + 1 - $start)));
$timeLimitArray[] = $timeLimit;
}
@@ -444,7 +450,7 @@ App::init()
$abuse = new Abuse($timeLimit);
$remaining = $timeLimit->remaining();
$limit = $timeLimit->limit();
$time = (new \DateTime($timeLimit->time()))->getTimestamp() + $route->getLabel('abuse-time', 3600);
$time = $timeLimit->time() + $route->getLabel('abuse-time', 3600);
if ($limit && ($remaining < $closestLimit || is_null($closestLimit))) {
$closestLimit = $remaining;
@@ -478,9 +484,23 @@ App::init()
->setMode($mode)
->setUserAgent($request->getUserAgent(''))
->setIP($request->getIP())
->setHostname($request->getHostname())
->setEvent($route->getLabel('audits.event', ''))
->setProject($project)
->setUser($user);
->setProject($project);
/* If a session exists, use the user associated with the session */
if (!$user->isEmpty()) {
$userClone = clone $user;
// $user doesn't support `type` and can cause unintended effects.
$userClone->setAttribute('type', Auth::ACTIVITY_TYPE_USER);
$queueForAudits->setUser($userClone);
}
if (!empty($apiKey) && !empty($apiKey->getDisabledMetrics())) {
foreach ($apiKey->getDisabledMetrics() as $key) {
$queueForStatsUsage->disableMetric($key);
}
}
$queueForDeletes->setProject($project);
$queueForDatabase->setProject($project);
@@ -489,15 +509,16 @@ App::init()
// Clone the queues, to prevent events triggered by the database listener
// from overwriting the events that are supposed to be triggered in the shutdown hook.
$queueForEventsClone = new Event($queue);
$queueForFunctions = new Func($queue);
$queueForWebhooks = new Webhook($queue);
$queueForEventsClone = new Event($publisher);
$queueForFunctions = new Func($publisher);
$queueForWebhooks = new Webhook($publisher);
$queueForRealtime = new Realtime();
$dbForProject
->on(Database::EVENT_DOCUMENT_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForUsage))
->on(Database::EVENT_DOCUMENT_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForUsage))
->on(Database::EVENT_DOCUMENT_CREATE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage))
->on(Database::EVENT_DOCUMENT_DELETE, 'calculate-usage', fn ($event, $document) => $usageDatabaseListener($event, $document, $queueForStatsUsage))
->on(Database::EVENT_DOCUMENT_CREATE, 'create-trigger-events', fn ($event, $document) => $eventDatabaseListener(
$project,
$document,
$response,
$queueForEventsClone->from($queueForEvents),
@@ -522,12 +543,9 @@ App::init()
if ($type === 'bucket') {
$bucketId = $parts[1] ?? null;
$bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId));
$bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId));
$isAPIKey = Auth::isAppUser(Authorization::getRoles());
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) {
if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAppUser && !$isPrivilegedUser)) {
throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND);
}
@@ -551,6 +569,14 @@ App::init()
if ($file->isEmpty()) {
throw new Exception(Exception::STORAGE_FILE_NOT_FOUND);
}
//Do not update transformedAt if it's a console user
if (!Auth::isPrivilegedUser(Authorization::getRoles())) {
$transformedAt = $file->getAttribute('transformedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) {
$file->setAttribute('transformedAt', DateTime::now());
Authorization::skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file));
}
}
}
$response
@@ -563,8 +589,7 @@ App::init()
->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
->addHeader('Pragma', 'no-cache')
->addHeader('Expires', '0')
->addHeader('X-Appwrite-Cache', 'miss')
;
->addHeader('X-Appwrite-Cache', 'miss');
}
}
});
@@ -632,7 +657,7 @@ App::shutdown()
->inject('user')
->inject('queueForEvents')
->inject('queueForAudits')
->inject('queueForUsage')
->inject('queueForStatsUsage')
->inject('queueForDeletes')
->inject('queueForDatabase')
->inject('queueForBuilds')
@@ -641,9 +666,7 @@ App::shutdown()
->inject('queueForWebhooks')
->inject('queueForRealtime')
->inject('dbForProject')
->inject('mode')
->inject('dbForConsole')
->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Audit $queueForAudits, Usage $queueForUsage, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Messaging $queueForMessaging, Func $queueForFunctions, Event $queueForWebhooks, Realtime $queueForRealtime, Database $dbForProject, string $mode, Database $dbForConsole) use ($parseLabel) {
->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Audit $queueForAudits, StatsUsage $queueForStatsUsage, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Messaging $queueForMessaging, Func $queueForFunctions, Event $queueForWebhooks, Realtime $queueForRealtime, Database $dbForProject) use ($parseLabel) {
$responsePayload = $response->getPayload();
@@ -652,10 +675,6 @@ App::shutdown()
$queueForEvents->setPayload($responsePayload);
}
$queueForWebhooks
->from($queueForEvents)
->trigger();
$queueForFunctions
->from($queueForEvents)
->trigger();
@@ -665,6 +684,17 @@ App::shutdown()
->from($queueForEvents)
->trigger();
}
/** Trigger webhooks events only if a project has them enabled
* A future optimisation is to only trigger webhooks if the webhook is "enabled"
* But it might have performance implications on the API due to the number of webhooks etc.
* Some profiling is needed to see if this is a problem.
*/
if (!empty($project->getAttribute('webhooks'))) {
$queueForWebhooks
->from($queueForEvents)
->trigger();
}
}
$route = $utopia->getRoute();
@@ -682,10 +712,32 @@ App::shutdown()
}
if (!$user->isEmpty()) {
$userClone = clone $user;
// $user doesn't support `type` and can cause unintended effects.
$userClone->setAttribute('type', Auth::ACTIVITY_TYPE_USER);
$queueForAudits->setUser($userClone);
} elseif ($queueForAudits->getUser() === null || $queueForAudits->getUser()->isEmpty()) {
/**
* User in the request is empty, and no user was set for auditing previously.
* This indicates:
* - No API Key was used.
* - No active session exists.
*
* Therefore, we consider this an anonymous request and create a relevant user.
*/
$user = new Document([
'$id' => '',
'status' => true,
'type' => Auth::ACTIVITY_TYPE_GUEST,
'email' => 'guest.' . $project->getId() . '@service.' . $request->getHostname(),
'password' => '',
'name' => 'Guest',
]);
$queueForAudits->setUser($user);
}
if (!empty($queueForAudits->getResource()) && !empty($queueForAudits->getUser()->getId())) {
if (!empty($queueForAudits->getResource()) && !$queueForAudits->getUser()->isEmpty()) {
/**
* audits.payload is switched to default true
* in order to auto audit payload for all endpoints
@@ -698,6 +750,7 @@ App::shutdown()
foreach ($queueForEvents->getParams() as $key => $value) {
$queueForAudits->setParam($key, $value);
}
$queueForAudits->trigger();
}
@@ -717,9 +770,7 @@ App::shutdown()
$queueForMessaging->trigger();
}
/**
* Cache label
*/
// Cache label
$useCache = $route->getLabel('cache', false);
if ($useCache) {
$resource = $resourceType = null;
@@ -763,8 +814,6 @@ App::shutdown()
}
}
if ($project->getId() !== 'console') {
if (!Auth::isPrivilegedUser(Authorization::getRoles())) {
$fileSize = 0;
@@ -773,43 +822,16 @@ App::shutdown()
$fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size'];
}
$queueForUsage
$queueForStatsUsage
->addMetric(METRIC_NETWORK_REQUESTS, 1)
->addMetric(METRIC_NETWORK_INBOUND, $request->getSize() + $fileSize)
->addMetric(METRIC_NETWORK_OUTBOUND, $response->getSize());
}
$queueForUsage
$queueForStatsUsage
->setProject($project)
->trigger();
}
/**
* Update project last activity
*/
if (!$project->isEmpty() && $project->getId() !== 'console') {
$accessedAt = $project->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) {
$project->setAttribute('accessedAt', DateTime::now());
Authorization::skip(fn () => $dbForConsole->updateDocument('projects', $project->getId(), $project));
}
}
/**
* Update user last activity
*/
if (!$user->isEmpty()) {
$accessedAt = $user->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_USER_ACCESS)) > $accessedAt) {
$user->setAttribute('accessedAt', DateTime::now());
if (APP_MODE_ADMIN !== $mode) {
$dbForProject->updateDocument('users', $user->getId(), $user);
} else {
$dbForConsole->updateDocument('users', $user->getId(), $user);
}
}
}
});
App::init()
+9 -8
View File
@@ -5,6 +5,7 @@ use Appwrite\Extend\Exception;
use Appwrite\Utopia\Request;
use MaxMind\Db\Reader;
use Utopia\App;
use Utopia\Config\Config;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization;
@@ -57,44 +58,44 @@ App::init()
$auths = $project->getAttribute('auths', []);
switch ($route->getLabel('auth.type', '')) {
case 'emailPassword':
if (($auths['emailPassword'] ?? true) === false) {
case 'email-password':
if (($auths[Config::getParam('auth')['email-password']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email / Password authentication is disabled for this project');
}
break;
case 'magic-url':
if (($auths['usersAuthMagicURL'] ?? true) === false) {
if (($auths[Config::getParam('auth')['magic-url']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Magic URL authentication is disabled for this project');
}
break;
case 'anonymous':
if (($auths['anonymous'] ?? true) === false) {
if (($auths[Config::getParam('auth')['anonymous']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Anonymous authentication is disabled for this project');
}
break;
case 'phone':
if (($auths['phone'] ?? true) === false) {
if (($auths[Config::getParam('auth')['phone']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Phone authentication is disabled for this project');
}
break;
case 'invites':
if (($auths['invites'] ?? true) === false) {
if (($auths[Config::getParam('auth')['invites']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Invites authentication is disabled for this project');
}
break;
case 'jwt':
if (($auths['JWT'] ?? true) === false) {
if (($auths[Config::getParam('auth')['jwt']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'JWT authentication is disabled for this project');
}
break;
case 'email-otp':
if (($auths['emailOTP'] ?? true) === false) {
if (($auths[Config::getParam('auth')['email-otp']['key']] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email OTP authentication is disabled for this project');
}
break;
+353 -90
View File
@@ -9,18 +9,19 @@ use Swoole\Http\Request as SwooleRequest;
use Swoole\Http\Response as SwooleResponse;
use Swoole\Http\Server;
use Swoole\Process;
use Utopia\Abuse\Adapters\Database\TimeLimit;
use Swoole\Table;
use Utopia\App;
use Utopia\Audit\Audit;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Compression\Compression;
use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Duplicate;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Logger\Log;
use Utopia\Logger\Log\User;
@@ -28,6 +29,14 @@ use Utopia\Pools\Group;
use Utopia\Swoole\Files;
use Utopia\System\System;
Files::load(__DIR__.'/../public');
const DOMAIN_SYNC_TIMER = 30; // 30 seconds
$domains = new Table(1_000_000); // 1 million rows
$domains->column('value', Table::TYPE_INT, 1);
$domains->create();
$http = new Server(
host: "0.0.0.0",
port: System::getEnv('PORT', 80),
@@ -35,15 +44,17 @@ $http = new Server(
);
$payloadSize = 12 * (1024 * 1024); // 12MB - adding slight buffer for headers and other data that might be sent with the payload - update later with valid testing
$workerNumber = swoole_cpu_num() * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$totalWorkers = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$http
->set([
'worker_num' => $workerNumber,
'worker_num' => $totalWorkers,
'dispatch_func' => 'dispatch',
'open_http2_protocol' => true,
'http_compression' => false,
'package_max_length' => $payloadSize,
'buffer_output_size' => $payloadSize,
'task_worker_num' => 1, // required for the task to fetch domains background
]);
$http->on(Constant::EVENT_WORKER_START, function ($server, $workerId) {
@@ -58,8 +69,168 @@ $http->on(Constant::EVENT_AFTER_RELOAD, function ($server, $workerId) {
Console::success('Reload completed...');
});
/**
* Assigns HTTP requests to worker threads by analyzing its payload/content.
*
* Routes requests as 'safe' or 'risky' based on specific content patterns (like POST actions or certain domains)
* to optimize load distribution between the workers. Utilizes `$safeThreadsPercent` to manage risk by assigning
* riskier tasks to a dedicated worker subset. Prefers idle workers, with fallback to random selection if necessary.
* doc: https://openswoole.com/docs/modules/swoole-server/configuration#dispatch_func
*
* @param Server $server Swoole server instance.
* @param int $fd client ID
* @param int $type the type of data and its current state
* @param string|null $data Request content for categorization.
* @global int $totalThreads Total number of workers.
* @return int Chosen worker ID for the request.
*/
function dispatch(Server $server, int $fd, int $type, $data = null): int
{
global $totalWorkers, $domains;
// If data is not set we can send request to any worker
// first we try to pick idle worker, if not we randomly pick a worker
if ($data === null) {
for ($i = 0; $i < $totalWorkers; $i++) {
if ($server->getWorkerStatus($i) === SWOOLE_WORKER_IDLE) {
return $i;
}
}
return rand(0, $totalWorkers - 1);
}
$riskyWorkersPercent = intval(System::getEnv('_APP_RISKY_WORKERS_PERCENT', 80)) / 100; // Decimal form 0 to 1
// Each worker has numeric ID, starting from 0 and incrementing
// From 0 to riskyWorkers, we consider safe workers
// From riskyWorkers to totalWorkers, we consider risky workers
$riskyWorkers = (int) floor($totalWorkers * $riskyWorkersPercent); // Absolute amount of risky workers
$domain = '';
// max up to 3 as first line has request details and second line has host
$lines = explode("\n", $data, 3);
$request = $lines[0];
if (count($lines) > 1) {
$domain = trim(explode('Host: ', $lines[1])[1]);
}
// Sync executions are considered risky
$risky = false;
if (str_starts_with($request, 'POST') && str_contains($request, '/executions')) {
$risky = true;
} elseif (str_ends_with($domain, System::getEnv('_APP_DOMAIN_FUNCTIONS'))) {
$risky = true;
} elseif ($domains->get(md5($domain), 'value') === 1) {
// executions request coming from custom domain
$risky = true;
}
if ($risky) {
// If risky request, only consider risky workers
for ($j = $riskyWorkers; $j < $totalWorkers; $j++) {
/** Reference https://openswoole.com/docs/modules/swoole-server-getWorkerStatus#description */
if ($server->getWorkerStatus($j) === SWOOLE_WORKER_IDLE) {
// If idle worker found, give to him
return $j;
}
}
// If no idle workers, give to random risky worker
$worker = rand($riskyWorkers, $totalWorkers - 1);
Console::warning("swoole_dispatch: Risky branch: did not find a idle worker, picking random worker {$worker}");
return $worker;
}
// If safe request, give to any idle worker
// Its fine to pick risky worker here, because it's idle. Idle is never actually risky
for ($i = 0; $i < $totalWorkers; $i++) {
if ($server->getWorkerStatus($i) === SWOOLE_WORKER_IDLE) {
return $i;
}
}
// If no idle worker found, give to random safe worker
// We avoid risky workers here, as it could be in work - not idle. Thats exactly when they are risky.
$worker = rand(0, $riskyWorkers - 1);
Console::warning("swoole_dispatch: Non-risky branch: did not find a idle worker, picking random worker {$worker}");
return $worker;
}
include __DIR__ . '/controllers/general.php';
function createDatabase(App $app, string $resourceKey, string $dbName, array $collections, mixed $pools, callable $extraSetup = null): void
{
$max = 10;
$sleep = 1;
$attempts = 0;
do {
try {
$attempts++;
$resource = $app->getResource($resourceKey);
/* @var $database Database */
$database = is_callable($resource) ? $resource() : $resource;
break; // exit loop on success
} catch (\Exception $e) {
Console::warning(" └── Database not ready. Retrying connection ({$attempts})...");
$pools->reclaim();
if ($attempts >= $max) {
throw new \Exception(' └── Failed to connect to database: ' . $e->getMessage());
}
sleep($sleep);
}
} while ($attempts < $max);
Console::success("[Setup] - $dbName database init started...");
// Attempt to create the database
try {
Console::info(" └── Creating database: $dbName...");
$database->create();
} catch (\Exception $e) {
Console::info(" └── Skip: metadata table already exists");
}
// Process collections
foreach ($collections as $key => $collection) {
if (($collection['$collection'] ?? '') !== Database::METADATA) {
continue;
}
if (!$database->getCollection($key)->isEmpty()) {
continue;
}
Console::info(" └── Creating collection: {$collection['$id']}...");
$attributes = array_map(fn ($attr) => new Document([
'$id' => ID::custom($attr['$id']),
'type' => $attr['type'],
'size' => $attr['size'],
'required' => $attr['required'],
'signed' => $attr['signed'],
'array' => $attr['array'],
'filters' => $attr['filters'],
'default' => $attr['default'] ?? null,
'format' => $attr['format'] ?? ''
]), $collection['attributes']);
$indexes = array_map(fn ($index) => new Document([
'$id' => ID::custom($index['$id']),
'type' => $index['type'],
'attributes' => $index['attributes'],
'lengths' => $index['lengths'],
'orders' => $index['orders'],
]), $collection['indexes']);
$database->createCollection($key, $attributes, $indexes);
}
if ($extraSetup) {
$extraSetup($database);
}
}
$http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $register) {
$app = new App('UTC');
@@ -68,99 +239,120 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
/** @var Group $pools */
App::setResource('pools', fn () => $pools);
// wait for database to be ready
$attempts = 0;
$max = 10;
$sleep = 1;
do {
try {
$attempts++;
$dbForConsole = $app->getResource('dbForConsole');
/** @var Utopia\Database\Database $dbForConsole */
break; // leave the do-while if successful
} catch (\Throwable $e) {
Console::warning("Database not ready. Retrying connection ({$attempts})...");
if ($attempts >= $max) {
throw new \Exception('Failed to connect to database: ' . $e->getMessage());
}
sleep($sleep);
}
} while ($attempts < $max);
Console::success('[Setup] - Server database init started...');
try {
Console::success('[Setup] - Creating console database...');
$dbForConsole->create();
} catch (Duplicate) {
Console::success('[Setup] - Skip: metadata table already exists');
}
if ($dbForConsole->getCollection(Audit::COLLECTION)->isEmpty()) {
$audit = new Audit($dbForConsole);
$audit->setup();
}
if ($dbForConsole->getCollection(TimeLimit::COLLECTION)->isEmpty()) {
$adapter = new TimeLimit("", 0, 1, $dbForConsole);
$adapter->setup();
}
/** @var array $collections */
$collections = Config::getParam('collections', []);
$consoleCollections = $collections['console'];
foreach ($consoleCollections as $key => $collection) {
if (($collection['$collection'] ?? '') !== Database::METADATA) {
continue;
}
if (!$dbForConsole->getCollection($key)->isEmpty()) {
continue;
// create logs database first, `getLogsDB` is a callable.
createDatabase($app, 'getLogsDB', 'logs', $collections['logs'], $pools);
// create appwrite database, `dbForPlatform` is a direct access call.
createDatabase($app, 'dbForPlatform', 'appwrite', $collections['console'], $pools, function (Database $dbForPlatform) use ($collections) {
if ($dbForPlatform->getCollection(Audit::COLLECTION)->isEmpty()) {
$audit = new Audit($dbForPlatform);
$audit->setup();
}
Console::success('[Setup] - Creating console collection: ' . $collection['$id'] . '...');
if ($dbForPlatform->getDocument('buckets', 'default')->isEmpty()) {
Console::info(" └── Creating default bucket...");
$dbForPlatform->createDocument('buckets', new Document([
'$id' => ID::custom('default'),
'$collection' => ID::custom('buckets'),
'name' => 'Default',
'maximumFileSize' => (int) System::getEnv('_APP_STORAGE_LIMIT', 0),
'allowedFileExtensions' => [],
'enabled' => true,
'compression' => 'gzip',
'encryption' => true,
'antivirus' => true,
'fileSecurity' => true,
'$permissions' => [
Permission::create(Role::any()),
Permission::read(Role::any()),
Permission::update(Role::any()),
Permission::delete(Role::any()),
],
'search' => 'buckets Default',
]));
$attributes = \array_map(fn ($attribute) => new Document($attribute), $collection['attributes']);
$indexes = \array_map(fn (array $index) => new Document($index), $collection['indexes']);
$bucket = $dbForPlatform->getDocument('buckets', 'default');
$dbForConsole->createCollection($key, $attributes, $indexes);
}
Console::info(" └── Creating files collection for default bucket...");
$files = $collections['buckets']['files'] ?? [];
if (empty($files)) {
throw new Exception('Files collection is not configured.');
}
if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists($dbForConsole->getDatabase(), 'bucket_1')) {
Console::success('[Setup] - Creating default bucket...');
$dbForConsole->createDocument('buckets', new Document([
'$id' => ID::custom('default'),
'$collection' => ID::custom('buckets'),
'name' => 'Default',
'maximumFileSize' => (int) System::getEnv('_APP_STORAGE_LIMIT', 0), // 10MB
'allowedFileExtensions' => [],
'enabled' => true,
'compression' => 'gzip',
'encryption' => true,
'antivirus' => true,
'fileSecurity' => true,
'$permissions' => [
Permission::create(Role::any()),
Permission::read(Role::any()),
Permission::update(Role::any()),
Permission::delete(Role::any()),
],
'search' => 'buckets Default',
]));
$attributes = array_map(fn ($attr) => new Document([
'$id' => ID::custom($attr['$id']),
'type' => $attr['type'],
'size' => $attr['size'],
'required' => $attr['required'],
'signed' => $attr['signed'],
'array' => $attr['array'],
'filters' => $attr['filters'],
'default' => $attr['default'] ?? null,
'format' => $attr['format'] ?? ''
]), $files['attributes']);
$bucket = $dbForConsole->getDocument('buckets', 'default');
$indexes = array_map(fn ($index) => new Document([
'$id' => ID::custom($index['$id']),
'type' => $index['type'],
'attributes' => $index['attributes'],
'lengths' => $index['lengths'],
'orders' => $index['orders'],
]), $files['indexes']);
Console::success('[Setup] - Creating files collection for default bucket...');
$files = $collections['buckets']['files'] ?? [];
if (empty($files)) {
throw new Exception('Files collection is not configured.');
$dbForPlatform->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes);
}
$attributes = \array_map(fn ($attribute) => new Document($attribute), $files['attributes']);
$indexes = \array_map(fn (array $index) => new Document($index), $files['indexes']);
if (Authorization::skip(fn () => $dbForPlatform->getDocument('buckets', 'screenshots')->isEmpty())) {
Console::info(" └── Creating screenshots bucket...");
Authorization::skip(fn () => $dbForPlatform->createDocument('buckets', new Document([
'$id' => ID::custom('screenshots'),
'$collection' => ID::custom('buckets'),
'name' => 'Screenshots',
'maximumFileSize' => 5000000, // ~5MB
'allowedFileExtensions' => [ 'png' ],
'enabled' => true,
'compression' => Compression::GZIP,
'encryption' => false,
'antivirus' => false,
'fileSecurity' => true,
'$permissions' => [],
'search' => 'buckets Screenshots',
])));
$dbForConsole->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes);
}
$bucket = Authorization::skip(fn () => $dbForPlatform->getDocument('buckets', 'screenshots'));
Console::info(" └── Creating files collection for screenshots bucket...");
$files = $collections['buckets']['files'] ?? [];
if (empty($files)) {
throw new Exception('Files collection is not configured.');
}
$attributes = array_map(fn ($attr) => new Document([
'$id' => ID::custom($attr['$id']),
'type' => $attr['type'],
'size' => $attr['size'],
'required' => $attr['required'],
'signed' => $attr['signed'],
'array' => $attr['array'],
'filters' => $attr['filters'],
'default' => $attr['default'] ?? null,
'format' => $attr['format'] ?? ''
]), $files['attributes']);
$indexes = array_map(fn ($index) => new Document([
'$id' => ID::custom($index['$id']),
'type' => $index['type'],
'attributes' => $index['attributes'],
'lengths' => $index['lengths'],
'orders' => $index['orders'],
]), $files['indexes']);
Authorization::skip(fn () => $dbForPlatform->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes));
}
});
$projectCollections = $collections['projects'];
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
@@ -188,6 +380,11 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
Console::success('[Setup] - Skip: metadata table already exists');
}
if ($dbForProject->getCollection(Audit::COLLECTION)->isEmpty()) {
$audit = new Audit($dbForProject);
$audit->setup();
}
foreach ($projectCollections as $key => $collection) {
if (($collection['$collection'] ?? '') !== Database::METADATA) {
continue;
@@ -206,13 +403,15 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
}
$pools->reclaim();
Console::success('[Setup] - Server database init completed...');
});
Console::success('Server started successfully (max payload is ' . number_format($payloadSize) . ' bytes)');
Console::info("Master pid {$http->master_pid}, manager pid {$http->manager_pid}");
// Start the task that starts fetching custom domains
$http->task([], 0);
// listen ctrl + c
Process::signal(2, function () use ($http) {
Console::log('Stop by Ctrl+C');
@@ -240,7 +439,7 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
}
$app = new App('UTC');
$app->setCompression(true);
$app->setCompression(System::getEnv('_APP_COMPRESSION_ENABLED', 'enabled') === 'enabled');
$app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB
$pools = $register->get('pools');
@@ -269,10 +468,12 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
if (isset($user) && !$user->isEmpty()) {
$log->setUser(new User($user->getId()));
} else {
$log->setUser(new User('guest-' . hash('sha256', $request->getIP())));
}
$log->setNamespace("http");
$log->setServer(\gethostname());
$log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$log->setVersion($version);
$log->setType(Log::TYPE_ERROR);
$log->setMessage($th->getMessage());
@@ -290,8 +491,16 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
$log->addExtra('trace', $th->getTraceAsString());
$log->addExtra('roles', Authorization::getRoles());
$action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD");
$sdk = $route->getLabel("sdk", false);
$action = 'UNKNOWN_NAMESPACE.UNKNOWN.METHOD';
if (!empty($sdk)) {
/** @var Appwrite\SDK\Method $sdk */
$action = $sdk->getNamespace() . '.' . $sdk->getMethodName();
}
$log->setAction($action);
$log->addTag('service', $action);
$isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
@@ -330,4 +539,58 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
}
});
// Fetch domains every `DOMAIN_SYNC_TIMER` seconds and update in the memory
$http->on('Task', function () use ($register, $domains) {
$lastSyncUpdate = null;
$pools = $register->get('pools');
App::setResource('pools', fn () => $pools);
$app = new App('UTC');
/** @var Utopia\Database\Database $dbForPlatform */
$dbForPlatform = $app->getResource('dbForPlatform');
Console::loop(function () use ($dbForPlatform, $domains, &$lastSyncUpdate) {
try {
$time = DateTime::now();
$limit = 1000;
$sum = $limit;
$latestDocument = null;
while ($sum === $limit) {
$queries = [Query::limit($limit)];
if ($latestDocument !== null) {
$queries[] = Query::cursorAfter($latestDocument);
}
if ($lastSyncUpdate != null) {
$queries[] = Query::greaterThanEqual('$updatedAt', $lastSyncUpdate);
}
$results = [];
try {
$results = Authorization::skip(fn () => $dbForPlatform->find('rules', $queries));
} catch (Throwable $th) {
Console::error($th->getMessage());
}
$sum = count($results);
foreach ($results as $document) {
$domain = $document->getAttribute('domain');
if (str_ends_with($domain, System::getEnv('_APP_DOMAIN_FUNCTIONS')) || str_ends_with($domain, System::getEnv('_APP_DOMAIN_SITES'))) {
continue;
}
$domains->set(md5($domain), ['value' => 1]);
}
$latestDocument = !empty(array_key_last($results)) ? $results[array_key_last($results)] : null;
}
$lastSyncUpdate = $time;
if ($sum > 0) {
Console::log("Sync domains tick: {$sum} domains were updated");
}
} catch (Throwable $th) {
Console::error($th->getMessage());
}
}, DOMAIN_SYNC_TIMER, 0, function ($error) {
Console::error($error);
});
});
$http->start();
+9 -1798
View File
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
<?php
use Utopia\Config\Config;
Config::load('template-runtimes', __DIR__ . '/../config/template-runtimes.php');
Config::load('events', __DIR__ . '/../config/events.php');
Config::load('auth', __DIR__ . '/../config/auth.php');
Config::load('apis', __DIR__ . '/../config/apis.php'); // List of APIs
Config::load('errors', __DIR__ . '/../config/errors.php');
Config::load('oAuthProviders', __DIR__ . '/../config/oAuthProviders.php');
Config::load('platforms', __DIR__ . '/../config/platforms.php');
Config::load('console', __DIR__ . '/../config/console.php');
Config::load('collections', __DIR__ . '/../config/collections.php');
Config::load('frameworks', __DIR__ . '/../config/frameworks.php');
Config::load('runtimes', __DIR__ . '/../config/runtimes.php');
Config::load('runtimes-v2', __DIR__ . '/../config/runtimes-v2.php');
Config::load('usage', __DIR__ . '/../config/usage.php');
Config::load('roles', __DIR__ . '/../config/roles.php'); // User roles and scopes
Config::load('scopes', __DIR__ . '/../config/scopes.php'); // User roles and scopes
Config::load('services', __DIR__ . '/../config/services.php'); // List of services
Config::load('variables', __DIR__ . '/../config/variables.php'); // List of env variables
Config::load('regions', __DIR__ . '/../config/regions.php'); // List of available regions
Config::load('avatar-browsers', __DIR__ . '/../config/avatars/browsers.php');
Config::load('avatar-credit-cards', __DIR__ . '/../config/avatars/credit-cards.php');
Config::load('avatar-flags', __DIR__ . '/../config/avatars/flags.php');
Config::load('locale-codes', __DIR__ . '/../config/locale/codes.php');
Config::load('locale-currencies', __DIR__ . '/../config/locale/currencies.php');
Config::load('locale-eu', __DIR__ . '/../config/locale/eu.php');
Config::load('locale-languages', __DIR__ . '/../config/locale/languages.php');
Config::load('locale-phones', __DIR__ . '/../config/locale/phones.php');
Config::load('locale-countries', __DIR__ . '/../config/locale/countries.php');
Config::load('locale-continents', __DIR__ . '/../config/locale/continents.php');
Config::load('locale-templates', __DIR__ . '/../config/locale/templates.php');
Config::load('storage-logos', __DIR__ . '/../config/storage/logos.php');
Config::load('storage-mimes', __DIR__ . '/../config/storage/mimes.php');
Config::load('storage-inputs', __DIR__ . '/../config/storage/inputs.php');
Config::load('storage-outputs', __DIR__ . '/../config/storage/outputs.php');
Config::load('specifications', __DIR__ . '/../config/specifications.php');
Config::load('templates-function', __DIR__ . '/../config/templates/function.php');
Config::load('templates-site', __DIR__ . '/../config/templates/site.php');
+257
View File
@@ -0,0 +1,257 @@
<?php
use Appwrite\Platform\Modules\Compute\Specification;
const APP_NAME = 'Appwrite';
const APP_DOMAIN = 'appwrite.io';
const APP_EMAIL_TEAM = 'team@localhost.test'; // Default email address
const APP_EMAIL_SECURITY = ''; // Default security email address
const APP_USERAGENT = APP_NAME . '-Server v%s. Please report abuse at %s';
const APP_MODE_DEFAULT = 'default';
const APP_MODE_ADMIN = 'admin';
const APP_PAGING_LIMIT = 12;
const APP_LIMIT_COUNT = 5000;
const APP_LIMIT_USERS = 10_000;
const APP_LIMIT_USER_PASSWORD_HISTORY = 20;
const APP_LIMIT_USER_SESSIONS_MAX = 100;
const APP_LIMIT_USER_SESSIONS_DEFAULT = 10;
const APP_LIMIT_ANTIVIRUS = 20_000_000; //20MB
const APP_LIMIT_ENCRYPTION = 20_000_000; //20MB
const APP_LIMIT_COMPRESSION = 20_000_000; //20MB
const APP_LIMIT_ARRAY_PARAMS_SIZE = 100; // Default maximum of how many elements can there be in API parameter that expects array value
const APP_LIMIT_ARRAY_LABELS_SIZE = 1000; // Default maximum of how many labels elements can there be in API parameter that expects array value
const APP_LIMIT_ARRAY_ELEMENT_SIZE = 4096; // Default maximum length of element in array parameter represented by maximum URL length.
const APP_LIMIT_SUBQUERY = 1000;
const APP_LIMIT_SUBSCRIBERS_SUBQUERY = 1_000_000;
const APP_LIMIT_WRITE_RATE_DEFAULT = 60; // Default maximum write rate per rate period
const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate period in seconds
const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return in list API calls
const APP_KEY_ACCESS = 24 * 60 * 60; // 24 hours
const APP_USER_ACCESS = 24 * 60 * 60; // 24 hours
const APP_PROJECT_ACCESS = 24 * 60 * 60; // 24 hours
const APP_FILE_ACCESS = 24 * 60 * 60; // 24 hours
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
const APP_CACHE_BUSTER = 4318;
const APP_VERSION_STABLE = '1.7.0';
const APP_DATABASE_ATTRIBUTE_EMAIL = 'email';
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
const APP_DATABASE_ATTRIBUTE_IP = 'ip';
const APP_DATABASE_ATTRIBUTE_DATETIME = 'datetime';
const APP_DATABASE_ATTRIBUTE_URL = 'url';
const APP_DATABASE_ATTRIBUTE_INT_RANGE = 'intRange';
const APP_DATABASE_ATTRIBUTE_FLOAT_RANGE = 'floatRange';
const APP_DATABASE_ATTRIBUTE_STRING_MAX_LENGTH = 1_073_741_824; // 2^32 bits / 4 bits per char
const APP_DATABASE_TIMEOUT_MILLISECONDS_API = 15 * 1000; // 15 seconds
const APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER = 300 * 1000; // 5 minutes
const APP_DATABASE_TIMEOUT_MILLISECONDS_TASK = 300 * 1000; // 5 minutes
const APP_DATABASE_QUERY_MAX_VALUES = 500;
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_SITES = '/storage/sites';
const APP_STORAGE_FUNCTIONS = '/storage/functions';
const APP_STORAGE_BUILDS = '/storage/builds';
const APP_STORAGE_CACHE = '/storage/cache';
const APP_STORAGE_CERTIFICATES = '/storage/certificates';
const APP_STORAGE_CONFIG = '/storage/config';
const APP_STORAGE_READ_BUFFER = 20 * (1000 * 1000); //20MB other names `APP_STORAGE_MEMORY_LIMIT`, `APP_STORAGE_MEMORY_BUFFER`, `APP_STORAGE_READ_LIMIT`, `APP_STORAGE_BUFFER_LIMIT`
const APP_SOCIAL_TWITTER = 'https://twitter.com/appwrite';
const APP_SOCIAL_TWITTER_HANDLE = 'appwrite';
const APP_SOCIAL_FACEBOOK = 'https://www.facebook.com/appwrite.io';
const APP_SOCIAL_LINKEDIN = 'https://www.linkedin.com/company/appwrite';
const APP_SOCIAL_INSTAGRAM = 'https://www.instagram.com/appwrite.io';
const APP_SOCIAL_GITHUB = 'https://github.com/appwrite';
const APP_SOCIAL_DISCORD = 'https://appwrite.io/discord';
const APP_SOCIAL_DISCORD_CHANNEL = '564160730845151244';
const APP_SOCIAL_DEV = 'https://dev.to/appwrite';
const APP_SOCIAL_STACKSHARE = 'https://stackshare.io/appwrite';
const APP_SOCIAL_YOUTUBE = 'https://www.youtube.com/c/appwrite?sub_confirmation=1';
const APP_HOSTNAME_INTERNAL = 'appwrite';
const APP_COMPUTE_CPUS_DEFAULT = 0.5;
const APP_COMPUTE_MEMORY_DEFAULT = 512;
const APP_COMPUTE_SPECIFICATION_DEFAULT = Specification::S_1VCPU_512MB;
const APP_PLATFORM_SERVER = 'server';
const APP_PLATFORM_CLIENT = 'client';
const APP_PLATFORM_CONSOLE = 'console';
// Database Reconnect
const DATABASE_RECONNECT_SLEEP = 2;
const DATABASE_RECONNECT_MAX_ATTEMPTS = 10;
// Database Worker Types
const DATABASE_TYPE_CREATE_ATTRIBUTE = 'createAttribute';
const DATABASE_TYPE_CREATE_INDEX = 'createIndex';
const DATABASE_TYPE_DELETE_ATTRIBUTE = 'deleteAttribute';
const DATABASE_TYPE_DELETE_INDEX = 'deleteIndex';
const DATABASE_TYPE_DELETE_COLLECTION = 'deleteCollection';
const DATABASE_TYPE_DELETE_DATABASE = 'deleteDatabase';
// Build Worker Types
const BUILD_TYPE_DEPLOYMENT = 'deployment';
const BUILD_TYPE_RETRY = 'retry';
// Deletion Types
const DELETE_TYPE_DATABASES = 'databases';
const DELETE_TYPE_DOCUMENT = 'document';
const DELETE_TYPE_COLLECTIONS = 'collections';
const DELETE_TYPE_PROJECTS = 'projects';
const DELETE_TYPE_SITES = 'sites';
const DELETE_TYPE_FUNCTIONS = 'functions';
const DELETE_TYPE_DEPLOYMENTS = 'deployments';
const DELETE_TYPE_USERS = 'users';
const DELETE_TYPE_TEAM_PROJECTS = 'teams_projects';
const DELETE_TYPE_EXECUTIONS = 'executions';
const DELETE_TYPE_AUDIT = 'audit';
const DELETE_TYPE_ABUSE = 'abuse';
const DELETE_TYPE_USAGE = 'usage';
const DELETE_TYPE_REALTIME = 'realtime';
const DELETE_TYPE_BUCKETS = 'buckets';
const DELETE_TYPE_INSTALLATIONS = 'installations';
const DELETE_TYPE_RULES = 'rules';
const DELETE_TYPE_SESSIONS = 'sessions';
const DELETE_TYPE_CACHE_BY_TIMESTAMP = 'cacheByTimeStamp';
const DELETE_TYPE_CACHE_BY_RESOURCE = 'cacheByResource';
const DELETE_TYPE_SCHEDULES = 'schedules';
const DELETE_TYPE_TOPIC = 'topic';
const DELETE_TYPE_TARGET = 'target';
const DELETE_TYPE_EXPIRED_TARGETS = 'invalid_targets';
const DELETE_TYPE_SESSION_TARGETS = 'session_targets';
const DELETE_TYPE_MAINTENANCE = 'maintenance';
// Message types
const MESSAGE_SEND_TYPE_INTERNAL = 'internal';
const MESSAGE_SEND_TYPE_EXTERNAL = 'external';
// Mail Types
const MAIL_TYPE_VERIFICATION = 'verification';
const MAIL_TYPE_MAGIC_SESSION = 'magicSession';
const MAIL_TYPE_RECOVERY = 'recovery';
const MAIL_TYPE_INVITATION = 'invitation';
const MAIL_TYPE_CERTIFICATE = 'certificate';
// Auth Types
const APP_AUTH_TYPE_SESSION = 'Session';
const APP_AUTH_TYPE_JWT = 'JWT';
const APP_AUTH_TYPE_KEY = 'Key';
const APP_AUTH_TYPE_ADMIN = 'Admin';
// Response related
const MAX_OUTPUT_CHUNK_SIZE = 10 * 1024 * 1024; // 10MB
// Function headers
const FUNCTION_ALLOWLIST_HEADERS_REQUEST = ['content-type', 'agent', 'content-length', 'host'];
const FUNCTION_ALLOWLIST_HEADERS_RESPONSE = ['content-type', 'content-length'];
// Message types
const MESSAGE_TYPE_EMAIL = 'email';
const MESSAGE_TYPE_SMS = 'sms';
const MESSAGE_TYPE_PUSH = 'push';
// API key types
const API_KEY_STANDARD = 'standard';
const API_KEY_DYNAMIC = 'dynamic';
// Usage metrics
const METRIC_TEAMS = 'teams';
const METRIC_USERS = 'users';
const METRIC_WEBHOOKS_SENT = 'webhooks.events.sent';
const METRIC_WEBHOOKS_FAILED = 'webhooks.events.failed';
const METRIC_WEBHOOK_ID_SENT = '{webhookInternalId}.webhooks.events.sent';
const METRIC_WEBHOOK_ID_FAILED = '{webhookInternalId}.webhooks.events.failed';
const METRIC_AUTH_METHOD_PHONE = 'auth.method.phone';
const METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE = METRIC_AUTH_METHOD_PHONE . '.{countryCode}';
const METRIC_MESSAGES = 'messages';
const METRIC_MESSAGES_SENT = METRIC_MESSAGES . '.sent';
const METRIC_MESSAGES_FAILED = METRIC_MESSAGES . '.failed';
const METRIC_MESSAGES_TYPE = METRIC_MESSAGES . '.{type}';
const METRIC_MESSAGES_TYPE_SENT = METRIC_MESSAGES . '.{type}.sent';
const METRIC_MESSAGES_TYPE_FAILED = METRIC_MESSAGES . '.{type}.failed';
const METRIC_MESSAGES_TYPE_PROVIDER = METRIC_MESSAGES . '.{type}.{provider}';
const METRIC_MESSAGES_TYPE_PROVIDER_SENT = METRIC_MESSAGES . '.{type}.{provider}.sent';
const METRIC_MESSAGES_TYPE_PROVIDER_FAILED = METRIC_MESSAGES . '.{type}.{provider}.failed';
const METRIC_SESSIONS = 'sessions';
const METRIC_DATABASES = 'databases';
const METRIC_COLLECTIONS = 'collections';
const METRIC_DATABASES_STORAGE = 'databases.storage';
const METRIC_DATABASE_ID_COLLECTIONS = '{databaseInternalId}.collections';
const METRIC_DATABASE_ID_STORAGE = '{databaseInternalId}.databases.storage';
const METRIC_DOCUMENTS = 'documents';
const METRIC_DATABASE_ID_DOCUMENTS = '{databaseInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS = '{databaseInternalId}.{collectionInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE = '{databaseInternalId}.{collectionInternalId}.databases.storage';
const METRIC_DATABASES_OPERATIONS_READS = 'databases.operations.reads';
const METRIC_DATABASE_ID_OPERATIONS_READS = '{databaseInternalId}.databases.operations.reads';
const METRIC_DATABASES_OPERATIONS_WRITES = 'databases.operations.writes';
const METRIC_DATABASE_ID_OPERATIONS_WRITES = '{databaseInternalId}.databases.operations.writes';
const METRIC_BUCKETS = 'buckets';
const METRIC_FILES = 'files';
const METRIC_FILES_STORAGE = 'files.storage';
const METRIC_FILES_TRANSFORMATIONS = 'files.transformations';
const METRIC_BUCKET_ID_FILES_TRANSFORMATIONS = '{bucketInternalId}.files.transformations';
const METRIC_FILES_IMAGES_TRANSFORMED = 'files.imagesTransformed';
const METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED = '{bucketInternalId}.files.imagesTransformed';
const METRIC_BUCKET_ID_FILES = '{bucketInternalId}.files';
const METRIC_BUCKET_ID_FILES_STORAGE = '{bucketInternalId}.files.storage';
const METRIC_SITES = 'sites';
const METRIC_FUNCTIONS = 'functions';
const METRIC_DEPLOYMENTS = 'deployments';
const METRIC_DEPLOYMENTS_STORAGE = 'deployments.storage';
const METRIC_BUILDS = 'builds';
const METRIC_BUILDS_SUCCESS = 'builds.success';
const METRIC_BUILDS_FAILED = 'builds.failed';
const METRIC_BUILDS_STORAGE = 'builds.storage';
const METRIC_BUILDS_COMPUTE = 'builds.compute';
const METRIC_BUILDS_COMPUTE_SUCCESS = 'builds.compute.success';
const METRIC_BUILDS_COMPUTE_FAILED = 'builds.compute.failed';
const METRIC_BUILDS_MB_SECONDS = 'builds.mbSeconds';
const METRIC_FUNCTION_ID_BUILDS = '{functionInternalId}.builds';
const METRIC_FUNCTION_ID_BUILDS_SUCCESS = '{functionInternalId}.builds.success';
const METRIC_FUNCTION_ID_BUILDS_FAILED = '{functionInternalId}.builds.failed';
const METRIC_FUNCTION_ID_BUILDS_STORAGE = '{functionInternalId}.builds.storage';
const METRIC_FUNCTION_ID_BUILDS_COMPUTE = '{functionInternalId}.builds.compute';
const METRIC_FUNCTION_ID_BUILDS_COMPUTE_SUCCESS = '{functionInternalId}.builds.compute.success';
const METRIC_FUNCTION_ID_BUILDS_COMPUTE_FAILED = '{functionInternalId}.builds.compute.failed';
const METRIC_FUNCTION_ID_BUILDS_MB_SECONDS = '{functionInternalId}.builds.mbSeconds';
const METRIC_SITES_ID_BUILDS = 'sites.{siteInternalId}.builds';
const METRIC_SITES_ID_BUILDS_SUCCESS = 'sites.{siteInternalId}.builds.success';
const METRIC_SITES_ID_BUILDS_FAILED = 'sites.{siteInternalId}.builds.failed';
const METRIC_SITES_ID_BUILDS_STORAGE = 'sites.{siteInternalId}.builds.storage';
const METRIC_SITES_ID_BUILDS_COMPUTE = 'sites.{siteInternalId}.builds.compute';
const METRIC_SITES_ID_BUILDS_COMPUTE_SUCCESS = 'sites.{siteInternalId}.builds.compute.success';
const METRIC_SITES_ID_BUILDS_COMPUTE_FAILED = 'sites.{siteInternalId}.builds.compute.failed';
const METRIC_SITES_ID_BUILDS_MB_SECONDS = 'sites.{siteInternalId}.builds.mbSeconds';
const METRIC_FUNCTION_ID_DEPLOYMENTS = '{resourceType}.{resourceInternalId}.deployments';
const METRIC_FUNCTION_ID_DEPLOYMENTS_STORAGE = '{resourceType}.{resourceInternalId}.deployments.storage';
const METRIC_EXECUTIONS = 'executions';
const METRIC_EXECUTIONS_COMPUTE = 'executions.compute';
const METRIC_EXECUTIONS_MB_SECONDS = 'executions.mbSeconds';
const METRIC_FUNCTION_ID_EXECUTIONS = '{functionInternalId}.executions';
const METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE = '{functionInternalId}.executions.compute';
const METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS = '{functionInternalId}.executions.mbSeconds';
const METRIC_SITE_ID_DEPLOYMENTS = '{resourceType}.{resourceInternalId}.deployments';
const METRIC_SITE_ID_DEPLOYMENTS_STORAGE = '{resourceType}.{resourceInternalId}.deployments.storage';
const METRIC_SITE_ID_BUILDS = '{siteInternalId}.builds';
const METRIC_SITE_ID_BUILDS_STORAGE = '{siteInternalId}.builds.storage';
const METRIC_SITE_ID_BUILDS_COMPUTE = '{siteInternalId}.builds.compute';
const METRIC_SITE_ID_BUILDS_MB_SECONDS = '{siteInternalId}.builds.mbSeconds';
const METRIC_NETWORK_REQUESTS = 'network.requests';
const METRIC_NETWORK_INBOUND = 'network.inbound';
const METRIC_NETWORK_OUTBOUND = 'network.outbound';
const METRIC_MAU = 'users.mau';
const METRIC_DAU = 'users.dau';
const METRIC_WAU = 'users.wau';
const METRIC_WEBHOOKS = 'webhooks';
const METRIC_PLATFORMS = 'platforms';
const METRIC_PROVIDERS = 'providers';
const METRIC_TOPICS = 'topics';
const METRIC_TARGETS = 'targets';
const METRIC_PROVIDER_TYPE_TARGETS = '{providerType}.targets';
const METRIC_KEYS = 'keys';
const METRIC_DOMAINS = 'domains';
const METRIC_RESOURCE_TYPE_ID_BUILDS = '{resourceType}.{resourceInternalId}.builds';
const METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE = '{resourceType}.{resourceInternalId}.builds.storage';
const METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS = '{resourceType}.{resourceInternalId}.deployments';
const METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE = '{resourceType}.{resourceInternalId}.deployments.storage';
// Resource types
const RESOURCE_TYPE_PROJECTS = 'projects';
const RESOURCE_TYPE_FUNCTIONS = 'functions';
const RESOURCE_TYPE_SITES = 'sites';
const RESOURCE_TYPE_DATABASES = 'databases';
const RESOURCE_TYPE_BUCKETS = 'buckets';
const RESOURCE_TYPE_PROVIDERS = 'providers';
const RESOURCE_TYPE_TOPICS = 'topics';
const RESOURCE_TYPE_SUBSCRIBERS = 'subscribers';
const RESOURCE_TYPE_MESSAGES = 'messages';
+404
View File
@@ -0,0 +1,404 @@
<?php
use Appwrite\OpenSSL\OpenSSL;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\System\System;
Database::addFilter(
'casting',
function (mixed $value) {
return json_encode(['value' => $value], JSON_PRESERVE_ZERO_FRACTION);
},
function (mixed $value) {
if (is_null($value)) {
return;
}
return json_decode($value, true)['value'];
}
);
Database::addFilter(
'enum',
function (mixed $value, Document $attribute) {
if ($attribute->isSet('elements')) {
$attribute->removeAttribute('elements');
}
return $value;
},
function (mixed $value, Document $attribute) {
$formatOptions = \json_decode($attribute->getAttribute('formatOptions', '[]'), true);
if (isset($formatOptions['elements'])) {
$attribute->setAttribute('elements', $formatOptions['elements']);
}
return $value;
}
);
Database::addFilter(
'range',
function (mixed $value, Document $attribute) {
if ($attribute->isSet('min')) {
$attribute->removeAttribute('min');
}
if ($attribute->isSet('max')) {
$attribute->removeAttribute('max');
}
return $value;
},
function (mixed $value, Document $attribute) {
$formatOptions = json_decode($attribute->getAttribute('formatOptions', '[]'), true);
if (isset($formatOptions['min']) || isset($formatOptions['max'])) {
$attribute
->setAttribute('min', $formatOptions['min'])
->setAttribute('max', $formatOptions['max']);
}
return $value;
}
);
Database::addFilter(
'subQueryAttributes',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
$attributes = $database->find('attributes', [
Query::equal('collectionInternalId', [$document->getInternalId()]),
Query::equal('databaseInternalId', [$document->getAttribute('databaseInternalId')]),
Query::limit($database->getLimitForAttributes()),
]);
foreach ($attributes as $attribute) {
if ($attribute->getAttribute('type') === Database::VAR_RELATIONSHIP) {
$options = $attribute->getAttribute('options');
foreach ($options as $key => $value) {
$attribute->setAttribute($key, $value);
}
$attribute->removeAttribute('options');
}
}
return $attributes;
}
);
Database::addFilter(
'subQueryIndexes',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('indexes', [
Query::equal('collectionInternalId', [$document->getInternalId()]),
Query::equal('databaseInternalId', [$document->getAttribute('databaseInternalId')]),
Query::limit($database->getLimitForIndexes()),
]);
}
);
Database::addFilter(
'subQueryPlatforms',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('platforms', [
Query::equal('projectInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]);
}
);
Database::addFilter(
'subQueryKeys',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('keys', [
Query::equal('projectInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]);
}
);
Database::addFilter(
'subQueryWebhooks',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('webhooks', [
Query::equal('projectInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]);
}
);
Database::addFilter(
'subQuerySessions',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database->find('sessions', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
}
);
Database::addFilter(
'subQueryTokens',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database
->find('tokens', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
}
);
Database::addFilter(
'subQueryChallenges',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database
->find('challenges', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
}
);
Database::addFilter(
'subQueryAuthenticators',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database
->find('authenticators', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
}
);
Database::addFilter(
'subQueryMemberships',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database
->find('memberships', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
}
);
Database::addFilter(
'subQueryVariables',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('variables', [
Query::equal('resourceInternalId', [$document->getInternalId()]),
Query::equal('resourceType', ['function', 'site']),
Query::limit(APP_LIMIT_SUBQUERY),
]);
}
);
Database::addFilter(
'encrypt',
function (mixed $value) {
$key = System::getEnv('_APP_OPENSSL_KEY_V1');
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
$tag = null;
return json_encode([
'data' => OpenSSL::encrypt($value, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag),
'method' => OpenSSL::CIPHER_AES_128_GCM,
'iv' => \bin2hex($iv),
'tag' => \bin2hex($tag ?? ''),
'version' => '1',
]);
},
function (mixed $value) {
if (is_null($value)) {
return;
}
$value = json_decode($value, true);
$key = System::getEnv('_APP_OPENSSL_KEY_V' . $value['version']);
return OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag']));
}
);
Database::addFilter(
'subQueryProjectVariables',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return $database
->find('variables', [
Query::equal('resourceType', ['project']),
Query::limit(APP_LIMIT_SUBQUERY)
]);
}
);
Database::addFilter(
'userSearch',
function (mixed $value, Document $user) {
$searchValues = [
$user->getId(),
$user->getAttribute('email', ''),
$user->getAttribute('name', ''),
$user->getAttribute('phone', '')
];
foreach ($user->getAttribute('labels', []) as $label) {
$searchValues[] = 'label:' . $label;
}
$search = implode(' ', \array_filter($searchValues));
return $search;
},
function (mixed $value) {
return $value;
}
);
Database::addFilter(
'subQueryTargets',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
return Authorization::skip(fn () => $database
->find('targets', [
Query::equal('userInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBQUERY)
]));
}
);
Database::addFilter(
'subQueryTopicTargets',
function (mixed $value) {
return;
},
function (mixed $value, Document $document, Database $database) {
$targetIds = Authorization::skip(fn () => \array_map(
fn ($document) => $document->getAttribute('targetInternalId'),
$database->find('subscribers', [
Query::equal('topicInternalId', [$document->getInternalId()]),
Query::limit(APP_LIMIT_SUBSCRIBERS_SUBQUERY)
])
));
if (\count($targetIds) > 0) {
return $database->skipValidation(fn () => $database->find('targets', [
Query::equal('$internalId', $targetIds)
]));
}
return [];
}
);
Database::addFilter(
'providerSearch',
function (mixed $value, Document $provider) {
$searchValues = [
$provider->getId(),
$provider->getAttribute('name', ''),
$provider->getAttribute('provider', ''),
$provider->getAttribute('type', '')
];
$search = \implode(' ', \array_filter($searchValues));
return $search;
},
function (mixed $value) {
return $value;
}
);
Database::addFilter(
'topicSearch',
function (mixed $value, Document $topic) {
$searchValues = [
$topic->getId(),
$topic->getAttribute('name', ''),
$topic->getAttribute('description', ''),
];
$search = \implode(' ', \array_filter($searchValues));
return $search;
},
function (mixed $value) {
return $value;
}
);
Database::addFilter(
'messageSearch',
function (mixed $value, Document $message) {
$searchValues = [
$message->getId(),
$message->getAttribute('description', ''),
$message->getAttribute('status', ''),
];
$data = \json_decode($message->getAttribute('data', []), true);
$providerType = $message->getAttribute('providerType', '');
switch ($providerType) {
case MESSAGE_TYPE_EMAIL:
$searchValues[] = $data['subject'];
$searchValues[] = MESSAGE_TYPE_EMAIL;
break;
case MESSAGE_TYPE_SMS:
$searchValues[] = $data['content'];
$searchValues[] = MESSAGE_TYPE_SMS;
break;
case MESSAGE_TYPE_PUSH:
$searchValues[] = $data['title'] ?? '';
$searchValues[] = MESSAGE_TYPE_PUSH;
break;
}
$search = \implode(' ', \array_filter($searchValues));
return $search;
},
function (mixed $value) {
return $value;
}
);
+43
View File
@@ -0,0 +1,43 @@
<?php
use Appwrite\Network\Validator\Email;
use Utopia\Database\Database;
use Utopia\Database\Validator\Datetime as DatetimeValidator;
use Utopia\Database\Validator\Structure;
use Utopia\Validator\IP;
use Utopia\Validator\Range;
use Utopia\Validator\URL;
use Utopia\Validator\WhiteList;
Structure::addFormat(APP_DATABASE_ATTRIBUTE_EMAIL, function () {
return new Email();
}, Database::VAR_STRING);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_DATETIME, function () {
return new DatetimeValidator();
}, Database::VAR_DATETIME);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_ENUM, function ($attribute) {
$elements = $attribute['formatOptions']['elements'] ?? [];
return new WhiteList($elements, true);
}, Database::VAR_STRING);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_IP, function () {
return new IP();
}, Database::VAR_STRING);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_URL, function () {
return new URL();
}, Database::VAR_STRING);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) {
$min = $attribute['formatOptions']['min'] ?? -INF;
$max = $attribute['formatOptions']['max'] ?? INF;
return new Range($min, $max, Range::TYPE_INTEGER);
}, Database::VAR_INTEGER);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, function ($attribute) {
$min = $attribute['formatOptions']['min'] ?? -INF;
$max = $attribute['formatOptions']['max'] ?? INF;
return new Range($min, $max, Range::TYPE_FLOAT);
}, Database::VAR_FLOAT);
+23
View File
@@ -0,0 +1,23 @@
<?php
use Utopia\Config\Config;
use Utopia\Locale\Locale;
Locale::$exceptions = false;
$locales = Config::getParam('locale-codes', []);
foreach ($locales as $locale) {
$code = $locale['code'];
$path = __DIR__ . '/../config/locale/translations/' . $code . '.json';
if (!\file_exists($path)) {
$path = __DIR__ . '/../config/locale/translations/' . \substr($code, 0, 2) . '.json'; // if `ar-ae` doesn't exist, look for `ar`
if (!\file_exists($path)) {
$path = __DIR__ . '/../config/locale/translations/en.json'; // if none translation exists, use default from `en.json`
}
}
Locale::setLanguageFromJSON($code, $path);
}
+340
View File
@@ -0,0 +1,340 @@
<?php
use Appwrite\Extend\Exception;
use Appwrite\GraphQL\Promises\Adapter\Swoole;
use Appwrite\Hooks\Hooks;
use Appwrite\PubSub\Adapter\Redis as PubSub;
use Appwrite\URL\URL as AppwriteURL;
use MaxMind\Db\Reader;
use PHPMailer\PHPMailer\PHPMailer;
use Swoole\Database\PDOProxy;
use Utopia\App;
use Utopia\Cache\Adapter\Redis as RedisCache;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Adapter\MariaDB;
use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Adapter\SQL;
use Utopia\Domains\Validator\PublicDomain;
use Utopia\DSN\DSN;
use Utopia\Logger\Adapter\AppSignal;
use Utopia\Logger\Adapter\LogOwl;
use Utopia\Logger\Adapter\Raygun;
use Utopia\Logger\Adapter\Sentry;
use Utopia\Logger\Logger;
use Utopia\Pools\Group;
use Utopia\Pools\Pool;
use Utopia\Queue;
use Utopia\Registry\Registry;
use Utopia\System\System;
$register = new Registry();
App::setMode(System::getEnv('_APP_ENV', App::MODE_TYPE_PRODUCTION));
if (!App::isProduction()) {
// Allow specific domains to skip public domain validation in dev environment
// Useful for existing tests involving webhooks
PublicDomain::allow(['request-catcher']);
}
$register->set('logger', function () {
// Register error logger
$providerName = System::getEnv('_APP_LOGGING_PROVIDER', '');
$providerConfig = System::getEnv('_APP_LOGGING_CONFIG', '');
if (empty($providerConfig)) {
return;
}
try {
$loggingProvider = new DSN($providerConfig ?? '');
$providerName = $loggingProvider->getScheme();
$providerConfig = match ($providerName) {
'sentry' => ['key' => $loggingProvider->getPassword(), 'projectId' => $loggingProvider->getUser() ?? '', 'host' => 'https://' . $loggingProvider->getHost()],
'logowl' => ['ticket' => $loggingProvider->getUser() ?? '', 'host' => $loggingProvider->getHost()],
default => ['key' => $loggingProvider->getHost()],
};
} catch (Throwable $th) {
// Fallback for older Appwrite versions up to 1.5.x that use _APP_LOGGING_PROVIDER and _APP_LOGGING_CONFIG environment variables
Console::warning('Using deprecated logging configuration. Please update your configuration to use DSN format.' . $th->getMessage());
$configChunks = \explode(";", $providerConfig);
$providerConfig = match ($providerName) {
'sentry' => [ 'key' => $configChunks[0], 'projectId' => $configChunks[1] ?? '', 'host' => '',],
'logowl' => ['ticket' => $configChunks[0] ?? '', 'host' => ''],
default => ['key' => $providerConfig],
};
}
if (empty($providerName) || empty($providerConfig)) {
return;
}
if (!Logger::hasProvider($providerName)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, "Logging provider not supported. Logging is disabled");
}
try {
$adapter = match ($providerName) {
'sentry' => new Sentry($providerConfig['projectId'], $providerConfig['key'], $providerConfig['host']),
'logowl' => new LogOwl($providerConfig['ticket'], $providerConfig['host']),
'raygun' => new Raygun($providerConfig['key']),
'appsignal' => new AppSignal($providerConfig['key']),
default => null
};
} catch (Throwable $th) {
$adapter = null;
}
if ($adapter === null) {
Console::error("Logging provider not supported. Logging is disabled");
return;
}
return new Logger($adapter);
});
$register->set('pools', function () {
$group = new Group();
$fallbackForDB = 'db_main=' . AppwriteURL::unparse([
'scheme' => 'mariadb',
'host' => System::getEnv('_APP_DB_HOST', 'mariadb'),
'port' => System::getEnv('_APP_DB_PORT', '3306'),
'user' => System::getEnv('_APP_DB_USER', ''),
'pass' => System::getEnv('_APP_DB_PASS', ''),
'path' => System::getEnv('_APP_DB_SCHEMA', ''),
]);
$fallbackForRedis = 'redis_main=' . AppwriteURL::unparse([
'scheme' => 'redis',
'host' => System::getEnv('_APP_REDIS_HOST', 'redis'),
'port' => System::getEnv('_APP_REDIS_PORT', '6379'),
'user' => System::getEnv('_APP_REDIS_USER', ''),
'pass' => System::getEnv('_APP_REDIS_PASS', ''),
]);
$connections = [
'console' => [
'type' => 'database',
'dsns' => $fallbackForDB,
'multiple' => false,
'schemes' => ['mariadb', 'mysql'],
],
'database' => [
'type' => 'database',
'dsns' => $fallbackForDB,
'multiple' => true,
'schemes' => ['mariadb', 'mysql'],
],
'logs' => [
'type' => 'database',
'dsns' => System::getEnv('_APP_CONNECTIONS_DB_LOGS', $fallbackForDB),
'multiple' => false,
'schemes' => ['mariadb', 'mysql'],
],
'publisher' => [
'type' => 'publisher',
'dsns' => $fallbackForRedis,
'multiple' => false,
'schemes' => ['redis'],
],
'consumer' => [
'type' => 'consumer',
'dsns' => $fallbackForRedis,
'multiple' => false,
'schemes' => ['redis'],
],
'pubsub' => [
'type' => 'pubsub',
'dsns' => $fallbackForRedis,
'multiple' => false,
'schemes' => ['redis'],
],
'cache' => [
'type' => 'cache',
'dsns' => $fallbackForRedis,
'multiple' => true,
'schemes' => ['redis'],
],
];
$maxConnections = System::getEnv('_APP_CONNECTIONS_MAX', 151);
$instanceConnections = $maxConnections / System::getEnv('_APP_POOL_CLIENTS', 14);
$multiprocessing = System::getEnv('_APP_SERVER_MULTIPROCESS', 'disabled') === 'enabled';
if ($multiprocessing) {
$workerCount = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
} else {
$workerCount = 1;
}
if ($workerCount > $instanceConnections) {
throw new \Exception('Pool size is too small. Increase the number of allowed database connections or decrease the number of workers.', 500);
}
$poolSize = (int)($instanceConnections / $workerCount);
foreach ($connections as $key => $connection) {
$type = $connection['type'] ?? '';
$multiple = $connection['multiple'] ?? false;
$schemes = $connection['schemes'] ?? [];
$config = [];
$dsns = explode(',', $connection['dsns'] ?? '');
foreach ($dsns as &$dsn) {
$dsn = explode('=', $dsn);
$name = ($multiple) ? $key . '_' . $dsn[0] : $key;
$dsn = $dsn[1] ?? '';
$config[] = $name;
if (empty($dsn)) {
//throw new Exception(Exception::GENERAL_SERVER_ERROR, "Missing value for DSN connection in {$key}");
continue;
}
$dsn = new DSN($dsn);
$dsnHost = $dsn->getHost();
$dsnPort = $dsn->getPort();
$dsnUser = $dsn->getUser();
$dsnPass = $dsn->getPassword();
$dsnScheme = $dsn->getScheme();
$dsnDatabase = $dsn->getPath();
if (!in_array($dsnScheme, $schemes)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, "Invalid console database scheme");
}
/**
* Get Resource
*
* Creation could be reused across connection types like database, cache, queue, etc.
*
* Resource assignment to an adapter will happen below.
*/
$resource = match ($dsnScheme) {
'mysql',
'mariadb' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) {
return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) {
return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, array(
PDO::ATTR_TIMEOUT => 3, // Seconds
PDO::ATTR_PERSISTENT => false,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => true,
PDO::ATTR_STRINGIFY_FETCHES => true
));
});
},
'redis' => function () use ($dsnHost, $dsnPort, $dsnPass) {
$redis = new \Redis();
@$redis->pconnect($dsnHost, (int)$dsnPort);
if ($dsnPass) {
$redis->auth($dsnPass);
}
$redis->setOption(\Redis::OPT_READ_TIMEOUT, -1);
return $redis;
},
default => throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Invalid scheme'),
};
$pool = new Pool($name, $poolSize, function () use ($type, $resource, $dsn) {
// Get Adapter
switch ($type) {
case 'database':
$adapter = match ($dsn->getScheme()) {
'mariadb' => new MariaDB($resource()),
'mysql' => new MySQL($resource()),
default => null
};
$adapter->setDatabase($dsn->getPath());
return $adapter;
case 'pubsub':
return match ($dsn->getScheme()) {
'redis' => new PubSub($resource()),
default => null
};
case 'publisher':
case 'consumer':
return match ($dsn->getScheme()) {
'redis' => new Queue\Broker\Redis(new Queue\Connection\Redis($dsn->getHost(), $dsn->getPort())),
default => null
};
case 'cache':
return match ($dsn->getScheme()) {
'redis' => new RedisCache($resource()),
default => null
};
default:
throw new Exception(Exception::GENERAL_SERVER_ERROR, "Server error: Missing adapter implementation.");
}
});
$group->add($pool);
}
Config::setParam('pools-' . $key, $config);
}
return $group;
});
$register->set('db', function () {
// This is usually for our workers or CLI commands scope
$dbHost = System::getEnv('_APP_DB_HOST', '');
$dbPort = System::getEnv('_APP_DB_PORT', '');
$dbUser = System::getEnv('_APP_DB_USER', '');
$dbPass = System::getEnv('_APP_DB_PASS', '');
$dbScheme = System::getEnv('_APP_DB_SCHEMA', '');
return new PDO(
"mysql:host={$dbHost};port={$dbPort};dbname={$dbScheme};charset=utf8mb4",
$dbUser,
$dbPass,
SQL::getPDOAttributes()
);
});
$register->set('smtp', function () {
$mail = new PHPMailer(true);
$mail->isSMTP();
$username = System::getEnv('_APP_SMTP_USERNAME');
$password = System::getEnv('_APP_SMTP_PASSWORD');
$mail->XMailer = 'Appwrite Mailer';
$mail->Host = System::getEnv('_APP_SMTP_HOST', 'smtp');
$mail->Port = System::getEnv('_APP_SMTP_PORT', 25);
$mail->SMTPAuth = !empty($username) && !empty($password);
$mail->Username = $username;
$mail->Password = $password;
$mail->SMTPSecure = System::getEnv('_APP_SMTP_SECURE', '');
$mail->SMTPAutoTLS = false;
$mail->CharSet = 'UTF-8';
$from = \urldecode(System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'));
$email = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$mail->setFrom($email, $from);
$mail->addReplyTo($email, $from);
$mail->isHTML(true);
return $mail;
});
$register->set('geodb', function () {
return new Reader(__DIR__ . '/../assets/dbip/dbip-country-lite-2024-09.mmdb');
});
$register->set('passwordsDictionary', function () {
$content = \file_get_contents(__DIR__ . '/../assets/security/10k-common-passwords');
$content = explode("\n", $content);
$content = array_flip($content);
return $content;
});
$register->set('promiseAdapter', function () {
return new Swoole();
});
$register->set('hooks', function () {
return new Hooks();
});
+836
View File
@@ -0,0 +1,836 @@
<?php
use Ahc\Jwt\JWT;
use Ahc\Jwt\JWTException;
use Appwrite\Auth\Auth;
use Appwrite\Auth\Key;
use Appwrite\Event\Audit;
use Appwrite\Event\Build;
use Appwrite\Event\Certificate;
use Appwrite\Event\Database as EventDatabase;
use Appwrite\Event\Delete;
use Appwrite\Event\Event;
use Appwrite\Event\Func;
use Appwrite\Event\Mail;
use Appwrite\Event\Messaging;
use Appwrite\Event\Migration;
use Appwrite\Event\Realtime;
use Appwrite\Event\StatsUsage;
use Appwrite\Event\Webhook;
use Appwrite\Extend\Exception;
use Appwrite\GraphQL\Schema;
use Appwrite\Network\Validator\Origin;
use Appwrite\Utopia\Request;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\App;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\DSN\DSN;
use Utopia\Locale\Locale;
use Utopia\Logger\Log;
use Utopia\Pools\Group;
use Utopia\Queue\Publisher;
use Utopia\Storage\Device;
use Utopia\Storage\Device\Backblaze;
use Utopia\Storage\Device\DOSpaces;
use Utopia\Storage\Device\Linode;
use Utopia\Storage\Device\Local;
use Utopia\Storage\Device\S3;
use Utopia\Storage\Device\Wasabi;
use Utopia\Storage\Storage;
use Utopia\System\System;
use Utopia\Validator\Hostname;
use Utopia\VCS\Adapter\Git\GitHub as VcsGitHub;
// Runtime Execution
App::setResource('log', fn () => new Log());
App::setResource('logger', function ($register) {
return $register->get('logger');
}, ['register']);
App::setResource('hooks', function ($register) {
return $register->get('hooks');
}, ['register']);
App::setResource('register', fn () => $register);
App::setResource('locale', fn () => new Locale(System::getEnv('_APP_LOCALE', 'en')));
App::setResource('localeCodes', function () {
return array_map(fn ($locale) => $locale['code'], Config::getParam('locale-codes', []));
});
// Queues
App::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
}, ['pools']);
App::setResource('consumer', function (Group $pools) {
return $pools->get('consumer')->pop()->getResource();
}, ['pools']);
App::setResource('queueForMessaging', function (Publisher $publisher) {
return new Messaging($publisher);
}, ['publisher']);
App::setResource('queueForMails', function (Publisher $publisher) {
return new Mail($publisher);
}, ['publisher']);
App::setResource('queueForBuilds', function (Publisher $publisher) {
return new Build($publisher);
}, ['publisher']);
App::setResource('queueForDatabase', function (Publisher $publisher) {
return new EventDatabase($publisher);
}, ['publisher']);
App::setResource('queueForDeletes', function (Publisher $publisher) {
return new Delete($publisher);
}, ['publisher']);
App::setResource('queueForEvents', function (Publisher $publisher) {
return new Event($publisher);
}, ['publisher']);
App::setResource('queueForWebhooks', function (Publisher $publisher) {
return new Webhook($publisher);
}, ['publisher']);
App::setResource('queueForRealtime', function () {
return new Realtime();
}, []);
App::setResource('queueForStatsUsage', function (Publisher $publisher) {
return new StatsUsage($publisher);
}, ['publisher']);
App::setResource('queueForAudits', function (Publisher $publisher) {
return new Audit($publisher);
}, ['publisher']);
App::setResource('queueForFunctions', function (Publisher $publisher) {
return new Func($publisher);
}, ['publisher']);
App::setResource('queueForCertificates', function (Publisher $publisher) {
return new Certificate($publisher);
}, ['publisher']);
App::setResource('queueForMigrations', function (Publisher $publisher) {
return new Migration($publisher);
}, ['publisher']);
App::setResource('clients', function ($request, $console, $project) {
$console->setAttribute('platforms', [ // Always allow current host
'$collection' => ID::custom('platforms'),
'name' => 'Current Host',
'type' => Origin::CLIENT_TYPE_WEB,
'hostname' => $request->getHostname(),
], Document::SET_TYPE_APPEND);
$hostnames = explode(',', System::getEnv('_APP_CONSOLE_HOSTNAMES', ''));
$validator = new Hostname();
foreach ($hostnames as $hostname) {
$hostname = trim($hostname);
if (!$validator->isValid($hostname)) {
continue;
}
$console->setAttribute('platforms', [
'$collection' => ID::custom('platforms'),
'type' => Origin::CLIENT_TYPE_WEB,
'name' => $hostname,
'hostname' => $hostname,
], Document::SET_TYPE_APPEND);
}
/**
* Get All verified client URLs for both console and current projects
* + Filter for duplicated entries
*/
$clientsConsole = \array_map(
fn ($node) => $node['hostname'],
\array_filter(
$console->getAttribute('platforms', []),
fn ($node) => (isset($node['type']) && ($node['type'] === Origin::CLIENT_TYPE_WEB) && !empty($node['hostname']))
)
);
$clients = $clientsConsole;
$platforms = $project->getAttribute('platforms', []);
foreach ($platforms as $node) {
if (
isset($node['type']) &&
($node['type'] === Origin::CLIENT_TYPE_WEB ||
$node['type'] === Origin::CLIENT_TYPE_FLUTTER_WEB) &&
!empty($node['hostname'])
) {
$clients[] = $node['hostname'];
}
}
return \array_unique($clients);
}, ['request', 'console', 'project']);
App::setResource('user', function ($mode, $project, $console, $request, $response, $dbForProject, $dbForPlatform) {
/** @var Appwrite\Utopia\Request $request */
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Document $project */
/** @var Utopia\Database\Database $dbForProject */
/** @var Utopia\Database\Database $dbForPlatform */
/** @var string $mode */
Authorization::setDefaultStatus(true);
Auth::setCookieName('a_session_' . $project->getId());
if (APP_MODE_ADMIN === $mode) {
Auth::setCookieName('a_session_' . $console->getId());
}
$session = Auth::decodeSession(
$request->getCookie(
Auth::$cookieName, // Get sessions
$request->getCookie(Auth::$cookieName . '_legacy', '')
)
);
// Get session from header for SSR clients
if (empty($session['id']) && empty($session['secret'])) {
$sessionHeader = $request->getHeader('x-appwrite-session', '');
if (!empty($sessionHeader)) {
$session = Auth::decodeSession($sessionHeader);
}
}
// Get fallback session from old clients (no SameSite support) or clients who block 3rd-party cookies
if ($response) {
$response->addHeader('X-Debug-Fallback', 'false');
}
if (empty($session['id']) && empty($session['secret'])) {
if ($response) {
$response->addHeader('X-Debug-Fallback', 'true');
}
$fallback = $request->getHeader('x-fallback-cookies', '');
$fallback = \json_decode($fallback, true);
$session = Auth::decodeSession(((isset($fallback[Auth::$cookieName])) ? $fallback[Auth::$cookieName] : ''));
}
Auth::$unique = $session['id'] ?? '';
Auth::$secret = $session['secret'] ?? '';
if (APP_MODE_ADMIN !== $mode) {
if ($project->isEmpty()) {
$user = new Document([]);
} else {
if ($project->getId() === 'console') {
$user = $dbForPlatform->getDocument('users', Auth::$unique);
} else {
$user = $dbForProject->getDocument('users', Auth::$unique);
}
}
} else {
$user = $dbForPlatform->getDocument('users', Auth::$unique);
}
if (
$user->isEmpty() // Check a document has been found in the DB
|| !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret)
) { // Validate user has valid login token
$user = new Document([]);
}
// if (APP_MODE_ADMIN === $mode) {
// if ($user->find('teamInternalId', $project->getAttribute('teamInternalId'), 'memberships')) {
// Authorization::setDefaultStatus(false); // Cancel security segmentation for admin users.
// } else {
// $user = new Document([]);
// }
// }
$authJWT = $request->getHeader('x-appwrite-jwt', '');
if (!empty($authJWT) && !$project->isEmpty()) { // JWT authentication
$jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 0);
try {
$payload = $jwt->decode($authJWT);
} catch (JWTException $error) {
throw new Exception(Exception::USER_JWT_INVALID, 'Failed to verify JWT. ' . $error->getMessage());
}
$jwtUserId = $payload['userId'] ?? '';
if (!empty($jwtUserId)) {
$user = $dbForProject->getDocument('users', $jwtUserId);
}
$jwtSessionId = $payload['sessionId'] ?? '';
if (!empty($jwtSessionId)) {
if (empty($user->find('$id', $jwtSessionId, 'sessions'))) { // Match JWT to active token
$user = new Document([]);
}
}
}
$dbForProject->setMetadata('user', $user->getId());
$dbForPlatform->setMetadata('user', $user->getId());
return $user;
}, ['mode', 'project', 'console', 'request', 'response', 'dbForProject', 'dbForPlatform']);
App::setResource('project', function ($dbForPlatform, $request, $console) {
/** @var Appwrite\Utopia\Request $request */
/** @var Utopia\Database\Database $dbForPlatform */
/** @var Utopia\Database\Document $console */
$projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', ''));
if (empty($projectId) || $projectId === 'console') {
return $console;
}
$project = Authorization::skip(fn () => $dbForPlatform->getDocument('projects', $projectId));
return $project;
}, ['dbForPlatform', 'request', 'console']);
App::setResource('session', function (Document $user) {
if ($user->isEmpty()) {
return;
}
$sessions = $user->getAttribute('sessions', []);
$sessionId = Auth::sessionVerify($user->getAttribute('sessions'), Auth::$secret);
if (!$sessionId) {
return;
}
foreach ($sessions as $session) {/** @var Document $session */
if ($sessionId === $session->getId()) {
return $session;
}
}
return;
}, ['user']);
App::setResource('console', function () {
return new Document(Config::getParam('console'));
}, []);
App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform, Cache $cache, Document $project) {
if ($project->isEmpty() || $project->getId() === 'console') {
return $dbForPlatform;
}
try {
$dsn = new DSN($project->getAttribute('database'));
} catch (\InvalidArgumentException) {
// TODO: Temporary until all projects are using shared tables
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$database
->setMetadata('host', \gethostname())
->setMetadata('project', $project->getId())
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_API)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getInternalId())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
->setSharedTables(false)
->setTenant(null)
->setNamespace('_' . $project->getInternalId());
}
return $database;
}, ['pools', 'dbForPlatform', 'cache', 'project']);
App::setResource('dbForPlatform', function (Group $pools, Cache $cache) {
$dbAdapter = $pools
->get('console')
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$database
->setNamespace('_console')
->setMetadata('host', \gethostname())
->setMetadata('project', 'console')
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_API)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
return $database;
}, ['pools', 'cache']);
App::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) {
$databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools
return function (Document $project) use ($pools, $dbForPlatform, $cache, &$databases) {
if ($project->isEmpty() || $project->getId() === 'console') {
return $dbForPlatform;
}
try {
$dsn = new DSN($project->getAttribute('database'));
} catch (\InvalidArgumentException) {
// TODO: Temporary until all projects are using shared tables
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$configure = (function (Database $database) use ($project, $dsn) {
$database
->setMetadata('host', \gethostname())
->setMetadata('project', $project->getId())
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_API)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getInternalId())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
->setSharedTables(false)
->setTenant(null)
->setNamespace('_' . $project->getInternalId());
}
});
if (isset($databases[$dsn->getHost()])) {
$database = $databases[$dsn->getHost()];
$configure($database);
return $database;
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$databases[$dsn->getHost()] = $database;
$configure($database);
return $database;
};
}, ['pools', 'dbForPlatform', 'cache']);
App::setResource('getLogsDB', function (Group $pools, Cache $cache) {
$database = null;
return function (?Document $project = null) use ($pools, $cache, $database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$database
->setSharedTables(true)
->setNamespace('logsV1')
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_API)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
// set tenant
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
}
return $database;
};
}, ['pools', 'cache']);
App::setResource('cache', function (Group $pools) {
$list = Config::getParam('pools-cache', []);
$adapters = [];
foreach ($list as $value) {
$adapters[] = $pools
->get($value)
->pop()
->getResource()
;
}
return new Cache(new Sharding($adapters));
}, ['pools']);
App::setResource('redis', function () {
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
$port = System::getEnv('_APP_REDIS_PORT', 6379);
$pass = System::getEnv('_APP_REDIS_PASS', '');
$redis = new \Redis();
@$redis->pconnect($host, (int)$port);
if ($pass) {
$redis->auth($pass);
}
$redis->setOption(\Redis::OPT_READ_TIMEOUT, -1);
return $redis;
});
App::setResource('timelimit', function (\Redis $redis) {
return function (string $key, int $limit, int $time) use ($redis) {
return new TimeLimitRedis($key, $limit, $time, $redis);
};
}, ['redis']);
App::setResource('deviceForLocal', function () {
return new Local();
});
App::setResource('deviceForFiles', function ($project) {
return getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId());
}, ['project']);
App::setResource('deviceForSites', function ($project) {
return getDevice(APP_STORAGE_SITES . '/app-' . $project->getId());
}, ['project']);
App::setResource('deviceForFunctions', function ($project) {
return getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId());
}, ['project']);
App::setResource('deviceForBuilds', function ($project) {
return getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId());
}, ['project']);
function getDevice(string $root, string $connection = ''): Device
{
$connection = !empty($connection) ? $connection : System::getEnv('_APP_CONNECTIONS_STORAGE', '');
if (!empty($connection)) {
$acl = 'private';
$device = Storage::DEVICE_LOCAL;
$accessKey = '';
$accessSecret = '';
$bucket = '';
$region = '';
$url = System::getEnv('_APP_STORAGE_S3_ENDPOINT', '');
try {
$dsn = new DSN($connection);
$device = $dsn->getScheme();
$accessKey = $dsn->getUser() ?? '';
$accessSecret = $dsn->getPassword() ?? '';
$bucket = $dsn->getPath() ?? '';
$region = $dsn->getParam('region');
} catch (\Throwable $e) {
Console::warning($e->getMessage() . 'Invalid DSN. Defaulting to Local device.');
}
switch ($device) {
case Storage::DEVICE_S3:
return new S3($root, $accessKey, $accessSecret, $bucket, $region, $acl, $url);
case STORAGE::DEVICE_DO_SPACES:
$device = new DOSpaces($root, $accessKey, $accessSecret, $bucket, $region, $acl);
$device->setHttpVersion(S3::HTTP_VERSION_1_1);
return $device;
case Storage::DEVICE_BACKBLAZE:
return new Backblaze($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_LINODE:
return new Linode($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_WASABI:
return new Wasabi($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_LOCAL:
default:
return new Local($root);
}
} else {
switch (strtolower(System::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) ?? '')) {
case Storage::DEVICE_LOCAL:
default:
return new Local($root);
case Storage::DEVICE_S3:
$s3AccessKey = System::getEnv('_APP_STORAGE_S3_ACCESS_KEY', '');
$s3SecretKey = System::getEnv('_APP_STORAGE_S3_SECRET', '');
$s3Region = System::getEnv('_APP_STORAGE_S3_REGION', '');
$s3Bucket = System::getEnv('_APP_STORAGE_S3_BUCKET', '');
$s3Acl = 'private';
$s3EndpointUrl = System::getEnv('_APP_STORAGE_S3_ENDPOINT', '');
return new S3($root, $s3AccessKey, $s3SecretKey, $s3Bucket, $s3Region, $s3Acl, $s3EndpointUrl);
case Storage::DEVICE_DO_SPACES:
$doSpacesAccessKey = System::getEnv('_APP_STORAGE_DO_SPACES_ACCESS_KEY', '');
$doSpacesSecretKey = System::getEnv('_APP_STORAGE_DO_SPACES_SECRET', '');
$doSpacesRegion = System::getEnv('_APP_STORAGE_DO_SPACES_REGION', '');
$doSpacesBucket = System::getEnv('_APP_STORAGE_DO_SPACES_BUCKET', '');
$doSpacesAcl = 'private';
$device = new DOSpaces($root, $doSpacesAccessKey, $doSpacesSecretKey, $doSpacesBucket, $doSpacesRegion, $doSpacesAcl);
$device->setHttpVersion(S3::HTTP_VERSION_1_1);
return $device;
case Storage::DEVICE_BACKBLAZE:
$backblazeAccessKey = System::getEnv('_APP_STORAGE_BACKBLAZE_ACCESS_KEY', '');
$backblazeSecretKey = System::getEnv('_APP_STORAGE_BACKBLAZE_SECRET', '');
$backblazeRegion = System::getEnv('_APP_STORAGE_BACKBLAZE_REGION', '');
$backblazeBucket = System::getEnv('_APP_STORAGE_BACKBLAZE_BUCKET', '');
$backblazeAcl = 'private';
return new Backblaze($root, $backblazeAccessKey, $backblazeSecretKey, $backblazeBucket, $backblazeRegion, $backblazeAcl);
case Storage::DEVICE_LINODE:
$linodeAccessKey = System::getEnv('_APP_STORAGE_LINODE_ACCESS_KEY', '');
$linodeSecretKey = System::getEnv('_APP_STORAGE_LINODE_SECRET', '');
$linodeRegion = System::getEnv('_APP_STORAGE_LINODE_REGION', '');
$linodeBucket = System::getEnv('_APP_STORAGE_LINODE_BUCKET', '');
$linodeAcl = 'private';
return new Linode($root, $linodeAccessKey, $linodeSecretKey, $linodeBucket, $linodeRegion, $linodeAcl);
case Storage::DEVICE_WASABI:
$wasabiAccessKey = System::getEnv('_APP_STORAGE_WASABI_ACCESS_KEY', '');
$wasabiSecretKey = System::getEnv('_APP_STORAGE_WASABI_SECRET', '');
$wasabiRegion = System::getEnv('_APP_STORAGE_WASABI_REGION', '');
$wasabiBucket = System::getEnv('_APP_STORAGE_WASABI_BUCKET', '');
$wasabiAcl = 'private';
return new Wasabi($root, $wasabiAccessKey, $wasabiSecretKey, $wasabiBucket, $wasabiRegion, $wasabiAcl);
}
}
}
App::setResource('mode', function ($request) {
/** @var Appwrite\Utopia\Request $request */
/**
* Defines the mode for the request:
* - 'default' => Requests for Client and Server Side
* - 'admin' => Request from the Console on non-console projects
*/
return $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT));
}, ['request']);
App::setResource('geodb', function ($register) {
/** @var Utopia\Registry\Registry $register */
return $register->get('geodb');
}, ['register']);
App::setResource('passwordsDictionary', function ($register) {
/** @var Utopia\Registry\Registry $register */
return $register->get('passwordsDictionary');
}, ['register']);
App::setResource('servers', function () {
$platforms = Config::getParam('platforms');
$server = $platforms[APP_PLATFORM_SERVER];
$languages = array_map(function ($language) {
return strtolower($language['name']);
}, $server['sdks']);
return $languages;
});
App::setResource('promiseAdapter', function ($register) {
return $register->get('promiseAdapter');
}, ['register']);
App::setResource('schema', function ($utopia, $dbForProject) {
$complexity = function (int $complexity, array $args) {
$queries = Query::parseQueries($args['queries'] ?? []);
$query = Query::getByType($queries, [Query::TYPE_LIMIT])[0] ?? null;
$limit = $query ? $query->getValue() : APP_LIMIT_LIST_DEFAULT;
return $complexity * $limit;
};
$attributes = function (int $limit, int $offset) use ($dbForProject) {
$attrs = Authorization::skip(fn () => $dbForProject->find('attributes', [
Query::limit($limit),
Query::offset($offset),
]));
return \array_map(function ($attr) {
return $attr->getArrayCopy();
}, $attrs);
};
$urls = [
'list' => function (string $databaseId, string $collectionId, array $args) {
return "/v1/databases/$databaseId/collections/$collectionId/documents";
},
'create' => function (string $databaseId, string $collectionId, array $args) {
return "/v1/databases/$databaseId/collections/$collectionId/documents";
},
'read' => function (string $databaseId, string $collectionId, array $args) {
return "/v1/databases/$databaseId/collections/$collectionId/documents/{$args['documentId']}";
},
'update' => function (string $databaseId, string $collectionId, array $args) {
return "/v1/databases/$databaseId/collections/$collectionId/documents/{$args['documentId']}";
},
'delete' => function (string $databaseId, string $collectionId, array $args) {
return "/v1/databases/$databaseId/collections/$collectionId/documents/{$args['documentId']}";
},
];
$params = [
'list' => function (string $databaseId, string $collectionId, array $args) {
return [ 'queries' => $args['queries']];
},
'create' => function (string $databaseId, string $collectionId, array $args) {
$id = $args['id'] ?? 'unique()';
$permissions = $args['permissions'] ?? null;
unset($args['id']);
unset($args['permissions']);
// Order must be the same as the route params
return [
'databaseId' => $databaseId,
'documentId' => $id,
'collectionId' => $collectionId,
'data' => $args,
'permissions' => $permissions,
];
},
'update' => function (string $databaseId, string $collectionId, array $args) {
$documentId = $args['id'];
$permissions = $args['permissions'] ?? null;
unset($args['id']);
unset($args['permissions']);
// Order must be the same as the route params
return [
'databaseId' => $databaseId,
'collectionId' => $collectionId,
'documentId' => $documentId,
'data' => $args,
'permissions' => $permissions,
];
},
];
return Schema::build(
$utopia,
$complexity,
$attributes,
$urls,
$params,
);
}, ['utopia', 'dbForProject']);
App::setResource('contributors', function () {
$path = 'app/config/contributors.json';
$list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : [];
return $list;
});
App::setResource('employees', function () {
$path = 'app/config/employees.json';
$list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : [];
return $list;
});
App::setResource('heroes', function () {
$path = 'app/config/heroes.json';
$list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : [];
return $list;
});
App::setResource('gitHub', function (Cache $cache) {
return new VcsGitHub($cache);
}, ['cache']);
App::setResource('requestTimestamp', function ($request) {
//TODO: Move this to the Request class itself
$timestampHeader = $request->getHeader('x-appwrite-timestamp');
$requestTimestamp = null;
if (!empty($timestampHeader)) {
try {
$requestTimestamp = new \DateTime($timestampHeader);
} catch (\Throwable $e) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Invalid X-Appwrite-Timestamp header value');
}
}
return $requestTimestamp;
}, ['request']);
App::setResource('plan', function (array $plan = []) {
return [];
});
App::setResource('smsRates', function () {
return [];
});
App::setResource('team', function (Document $project, Database $dbForPlatform, App $utopia, Request $request) {
$teamInternalId = '';
if ($project->getId() !== 'console') {
$teamInternalId = $project->getAttribute('teamInternalId', '');
} else {
$route = $utopia->match($request);
$path = $route->getPath();
if (str_starts_with($path, '/v1/projects/:projectId')) {
$uri = $request->getURI();
$pid = explode('/', $uri)[3];
$p = Authorization::skip(fn () => $dbForPlatform->getDocument('projects', $pid));
$teamInternalId = $p->getAttribute('teamInternalId', '');
} elseif ($path === '/v1/projects') {
$teamId = $request->getParam('teamId', '');
$team = Authorization::skip(fn () => $dbForPlatform->getDocument('teams', $teamId));
return $team;
}
}
$team = Authorization::skip(function () use ($dbForPlatform, $teamInternalId) {
return $dbForPlatform->findOne('teams', [
Query::equal('$internalId', [$teamInternalId]),
]);
});
return $team;
}, ['project', 'dbForPlatform', 'utopia', 'request']);
App::setResource(
'isResourceBlocked',
fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false
);
App::setResource('previewHostname', function (Request $request, ?Key $apiKey) {
$allowed = false;
if (App::isDevelopment()) {
$allowed = true;
} elseif (!\is_null($apiKey) && $apiKey->getHostnameOverride() === true) {
$allowed = true;
}
if ($allowed) {
$host = $request->getQuery('appwrite-hostname', $request->getHeader('x-appwrite-hostname', '')) ?? '';
if (!empty($host)) {
return $host;
}
}
return '';
}, ['request', 'apiKey']);
App::setResource('apiKey', function (Request $request, Document $project): ?Key {
$key = $request->getHeader('x-appwrite-key');
if (empty($key)) {
return null;
}
return Key::decode($project, $key);
}, ['request', 'project']);
+35 -10
View File
@@ -13,7 +13,7 @@ use Swoole\Runtime;
use Swoole\Table;
use Swoole\Timer;
use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\Database\TimeLimit;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\App;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
@@ -138,6 +138,32 @@ if (!function_exists('getCache')) {
}
}
// Allows overriding
if (!function_exists('getRedis')) {
function getRedis(): \Redis
{
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
$port = System::getEnv('_APP_REDIS_PORT', 6379);
$pass = System::getEnv('_APP_REDIS_PASS', '');
$redis = new \Redis();
@$redis->pconnect($host, (int)$port);
if ($pass) {
$redis->auth($pass);
}
$redis->setOption(\Redis::OPT_READ_TIMEOUT, -1);
return $redis;
}
}
if (!function_exists('getTimelimit')) {
function getTimelimit(): TimeLimitRedis
{
return new TimeLimitRedis("", 0, 1, getRedis());
}
}
if (!function_exists('getRealtime')) {
function getRealtime(): Realtime
{
@@ -167,7 +193,7 @@ $stats->create();
$containerId = uniqid();
$statsDocument = null;
$workerNumber = swoole_cpu_num() * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$workerNumber = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$adapter = new Adapter\Swoole(port: System::getEnv('PORT', 80));
$adapter
@@ -184,7 +210,7 @@ $logError = function (Throwable $error, string $action) use ($register) {
$log = new Log();
$log->setNamespace("realtime");
$log->setServer(gethostname());
$log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$log->setVersion($version);
$log->setType(Log::TYPE_ERROR);
$log->setMessage($error->getMessage());
@@ -481,7 +507,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
throw new AppwriteException(AppwriteException::GENERAL_API_DISABLED);
}
$dbForProject = getProjectDB($project);
$timelimit = $app->getResource('timelimit');
$console = $app->getResource('console'); /** @var Document $console */
$user = $app->getResource('user'); /** @var Document $user */
@@ -490,12 +516,12 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
*
* Abuse limits are connecting 128 times per minute and ip address.
*/
$timeLimit = new TimeLimit('url:{url},ip:{ip}', 128, 60, $dbForProject);
$timeLimit
$timelimit = $timelimit('url:{url},ip:{ip}', 128, 60);
$timelimit
->setParam('{ip}', $request->getIP())
->setParam('{url}', $request->getURI());
$abuse = new Abuse($timeLimit);
$abuse = new Abuse($timelimit);
if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) {
throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many requests');
@@ -593,7 +619,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
*
* Abuse limits are sending 32 times per minute and connection.
*/
$timeLimit = new TimeLimit('url:{url},connection:{connection}', 32, 60, $database);
$timeLimit = getTimelimit('url:{url},connection:{connection}', 32, 60);
$timeLimit
->setParam('{connection}', $connection)
@@ -678,11 +704,10 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
$server->onClose(function (int $connection) use ($realtime, $stats, $register) {
if (array_key_exists($connection, $realtime->connections)) {
$stats->decr($realtime->connections[$connection]['projectId'], 'connectionsTotal');
$register->get('telemetry.connectionCounter')->add(-1);
}
$realtime->unsubscribe($connection);
$register->get('telemetry.connectionCounter')->add(-1);
Console::info('Connection close: ' . $connection);
});
+185
View File
@@ -0,0 +1,185 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404 Not Found</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: #FFFFFF;
}
.main {
display: flex;
min-height: 100vh;
width: 100vw;
align-items: center;
justify-content: center;
}
.content {
margin-left: auto;
margin-right: auto;
max-width: 400px;
}
span {
padding: var(--space-1, 2px) var(--space-3, 6px);
border-radius: var(--border-radius-XS, 6px);
background: var(--color-overlay-on-neutral, rgba(0, 0, 0, 0.06));
color: var(--color-fgColor-neutral-secondary, #56565C);
text-align: center;
font-family: var(--font-family-sansSerif, Inter);
font-size: var(--font-size-S, 14px);
font-style: normal;
font-weight: 400;
line-height: 140%;
letter-spacing: -0.063px;
}
h1 {
color: var(--color-fgColor-neutral-primary, #2D2D31);
text-align: center;
font-family: var(--font-family-sansSerif, Inter);
font-size: var(--font-size-XXXL, 32px);
font-style: normal;
font-weight: 400;
line-height: 140%;
letter-spacing: -0.144px;
margin-top: 8px;
margin-bottom: 32px;
}
button {
border-radius: var(--border-radius-S, 8px);
font-family: var(--font-family-sansSerif, Inter);
font-size: var(--font-size-S, 14px);
font-style: normal;
font-weight: 500;
line-height: 140%;
letter-spacing: -0.063px;
padding: var(--space-3, 6px) var(--space-5, 10px);
cursor: pointer;
border: var(--border-width-S, 1px) solid var(--color-border-neutral-strong, #D8D8DB);
background: var(--color-bgColor-neutral-primary, #FFF);
color: var(--color-fgColor-neutral-secondary, #56565C);
}
.center {
display: flex;
justify-content: center;
}
.brand {
position: absolute;
width: 100%;
bottom: 32px;
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
}
.brand p {
font-family: var(--font-family-monospace, "Aeonik Fono");
font-size: var(--font-size-XS, 12px);
font-style: normal;
font-weight: 400;
line-height: 130%;
letter-spacing: 0.96px;
text-transform: uppercase;
color: var(--color-fgColor-neutral-secondary, #56565C);
}
.brand svg {
height: 20px;
}
.logo-dark {
display: none;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #1D1D21;
}
h1 {
color: var(--color-fgColor-neutral-primary, #EDEDF0);
}
button {
border: var(--border-width-S, 1px) solid var(--color-border-neutral-strong, #414146);
background: var(--color-bgColor-neutral-primary, #1D1D21);
color: var(--color-fgColor-neutral-secondary, #C3C3C6);
}
.brand p {
color: var(--color-fgColor-neutral-secondary, #C3C3C6);
}
span {
background: var(--color-overlay-on-neutral, rgba(255, 255, 255, 0.20));
color: var(--color-fgColor-neutral-secondary, #C3C3C6);
}
.logo-light {
display: none;
}
.logo-dark {
display: block;
}
}
</style>
</head>
<body>
<div class="main">
<div class="content">
<div class="center"><span>Page not found</span></div>
<h1>The page youre looking for doesnt exist.</h1>
<div class="center"><a href="/"><button>Go to homepage</button></a></div>
</div>
</div>
<div class="brand">
<p>Powered by</p>
<svg class="logo-dark" width="110" height="20" viewBox="0 0 110 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M31.8649 16.2461C33.6492 16.2461 34.5511 15.3184 34.9433 14.6867H35.1197C35.1981 15.3578 35.6687 15.9895 36.5903 15.9895H38.3353V14.0156H37.8843C37.5706 14.0156 37.4138 13.838 37.4138 13.5617V5.64661H35.1001V6.90986H34.9236C34.4727 6.27823 33.5315 5.39001 31.8061 5.39001C29.0611 5.39001 27.022 7.67965 27.022 10.818C27.022 13.9564 29.1003 16.2461 31.8649 16.2461ZM32.2767 13.9959C30.6493 13.9959 29.3748 12.7919 29.3748 10.8378C29.3748 8.92316 30.6101 7.62044 32.2571 7.62044C33.8256 7.62044 35.1393 8.78499 35.1393 10.8378C35.1393 12.5945 34.0217 13.9959 32.2767 13.9959Z" fill="#EDEDF0" />
<path d="M39.7013 20H42.0149V14.6867H42.1914C42.6227 15.3184 43.5443 16.2461 45.3677 16.2461C48.1127 16.2461 50.1127 13.9169 50.1127 10.818C50.1127 7.69939 47.9755 5.39001 45.2109 5.39001C43.4462 5.39001 42.5835 6.35719 42.1718 6.89012H41.9953V5.64661H39.7013V20ZM44.8776 14.0551C43.2894 14.0551 41.9757 12.8708 41.9757 10.818C41.9757 9.06133 43.0933 7.58096 44.8383 7.58096C46.4657 7.58096 47.7402 8.86395 47.7402 10.818C47.7402 12.7326 46.5049 14.0551 44.8776 14.0551Z" fill="#EDEDF0" />
<path d="M51.3065 20H53.6202V14.6867H53.7966C54.228 15.3184 55.1495 16.2461 56.973 16.2461C59.718 16.2461 61.5273 13.9169 61.5273 10.818C61.5273 7.69939 59.5807 5.39001 56.8161 5.39001C55.0515 5.39001 54.1888 6.35719 53.777 6.89012H53.6005V5.64661H51.3065V20ZM56.4828 14.0551C54.8946 14.0551 53.5809 12.8708 53.5809 10.818C53.5809 9.06133 54.6985 7.58096 56.4436 7.58096C58.071 7.58096 59.3454 8.86395 59.3454 10.818C59.3454 12.7326 58.1102 14.0551 56.4828 14.0551Z" fill="#EDEDF0" />
<path d="M64.5857 16.2296H67.8601L69.7227 8.11721H69.8404L71.7031 16.2296H74.9579L77.5642 5.88678H75.2323L73.3697 14.0189H73.1932L71.3305 5.88678H68.2522L66.3699 14.0189H66.1935L64.3504 5.88678H61.8799L64.5857 16.2296Z" fill="#EDEDF0" />
<path d="M78.7363 16.2296H81.0499V11.1174C81.0499 9.16334 81.9519 7.9593 83.6381 7.9593H84.6576V5.63019H83.893C82.5793 5.63019 81.5793 6.53815 81.1872 7.40663H81.0303V5.88678H78.7363V16.2296Z" fill="#EDEDF0" />
<path d="M96.1391 16.2296H97.943V14.1571H96.1587C95.4529 14.1571 95.1588 13.8413 95.1588 13.111V7.93956H98.0606V5.88678H95.1588V2.98526H92.9628V5.88678H91.0413V7.93956H92.8255V13.1307C92.8255 15.3217 94.1392 16.2296 96.1391 16.2296Z" fill="#EDEDF0" />
<path d="M104.15 16.2461C106.287 16.2461 108.17 15.1802 108.836 13.0287L106.719 12.5155C106.346 13.6603 105.268 14.2525 104.13 14.2525C102.444 14.2525 101.327 13.1472 101.307 11.4102H109.091V10.7588C109.091 7.67965 107.189 5.39001 104.052 5.39001C101.287 5.39001 98.915 7.58096 98.915 10.8378C98.915 13.9959 101.013 16.2461 104.15 16.2461ZM101.327 9.71269C101.464 8.46918 102.581 7.42305 104.052 7.42305C105.464 7.42305 106.621 8.31128 106.738 9.71269H101.327Z" fill="#EDEDF0" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M90.0125 16.2296H87.6989V7.93956H85.895V5.88678H90.0125V16.2296Z" fill="#EDEDF0" />
<path d="M88.6834 4.45145C89.5265 4.45145 90.154 3.81983 90.154 2.99082C90.154 2.18155 89.5265 1.54993 88.6834 1.54993C87.8403 1.54993 87.2129 2.18155 87.2129 2.99082C87.2129 3.81983 87.8403 4.45145 88.6834 4.45145Z" fill="#EDEDF0" />
<path d="M20.2007 13.6935V18.258H8.88588C5.5894 18.258 2.71111 16.4222 1.17116 13.6935C0.947288 13.2968 0.751353 12.8806 0.586995 12.4486C0.26435 11.6021 0.0615332 10.6938 0 9.74603V8.51195C0.0133592 8.30074 0.03441 8.09119 0.0619381 7.88413C0.118209 7.45921 0.203222 7.04343 0.314953 6.63926C1.37195 2.80758 4.8089 0 8.88588 0C12.9629 0 16.3994 2.80758 17.4564 6.63926H12.6184C11.8241 5.39025 10.4493 4.5645 8.88588 4.5645C7.32245 4.5645 5.94767 5.39025 5.15341 6.63926C4.91132 7.01895 4.72349 7.43764 4.60042 7.88413C4.49112 8.27999 4.43282 8.69744 4.43282 9.12899C4.43282 10.4373 4.96962 11.6166 5.83027 12.4486C6.62778 13.2209 7.70299 13.6935 8.88588 13.6935H20.2007Z" fill="#FD366E" />
<path d="M20.2006 7.88412V12.4486H11.9414C12.8021 11.6166 13.3389 10.4373 13.3389 9.12899C13.3389 8.69744 13.2806 8.27999 13.1713 7.88412H20.2006Z" fill="#FD366E" />
</svg>
<svg class="logo-light" width="110" height="20" viewBox="0 0 110 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M31.8648 16.2461C33.649 16.2461 34.5509 15.3184 34.9431 14.6867H35.1195C35.198 15.3578 35.6685 15.9895 36.5901 15.9895H38.3351V14.0156H37.8841C37.5704 14.0156 37.4136 13.838 37.4136 13.5617V5.64661H35.0999V6.90986H34.9235C34.4725 6.27823 33.5314 5.39001 31.8059 5.39001C29.0609 5.39001 27.0218 7.67965 27.0218 10.818C27.0218 13.9564 29.1001 16.2461 31.8648 16.2461ZM32.2765 13.9959C30.6491 13.9959 29.3746 12.7919 29.3746 10.8378C29.3746 8.92316 30.6099 7.62044 32.2569 7.62044C33.8255 7.62044 35.1391 8.78499 35.1391 10.8378C35.1391 12.5945 34.0215 13.9959 32.2765 13.9959Z" fill="#2D2D31" />
<path d="M39.7011 20H42.0147V14.6867H42.1912C42.6226 15.3184 43.5441 16.2461 45.3676 16.2461C48.1126 16.2461 50.1125 13.9169 50.1125 10.818C50.1125 7.69939 47.9753 5.39001 45.2107 5.39001C43.4461 5.39001 42.5833 6.35719 42.1716 6.89012H41.9951V5.64661H39.7011V20ZM44.8774 14.0551C43.2892 14.0551 41.9755 12.8708 41.9755 10.818C41.9755 9.06133 43.0931 7.58096 44.8382 7.58096C46.4656 7.58096 47.74 8.86395 47.74 10.818C47.74 12.7326 46.5048 14.0551 44.8774 14.0551Z" fill="#2D2D31" />
<path d="M51.3063 20H53.62V14.6867H53.7964C54.2278 15.3184 55.1493 16.2461 56.9728 16.2461C59.7178 16.2461 61.5271 13.9169 61.5271 10.818C61.5271 7.69939 59.5805 5.39001 56.8159 5.39001C55.0513 5.39001 54.1886 6.35719 53.7768 6.89012H53.6004V5.64661H51.3063V20ZM56.4826 14.0551C54.8944 14.0551 53.5808 12.8708 53.5808 10.818C53.5808 9.06133 54.6984 7.58096 56.4434 7.58096C58.0708 7.58096 59.3453 8.86395 59.3453 10.818C59.3453 12.7326 58.11 14.0551 56.4826 14.0551Z" fill="#2D2D31" />
<path d="M64.5855 16.2296H67.8599L69.7226 8.11721H69.8402L71.7029 16.2296H74.9577L77.564 5.88678H75.2322L73.3695 14.0189H73.193L71.3303 5.88678H68.252L66.3697 14.0189H66.1933L64.3502 5.88678H61.8797L64.5855 16.2296Z" fill="#2D2D31" />
<path d="M78.7361 16.2296H81.0498V11.1174C81.0498 9.16334 81.9517 7.9593 83.6379 7.9593H84.6575V5.63019H83.8928C82.5791 5.63019 81.5791 6.53815 81.187 7.40663H81.0301V5.88678H78.7361V16.2296Z" fill="#2D2D31" />
<path d="M96.1389 16.2296H97.9428V14.1571H96.1585C95.4527 14.1571 95.1586 13.8413 95.1586 13.111V7.93956H98.0604V5.88678H95.1586V2.98526H92.9626V5.88678H91.0411V7.93956H92.8253V13.1307C92.8253 15.3217 94.139 16.2296 96.1389 16.2296Z" fill="#2D2D31" />
<path d="M104.15 16.2461C106.287 16.2461 108.169 15.1802 108.836 13.0287L106.718 12.5155C106.346 13.6603 105.268 14.2525 104.13 14.2525C102.444 14.2525 101.326 13.1472 101.307 11.4102H109.091V10.7588C109.091 7.67965 107.189 5.39001 104.052 5.39001C101.287 5.39001 98.9148 7.58096 98.9148 10.8378C98.9148 13.9959 101.013 16.2461 104.15 16.2461ZM101.326 9.71269C101.464 8.46918 102.581 7.42305 104.052 7.42305C105.464 7.42305 106.62 8.31128 106.738 9.71269H101.326Z" fill="#2D2D31" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M90.0123 16.2296H87.6987V7.93956H85.8948V5.88678H90.0123V16.2296Z" fill="#2D2D31" />
<path d="M88.6835 4.45145C89.5266 4.45145 90.154 3.81983 90.154 2.99082C90.154 2.18155 89.5266 1.54993 88.6835 1.54993C87.8404 1.54993 87.213 2.18155 87.213 2.99082C87.213 3.81983 87.8404 4.45145 88.6835 4.45145Z" fill="#2D2D31" />
<path d="M20.2007 13.6935V18.258H8.88588C5.5894 18.258 2.71111 16.4222 1.17116 13.6935C0.947288 13.2968 0.751353 12.8806 0.586995 12.4486C0.26435 11.6021 0.0615332 10.6938 0 9.74603V8.51195C0.0133592 8.30074 0.03441 8.09119 0.0619381 7.88413C0.118209 7.45921 0.203222 7.04343 0.314953 6.63926C1.37195 2.80758 4.8089 0 8.88588 0C12.9629 0 16.3994 2.80758 17.4564 6.63926H12.6184C11.8241 5.39025 10.4493 4.5645 8.88588 4.5645C7.32245 4.5645 5.94767 5.39025 5.15341 6.63926C4.91132 7.01895 4.72349 7.43764 4.60042 7.88413C4.49112 8.27999 4.43282 8.69744 4.43282 9.12899C4.43282 10.4373 4.96962 11.6166 5.83027 12.4486C6.62778 13.2209 7.70299 13.6935 8.88588 13.6935H20.2007Z" fill="#FD366E" />
<path d="M20.2007 7.88412V12.4486H11.9415C12.8022 11.6166 13.339 10.4373 13.339 9.12899C13.339 8.69744 13.2807 8.27999 13.1714 7.88412H20.2007Z" fill="#FD366E" />
</svg>
</div>
</body>
</html>
+94 -28
View File
@@ -86,7 +86,7 @@ $image = $this->getParam('image', '');
- _APP_OPTIONS_ABUSE
- _APP_OPTIONS_ROUTER_PROTECTION
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS
- _APP_OPTIONS_COMPUTE_FORCE_HTTPS
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET
@@ -116,6 +116,7 @@ $image = $this->getParam('image', '');
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -132,12 +133,13 @@ $image = $this->getParam('image', '');
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_FUNCTIONS_SIZE_LIMIT
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_COMPUTE_SIZE_LIMIT
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_FUNCTIONS_RUNTIMES
- _APP_SITES_RUNTIMES
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_LOGGING_CONFIG
@@ -163,11 +165,10 @@ $image = $this->getParam('image', '');
- _APP_MIGRATIONS_FIREBASE_CLIENT_ID
- _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET
- _APP_ASSISTANT_OPENAI_API_KEY
appwrite-console:
<<: *x-logging
container_name: appwrite-console
image: <?php echo $organization; ?>/console:5.0.12
image: <?php echo $organization; ?>/console:5.2.53
restart: unless-stopped
networks:
- appwrite
@@ -318,6 +319,7 @@ $image = $this->getParam('image', '');
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -340,6 +342,8 @@ $image = $this->getParam('image', '');
- _APP_MAINTENANCE_RETENTION_ABUSE
- _APP_MAINTENANCE_RETENTION_AUDIT
- _APP_MAINTENANCE_RETENTION_EXECUTION
- _APP_SYSTEM_SECURITY_EMAIL_ADDRESS
- _APP_EMAIL_CERTIFICATES
appwrite-worker-databases:
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
@@ -400,19 +404,20 @@ $image = $this->getParam('image', '');
- _APP_VCS_GITHUB_APP_NAME
- _APP_VCS_GITHUB_PRIVATE_KEY
- _APP_VCS_GITHUB_APP_ID
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_FUNCTIONS_SIZE_LIMIT
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_COMPUTE_SIZE_LIMIT
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS
- _APP_OPTIONS_COMPUTE_FORCE_HTTPS
- _APP_DOMAIN
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -490,10 +495,10 @@ $image = $this->getParam('image', '');
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_USAGE_STATS
@@ -568,6 +573,7 @@ $image = $this->getParam('image', '');
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -649,10 +655,69 @@ $image = $this->getParam('image', '');
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY
- _APP_MAINTENANCE_RETENTION_SCHEDULES
appwrite-worker-usage:
appwrite-task-stats-resources:
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
entrypoint: worker-usage
container_name: appwrite-worker-usage
container_name: appwrite-task-stats-resources
entrypoint: stats-resources
<<: *x-logging
networks:
- appwrite
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_DATABASE_SHARED_TABLES
- _APP_STATS_RESOURCES_INTERVAL
appwrite-worker-stats-resources:
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
entrypoint: worker-stats-resources
container_name: appwrite-worker-stats-resources
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_STATS_RESOURCES_INTERVAL
appwrite-worker-stats-usage:
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
entrypoint: worker-stats-usage
container_name: appwrite-worker-stats-usage
<<: *x-logging
restart: unless-stopped
networks:
@@ -677,11 +742,11 @@ $image = $this->getParam('image', '');
- _APP_LOGGING_CONFIG
- _APP_USAGE_AGGREGATION_INTERVAL
appwrite-worker-usage-dump:
appwrite-worker-stats-usage-dump:
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
entrypoint: worker-usage-dump
entrypoint: worker-stats-usage-dump
<<: *x-logging
container_name: appwrite-worker-usage-dump
container_name: appwrite-worker-stats-usage-dump
restart: unless-stopped
networks:
- appwrite
@@ -796,7 +861,7 @@ $image = $this->getParam('image', '');
<<: *x-logging
restart: unless-stopped
stop_signal: SIGINT
image: openruntimes/executor:0.6.11
image: openruntimes/executor:0.7.0
networks:
- appwrite
- runtimes
@@ -808,9 +873,9 @@ $image = $this->getParam('image', '');
# It's not possible to share mount file between 2 containers without host mount (copying is too slow)
- /tmp:/tmp:rw
environment:
- OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_FUNCTIONS_INACTIVE_THRESHOLD
- OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_FUNCTIONS_MAINTENANCE_INTERVAL
- OPR_EXECUTOR_NETWORK=$_APP_FUNCTIONS_RUNTIMES_NETWORK
- OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD
- OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL
- OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK
- OPR_EXECUTOR_DOCKER_HUB_USERNAME=$_APP_DOCKER_HUB_USERNAME
- OPR_EXECUTOR_DOCKER_HUB_PASSWORD=$_APP_DOCKER_HUB_PASSWORD
- OPR_EXECUTOR_ENV=$_APP_ENV
@@ -822,6 +887,7 @@ $image = $this->getParam('image', '');
- OPR_EXECUTOR_STORAGE_S3_SECRET=$_APP_STORAGE_S3_SECRET
- OPR_EXECUTOR_STORAGE_S3_REGION=$_APP_STORAGE_S3_REGION
- OPR_EXECUTOR_STORAGE_S3_BUCKET=$_APP_STORAGE_S3_BUCKET
- OPR_EXECUTOR_STORAGE_S3_ENDPOINT=$_APP_STORAGE_S3_ENDPOINT
- OPR_EXECUTOR_STORAGE_DO_SPACES_ACCESS_KEY=$_APP_STORAGE_DO_SPACES_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_DO_SPACES_SECRET=$_APP_STORAGE_DO_SPACES_SECRET
- OPR_EXECUTOR_STORAGE_DO_SPACES_REGION=$_APP_STORAGE_DO_SPACES_REGION
+148 -60
View File
@@ -2,6 +2,7 @@
require_once __DIR__ . '/init.php';
use Appwrite\Certificates\LetsEncrypt;
use Appwrite\Event\Audit;
use Appwrite\Event\Build;
use Appwrite\Event\Certificate;
@@ -12,11 +13,15 @@ use Appwrite\Event\Func;
use Appwrite\Event\Mail;
use Appwrite\Event\Messaging;
use Appwrite\Event\Migration;
use Appwrite\Event\Usage;
use Appwrite\Event\UsageDump;
use Appwrite\Event\Realtime;
use Appwrite\Event\StatsUsage;
use Appwrite\Event\StatsUsageDump;
/** remove */
/** /remove */
use Appwrite\Event\Webhook;
use Appwrite\Platform\Appwrite;
use Swoole\Runtime;
use Utopia\App;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
@@ -30,8 +35,8 @@ use Utopia\Logger\Log;
use Utopia\Logger\Logger;
use Utopia\Platform\Service;
use Utopia\Pools\Group;
use Utopia\Queue\Connection;
use Utopia\Queue\Message;
use Utopia\Queue\Publisher;
use Utopia\Queue\Server;
use Utopia\Registry\Registry;
use Utopia\System\System;
@@ -41,7 +46,7 @@ Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
Server::setResource('register', fn () => $register);
Server::setResource('dbForConsole', function (Cache $cache, Registry $register) {
Server::setResource('dbForPlatform', function (Cache $cache, Registry $register) {
$pools = $register->get('pools');
$database = $pools
->get('console')
@@ -54,7 +59,7 @@ Server::setResource('dbForConsole', function (Cache $cache, Registry $register)
return $adapter;
}, ['cache', 'register']);
Server::setResource('project', function (Message $message, Database $dbForConsole) {
Server::setResource('project', function (Message $message, Database $dbForPlatform) {
$payload = $message->getPayload() ?? [];
$project = new Document($payload['project'] ?? []);
@@ -62,12 +67,12 @@ Server::setResource('project', function (Message $message, Database $dbForConsol
return $project;
}
return $dbForConsole->getDocument('projects', $project->getId());
}, ['message', 'dbForConsole']);
return $dbForPlatform->getDocument('projects', $project->getId());
}, ['message', 'dbForPlatform']);
Server::setResource('dbForProject', function (Cache $cache, Registry $register, Message $message, Document $project, Database $dbForConsole) {
Server::setResource('dbForProject', function (Cache $cache, Registry $register, Message $message, Document $project, Database $dbForPlatform) {
if ($project->isEmpty() || $project->getId() === 'console') {
return $dbForConsole;
return $dbForPlatform;
}
$pools = $register->get('pools');
@@ -107,15 +112,17 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register,
->setNamespace('_' . $project->getInternalId());
}
return $database;
}, ['cache', 'register', 'message', 'project', 'dbForConsole']);
$database->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER);
Server::setResource('getProjectDB', function (Group $pools, Database $dbForConsole, $cache) {
return $database;
}, ['cache', 'register', 'message', 'project', 'dbForPlatform']);
Server::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) {
$databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools
return function (Document $project) use ($pools, $dbForConsole, $cache, &$databases): Database {
return function (Document $project) use ($pools, $dbForPlatform, $cache, &$databases): Database {
if ($project->isEmpty() || $project->getId() === 'console') {
return $dbForConsole;
return $dbForPlatform;
}
try {
@@ -168,12 +175,47 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForConso
->setNamespace('_' . $project->getInternalId());
}
$database->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER);
return $database;
};
}, ['pools', 'dbForConsole', 'cache']);
}, ['pools', 'dbForPlatform', 'cache']);
Server::setResource('getLogsDB', function (Group $pools, Cache $cache) {
$database = null;
return function (?Document $project = null) use ($pools, $cache, $database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$database
->setSharedTables(true)
->setNamespace('logsV1')
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
// set tenant
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
}
return $database;
};
}, ['pools', 'cache']);
Server::setResource('abuseRetention', function () {
return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', 86400));
return time() - (int) System::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', 86400);
});
Server::setResource('auditRetention', function () {
@@ -200,59 +242,92 @@ Server::setResource('cache', function (Registry $register) {
return new Cache(new Sharding($adapters));
}, ['register']);
Server::setResource('redis', function () {
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
$port = System::getEnv('_APP_REDIS_PORT', 6379);
$pass = System::getEnv('_APP_REDIS_PASS', '');
$redis = new \Redis();
@$redis->pconnect($host, (int)$port);
if ($pass) {
$redis->auth($pass);
}
$redis->setOption(\Redis::OPT_READ_TIMEOUT, -1);
return $redis;
});
Server::setResource('timelimit', function (\Redis $redis) {
return function (string $key, int $limit, int $time) use ($redis) {
return new TimeLimitRedis($key, $limit, $time, $redis);
};
}, ['redis']);
Server::setResource('log', fn () => new Log());
Server::setResource('queueForUsage', function (Connection $queue) {
return new Usage($queue);
}, ['queue']);
Server::setResource('queueForUsageDump', function (Connection $queue) {
return new UsageDump($queue);
}, ['queue']);
Server::setResource('queue', function (Group $pools) {
return $pools->get('queue')->pop()->getResource();
Server::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
}, ['pools']);
Server::setResource('queueForDatabase', function (Connection $queue) {
return new EventDatabase($queue);
}, ['queue']);
Server::setResource('consumer', function (Group $pools) {
return $pools->get('consumer')->pop()->getResource();
}, ['pools']);
Server::setResource('queueForMessaging', function (Connection $queue) {
return new Messaging($queue);
}, ['queue']);
Server::setResource('queueForStatsUsage', function (Publisher $publisher) {
return new StatsUsage($publisher);
}, ['publisher']);
Server::setResource('queueForMails', function (Connection $queue) {
return new Mail($queue);
}, ['queue']);
Server::setResource('queueForStatsUsageDump', function (Publisher $publisher) {
return new StatsUsageDump($publisher);
}, ['publisher']);
Server::setResource('queueForBuilds', function (Connection $queue) {
return new Build($queue);
}, ['queue']);
Server::setResource('queueForDatabase', function (Publisher $publisher) {
return new EventDatabase($publisher);
}, ['publisher']);
Server::setResource('queueForDeletes', function (Connection $queue) {
return new Delete($queue);
}, ['queue']);
Server::setResource('queueForMessaging', function (Publisher $publisher) {
return new Messaging($publisher);
}, ['publisher']);
Server::setResource('queueForEvents', function (Connection $queue) {
return new Event($queue);
}, ['queue']);
Server::setResource('queueForMails', function (Publisher $publisher) {
return new Mail($publisher);
}, ['publisher']);
Server::setResource('queueForAudits', function (Connection $queue) {
return new Audit($queue);
}, ['queue']);
Server::setResource('queueForBuilds', function (Publisher $publisher) {
return new Build($publisher);
}, ['publisher']);
Server::setResource('queueForFunctions', function (Connection $queue) {
return new Func($queue);
}, ['queue']);
Server::setResource('queueForDeletes', function (Publisher $publisher) {
return new Delete($publisher);
}, ['publisher']);
Server::setResource('queueForCertificates', function (Connection $queue) {
return new Certificate($queue);
}, ['queue']);
Server::setResource('queueForEvents', function (Publisher $publisher) {
return new Event($publisher);
}, ['publisher']);
Server::setResource('queueForMigrations', function (Connection $queue) {
return new Migration($queue);
}, ['queue']);
Server::setResource('queueForAudits', function (Publisher $publisher) {
return new Audit($publisher);
}, ['publisher']);
Server::setResource('queueForWebhooks', function (Publisher $publisher) {
return new Webhook($publisher);
}, ['publisher']);
Server::setResource('queueForFunctions', function (Publisher $publisher) {
return new Func($publisher);
}, ['publisher']);
Server::setResource('queueForRealtime', function () {
return new Realtime();
}, []);
Server::setResource('queueForCertificates', function (Publisher $publisher) {
return new Certificate($publisher);
}, ['publisher']);
Server::setResource('queueForMigrations', function (Publisher $publisher) {
return new Migration($publisher);
}, ['publisher']);
Server::setResource('logger', function (Registry $register) {
return $register->get('logger');
@@ -262,6 +337,10 @@ Server::setResource('pools', function (Registry $register) {
return $register->get('pools');
}, ['register']);
Server::setResource('deviceForSites', function (Document $project) {
return getDevice(APP_STORAGE_SITES . '/app-' . $project->getId());
}, ['project']);
Server::setResource('deviceForFunctions', function (Document $project) {
return getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId());
}, ['project']);
@@ -283,6 +362,15 @@ Server::setResource(
fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false
);
Server::setResource('certificates', function () {
$email = System::getEnv('_APP_EMAIL_CERTIFICATES', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'));
if (empty($email)) {
throw new Exception('You must set a valid security email address (_APP_EMAIL_CERTIFICATES) to issue a LetsEncrypt SSL certificate.');
}
return new LetsEncrypt($email);
});
Server::setResource('logError', function (Registry $register, Document $project) {
return function (Throwable $error, string $namespace, string $action, ?array $extras) use ($register, $project) {
$logger = $register->get('logger');
@@ -292,7 +380,7 @@ Server::setResource('logError', function (Registry $register, Document $project)
$log = new Log();
$log->setNamespace($namespace);
$log->setServer(\gethostname());
$log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$log->setVersion($version);
$log->setType(Log::TYPE_ERROR);
$log->setMessage($error->getMessage());
@@ -355,7 +443,7 @@ try {
*/
$platform->init(Service::TYPE_WORKER, [
'workersNum' => System::getEnv('_APP_WORKERS_NUM', 1),
'connection' => $pools->get('queue')->pop()->getResource(),
'connection' => $pools->get('consumer')->pop()->getResource(),
'workerName' => strtolower($workerName) ?? null,
'queueName' => $queueName
]);
@@ -385,7 +473,7 @@ $worker
if ($logger) {
$log->setNamespace("appwrite-worker");
$log->setServer(\gethostname());
$log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$log->setVersion($version);
$log->setType(Log::TYPE_ERROR);
$log->setMessage($error->getMessage());
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/cli.php screenshot $@
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/cli.php stats-resources $@
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/worker.php stats-resources $@
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/worker.php stats-usage $@
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/worker.php stats-usage-dump $@
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
php /usr/src/code/app/worker.php usage $@
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
php /usr/src/code/app/worker.php usage-dump $@
+23 -20
View File
@@ -14,7 +14,8 @@
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/pint --test",
"format": "vendor/bin/pint",
"bench": "vendor/bin/phpbench run --report=benchmark"
"bench": "vendor/bin/phpbench run --report=benchmark",
"check": "./vendor/bin/phpstan analyse -c phpstan.neon"
},
"autoload": {
"psr-4": {
@@ -43,35 +44,36 @@
"ext-openssl": "*",
"ext-zlib": "*",
"ext-sockets": "*",
"appwrite/php-runtimes": "0.16.*",
"appwrite/php-runtimes": "0.19.*",
"appwrite/php-clamav": "2.0.*",
"utopia-php/abuse": "0.43.*",
"utopia-php/abuse": "0.52.*",
"utopia-php/analytics": "0.10.*",
"utopia-php/audit": "0.43.*",
"utopia-php/cache": "0.11.*",
"utopia-php/audit": "0.55.*",
"utopia-php/cache": "0.12.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.53.20",
"utopia-php/detector": "0.1.*",
"utopia-php/database": "0.61.*",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
"utopia-php/fetch": "0.2.*",
"utopia-php/image": "0.7.*",
"utopia-php/fetch": "0.3.*",
"utopia-php/image": "0.8.*",
"utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.12.*",
"utopia-php/migration": "0.6.*",
"utopia-php/messaging": "0.16.*",
"utopia-php/migration": "0.8.*",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.5.*",
"utopia-php/pools": "0.7.*",
"utopia-php/preloader": "0.2.*",
"utopia-php/queue": "0.7.*",
"utopia-php/queue": "0.9.*",
"utopia-php/registry": "0.5.*",
"utopia-php/storage": "0.18.*",
"utopia-php/swoole": "0.8.*",
"utopia-php/system": "0.9.*",
"utopia-php/telemetry": "0.1.*",
"utopia-php/vcs": "0.8.*",
"utopia-php/vcs": "0.10.*",
"utopia-php/websocket": "0.1.*",
"matomo/device-detector": "6.1.*",
"dragonmantank/cron-expression": "3.3.2",
@@ -84,12 +86,13 @@
},
"require-dev": {
"ext-fileinfo": "*",
"appwrite/sdk-generator": "0.39.*",
"phpunit/phpunit": "9.5.20",
"appwrite/sdk-generator": "0.40.*",
"phpunit/phpunit": "9.*",
"swoole/ide-helper": "5.1.2",
"textalk/websocket": "1.5.7",
"laravel/pint": "^1.14",
"phpbench/phpbench": "^1.2"
"phpstan/phpstan": "1.8.*",
"textalk/websocket": "1.5.*",
"laravel/pint": "1.*",
"phpbench/phpbench": "1.*"
},
"provide": {
"ext-phpiredis": "*"
@@ -99,8 +102,8 @@
"php": "8.3"
},
"allow-plugins": {
"php-http/discovery": false,
"tbachert/spi": false
"php-http/discovery": true,
"tbachert/spi": true
}
}
}
Generated
+719 -769
View File
File diff suppressed because it is too large Load Diff
+117 -30
View File
@@ -76,6 +76,8 @@ services:
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
@@ -110,7 +112,7 @@ services:
- _APP_OPTIONS_ABUSE
- _APP_OPTIONS_ROUTER_PROTECTION
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS
- _APP_OPTIONS_COMPUTE_FORCE_HTTPS
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET
@@ -140,6 +142,7 @@ services:
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -156,12 +159,14 @@ services:
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_FUNCTIONS_SIZE_LIMIT
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_COMPUTE_SIZE_LIMIT
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_FUNCTIONS_RUNTIMES
- _APP_SITES_RUNTIMES
- _APP_DOMAIN_SITES
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_LOGGING_CONFIG
@@ -195,11 +200,12 @@ services:
- _APP_DATABASE_SHARED_TABLES
- _APP_DATABASE_SHARED_TABLES_V1
- _APP_DATABASE_SHARED_NAMESPACE
- _APP_FUNCTIONS_CREATION_ABUSE_LIMIT
appwrite-console:
<<: *x-logging
container_name: appwrite-console
image: appwrite/console:5.0.12
image: appwrite/console:5.3.0-sites-rc.30
restart: unless-stopped
networks:
- appwrite
@@ -342,6 +348,7 @@ services:
- appwrite-uploads:/storage/uploads:rw
- appwrite-cache:/storage/cache:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
- appwrite-certificates:/storage/certificates:rw
- ./app:/usr/src/code/app
@@ -364,6 +371,7 @@ services:
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -385,6 +393,7 @@ services:
- _APP_EXECUTOR_HOST
- _APP_DATABASE_SHARED_TABLES
- _APP_DATABASE_SHARED_TABLES_V1
- _APP_EMAIL_CERTIFICATES
appwrite-worker-databases:
entrypoint: worker-databases
@@ -426,7 +435,9 @@ services:
- appwrite
volumes:
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
- appwrite-uploads:/storage/uploads:rw
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
@@ -451,19 +462,20 @@ services:
- _APP_VCS_GITHUB_APP_NAME
- _APP_VCS_GITHUB_PRIVATE_KEY
- _APP_VCS_GITHUB_APP_ID
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_FUNCTIONS_SIZE_LIMIT
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_COMPUTE_SIZE_LIMIT
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS
- _APP_OPTIONS_COMPUTE_FORCE_HTTPS
- _APP_DOMAIN
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -481,6 +493,7 @@ services:
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_DATABASE_SHARED_TABLES
- _APP_DOMAIN_SITES
appwrite-worker-certificates:
entrypoint: worker-certificates
@@ -546,10 +559,10 @@ services:
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_COMPUTE_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_USAGE_STATS
@@ -629,6 +642,7 @@ services:
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
@@ -720,10 +734,41 @@ services:
- _APP_MAINTENANCE_DELAY
- _APP_DATABASE_SHARED_TABLES
appwrite-worker-usage:
entrypoint: worker-usage
appwrite-task-stats-resources:
container_name: appwrite-task-stats-resources
entrypoint: stats-resources
<<: *x-logging
container_name: appwrite-worker-usage
image: appwrite-dev
networks:
- appwrite
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_DATABASE_SHARED_TABLES
- _APP_STATS_RESOURCES_INTERVAL
appwrite-worker-stats-resources:
entrypoint: worker-stats-resources
<<: *x-logging
container_name: appwrite-worker-stats-resources
image: appwrite-dev
networks:
- appwrite
@@ -751,10 +796,10 @@ services:
- _APP_USAGE_AGGREGATION_INTERVAL
- _APP_DATABASE_SHARED_TABLES
appwrite-worker-usage-dump:
entrypoint: worker-usage-dump
appwrite-worker-stats-usage:
entrypoint: worker-stats-usage
<<: *x-logging
container_name: appwrite-worker-usage-dump
container_name: appwrite-worker-stats-usage
image: appwrite-dev
networks:
- appwrite
@@ -782,6 +827,38 @@ services:
- _APP_USAGE_AGGREGATION_INTERVAL
- _APP_DATABASE_SHARED_TABLES
appwrite-worker-stats-usage-dump:
entrypoint: worker-stats-usage-dump
<<: *x-logging
container_name: appwrite-worker-stats-usage-dump
image: appwrite-dev
networks:
- appwrite
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_USAGE_AGGREGATION_INTERVAL
- _APP_DATABASE_SHARED_TABLES
- _APP_STATS_USAGE_DUAL_WRITING_DBS
appwrite-task-scheduler-functions:
entrypoint: schedule-functions
<<: *x-logging
@@ -867,18 +944,24 @@ services:
appwrite-assistant:
container_name: appwrite-assistant
image: appwrite/assistant:0.5.0
image: appwrite/assistant:0.7.0
networks:
- appwrite
environment:
- _APP_ASSISTANT_OPENAI_API_KEY
appwrite-browser:
container_name: appwrite-browser
image: appwrite/browser:0.2.2
networks:
- appwrite
openruntimes-executor:
container_name: openruntimes-executor
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.6.11
image: openruntimes/executor:0.7.13
restart: unless-stopped
networks:
- appwrite
@@ -887,25 +970,28 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- appwrite-builds:/storage/builds:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
# Host mount nessessary to share files between executor and runtimes.
# It's not possible to share mount file between 2 containers without host mount (copying is too slow)
- /tmp:/tmp:rw
environment:
- OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_FUNCTIONS_INACTIVE_THRESHOLD
- OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_FUNCTIONS_MAINTENANCE_INTERVAL
- OPR_EXECUTOR_NETWORK=$_APP_FUNCTIONS_RUNTIMES_NETWORK
- OPR_EXECUTOR_IMAGE_PULL=enabled
- OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD
- OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL
- OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK
- OPR_EXECUTOR_DOCKER_HUB_USERNAME=$_APP_DOCKER_HUB_USERNAME
- OPR_EXECUTOR_DOCKER_HUB_PASSWORD=$_APP_DOCKER_HUB_PASSWORD
- OPR_EXECUTOR_ENV=$_APP_ENV
- OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES
- OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES,$_APP_SITES_RUNTIMES
- OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET
- OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v4
- OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
- OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE
- OPR_EXECUTOR_STORAGE_S3_ACCESS_KEY=$_APP_STORAGE_S3_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_S3_SECRET=$_APP_STORAGE_S3_SECRET
- OPR_EXECUTOR_STORAGE_S3_REGION=$_APP_STORAGE_S3_REGION
- OPR_EXECUTOR_STORAGE_S3_BUCKET=$_APP_STORAGE_S3_BUCKET
- OPR_EXECUTOR_STORAGE_S3_ENDPOINT=$_APP_STORAGE_S3_ENDPOINT
- OPR_EXECUTOR_STORAGE_DO_SPACES_ACCESS_KEY=$_APP_STORAGE_DO_SPACES_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_DO_SPACES_SECRET=$_APP_STORAGE_DO_SPACES_SECRET
- OPR_EXECUTOR_STORAGE_DO_SPACES_REGION=$_APP_STORAGE_DO_SPACES_REGION
@@ -1056,5 +1142,6 @@ volumes:
appwrite-uploads:
appwrite-certificates:
appwrite-functions:
appwrite-sites:
appwrite-builds:
appwrite-config:
@@ -1,23 +0,0 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID
Functions functions = new Functions(client);
functions.getDeploymentDownload(
"<FUNCTION_ID>", // functionId
"<DEPLOYMENT_ID>", // deploymentId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Log.d("Appwrite", result.toString());
})
);
@@ -1,22 +0,0 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID
Functions functions = new Functions(client);
functions.getTemplate(
"<TEMPLATE_ID>", // templateId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Log.d("Appwrite", result.toString());
})
);

Some files were not shown because too many files have changed in this diff Show More