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
+93 -3
View File
@@ -33,16 +33,25 @@ html, body {
flex-direction: column;
user-select: none;
z-index: 20;
transition: width 0.2s ease;
transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
}
.hub-brand {
height: var(--hub-header-height);
padding: 0 1.25rem;
padding: 0 0.85rem 0 1.25rem;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid var(--hub-border-subtle);
overflow: hidden;
}
.hub-brand-left {
display: flex;
align-items: center;
gap: 0.75rem;
border-bottom: 1px solid var(--hub-border-subtle);
overflow: hidden;
}
.hub-logo-icon {
@@ -57,6 +66,7 @@ html, body {
font-size: 1rem;
color: #ffffff;
box-shadow: 0 0 12px var(--hub-accent-glow-current);
flex-shrink: 0;
}
.hub-brand-text {
@@ -64,6 +74,7 @@ html, body {
font-weight: 600;
letter-spacing: -0.01em;
color: var(--hub-text-primary);
white-space: nowrap;
}
.hub-brand-badge {
@@ -75,6 +86,33 @@ html, body {
border-radius: var(--hub-radius-full);
color: var(--hub-text-secondary);
border: 1px solid var(--hub-border-subtle);
white-space: nowrap;
}
/* Sidebar Collapse Toggle Button */
.hub-collapse-btn {
width: 28px;
height: 28px;
border-radius: var(--hub-radius-sm);
background: transparent;
border: 1px solid transparent;
color: var(--hub-text-muted);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.15s ease;
flex-shrink: 0;
}
.hub-collapse-btn:hover {
background-color: var(--hub-bg-card-hover);
color: var(--hub-text-primary);
border-color: var(--hub-border-subtle);
}
.hub-collapse-icon {
transition: transform 0.2s ease;
}
/* Universes Switcher List */
@@ -85,6 +123,7 @@ html, body {
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--hub-text-muted);
white-space: nowrap;
}
.hub-universes-list {
@@ -95,6 +134,7 @@ html, body {
gap: 0.35rem;
flex: 1;
overflow-y: auto;
overflow-x: hidden;
}
.hub-universe-btn {
@@ -216,6 +256,7 @@ html, body {
font-weight: 500;
cursor: pointer;
transition: all 0.15s ease;
white-space: nowrap;
}
.hub-tool-btn:hover {
@@ -223,6 +264,54 @@ html, body {
color: var(--hub-text-primary);
}
/* =========================================================================
Collapsed Sidebar State
========================================================================= */
.hub-sidebar.collapsed {
width: var(--hub-sidebar-collapsed-width);
}
.hub-sidebar.collapsed .hub-brand {
padding: 0;
justify-content: center;
}
.hub-sidebar.collapsed .hub-brand-left,
.hub-sidebar.collapsed .hub-nav-section,
.hub-sidebar.collapsed .hub-universe-info,
.hub-sidebar.collapsed .hub-sidebar-footer .hub-tool-btn span:last-child {
display: none;
}
.hub-sidebar.collapsed .hub-collapse-btn {
width: 36px;
height: 36px;
}
.hub-sidebar.collapsed .hub-collapse-icon {
transform: rotate(180deg);
}
.hub-sidebar.collapsed .hub-universe-btn {
padding: 0.65rem 0;
justify-content: center;
}
.hub-sidebar.collapsed .hub-universe-btn.active::before {
left: -0.25rem;
}
.hub-sidebar.collapsed .hub-status-dot {
position: absolute;
top: 6px;
right: 6px;
}
.hub-sidebar.collapsed .hub-sidebar-footer .hub-tool-btn {
padding: 0.5rem 0;
justify-content: center;
}
/* Main View Area */
.hub-main {
flex: 1;
@@ -231,6 +320,7 @@ html, body {
height: 100%;
overflow: hidden;
background-color: var(--hub-bg-canvas);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Universe Topbar */
+39 -10
View File
@@ -1,7 +1,7 @@
/**
* Hermes Hub — Client-side Workspace Switcher & Context Manager
* Routage natif par sous-domaine (tt.hub.yesminedor.tn, nyora.hub..., perso.hub..., nabil.hub..., dsh.hub...)
* Résout à 100% le chargement des assets absolus sans réécriture fragile
* Routage natif par sous-domaine 1er niveau (tt-hub.yesminedor.tn, nyora-hub..., perso-hub..., nabil-hub..., dsh-hub...)
* Résout à 100% le chargement des assets absolus et la couverture TLS wildcard
*/
(function () {
@@ -16,6 +16,8 @@
const nabilModeToggle = document.getElementById("nabil-mode-toggle");
const tabSession = document.getElementById("tab-session");
const tabFiles = document.getElementById("tab-files");
const sidebar = document.getElementById("hub-sidebar");
const toggleBtn = document.getElementById("btn-toggle-sidebar");
// Accent mappings
const ACCENT_MAP = {
@@ -42,24 +44,24 @@
function getTargetUrl(universeId, mode) {
const hostname = window.location.hostname;
// 1. Production *.hub.yesminedor.tn (Routage par sous-domaine natif)
if (hostname === "hub.yesminedor.tn" || hostname.endsWith(".hub.yesminedor.tn")) {
// 1. Production *-hub.yesminedor.tn (Routage par sous-domaine tiret)
if (hostname === "hub.yesminedor.tn" || hostname.endsWith(".yesminedor.tn")) {
if (universeId === "nabil" && mode === "files") {
return "https://dsh.hub.yesminedor.tn/";
return "https://dsh-hub.yesminedor.tn/";
}
return `https://${universeId}.hub.yesminedor.tn/`;
return `https://${universeId}-hub.yesminedor.tn/`;
}
// 2. Test local *.localhost
// 2. Test local *-hub.localhost ou *.localhost
if (hostname.endsWith(".localhost") || hostname === "localhost") {
const port = window.location.port ? `:${window.location.port}` : "";
if (universeId === "nabil" && mode === "files") {
return `${window.location.protocol}//dsh.localhost${port}/`;
return `${window.location.protocol}//dsh-hub.localhost${port}/`;
}
return `${window.location.protocol}//${universeId}.localhost${port}/`;
return `${window.location.protocol}//${universeId}-hub.localhost${port}/`;
}
// 3. Fallback IP direct / chemin relatif (pour tests curl/SSH)
// 3. Fallback IP direct / chemin relatif (tests curl/SSH)
if (universeId === "nabil" && mode === "files") {
return "/u/nabil/files/";
}
@@ -142,6 +144,22 @@
}, 50);
}
// Sidebar Collapse / Expand Functionality
function setSidebarCollapsed(collapsed) {
if (!sidebar) return;
if (collapsed) {
sidebar.classList.add("collapsed");
toggleBtn?.setAttribute("aria-label", "Déplier la barre latérale");
toggleBtn?.setAttribute("title", "Déplier la barre latérale");
localStorage.setItem("hermes_hub_sidebar_collapsed", "true");
} else {
sidebar.classList.remove("collapsed");
toggleBtn?.setAttribute("aria-label", "Replier la barre latérale");
toggleBtn?.setAttribute("title", "Replier la barre latérale");
localStorage.setItem("hermes_hub_sidebar_collapsed", "false");
}
}
// Écouter le chargement de l'iframe
if (iframe) {
iframe.addEventListener("load", () => {
@@ -262,6 +280,17 @@
tabSession?.addEventListener("click", () => setMode("session"));
tabFiles?.addEventListener("click", () => setMode("files"));
// Toggle Sidebar
toggleBtn?.addEventListener("click", () => {
const isCollapsed = sidebar?.classList.contains("collapsed");
setSidebarCollapsed(!isCollapsed);
});
// Restore saved sidebar collapsed state
if (localStorage.getItem("hermes_hub_sidebar_collapsed") === "true") {
setSidebarCollapsed(true);
}
document.getElementById("btn-edit-persona")?.addEventListener("click", openPersonaModal);
document.getElementById("btn-clone-universe")?.addEventListener("click", openCloneModal);
document.getElementById("btn-save-persona")?.addEventListener("click", savePersona);