From 40e343d17db8bcea72f5c582f157ff375af30a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 20 Nov 2024 15:02:26 +0100 Subject: [PATCH] Fix response model missing fallbackFile --- app/config/specs/open-api3-latest-console.json | 8 +++++++- app/config/specs/open-api3-latest-server.json | 8 +++++++- app/config/specs/swagger2-latest-console.json | 8 +++++++- app/config/specs/swagger2-latest-server.json | 8 +++++++- .../Platform/Modules/Sites/Http/Sites/CreateSite.php | 2 +- .../Platform/Modules/Sites/Http/Sites/UpdateSite.php | 2 +- src/Appwrite/Utopia/Response/Model/Site.php | 6 ++++++ 7 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index f4411c6a2c..3cb5acc0a6 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -37506,6 +37506,11 @@ "type": "string", "description": "Site serve runtime.", "x-example": "static-1" + }, + "fallbackFile": { + "type": "string", + "description": "Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.", + "x-example": "index.html" } }, "required": [ @@ -37529,7 +37534,8 @@ "providerSilentMode", "specification", "buildRuntime", - "serveRuntime" + "serveRuntime", + "fallbackFile" ] }, "templateSite": { diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index ec56b03eff..abe0f04787 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -27740,6 +27740,11 @@ "type": "string", "description": "Site serve runtime.", "x-example": "static-1" + }, + "fallbackFile": { + "type": "string", + "description": "Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.", + "x-example": "index.html" } }, "required": [ @@ -27763,7 +27768,8 @@ "providerSilentMode", "specification", "buildRuntime", - "serveRuntime" + "serveRuntime", + "fallbackFile" ] }, "function": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 7385477130..612d3005b3 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -38060,6 +38060,11 @@ "type": "string", "description": "Site serve runtime.", "x-example": "static-1" + }, + "fallbackFile": { + "type": "string", + "description": "Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.", + "x-example": "index.html" } }, "required": [ @@ -38083,7 +38088,8 @@ "providerSilentMode", "specification", "buildRuntime", - "serveRuntime" + "serveRuntime", + "fallbackFile" ] }, "templateSite": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index be0d35f20b..2114a88711 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -28271,6 +28271,11 @@ "type": "string", "description": "Site serve runtime.", "x-example": "static-1" + }, + "fallbackFile": { + "type": "string", + "description": "Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.", + "x-example": "index.html" } }, "required": [ @@ -28294,7 +28299,8 @@ "providerSilentMode", "specification", "buildRuntime", - "serveRuntime" + "serveRuntime", + "fallbackFile" ] }, "function": { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php index 5c8081ece7..0d0a0f0d2b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php @@ -95,7 +95,7 @@ class CreateSite extends Base ->callback([$this, 'action']); } - public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $subdomain, string $buildRuntime, string $serveRuntime, string $installationId, string $fallbackFile, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) + public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $subdomain, string $buildRuntime, string $serveRuntime, string $installationId, ?string $fallbackFile, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) { $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); $routeSubdomain = ''; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php index 1e310dc523..90d50f49d2 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php @@ -87,7 +87,7 @@ class UpdateSite extends Base ->callback([$this, 'action']); } - public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $buildRuntime, string $serveRuntime, string $fallbackFile, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) + public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $buildRuntime, string $serveRuntime, ?string $fallbackFile, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) { // TODO: If only branch changes, re-deploy $site = $dbForProject->getDocument('sites', $siteId); diff --git a/src/Appwrite/Utopia/Response/Model/Site.php b/src/Appwrite/Utopia/Response/Model/Site.php index 2cc181418b..1897a502ac 100644 --- a/src/Appwrite/Utopia/Response/Model/Site.php +++ b/src/Appwrite/Utopia/Response/Model/Site.php @@ -137,6 +137,12 @@ class Site extends Model 'default' => '', 'example' => 'static-1', ]) + ->addRule('fallbackFile', [ + 'type' => self::TYPE_STRING, + 'description' => 'Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.', + 'default' => null, + 'example' => 'index.html', + ]) ; }