fix superadmin settings cache
This commit is contained in:
@@ -278,15 +278,28 @@ class SuperAdminProgramSettingsClient
|
||||
/**
|
||||
* دامنههای کاندید برای resolve نسخه در سوپرادمین.
|
||||
*
|
||||
* ترتیب مهم است: اولین پاسخ ۲۰۰ معتبر برنده است.
|
||||
* Host واقعی درخواست باید قبل از APP_URL و SUPERADMIN_SMS_DOMAIN باشد؛
|
||||
* وگرنه دامنهٔ SMS/اشتراکی (با فلگهای پیشفرض false) بهاشتباه اعمال میشود
|
||||
* و همگامسازی «موفق» دیده میشود ولی منو روشن نمیشود.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
private function domainCandidates(): array
|
||||
{
|
||||
$candidates = [];
|
||||
|
||||
$override = trim((string) config('services.superadmin.sms_domain', ''));
|
||||
if ($override !== '') {
|
||||
$candidates[] = $this->normalizeHost($override);
|
||||
try {
|
||||
$request = request();
|
||||
if ($request) {
|
||||
$forwarded = (string) $request->headers->get('X-Forwarded-Host', '');
|
||||
if ($forwarded !== '') {
|
||||
$candidates[] = $this->normalizeHost(explode(',', $forwarded)[0] ?? '');
|
||||
}
|
||||
$candidates[] = $this->normalizeHost((string) $request->getHost());
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// CLI / بدون request
|
||||
}
|
||||
|
||||
$fromApp = parse_url((string) config('app.url'), PHP_URL_HOST);
|
||||
@@ -294,17 +307,9 @@ class SuperAdminProgramSettingsClient
|
||||
$candidates[] = $this->normalizeHost($fromApp);
|
||||
}
|
||||
|
||||
try {
|
||||
$request = request();
|
||||
if ($request) {
|
||||
$candidates[] = $this->normalizeHost((string) $request->getHost());
|
||||
$forwarded = (string) $request->headers->get('X-Forwarded-Host', '');
|
||||
if ($forwarded !== '') {
|
||||
$candidates[] = $this->normalizeHost(explode(',', $forwarded)[0] ?? '');
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// CLI / بدون request
|
||||
$override = trim((string) config('services.superadmin.sms_domain', ''));
|
||||
if ($override !== '') {
|
||||
$candidates[] = $this->normalizeHost($override);
|
||||
}
|
||||
|
||||
$out = [];
|
||||
@@ -324,7 +329,7 @@ class SuperAdminProgramSettingsClient
|
||||
}
|
||||
|
||||
/**
|
||||
* admin.example.com / www.example.com → example.com هم امتحان شود.
|
||||
* admin.example.com / www.example.com / api.example.com → example.com هم امتحان شود.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
@@ -336,7 +341,7 @@ class SuperAdminProgramSettingsClient
|
||||
}
|
||||
|
||||
$aliases = [$host];
|
||||
foreach (['www.', 'admin.', 'panel.', 'app.'] as $prefix) {
|
||||
foreach (['www.', 'admin.', 'panel.', 'app.', 'api.', 'node.', 'backend.', 'server.'] as $prefix) {
|
||||
if (str_starts_with($host, $prefix)) {
|
||||
$bare = substr($host, strlen($prefix));
|
||||
if ($bare !== '') {
|
||||
|
||||
Reference in New Issue
Block a user