refactor: noms publics dracodev par configuration (dev/prod)
Aucun nom public d'une autre app dracodev n'est codé en dur dans le code vivant : nouveau module app/services/draco_urls.py (env > config > défaut officiel, jamais de -dev en défaut). CSP connect-src/frame-src, bouton SSO ObsiGate, révocations SSO, événements agent, preset MCP TikTak, barre commune, panneau Spark (injection hôte DRACO_PANNEAU_CONFIG), refs croisées (hôte configuré + officiel reconnus, URL d'affichage reconstruite, aucune donnée stockée migrée), User-Agent OG, liens Gitea. Variables ajoutées DRACO_AGENT_URL/TIKTAK_URL/KANBANTE_URL/FLOWDECK_URL, réutilisées DRACO_SSO_URL/OAUTH_REDIRECT_URI/AGENT_EVENEMENTS_URL/GITEA_URL/APP_BASE_URL. Version 7.82.0.
This commit is contained in:
+22
-2
@@ -32,12 +32,32 @@ def get_redirect_uri(request: Request) -> str:
|
||||
host = fwd_host.split(",")[0].strip() or request.headers.get("host", "localhost:8080")
|
||||
return f"{scheme}://{host}/auth/callback"
|
||||
|
||||
def _sso_login_url() -> str:
|
||||
"""URL du bouton « Login with ObsiGate (SSO) », résolue par la config.
|
||||
|
||||
Émettrice = DRACO_SSO_URL (défaut : nom officiel) ; retour =
|
||||
URL publique de cette instance (FLOWDECK_URL / OAUTH_REDIRECT_URI /
|
||||
APP_BASE_URL, défaut : nom officiel) + ``/auth/draco``. Aucun nom
|
||||
public figé : un dev déclare ses noms en ``-dev`` dans le .env.
|
||||
"""
|
||||
from urllib.parse import quote
|
||||
|
||||
from app.services import draco_urls
|
||||
|
||||
retour = f"{draco_urls.flowdeck_url()}/auth/draco"
|
||||
return (f"{draco_urls.obsigate_url()}/sso/authorize"
|
||||
f"?return_to={quote(retour, safe='')}")
|
||||
|
||||
|
||||
def _with_nonce(html: str) -> str:
|
||||
"""A20 : injecte le nonce CSP au moment du rendu.
|
||||
|
||||
`LOCAL_LOGIN_HTML` est une constante de module — le nonce, lui, est par
|
||||
requête, donc il ne peut être figé qu'ici.
|
||||
requête, donc il ne peut être figé qu'ici. Même traitement pour l'URL
|
||||
du bouton SSO ObsiGate (placeholder ``__SSO_LOGIN_URL__``), qui
|
||||
dépend de la config dev/prod courante.
|
||||
"""
|
||||
html = html.replace("__SSO_LOGIN_URL__", _sso_login_url())
|
||||
return html.replace("<script>", f'<script nonce="{CSP_NONCE.get()}">', 1)
|
||||
|
||||
|
||||
@@ -103,7 +123,7 @@ body{background:#191919;color:#fff;font-family:-apple-system,BlinkMacSystemFont,
|
||||
<p style="font-size:13px;color:rgba(255,255,255,.4);margin-bottom:8px;">Or continue with</p>
|
||||
<button class="oauth-btn" onclick="window.location='/auth/login?provider=gitea'" style="margin-bottom:8px">🔗 <span id="gitea-btn-label">Login</span> with Gitea</button>
|
||||
<button class="oauth-btn" onclick="window.location='/auth/login?provider=github'" style="margin-bottom:8px">🐙 <span id="github-btn-label">Login</span> with GitHub</button>
|
||||
<button class="oauth-btn" onclick="window.location='https://og.dracodev.net/sso/authorize?return_to=https%3A%2F%2Fflowdeck.dracodev.net%2Fauth%2Fdraco'">🧭 Login with ObsiGate (SSO)</button>
|
||||
<button class="oauth-btn" onclick="window.location='__SSO_LOGIN_URL__'">🧭 Login with ObsiGate (SSO)</button>
|
||||
</div>
|
||||
<!-- SSO / SAML + OIDC (v6.7.0) — buttons injected by loadSsoProviders() -->
|
||||
<div class="oauth-section" id="sso-section" style="display:none">
|
||||
|
||||
Reference in New Issue
Block a user