fix: migration hostnames hub point->tiret + bouton repli sidebar

This commit is contained in:
bolbol
2026-08-20 20:00:19 +01:00
parent 3fadb884f0
commit e474071f76
4 changed files with 170 additions and 27 deletions
+24 -8
View File
@@ -13,22 +13,38 @@ from app.personas import ensure_dirs
def get_subdomain_target(host: str) -> Optional[Tuple[str, str]]:
"""
Inspects Host header and returns (target_backend_url, universe_id) if it matches a subdomain.
Examples:
tt.hub.yesminedor.tn -> (HERMES_TT_URL, 'tt')
nyora.hub.yesminedor.tn -> (HERMES_NYORA_URL, 'nyora')
perso.hub.yesminedor.tn -> (HERMES_PERSO_URL, 'perso')
nabil.hub.yesminedor.tn -> (HERMES_NABIL_URL, 'nabil')
dsh.hub.yesminedor.tn -> (DSH_FILEBROWSER_URL, 'nabil')
Inspects Host header and returns (target_backend_url, universe_id) if it matches a universe hostname.
Hostnames (Dash-based 1st level):
tt-hub.yesminedor.tn -> (HERMES_TT_URL, 'tt')
nyora-hub.yesminedor.tn -> (HERMES_NYORA_URL, 'nyora')
perso-hub.yesminedor.tn -> (HERMES_PERSO_URL, 'perso')
nabil-hub.yesminedor.tn -> (HERMES_NABIL_URL, 'nabil')
dsh-hub.yesminedor.tn -> (DSH_FILEBROWSER_URL, 'nabil')
Apex / Hub UI:
hub.yesminedor.tn -> None (Serves index.html Workspace Switcher)
"""
if not host:
return None
hostname = host.split(":")[0].lower()
# The main hub switcher UI should NOT be proxied
if hostname in ("hub.yesminedor.tn", "localhost", "127.0.0.1"):
return None
sub = None
if hostname.endswith(".hub.yesminedor.tn"):
# 1. New 1st level dash-based production hostnames (*-hub.yesminedor.tn)
if hostname.endswith("-hub.yesminedor.tn"):
sub = hostname.rsplit("-hub.yesminedor.tn", 1)[0]
# 2. Backward compatibility (*.hub.yesminedor.tn)
elif hostname.endswith(".hub.yesminedor.tn"):
sub = hostname.rsplit(".hub.yesminedor.tn", 1)[0]
# 3. Localhost dash development (*-hub.localhost)
elif hostname.endswith("-hub.localhost"):
sub = hostname.rsplit("-hub.localhost", 1)[0]
# 4. Localhost dot development (*.localhost)
elif hostname.endswith(".localhost"):
sub = hostname.rsplit(".localhost", 1)[0]