mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9404e9225e | ||
|
|
e263d681d9 | ||
|
|
6b8df26f84 | ||
|
|
e8cc95323e | ||
|
|
7c1fb0d945 | ||
|
|
20f780a58b | ||
|
|
3d1ea6d330 | ||
|
|
2e0a6f9b9e | ||
|
|
572544bf55 | ||
|
|
65aa218aac | ||
|
|
df943c62ca |
@@ -227,6 +227,23 @@ return [
|
||||
]
|
||||
]
|
||||
],
|
||||
'lynx' => [
|
||||
'key' => 'lynx',
|
||||
'name' => 'Lynx',
|
||||
'screenshotSleep' => 5000,
|
||||
'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'
|
||||
]
|
||||
]
|
||||
],
|
||||
'flutter' => [
|
||||
'key' => 'flutter',
|
||||
'name' => 'Flutter',
|
||||
|
||||
@@ -24718,6 +24718,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -25353,6 +25354,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -37040,6 +37042,11 @@
|
||||
"description": "Site Template Name.",
|
||||
"x-example": "Starter site"
|
||||
},
|
||||
"tagline": {
|
||||
"type": "string",
|
||||
"description": "Short description of template",
|
||||
"x-example": "Minimal web app integrating with Appwrite."
|
||||
},
|
||||
"demoUrl": {
|
||||
"type": "string",
|
||||
"description": "URL hosting a template demo.",
|
||||
@@ -37103,6 +37110,7 @@
|
||||
"required": [
|
||||
"key",
|
||||
"name",
|
||||
"tagline",
|
||||
"demoUrl",
|
||||
"screenshotDark",
|
||||
"screenshotLight",
|
||||
|
||||
@@ -16816,6 +16816,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -17226,6 +17227,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
|
||||
@@ -25221,6 +25221,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -25871,6 +25872,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -37623,6 +37625,11 @@
|
||||
"description": "Site Template Name.",
|
||||
"x-example": "Starter site"
|
||||
},
|
||||
"tagline": {
|
||||
"type": "string",
|
||||
"description": "Short description of template",
|
||||
"x-example": "Minimal web app integrating with Appwrite."
|
||||
},
|
||||
"demoUrl": {
|
||||
"type": "string",
|
||||
"description": "URL hosting a template demo.",
|
||||
@@ -37688,6 +37695,7 @@
|
||||
"required": [
|
||||
"key",
|
||||
"name",
|
||||
"tagline",
|
||||
"demoUrl",
|
||||
"screenshotDark",
|
||||
"screenshotLight",
|
||||
|
||||
@@ -17285,6 +17285,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
@@ -17714,6 +17715,7 @@
|
||||
"sveltekit",
|
||||
"astro",
|
||||
"remix",
|
||||
"lynx",
|
||||
"flutter",
|
||||
"vite",
|
||||
"other"
|
||||
|
||||
@@ -87,15 +87,6 @@ const TEMPLATE_FRAMEWORKS = [
|
||||
'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',
|
||||
@@ -144,6 +135,16 @@ const TEMPLATE_FRAMEWORKS = [
|
||||
'adapter' => 'static',
|
||||
'outputDirectory' => './',
|
||||
],
|
||||
'LYNX' => [
|
||||
'key' => 'lynx',
|
||||
'name' => 'Lynx',
|
||||
'installCommand' => 'npm install && cd web && npm install && cd ..',
|
||||
'buildCommand' => 'npm run build && cd web && npm run build && cd ..',
|
||||
'buildRuntime' => 'node-22',
|
||||
'adapter' => 'static',
|
||||
'outputDirectory' => './web/dist',
|
||||
'fallbackFile' => 'index.html',
|
||||
],
|
||||
];
|
||||
|
||||
function getFramework(string $frameworkEnum, array $overrides)
|
||||
@@ -153,9 +154,30 @@ function getFramework(string $frameworkEnum, array $overrides)
|
||||
}
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'lynx-starter',
|
||||
'name' => 'Lynx Starter',
|
||||
'tagline' => 'Sample application built with Lynx, a cross-platform framework focused on performance.',
|
||||
'score' => 1, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'screenshotDark' => $url . '/images/sites/templates/lynx-starter-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/lynx-starter-light.png',
|
||||
'frameworks' => [
|
||||
getFramework('LYNX', [
|
||||
'providerRootDirectory' => './lynx/starter',
|
||||
]),
|
||||
],
|
||||
'vcsProvider' => 'github',
|
||||
'providerRepositoryId' => 'templates-for-sites',
|
||||
'providerOwner' => 'appwrite',
|
||||
'providerVersion' => '0.3.*',
|
||||
'variables' => []
|
||||
],
|
||||
[
|
||||
'key' => 'vitepress',
|
||||
'name' => 'Vitepress',
|
||||
'tagline' => 'Platform for documentation and knowledge sharing powered by Vite.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::DOCUMENTATION],
|
||||
'screenshotDark' => $url . '/images/sites/templates/vitepress-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/vitepress-light.png',
|
||||
@@ -177,6 +199,8 @@ return [
|
||||
[
|
||||
'key' => 'vuepress',
|
||||
'name' => 'Vuepress',
|
||||
'tagline' => 'Platform for documentation and knowledge sharing powered by Vue.',
|
||||
'score' => 4, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::DOCUMENTATION],
|
||||
'screenshotDark' => $url . '/images/sites/templates/vuepress-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/vuepress-light.png',
|
||||
@@ -198,6 +222,8 @@ return [
|
||||
[
|
||||
'key' => 'docusaurus',
|
||||
'name' => 'Docusaurus',
|
||||
'tagline' => 'Platform for documentation and knowledge sharing powered by React.',
|
||||
'score' => 4, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::DOCUMENTATION],
|
||||
'screenshotDark' => $url . '/images/sites/templates/docusaurus-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/docusaurus-light.png',
|
||||
@@ -219,6 +245,8 @@ return [
|
||||
[
|
||||
'key' => 'nxt-lnk',
|
||||
'name' => 'Nxt Lnk',
|
||||
'tagline' => 'Personal website for creators to merge all URLs to social profiles.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/nxt-lnk-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/nxt-lnk-light.png',
|
||||
@@ -236,6 +264,8 @@ return [
|
||||
[
|
||||
'key' => 'magic-portfolio',
|
||||
'name' => 'Magic Portfolio',
|
||||
'tagline' => 'Complex personal website to showcase your projects, articles, and more.',
|
||||
'score' => 7, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/magic-portfolio-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/magic-portfolio-light.png',
|
||||
@@ -253,6 +283,8 @@ return [
|
||||
[
|
||||
'key' => 'littlelink',
|
||||
'name' => 'LittleLink',
|
||||
'tagline' => 'Personal website for creators to merge all URLs to social profiles.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/littlelink-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/littlelink-light.png',
|
||||
@@ -270,6 +302,8 @@ return [
|
||||
[
|
||||
'key' => 'logspot',
|
||||
'name' => 'Logspot',
|
||||
'tagline' => 'Website to publish changelogs of your application.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::BLOG],
|
||||
'screenshotDark' => $url . '/images/sites/templates/logspot-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/logspot-light.png',
|
||||
@@ -290,6 +324,8 @@ return [
|
||||
[
|
||||
'key' => 'astro-nano',
|
||||
'name' => 'Astro Nano',
|
||||
'tagline' => 'Minimal personal website to showcase your projects, articles, and more.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/astro-nano-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/astro-nano-light.png',
|
||||
@@ -309,6 +345,8 @@ return [
|
||||
[
|
||||
'key' => 'astro-starlight',
|
||||
'name' => 'Astro Starlight',
|
||||
'tagline' => 'Platform for documentation and knowledge sharing powered by Astro.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::DOCUMENTATION],
|
||||
'screenshotDark' => $url . '/images/sites/templates/astro-starlight-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/astro-starlight-light.png',
|
||||
@@ -328,6 +366,8 @@ return [
|
||||
[
|
||||
'key' => 'astro-sphere',
|
||||
'name' => 'Astro Sphere',
|
||||
'tagline' => 'Modern personal website to showcase your projects, articles, and more.',
|
||||
'score' => 7, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/astro-sphere-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/astro-sphere-light.png',
|
||||
@@ -347,6 +387,8 @@ return [
|
||||
[
|
||||
'key' => 'astro-starlog',
|
||||
'name' => 'Astro Starlog',
|
||||
'tagline' => 'Platform for publishing written content and media powered by Astro.',
|
||||
'score' => 5, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::BLOG],
|
||||
'screenshotDark' => $url . '/images/sites/templates/astro-starlog-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/astro-starlog-light.png',
|
||||
@@ -366,6 +408,8 @@ return [
|
||||
[
|
||||
'key' => 'onelink',
|
||||
'name' => 'Onelink',
|
||||
'tagline' => 'Personal website for creators to merge all URLs to social profiles.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/onelink-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/onelink-light.png',
|
||||
@@ -387,6 +431,8 @@ return [
|
||||
'key' => 'starter-for-flutter',
|
||||
'name' => 'Flutter starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Flutter application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-flutter-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-flutter-light.png',
|
||||
'frameworks' => [
|
||||
@@ -430,6 +476,8 @@ return [
|
||||
'key' => 'starter-for-js',
|
||||
'name' => 'JavaScript starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple JavaScript application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-js-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-js-light.png',
|
||||
'frameworks' => [
|
||||
@@ -472,6 +520,8 @@ return [
|
||||
'key' => 'starter-for-angular',
|
||||
'name' => 'Angular starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Angular application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-angular-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-angular-light.png',
|
||||
'frameworks' => [
|
||||
@@ -516,6 +566,8 @@ return [
|
||||
'key' => 'starter-for-svelte',
|
||||
'name' => 'Svelte starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Svelte application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-svelte-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-svelte-light.png',
|
||||
'frameworks' => [
|
||||
@@ -558,6 +610,8 @@ return [
|
||||
'key' => 'starter-for-react',
|
||||
'name' => 'React starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple React application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-react-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-react-light.png',
|
||||
'frameworks' => [
|
||||
@@ -600,6 +654,8 @@ return [
|
||||
'key' => 'starter-for-vue',
|
||||
'name' => 'Vue starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Vue application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-vue-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-vue-light.png',
|
||||
'frameworks' => [
|
||||
@@ -642,6 +698,8 @@ return [
|
||||
'key' => 'starter-for-react-native',
|
||||
'name' => 'React Native starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple React Native application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-react-native-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-react-native-light.png',
|
||||
'frameworks' => [
|
||||
@@ -685,6 +743,8 @@ return [
|
||||
'key' => 'starter-for-nextjs',
|
||||
'name' => 'Next.js starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Next.js application integrated with Appwrite SDK.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-nextjs-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-nextjs-light.png',
|
||||
'frameworks' => [
|
||||
@@ -727,6 +787,8 @@ return [
|
||||
'key' => 'starter-for-nuxt',
|
||||
'name' => 'Nuxt starter',
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'tagline' => 'Simple Nuxt application integrated with Appwrite SDK.',
|
||||
'score' => 3, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'screenshotDark' => $url . '/images/sites/templates/starter-for-nuxt-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/starter-for-nuxt-light.png',
|
||||
'frameworks' => [
|
||||
@@ -768,6 +830,8 @@ return [
|
||||
[
|
||||
'key' => 'template-for-event',
|
||||
'name' => 'Event template',
|
||||
'tagline' => 'Hackathon landing page with support for project submissions.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::EVENTS],
|
||||
'screenshotDark' => $url . '/images/sites/templates/template-for-event-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/template-for-event-light.png',
|
||||
@@ -804,6 +868,8 @@ return [
|
||||
[
|
||||
'key' => 'template-for-portfolio',
|
||||
'name' => 'Portfolio template',
|
||||
'tagline' => 'Simple personal website to showcase your projects, articles, and more.',
|
||||
'score' => 6, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::PORTFOLIO],
|
||||
'screenshotDark' => $url . '/images/sites/templates/template-for-portfolio-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/template-for-portfolio-light.png',
|
||||
@@ -821,6 +887,8 @@ return [
|
||||
[
|
||||
'key' => 'template-for-store',
|
||||
'name' => 'Store template',
|
||||
'tagline' => 'E-commerce platform for selling products with Stripe integration.',
|
||||
'score' => 7, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::ECOMMERCE],
|
||||
'screenshotDark' => $url . '/images/sites/templates/template-for-store-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/template-for-store-light.png',
|
||||
@@ -863,6 +931,8 @@ return [
|
||||
[
|
||||
'key' => 'template-for-blog',
|
||||
'name' => 'Blog template',
|
||||
'tagline' => 'Platform for publishing written content and media.',
|
||||
'score' => 7, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::BLOG],
|
||||
'screenshotDark' => $url . '/images/sites/templates/template-for-blog-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/template-for-blog-light.png',
|
||||
@@ -880,6 +950,8 @@ return [
|
||||
[
|
||||
'key' => 'astro-starter',
|
||||
'name' => 'Astro starter',
|
||||
'tagline' => 'Sample application built with Astro, a content-driven web framework.',
|
||||
'score' => 1, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'screenshotDark' => $url . '/images/sites/templates/astro-starter-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/astro-starter-light.png',
|
||||
@@ -897,6 +969,8 @@ return [
|
||||
[
|
||||
'key' => 'remix-starter',
|
||||
'name' => 'Remix starter',
|
||||
'tagline' => 'Sample application built with Remix, a React meta-framework.',
|
||||
'score' => 1, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
|
||||
'useCases' => [UseCases::STARTER],
|
||||
'screenshotDark' => $url . '/images/sites/templates/remix-starter-dark.png',
|
||||
'screenshotLight' => $url . '/images/sites/templates/remix-starter-light.png',
|
||||
|
||||
@@ -56,25 +56,6 @@ Config::setParam('domainVerification', false);
|
||||
Config::setParam('cookieDomain', 'localhost');
|
||||
Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE);
|
||||
|
||||
/**
|
||||
* Routes an incoming HTTP request to the appropriate Appwrite resource.
|
||||
*
|
||||
* This function inspects the request hostname and domain rules to determine if the request should be processed as a
|
||||
* deployment (function or site execution), API call, or redirect. It handles ACME challenges, enforces HTTPS where required,
|
||||
* validates preview authorization (unless bypassed via the provided API key), and prepares execution parameters for deployments.
|
||||
* It also updates metrics and logs execution details before sending the response.
|
||||
*
|
||||
* Returns true if the request was processed (e.g. execution triggered, redirect issued) and a response was sent, or false if
|
||||
* the default API routing should continue.
|
||||
*
|
||||
* @param string $previewHostname Overrides the detected hostname for preview scenarios.
|
||||
* @param Key|null $apiKey Optional API key that may bypass standard deployment status checks and preview authorization.
|
||||
*
|
||||
* @return bool True if the request was fully handled; false otherwise.
|
||||
*
|
||||
* @throws AppwriteException If the request violates domain restrictions, router protection, service availability,
|
||||
* deployment status, authorization, or if the runtime is unsupported.
|
||||
*/
|
||||
function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey)
|
||||
{
|
||||
$utopia->getRoute()?->label('error', __DIR__ . '/../views/general/error.phtml');
|
||||
|
||||
Generated
+20
-20
@@ -709,16 +709,16 @@
|
||||
},
|
||||
{
|
||||
"name": "google/protobuf",
|
||||
"version": "v4.30.1",
|
||||
"version": "v4.30.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/protocolbuffers/protobuf-php.git",
|
||||
"reference": "f29ba8a30dfd940efb3a8a75dc44446539101f24"
|
||||
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/f29ba8a30dfd940efb3a8a75dc44446539101f24",
|
||||
"reference": "f29ba8a30dfd940efb3a8a75dc44446539101f24",
|
||||
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
|
||||
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -747,9 +747,9 @@
|
||||
"proto"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.1"
|
||||
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.2"
|
||||
},
|
||||
"time": "2025-03-13T21:08:17+00:00"
|
||||
"time": "2025-03-26T18:01:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jean85/pretty-package-versions",
|
||||
@@ -4700,16 +4700,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/swoole",
|
||||
"version": "0.8.2",
|
||||
"version": "0.8.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/swoole.git",
|
||||
"reference": "5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4"
|
||||
"reference": "1af73dd3e73987cf729c7db399054e4a70befd99"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4",
|
||||
"reference": "5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4",
|
||||
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/1af73dd3e73987cf729c7db399054e4a70befd99",
|
||||
"reference": "1af73dd3e73987cf729c7db399054e4a70befd99",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4745,9 +4745,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/swoole/issues",
|
||||
"source": "https://github.com/utopia-php/swoole/tree/0.8.2"
|
||||
"source": "https://github.com/utopia-php/swoole/tree/0.8.3"
|
||||
},
|
||||
"time": "2024-02-01T14:54:12+00:00"
|
||||
"time": "2025-03-26T10:09:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/system",
|
||||
@@ -5089,16 +5089,16 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "0.40.10",
|
||||
"version": "0.40.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "054ac96285caf4f77879087b2416a5ddb8263051"
|
||||
"reference": "0ec5f4a60c15e33e208bc3444ba6148b1d0f0027"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/054ac96285caf4f77879087b2416a5ddb8263051",
|
||||
"reference": "054ac96285caf4f77879087b2416a5ddb8263051",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/0ec5f4a60c15e33e208bc3444ba6148b1d0f0027",
|
||||
"reference": "0ec5f4a60c15e33e208bc3444ba6148b1d0f0027",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5134,9 +5134,9 @@
|
||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||
"support": {
|
||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.10"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.11"
|
||||
},
|
||||
"time": "2025-03-25T13:44:16+00:00"
|
||||
"time": "2025-03-26T10:53:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
@@ -8507,7 +8507,7 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
@@ -8531,5 +8531,5 @@
|
||||
"platform-overrides": {
|
||||
"php": "8.3"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 324 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 323 KiB |
@@ -12,22 +12,6 @@ use Utopia\System\System;
|
||||
|
||||
class Key
|
||||
{
|
||||
/**
|
||||
* Constructs a new Key instance with the specified configuration.
|
||||
*
|
||||
* @param string $projectId The ID of the project associated with the key.
|
||||
* @param string $type The type of the key (e.g., standard or dynamic).
|
||||
* @param string $role The role associated with the key.
|
||||
* @param array $scopes An array of scopes defining the key's permissions.
|
||||
* @param string $name The name assigned to the key.
|
||||
* @param bool $expired Indicates whether the key is expired. Defaults to false.
|
||||
* @param array $disabledMetrics A list of metrics disabled for this key.
|
||||
* @param bool $hostnameOverride Indicates if hostname override is enabled.
|
||||
* @param bool $bannerDisabled Indicates if the banner display is disabled.
|
||||
* @param bool $projectCheckDisabled Indicates whether project checks are disabled.
|
||||
* @param bool $previewAuthDisabled Indicates whether preview authentication is disabled.
|
||||
* @param bool $deploymentStatusIgnored Indicates if the deployment status should be ignored. Defaults to false.
|
||||
*/
|
||||
public function __construct(
|
||||
protected string $projectId,
|
||||
protected string $type,
|
||||
@@ -91,53 +75,29 @@ class Key
|
||||
return $this->bannerDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether preview authentication is disabled.
|
||||
*
|
||||
* @return bool True if preview authentication is disabled, false otherwise.
|
||||
*/
|
||||
public function isPreviewAuthDisabled(): bool
|
||||
{
|
||||
return $this->previewAuthDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the API key's deployment status is ignored.
|
||||
*
|
||||
* @return bool True if the deployment status is ignored; otherwise, false.
|
||||
*/
|
||||
public function isDeploymentStatusIgnored(): bool
|
||||
{
|
||||
return $this->deploymentStatusIgnored;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether project checks are disabled.
|
||||
*
|
||||
* This method indicates if project-based validations are bypassed.
|
||||
*
|
||||
* @return bool True if project checks are disabled; false otherwise.
|
||||
*/
|
||||
public function isProjectCheckDisabled(): bool
|
||||
{
|
||||
return $this->projectCheckDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a secret API key into a Key object.
|
||||
* Decode the given secret key into a Key object, containing the project ID, type, role, scopes, and name.
|
||||
* Can be a stored API key or a dynamic key (JWT).
|
||||
*
|
||||
* This method processes both dynamic (JWT) keys and standard API keys. For dynamic keys, it decodes the JWT payload
|
||||
* using a secure environment key and extracts properties such as the key name, project ID, scopes, disabled metrics,
|
||||
* hostname override, banner, project check, preview authentication, and deployment status. If decoding fails or if the
|
||||
* project ID in the token does not match the provided project (when project checks are enabled), a guest key is returned.
|
||||
*
|
||||
* For standard keys, the method retrieves the key document from the project and checks for expiration, returning a guest
|
||||
* key if the key is not found or has expired.
|
||||
*
|
||||
* @param Document $project The project document containing API key definitions.
|
||||
* @param string $key The secret API key, either in standard format or as a dynamic JWT.
|
||||
*
|
||||
* @return Key A new Key instance reflecting the decoded API key or a guest key if validation fails.
|
||||
* @param Document $project
|
||||
* @param string $key
|
||||
* @return Key
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function decode(
|
||||
Document $project,
|
||||
|
||||
@@ -45,11 +45,6 @@ use function Swoole\Coroutine\batch;
|
||||
|
||||
class Builds extends Action
|
||||
{
|
||||
/**
|
||||
* Retrieves the identifier for the build action.
|
||||
*
|
||||
* @return string The action name "builds".
|
||||
*/
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'builds';
|
||||
@@ -161,20 +156,26 @@ class Builds extends Action
|
||||
}
|
||||
|
||||
/**
|
||||
* Orchestrates the entire build deployment process for a function or site resource.
|
||||
* @param Device $deviceForFunctions
|
||||
* @param Device $deviceForSites
|
||||
* @param Device $deviceForFiles
|
||||
* @param Webhook $queueForWebhooks
|
||||
* @param Func $queueForFunctions
|
||||
* @param Realtime $queueForRealtime
|
||||
* @param Event $queueForEvents
|
||||
* @param StatsUsage $queueForStatsUsage
|
||||
* @param Database $dbForPlatform
|
||||
* @param Database $dbForProject
|
||||
* @param GitHub $github
|
||||
* @param Document $project
|
||||
* @param Document $resource
|
||||
* @param Document $deployment
|
||||
* @param Document $template
|
||||
* @param Log $log
|
||||
* @return void
|
||||
* @throws \Utopia\Database\Exception
|
||||
*
|
||||
* This method validates and retrieves the necessary resource and deployment documents, ensuring the resource is not blocked,
|
||||
* and sets up real-time update channels and logging contexts. It supports two deployment flows:
|
||||
* - A non-VCS flow that builds the resource using a template repository.
|
||||
* - A VCS-based flow that clones the source repository (and merges templates if provided), executes build commands,
|
||||
* and updates source commit details.
|
||||
*
|
||||
* The method concurrently streams build logs from a runtime executor, verifies build size limits, and handles post-build
|
||||
* operations such as screenshot generation for site deployments, updating deployment statuses, triggering webhooks,
|
||||
* function events, and usage metrics, and integrating with GitHub for commit status updates.
|
||||
*
|
||||
* @throws \Exception If validations fail, documents are missing, cloning or build operations encounter errors,
|
||||
* or deployment constraints are violated.
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function buildDeployment(
|
||||
Device $deviceForFunctions,
|
||||
|
||||
@@ -29,7 +29,7 @@ class Get extends Base
|
||||
->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET)
|
||||
->setHttpPath('/v1/sites/templates/:templateId')
|
||||
->desc('Get site template')
|
||||
->groups(['api', 'sites'])
|
||||
->groups(['api'])
|
||||
->label('scope', 'public')
|
||||
->label('resourceType', RESOURCE_TYPE_SITES)
|
||||
->label('sdk', new Method(
|
||||
|
||||
@@ -30,7 +30,7 @@ class XList extends Base
|
||||
->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET)
|
||||
->setHttpPath('/v1/sites/templates')
|
||||
->desc('List templates')
|
||||
->groups(['api', 'sites'])
|
||||
->groups(['api'])
|
||||
->label('scope', 'public')
|
||||
->label('resourceType', RESOURCE_TYPE_SITES)
|
||||
->label('sdk', new Method(
|
||||
@@ -76,10 +76,15 @@ class XList extends Base
|
||||
});
|
||||
}
|
||||
|
||||
$responseTemplates = \array_slice($templates, $offset, $limit);
|
||||
\usort($templates, function ($a, $b) {
|
||||
return $b['score'] <=> $a['score'];
|
||||
});
|
||||
|
||||
$templates = \array_slice($templates, $offset, $limit);
|
||||
|
||||
$response->dynamic(new Document([
|
||||
'templates' => $responseTemplates,
|
||||
'total' => \count($responseTemplates),
|
||||
'templates' => $templates,
|
||||
'total' => \count($templates),
|
||||
]), Response::MODEL_TEMPLATE_SITE_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,6 @@ class Preview extends Adapter
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a styled preview banner to the output.
|
||||
*
|
||||
* This method merges the existing input HTML with a preview banner, which
|
||||
* includes CSS for both light and dark themes and JavaScript to hide the banner
|
||||
* on click.
|
||||
*/
|
||||
public function transform(): void
|
||||
{
|
||||
$this->output = $this->input;
|
||||
|
||||
@@ -22,6 +22,12 @@ class TemplateSite extends Model
|
||||
'default' => '',
|
||||
'example' => 'Starter site',
|
||||
])
|
||||
->addRule('tagline', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Short description of template',
|
||||
'default' => '',
|
||||
'example' => 'Minimal web app integrating with Appwrite.',
|
||||
])
|
||||
->addRule('demoUrl', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'URL hosting a template demo.',
|
||||
|
||||
@@ -37,6 +37,7 @@ class SitesCustomClientTest extends Scope
|
||||
$this->assertArrayHasKey('variables', $template);
|
||||
$this->assertArrayHasKey('screenshotDark', $template);
|
||||
$this->assertArrayHasKey('screenshotLight', $template);
|
||||
$this->assertArrayHasKey('tagline', $template);
|
||||
}
|
||||
|
||||
// List templates with pagination
|
||||
@@ -126,6 +127,7 @@ class SitesCustomClientTest extends Scope
|
||||
$this->assertEquals('React starter', $template['body']['name']);
|
||||
$this->assertEquals(['starter'], $template['body']['useCases']);
|
||||
$this->assertEquals('github', $template['body']['vcsProvider']);
|
||||
$this->assertEquals('Simple React application integrated with Appwrite SDK.', $template['body']['tagline']);
|
||||
$this->assertIsArray($template['body']['frameworks']);
|
||||
$this->assertEquals('http://localhost/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']);
|
||||
$this->assertEquals('http://localhost/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']);
|
||||
|
||||
@@ -2430,4 +2430,38 @@ class SitesCustomServerTest extends Scope
|
||||
|
||||
$this->cleanupSite($siteId);
|
||||
}
|
||||
|
||||
public function testPermanentRedirect(): void
|
||||
{
|
||||
$siteId = $this->setupSite([
|
||||
'siteId' => ID::unique(),
|
||||
'name' => 'Sub project site',
|
||||
'framework' => 'other',
|
||||
'buildRuntime' => 'node-22',
|
||||
'outputDirectory' => './'
|
||||
]);
|
||||
$this->assertNotEmpty($siteId);
|
||||
|
||||
$domain = $this->setupSiteDomain($siteId);
|
||||
$this->assertNotEmpty($domain);
|
||||
|
||||
$deploymentId = $this->setupDeployment($siteId, [
|
||||
'code' => $this->packageSite('sub-directories'),
|
||||
'activate' => 'true'
|
||||
]);
|
||||
$this->assertNotEmpty($deploymentId);
|
||||
|
||||
$proxyClient = new Client();
|
||||
$proxyClient->setEndpoint('http://' . $domain);
|
||||
$response = $proxyClient->call(Client::METHOD_GET, '/');
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('Sub-directory index', $response['body']);
|
||||
$response1 = $proxyClient->call(Client::METHOD_GET, '/project1');
|
||||
$this->assertEquals(200, $response1['headers']['status-code']);
|
||||
$this->assertStringContainsString('Sub-directory project1', $response1['body']);
|
||||
$response2 = $proxyClient->call(Client::METHOD_GET, '/project1/');
|
||||
$this->assertEquals(200, $response2['headers']['status-code']);
|
||||
$this->assertStringContainsString('Sub-directory project1', $response2['body']);
|
||||
$this->cleanupSite($siteId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<html lang="en">
|
||||
<body>
|
||||
<p>Sub-directory index</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
<html lang="en">
|
||||
<body>
|
||||
<p>Sub-directory project1</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user