fix pargar bugs 2
This commit is contained in:
@@ -38,36 +38,7 @@ class PriceStreamService
|
||||
|
||||
public function resolveHost(?Request $request = null): string
|
||||
{
|
||||
$config = app(ConfigService::class);
|
||||
|
||||
$appUrl = trim($config->getString('app_url', ''));
|
||||
if ($appUrl !== '') {
|
||||
$host = parse_url($appUrl, PHP_URL_HOST);
|
||||
if (is_string($host) && $host !== '') {
|
||||
return $this->normalizeHost($host);
|
||||
}
|
||||
}
|
||||
|
||||
if ($request !== null) {
|
||||
$requestHost = trim((string) $request->getHost());
|
||||
if ($requestHost !== '') {
|
||||
return $this->normalizeHost($requestHost);
|
||||
}
|
||||
}
|
||||
|
||||
if (! app()->runningInConsole() && request()) {
|
||||
$requestHost = trim((string) request()->getHost());
|
||||
if ($requestHost !== '') {
|
||||
return $this->normalizeHost($requestHost);
|
||||
}
|
||||
}
|
||||
|
||||
$nameEn = trim((string) $config->getString('name_en', ''));
|
||||
if ($nameEn !== '') {
|
||||
return $this->normalizeHost($nameEn);
|
||||
}
|
||||
|
||||
return '';
|
||||
return app(ConfigService::class)->resolvePublicHost($request);
|
||||
}
|
||||
|
||||
public function currentSeq(): int
|
||||
@@ -219,11 +190,4 @@ class PriceStreamService
|
||||
|
||||
return md5(json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
private function normalizeHost(string $host): string
|
||||
{
|
||||
$host = strtolower(trim($host));
|
||||
|
||||
return strpos($host, 'www.') === 0 ? substr($host, 4) : $host;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user