From 7fedac93068ae2983e4fddff4dd16f75b0e0f543 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Wed, 16 Aug 2023 19:08:24 +0100 Subject: [PATCH] Handle Eldad Suggestions --- app/controllers/general.php | 4 ++-- app/controllers/web/console.php | 2 +- app/init.php | 2 +- src/Appwrite/Auth/OAuth2/Firebase.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 7a0cbda9f0..9dbb40c9a8 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -191,7 +191,7 @@ App::init() $host = $request->getHostname() ?? ''; $mainDomain = App::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain - if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_INTERNAL_LOOPBACK_HOST) { + if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL) { if (router($utopia, $dbForConsole, $swooleRequest, $request, $response)) { return; } @@ -489,7 +489,7 @@ App::options() $host = $request->getHostname() ?? ''; $mainDomain = App::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain - if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_INTERNAL_LOOPBACK_HOST) { + if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL) { if (router($utopia, $dbForConsole, $swooleRequest, $request, $response)) { return; } diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index 97e9a3932b..d7496b03bd 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -34,7 +34,7 @@ App::get('/console/*') // Serve static files (console) only for main domain $host = $request->getHostname() ?? ''; $mainDomain = App::getEnv('_APP_DOMAIN', ''); - if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_INTERNAL_LOOPBACK_HOST) { + if ($host !== $mainDomain && $host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL) { throw new Exception(Exception::GENERAL_ROUTE_NOT_FOUND); } diff --git a/app/init.php b/app/init.php index 79390b8290..0ba8a08d2a 100644 --- a/app/init.php +++ b/app/init.php @@ -135,7 +135,7 @@ 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_INTERNAL_LOOPBACK_HOST = 'appwrite'; +const APP_HOSTNAME_INTERNAL = 'appwrite'; // Database Reconnect const DATABASE_RECONNECT_SLEEP = 2; const DATABASE_RECONNECT_MAX_ATTEMPTS = 10; diff --git a/src/Appwrite/Auth/OAuth2/Firebase.php b/src/Appwrite/Auth/OAuth2/Firebase.php index 93078e5f1d..9c64038089 100644 --- a/src/Appwrite/Auth/OAuth2/Firebase.php +++ b/src/Appwrite/Auth/OAuth2/Firebase.php @@ -256,7 +256,7 @@ class Firebase extends OAuth2 ])); } - function generateRandomString($length = 10) + private function generateRandomString($length = 10): string { $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); @@ -267,7 +267,7 @@ class Firebase extends OAuth2 return $randomString; } - public function createCustomRole(string $accessToken, string $projectId): array + private function createCustomRole(string $accessToken, string $projectId): array { // Check if role already exists try {