Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/backend/routers/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
- Serving markdown content
- Documentation index
"""
from fastapi import APIRouter, HTTPException
from fastapi import APIRouter, Depends, HTTPException
from fastapi.responses import FileResponse, JSONResponse
from pathlib import Path
import json

from models import User
from dependencies import get_current_user

router = APIRouter(prefix="/api/docs", tags=["Documentation"])

# Documentation directory - relative to trinity root
Expand All @@ -31,7 +34,7 @@ def get_docs_dir() -> Path:


@router.get("/index")
async def get_docs_index():
async def get_docs_index(current_user: User = Depends(get_current_user)):
"""Get documentation index/navigation structure."""
docs_dir = get_docs_dir()
if not docs_dir:
Expand All @@ -49,7 +52,10 @@ async def get_docs_index():


@router.get("/content/{slug:path}")
async def get_doc_content(slug: str):
async def get_doc_content(
slug: str,
current_user: User = Depends(get_current_user),
):
"""Get documentation content by slug (supports .md and .json files)."""
docs_dir = get_docs_dir()
if not docs_dir:
Expand Down Expand Up @@ -100,7 +106,7 @@ async def get_doc_content(slug: str):


@router.get("/list")
async def list_docs():
async def list_docs(current_user: User = Depends(get_current_user)):
"""List all available documentation files."""
docs_dir = get_docs_dir()
if not docs_dir:
Expand Down
Loading