Spaces:
Build error
Build error
Update user_routes.py
Browse files- user_routes.py +12 -12
user_routes.py
CHANGED
|
@@ -22,10 +22,10 @@ GITHUB_PAGES_BASE_URL = "https://mindus0.github.io/nexus/"
|
|
| 22 |
|
| 23 |
# URLs des pages sensibles (celles que le backend doit sécuriser)
|
| 24 |
SECURE_PAGES_MAPPING = {
|
| 25 |
-
'/dashboard': GITHUB_PAGES_BASE_URL + 'dashboard.html',
|
| 26 |
-
'/profile': GITHUB_PAGES_BASE_URL + 'profile.html',
|
| 27 |
-
'/nouveau_project': GITHUB_PAGES_BASE_URL + 'nouveau_project.html',
|
| 28 |
-
'/repo_files': GITHUB_PAGES_BASE_URL + 'repo_files.html',
|
| 29 |
# Ajoutez les autres pages sensibles ici
|
| 30 |
# '/editor': GITHUB_PAGES_BASE_URL + 'editor.html',
|
| 31 |
# ...
|
|
@@ -78,7 +78,7 @@ def get_external_page_content(path: str) -> tuple[str | None, int]:
|
|
| 78 |
# ENDPOINTS PAGES SÉCURISÉES (Passerelle Inversée)
|
| 79 |
# ----------------------------------------------------------------------
|
| 80 |
|
| 81 |
-
@user_bp.route("/dashboard")
|
| 82 |
@login_required
|
| 83 |
def dashboard():
|
| 84 |
"""
|
|
@@ -94,7 +94,7 @@ def dashboard():
|
|
| 94 |
return redirect(url_for('user_bp.dashboard'))
|
| 95 |
|
| 96 |
# 1. Charger la page HTML à partir de l'URL externe
|
| 97 |
-
html_content, status_code = get_external_page_content('/dashboard')
|
| 98 |
|
| 99 |
# 2. Gérer les messages flash de Flask
|
| 100 |
# Pour que cela fonctionne, le HTML (dashboard.html) doit contenir la logique JS/Jinja
|
|
@@ -107,7 +107,7 @@ def dashboard():
|
|
| 107 |
return html_content, status_code
|
| 108 |
|
| 109 |
|
| 110 |
-
@user_bp.route("/profile", methods=['GET', 'POST'])
|
| 111 |
@login_required
|
| 112 |
def profile():
|
| 113 |
"""
|
|
@@ -144,7 +144,7 @@ def profile():
|
|
| 144 |
|
| 145 |
# Logique pour la méthode GET ou après un échec POST
|
| 146 |
# On charge la page HTML à partir de l'URL externe
|
| 147 |
-
html_content, status_code = get_external_page_content('/profile')
|
| 148 |
|
| 149 |
if status_code == 200:
|
| 150 |
return html_content
|
|
@@ -153,13 +153,13 @@ def profile():
|
|
| 153 |
|
| 154 |
# --- Vous devez ajouter ici les autres routes sécurisées (nouveau_project, repo_files, etc.) ---
|
| 155 |
|
| 156 |
-
@user_bp.route("/nouveau_project")
|
| 157 |
@login_required
|
| 158 |
def nouveau_project():
|
| 159 |
"""
|
| 160 |
Passerelle inversée pour nouveau_project.html
|
| 161 |
"""
|
| 162 |
-
html_content, status_code = get_external_page_content('/nouveau_project')
|
| 163 |
|
| 164 |
if status_code == 200:
|
| 165 |
return html_content
|
|
@@ -167,13 +167,13 @@ def nouveau_project():
|
|
| 167 |
return html_content, status_code
|
| 168 |
|
| 169 |
|
| 170 |
-
@user_bp.route("/repo_files") # Nous pourrions avoir besoin d'un paramètre ici : /repo_files/<slug>
|
| 171 |
@login_required
|
| 172 |
def repo_files():
|
| 173 |
"""
|
| 174 |
Passerelle inversée pour repo_files.html
|
| 175 |
"""
|
| 176 |
-
html_content, status_code = get_external_page_content('/repo_files')
|
| 177 |
|
| 178 |
if status_code == 200:
|
| 179 |
return html_content
|
|
|
|
| 22 |
|
| 23 |
# URLs des pages sensibles (celles que le backend doit sécuriser)
|
| 24 |
SECURE_PAGES_MAPPING = {
|
| 25 |
+
'/dashboard.html': GITHUB_PAGES_BASE_URL + 'dashboard.html',
|
| 26 |
+
'/profile.html': GITHUB_PAGES_BASE_URL + 'profile.html',
|
| 27 |
+
'/nouveau_project.html': GITHUB_PAGES_BASE_URL + 'nouveau_project.html',
|
| 28 |
+
'/repo_files.html': GITHUB_PAGES_BASE_URL + 'repo_files.html',
|
| 29 |
# Ajoutez les autres pages sensibles ici
|
| 30 |
# '/editor': GITHUB_PAGES_BASE_URL + 'editor.html',
|
| 31 |
# ...
|
|
|
|
| 78 |
# ENDPOINTS PAGES SÉCURISÉES (Passerelle Inversée)
|
| 79 |
# ----------------------------------------------------------------------
|
| 80 |
|
| 81 |
+
@user_bp.route("/dashboard.html")
|
| 82 |
@login_required
|
| 83 |
def dashboard():
|
| 84 |
"""
|
|
|
|
| 94 |
return redirect(url_for('user_bp.dashboard'))
|
| 95 |
|
| 96 |
# 1. Charger la page HTML à partir de l'URL externe
|
| 97 |
+
html_content, status_code = get_external_page_content('/dashboard.html')
|
| 98 |
|
| 99 |
# 2. Gérer les messages flash de Flask
|
| 100 |
# Pour que cela fonctionne, le HTML (dashboard.html) doit contenir la logique JS/Jinja
|
|
|
|
| 107 |
return html_content, status_code
|
| 108 |
|
| 109 |
|
| 110 |
+
@user_bp.route("/profile.html", methods=['GET', 'POST'])
|
| 111 |
@login_required
|
| 112 |
def profile():
|
| 113 |
"""
|
|
|
|
| 144 |
|
| 145 |
# Logique pour la méthode GET ou après un échec POST
|
| 146 |
# On charge la page HTML à partir de l'URL externe
|
| 147 |
+
html_content, status_code = get_external_page_content('/profile.html')
|
| 148 |
|
| 149 |
if status_code == 200:
|
| 150 |
return html_content
|
|
|
|
| 153 |
|
| 154 |
# --- Vous devez ajouter ici les autres routes sécurisées (nouveau_project, repo_files, etc.) ---
|
| 155 |
|
| 156 |
+
@user_bp.route("/nouveau_project.html")
|
| 157 |
@login_required
|
| 158 |
def nouveau_project():
|
| 159 |
"""
|
| 160 |
Passerelle inversée pour nouveau_project.html
|
| 161 |
"""
|
| 162 |
+
html_content, status_code = get_external_page_content('/nouveau_project.html')
|
| 163 |
|
| 164 |
if status_code == 200:
|
| 165 |
return html_content
|
|
|
|
| 167 |
return html_content, status_code
|
| 168 |
|
| 169 |
|
| 170 |
+
@user_bp.route("/repo_files.html") # Nous pourrions avoir besoin d'un paramètre ici : /repo_files/<slug>
|
| 171 |
@login_required
|
| 172 |
def repo_files():
|
| 173 |
"""
|
| 174 |
Passerelle inversée pour repo_files.html
|
| 175 |
"""
|
| 176 |
+
html_content, status_code = get_external_page_content('/repo_files.html')
|
| 177 |
|
| 178 |
if status_code == 200:
|
| 179 |
return html_content
|