From 46336df21bfa705833aa36eb30c032cf2c70493a Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 13 Jul 2026 14:58:01 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20frontend=20Gitea=20=E2=80=94=20workspac?= =?UTF-8?q?es=202=20sections=20+=20gitea=20workspace=20vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit workspaces.html: - Section πŸ“ Local Workspaces (existante, avec badges) - Section πŸ”— Gitea Projects (par organisation, lazy load) - Γ‰tats: loading, not_linked (lien pour login OAuth), error (retry), ok gitea_workspace.html: - Arbre fichiers (lazy: un dossier Γ  la fois) - Vue fichier (lecture seule β†’ bouton Edit) - Γ‰diteur avec zone de commit (message + historique dropdown) - Section πŸ”’ Private Pages (placeholder pour pages FlowDeck locales) - Bouton Delete fichier Routing: /gitea-workspace?owner=X&repo=Y Fallback: token admin serveur si pas de token OAuth utilisateur --- app/routers/dashboard.py | 14 ++ app/routers/gitea.py | 7 +- app/templates/gitea_workspace.html | 340 +++++++++++++++++++++++++++++ app/templates/workspaces.html | 175 +++++++++++++-- 4 files changed, 513 insertions(+), 23 deletions(-) create mode 100644 app/templates/gitea_workspace.html diff --git a/app/routers/dashboard.py b/app/routers/dashboard.py index 38c79fa..6abd441 100644 --- a/app/routers/dashboard.py +++ b/app/routers/dashboard.py @@ -393,6 +393,20 @@ async def workspace_page(request: Request): return template.render(**ctx) +@router.get("/gitea-workspace", response_class=HTMLResponse) +async def gitea_workspace_page(request: Request): + """Gitea workspace β€” browse repo files.""" + from jinja2 import Environment, FileSystemLoader + env = Environment(loader=FileSystemLoader("app/templates")) + sidebar = _sidebar_data(request, []) + user = SessionManager.decode_session(request.cookies.get("flowdeck_session", "")) + if not user: + return RedirectResponse("/auth/login?provider=local", status_code=302) + ctx = {**sidebar, "user": user} + template = env.get_template("gitea_workspace.html") + return template.render(**ctx) + + @router.get("/api/workspace/projects") async def list_workspace_projects(request: Request): """List all projects: built-in + Gitea + GitHub.""" diff --git a/app/routers/gitea.py b/app/routers/gitea.py index 835d1b5..efa7bc0 100644 --- a/app/routers/gitea.py +++ b/app/routers/gitea.py @@ -6,11 +6,12 @@ router = APIRouter(tags=["gitea"], prefix="/api/gitea") def _require_gitea(request: Request): - """Return a per-user GiteaClient or raise 401.""" - from app.services.gitea_client import get_user_gitea_client + """Return a per-user GiteaClient or fallback to admin token.""" + from app.services.gitea_client import get_user_gitea_client, GiteaClient client = get_user_gitea_client(request) if not client: - raise HTTPException(status_code=401, detail="Gitea account not linked. Login with Gitea or connect in Settings.") + # Fallback to server admin token + client = GiteaClient() return client diff --git a/app/templates/gitea_workspace.html b/app/templates/gitea_workspace.html new file mode 100644 index 0000000..2123ce3 --- /dev/null +++ b/app/templates/gitea_workspace.html @@ -0,0 +1,340 @@ +{% extends "base.html" %} +{% block page_title %}Gitea Workspace{% endblock %} +{% block page_icon %}πŸ”—{% endblock %} + +{% block topbar %} +
+ +
+ Home + +
+
+ + +
+
+{% endblock %} + +{% block content %} + + +
+ +
+
πŸ“ GITEA REPO
+ + +
Loading…
+ + + + + +
πŸ”’ PRIVATE PAGES
+
+ πŸ“ + My notes +
+
+ βž• + New page +
+
+ + +
+ + + + + + + + + + + +
+
+ + +{% endblock %} diff --git a/app/templates/workspaces.html b/app/templates/workspaces.html index 70d9c65..b486970 100644 --- a/app/templates/workspaces.html +++ b/app/templates/workspaces.html @@ -19,19 +19,33 @@ {% block content %}

🏠 Workspaces

-
-
-