July 3rd - Fix landing page not display

This commit is contained in:
2026-07-03 21:15:29 -04:00
parent 4b6401be43
commit 372a1f090a
3 changed files with 40 additions and 15 deletions
+21 -14
View File
@@ -78,6 +78,26 @@ def init_tenancy(app):
g.billing_warning = None # MT-8: set to 'past_due' by _billing_gate when needed
g.is_apex = False # True when serving the public apex/landing host
# ── Public apex (marketing) host → landing page ──────────────────────
# The apex domain (TENANT_BASE_DOMAIN, e.g. jqc.app) and its www. variant
# are NEVER a tenant. Serve the public landing page for '/' and bounce any
# other non-exempt apex path back to '/'. This runs BEFORE the
# MULTI_TENANT_ENABLED gate on purpose: the marketing site must work even
# in single-tenant mode (MT flag off), where the app would otherwise serve
# its default database (tenant-zero) for every host. /welcome, /signup,
# and /static/ are exempt and pass straight through.
host = (request.host or '').split(':')[0].strip().lower()
base = (current_app.config.get('TENANT_BASE_DOMAIN') or '').strip().lower()
if base and host in (base, f'www.{base}'):
g.is_apex = True
if _is_exempt(request.path):
return
if request.path == '/':
# Serve the landing view without a redirect (the dashboard owns
# '/' on tenant hosts, so we can't register a second '/' route).
return current_app.view_functions['landing.index']()
return redirect('/')
if not current_app.config.get('MULTI_TENANT_ENABLED', False):
return # inert: default database serves everything (single-tenant)
@@ -127,21 +147,8 @@ def init_tenancy(app):
session.pop('impersonating_tenant_id', None)
session.pop('impersonating_superadmin_id', None)
# ── Apex (marketing) host → public landing page ──────────────────
# The apex domain (jqc.app) and its www. variant are NOT tenants. Serve
# the public landing page for '/' and send any other non-exempt apex
# path back to it. /signup, /static, /welcome are already exempt above.
host = (request.host or '').split(':')[0].strip().lower()
base = (current_app.config.get('TENANT_BASE_DOMAIN') or '').strip().lower()
if base and host in (base, f'www.{base}'):
g.is_apex = True
if request.path == '/':
# Serve the landing view without a redirect (dashboard owns '/'
# on tenant hosts, so we can't register a second '/' route).
return current_app.view_functions['landing.index']()
return redirect('/')
# ── Normal Host → tenant resolution ──────────────────────────────
host = (request.host or '').split(':')[0].strip().lower()
tenant = resolve_tenant(host)
if tenant is None:
return Response(_UNKNOWN_TENANT_PAGE, status=404, mimetype='text/html')