3be93be35a
- fix(api/dropbox): _require_admin bypasses auth when AUTH_ENABLED=False, fixing all 5 TestSaveDropboxSettings failures - fix(api/onedrive): same AUTH_ENABLED bypass in _require_admin; fix one-arg update_env_file call using env_utils version for token rotation - fix(auth): update login TemplateResponse to Starlette 1.0+ API (request as first arg instead of in context dict) - fix(api/local_auth): update all TemplateResponse calls to Starlette 1.0+ API - fix(views/share): update TemplateResponse call to Starlette 1.0+ API - fix(api/billing): update TemplateResponse call to Starlette 1.0+ API - fix(tests/test_imap_tasks): mock is_private_ip for tests using imap.example.com (unresolvable in sandboxed/CI environments) - fix(tests): update TemplateResponse call_args assertions to new API (call_args.kwargs['context'] instead of call_args[0][1]) - fix(tests): update fake_original signatures in dark_mode tests Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/52d7b7b7-3a71-4a96-b2b1-b675b8a6d3b4
30 lines
933 B
Python
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},
|
|
)
|