diff --git a/src/Appwrite/Network/Platform.php b/src/Appwrite/Network/Platform.php index d584ec074f..cbfb2c3b99 100644 --- a/src/Appwrite/Network/Platform.php +++ b/src/Appwrite/Network/Platform.php @@ -24,6 +24,10 @@ class Platform public const SCHEME_HTTP = 'http'; public const SCHEME_HTTPS = 'https'; + public const SCHEME_CHROME_EXTENSION = 'chrome-extension'; + public const SCHEME_FIREFOX_EXTENSION = 'moz-extension'; + public const SCHEME_SAFARI_EXTENSION = 'extension'; + public const SCHEME_EDGE_EXTENSION = 'ms-browser-extension'; public const SCHEME_IOS = 'appwrite-ios'; public const SCHEME_MACOS = 'appwrite-macos'; public const SCHEME_WATCHOS = 'appwrite-watchos'; @@ -45,6 +49,10 @@ class Platform self::SCHEME_ANDROID => 'Android', self::SCHEME_WINDOWS => 'Windows', self::SCHEME_LINUX => 'Linux', + self::SCHEME_CHROME_EXTENSION => 'Chrome Extension', + self::SCHEME_FIREFOX_EXTENSION => 'Firefox Extension', + self::SCHEME_SAFARI_EXTENSION => 'Safari Extension', + self::SCHEME_EDGE_EXTENSION => 'Edge Extension', ]; /** diff --git a/src/Appwrite/Network/Validator/Origin.php b/src/Appwrite/Network/Validator/Origin.php index c8d9ee626d..fc58651723 100644 --- a/src/Appwrite/Network/Validator/Origin.php +++ b/src/Appwrite/Network/Validator/Origin.php @@ -42,7 +42,15 @@ class Origin extends Validator $this->scheme = $this->parseScheme($origin); $this->host = strtolower(parse_url($origin, PHP_URL_HOST) ?? ''); - if (in_array($this->scheme, [Platform::SCHEME_HTTP, Platform::SCHEME_HTTPS], true)) { + $webPlatforms = [ + Platform::SCHEME_HTTP, + Platform::SCHEME_HTTPS, + Platform::SCHEME_CHROME_EXTENSION, + Platform::SCHEME_FIREFOX_EXTENSION, + Platform::SCHEME_SAFARI_EXTENSION, + Platform::SCHEME_EDGE_EXTENSION, + ]; + if (in_array($this->scheme, $webPlatforms, true)) { $validator = new Hostname($this->hostnames); return $validator->isValid($this->host); }