�PNG  IHDR��;���IDATx��ܻn�0���K�� �)(�pA��� ���7�LeG{�� �§㻢|��ذaÆ 6lذaÆ 6lذaÆ 6lom��$^�y���ذag�5bÆ 6lذaÆ 6lذa{���� 6lذaÆ �`����}H�Fkm�,�m����Ӫ���ô�ô!� �x�|'ܢ˟;�E:���9�&ᶒ�}�{�v]�n&�6� �h��_��t�ڠ͵-ҫ���Z;��Z$�.�P���k�ž)�!��o���>}l�eQfJ�T��u і���چ��\��X=8��Rن4`Vw�l�>����n�G�^��i�s��"ms�$�u��i��?w�bs[m�6�K4���O���.�4��%����/����b�C%��t ��M�ז� �-l�G6�mrz2���s�%�9��s@���-�k�9�=���)������k�B5����\��+͂�Zsٲ ��Rn��~G���R���C����� �wIcI��n7jJ���hۛNCS|���j0��8y�iHKֶۛ�k�Ɉ+;Sz������L/��F�*\��Ԕ�#"5��m�2��[S��������=�g��n�a�P�e�ғ�L�� lذaÆ 6l�^k��̱aÆ 6lذaÆ 6lذa;���� �_��ذaÆ 6lذaÆ 6lذaÆ ���R���IEND�B` mergeConfigFrom($this->configPath(), 'cors'); $this->app->singleton(CorsService::class, function ($app) { return new CorsService($this->corsOptions(), $app); }); } /** * Register the config for publishing * */ public function boot() { if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { $this->publishes([$this->configPath() => config_path('cors.php')], 'cors'); } elseif ($this->app instanceof LumenApplication) { $this->app->configure('cors'); } // Add the headers on the Request Handled event as fallback in case of exceptions if (class_exists(RequestHandled::class) && $this->app->bound('events')) { $this->app->make('events')->listen(RequestHandled::class, function (RequestHandled $event) { $this->app->make(HandleCors::class)->onRequestHandled($event); }); } } /** * Set the config path * * @return string */ protected function configPath() { return __DIR__ . '/../config/cors.php'; } /** * Get options for CorsService * * @return array */ protected function corsOptions() { $config = $this->app['config']->get('cors'); if ($config['exposed_headers'] && !is_array($config['exposed_headers'])) { throw new \RuntimeException('CORS config `exposed_headers` should be `false` or an array'); } foreach (['allowed_origins', 'allowed_origins_patterns', 'allowed_headers', 'allowed_methods'] as $key) { if (!is_array($config[$key])) { throw new \RuntimeException('CORS config `' . $key . '` should be an array'); } } // Convert case to supported options $options = [ 'supportsCredentials' => $config['supports_credentials'], 'allowedOrigins' => $config['allowed_origins'], 'allowedOriginsPatterns' => $config['allowed_origins_patterns'], 'allowedHeaders' => $config['allowed_headers'], 'allowedMethods' => $config['allowed_methods'], 'exposedHeaders' => $config['exposed_headers'], 'maxAge' => $config['max_age'], ]; // Transform wildcard pattern foreach ($options['allowedOrigins'] as $origin) { if (strpos($origin, '*') !== false) { $options['allowedOriginsPatterns'][] = $this->convertWildcardToPattern($origin); } } return $options; } /** * Create a pattern for a wildcard, based on Str::is() from Laravel * * @see https://github.com/laravel/framework/blob/5.5/src/Illuminate/Support/Str.php * @param string $pattern * @return string */ protected function convertWildcardToPattern($pattern) { $pattern = preg_quote($pattern, '#'); // Asterisks are translated into zero-or-more regular expression wildcards // to make it convenient to check if the strings starts with the given // pattern such as "library/*", making any string check convenient. $pattern = str_replace('\*', '.*', $pattern); return '#^' . $pattern . '\z#u'; } }