From c09c8b4d258862b7d93d8cdb645083dc1fc8df3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 22 May 2023 21:27:14 +0200 Subject: [PATCH] Fix wildcard issue with OPTIONS & CORS --- Dockerfile | 2 ++ app/console | 2 +- app/controllers/api/vcs.php | 5 +++++ app/init.php | 2 +- app/workers/builds.php | 2 ++ composer.json | 2 +- composer.lock | 21 ++++++++++++++------- src/Appwrite/Utopia/Response/Model/Func.php | 2 +- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84e5d1dc56..4d4ff158fd 100755 --- a/Dockerfile +++ b/Dockerfile @@ -124,6 +124,8 @@ ENV _APP_SERVER=swoole \ _APP_LOGGING_PROVIDER= \ _APP_LOGGING_CONFIG= +RUN apk add git + RUN \ if [ "$DEBUG" == "true" ]; then \ apk add boost boost-dev; \ diff --git a/app/console b/app/console index 92be261660..dd6555abd4 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit 92be261660e051b88481be653d17d67c3a389364 +Subproject commit dd6555abd460b55be996d9d8e10c95801e8bf662 diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 7b8559a098..97f5c27515 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -92,6 +92,7 @@ App::get('/v1/vcs/github/incominginstallation') $vcsInstallation = $dbForConsole->updateDocument('vcs_installations', $vcsInstallation->getId(), $vcsInstallation); } + // TODO: Figure out port $url = $request->getProtocol() . '://' . $request->getHostname() . ":3000/console/project-$state/settings/git-installations"; $response @@ -132,6 +133,9 @@ App::get('v1/vcs/github/installations/:installationId/repositories') $privateKey = App::getEnv('VCS_GITHUB_PRIVATE_KEY'); $githubAppId = App::getEnv('VCS_GITHUB_APP_ID'); $github = new GitHub(); + \var_dump($installation); + \var_dump($privateKey); + \var_dump($githubAppId); $github->initialiseVariables($installationId, $privateKey, $githubAppId); $page = 1; @@ -247,6 +251,7 @@ App::post('/v1/vcs/github/incomingwebhook') 'activate' => $activate, ])); + // TODO: Figure out port $targetUrl = $request->getProtocol() . '://' . $request->getHostname() . ":3000/console/project-$projectId/functions/function-$functionId"; $buildEvent = new Build(); diff --git a/app/init.php b/app/init.php index 6a09af7e12..7d3613c369 100644 --- a/app/init.php +++ b/app/init.php @@ -1013,7 +1013,7 @@ App::setResource('console', function () { '$collection' => ID::custom('platforms'), 'name' => 'Localhost', 'type' => 'web', - 'hostname' => 'localhost', + 'hostname' => 'matejbaco.loca.lt', ], // Current host is added on app init ], 'legalName' => '', diff --git a/app/workers/builds.php b/app/workers/builds.php index 6377a8fb34..cf39021c3e 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -274,6 +274,8 @@ class BuildsV1 extends Worker $command = \str_replace('"', '\\"', $command); + \var_dump($path); + $response = $this->executor->createRuntime( projectId: $project->getId(), deploymentId: $deployment->getId(), diff --git a/composer.json b/composer.json index 9d0e792d19..0f2e22d511 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "utopia-php/pools": "0.4.*", "utopia-php/preloader": "0.2.*", "utopia-php/domains": "1.1.*", - "utopia-php/framework": "0.26.0", + "utopia-php/framework": "dev-fix-wildcards-g4 as 0.26.99", "utopia-php/image": "0.5.*", "utopia-php/dsn": "0.1.*", "utopia-php/locale": "0.4.*", diff --git a/composer.lock b/composer.lock index c41ebb4939..b9bd134c18 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fc4cf0faa56a3e2d63e7d887ec618a17", + "content-hash": "4478e6ea7546002b03722b73527f1286", "packages": [ { "name": "adhocore/jwt", @@ -2359,16 +2359,16 @@ }, { "name": "utopia-php/framework", - "version": "0.26.0", + "version": "dev-fix-wildcards-g4", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "e8da5576370366d3bf9c574ec855f8c96fe4f34e" + "reference": "3a3ed1296bf31c34bc0a8f80d707cabff2b02f6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/e8da5576370366d3bf9c574ec855f8c96fe4f34e", - "reference": "e8da5576370366d3bf9c574ec855f8c96fe4f34e", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/3a3ed1296bf31c34bc0a8f80d707cabff2b02f6e", + "reference": "3a3ed1296bf31c34bc0a8f80d707cabff2b02f6e", "shasum": "" }, "require": { @@ -2397,9 +2397,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.26.0" + "source": "https://github.com/utopia-php/framework/tree/fix-wildcards-g4" }, - "time": "2023-01-13T08:14:43+00:00" + "time": "2023-05-22T13:29:36+00:00" }, { "name": "utopia-php/image", @@ -5796,6 +5796,12 @@ "alias": "0.28.99", "alias_normalized": "0.28.99.0" }, + { + "package": "utopia-php/framework", + "version": "dev-fix-wildcards-g4", + "alias": "0.26.99", + "alias_normalized": "0.26.99.0" + }, { "package": "utopia-php/vcs", "version": "dev-feat-git-adapter", @@ -5805,6 +5811,7 @@ ], "minimum-stability": "stable", "stability-flags": { + "utopia-php/framework": 20, "utopia-php/vcs": 20, "appwrite/sdk-generator": 20 }, diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index a0b5331316..50017720de 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -114,7 +114,7 @@ class Func extends Model ->addRule('repositoryId', [ 'type' => self::TYPE_STRING, 'description' => 'VCS Repository ID', - 'default' => false, + 'default' => '', 'example' => '35493993', ]) ->addRule('vcsInstallationId', [