Files
gh-christianlouis-docuelevate/app/views/share.py
T
copilot-swe-agent[bot] c4e10bee5e fix: adapt TemplateResponse calls to Starlette 1.0 new-style API
Starlette 1.0.0 changed TemplateResponse signature from
(name, context_dict) to (request, name, context=dict).

- Update base.py wrapper to convert old-style calls to new-style
- Update main.py error handler TemplateResponse calls
- Update local_auth.py, billing.py, auth.py, share.py calls
- Update test mocks for new calling convention

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/7b5f7e0d-89ad-43be-b68d-a9c0c5407a7e
2026-03-23 12:50:09 +00:00

30 lines
933 B
Python

"""Public view for accessing a shared document link.
This route does NOT require authentication — it is the landing page
that link recipients visit. The page fetches link metadata via the
public ``/api/share/{token}/info`` JSON endpoint and then renders the
appropriate download UI (password gate or direct download button).
"""
import logging
import pathlib
from fastapi import APIRouter, Request
from fastapi.templating import Jinja2Templates
logger = logging.getLogger(__name__)
router = APIRouter()
_templates_dir = pathlib.Path(__file__).parents[2] / "frontend" / "templates"
templates = Jinja2Templates(directory=str(_templates_dir))
@router.get("/share/{token}")
async def shared_link_view(request: Request, token: str):
"""Render the public share landing page for a given token."""
return templates.TemplateResponse(
request,
"shared_link_view.html",
context={"token": token},
)