feat: готовый бренд ZoomStage и минимальный доменный подвал (refs #12)
deploy-preland / deploy zoomstage.online (push) Successful in 44s
deploy-preland / deploy zoomstage.online (push) Successful in 44s
This commit is contained in:
1 parent
a2c3197a16
commit
ec087ea636
24 files changed
+365
-237
No files matched your search
@@ -2,8 +2,8 @@
|
||||
/** Версия логотипа по содержимому исключает старый бренд из браузерного кеша. */
|
||||
function prelandAssetUrl(string $path): string
|
||||
{
|
||||
global $assetsUriPrefix;
|
||||
$file = dirname(__DIR__) . '/' . $path;
|
||||
$version = is_file($file) ? substr(hash_file('sha256', $file), 0, 16) : 'missing';
|
||||
return htmlspecialchars(rtrim($assetsUriPrefix, '/') . '/' . $path . '?v=' . $version, ENT_QUOTES, 'UTF-8');
|
||||
// Бренд всегда принадлежит текущему преленду, даже если общая статика на CDN/API.
|
||||
return htmlspecialchars('/' . $path . '?v=' . $version, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/** Домен преленда не связан с config.host основного сайта/API. */
|
||||
function prelandSiteDomain(array $server): string
|
||||
{
|
||||
foreach ([$server['HTTP_HOST'] ?? '', $server['SERVER_NAME'] ?? ''] as $candidate) {
|
||||
if (!is_string($candidate) || preg_match('/[\s\/@?#<>]/', $candidate)) continue;
|
||||
$host = strtolower(rtrim(preg_replace('/:\d+$/', '', $candidate), '.'));
|
||||
if (strlen($host) <= 253 && preg_match('/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/D', $host)) return $host;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
Reference in new issue
Block a user