RepoPulse: update frontend/src and backend/app (+4 areas)
Public changes compared with the previous published export: 19 files changed. Affected areas: - backend/app: 3 files - dependencies: 2 files - documentation: 1 file - frontend: 2 files - frontend/src: 10 files - tests: 1 file Changed files: - Updated: "backend/app/acquisition.py" - Added: "backend/app/icons.py" - Updated: "backend/app/main.py" - Added: "backend/tests/test_icons.py" - Updated: "docs/ARCHITECTURE.md" - Updated: "frontend/package-lock.json" - Updated: "frontend/package.json" - Updated: "frontend/playwright.config.ts" - Updated: "frontend/src/App.tsx" - Updated: "frontend/src/components/DashboardView.tsx" - Added: "frontend/src/components/HealthRing.tsx" - Updated: "frontend/src/components/HistoryView.tsx" - Added: "frontend/src/components/Icon.tsx" - Updated: "frontend/src/components/PortfolioAtlas.tsx" - Updated: "frontend/src/components/RemediationCenter.tsx" - Added: "frontend/src/components/RepoAvatar.tsx" - Updated: "frontend/src/main.tsx" - Updated: "frontend/src/styles.css" - Updated: "frontend/vite.config.ts" Export provenance/manifests refreshed; excluded from the change summary. Publish curated RepoPulse source from 7a60c53ee2c1daebecd66a01656e323f1db72e56
This commit is contained in:
1 parent
d5ab22ddf1
commit
787a2b1dc3
21 files changed
+1543
-759
No files matched your search
@@ -18,6 +18,8 @@ from starlette.types import Scope
|
||||
|
||||
from .acquisition import GitAcquirer
|
||||
from .gitea import GiteaClient
|
||||
from .icons import SAFE_REVISION as SAFE_ICON_REVISION
|
||||
from .icons import ProjectIconResolver
|
||||
from .jobs import ScanJobRunner
|
||||
from .models import (
|
||||
RepositoryDetail,
|
||||
@@ -56,6 +58,7 @@ MAX_CONCURRENT_SCANS = 1
|
||||
SCAN_SLOTS = BoundedSemaphore(MAX_CONCURRENT_SCANS)
|
||||
gitea_client = GiteaClient()
|
||||
repository_acquirer = GitAcquirer()
|
||||
project_icons = ProjectIconResolver(repository_acquirer.mirrors_root)
|
||||
job_runner: ScanJobRunner | None = None
|
||||
_api_mutation_lock = Lock()
|
||||
_MAINTENANCE_ENTER_PATH = "/api/v1/operator/maintenance/enter"
|
||||
@@ -280,6 +283,30 @@ def get_repository(repository_id: str) -> RepositoryDetail:
|
||||
return repository
|
||||
|
||||
|
||||
ICON_HEADERS = {
|
||||
"Cache-Control": "public, max-age=86400",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
# Repository-supplied SVG is untrusted: never allow script, network or embedding.
|
||||
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox",
|
||||
"Cross-Origin-Resource-Policy": "same-origin",
|
||||
}
|
||||
|
||||
|
||||
@app.get("/api/v1/repositories/{repository_id}/icon")
|
||||
def repository_icon(repository_id: str, rev: str | None = Query(default=None, max_length=64)) -> Response:
|
||||
"""Serve the project's own favicon or logo from its mirror at the retained revision."""
|
||||
|
||||
repository = store.get_repository(repository_id)
|
||||
if repository is None:
|
||||
raise HTTPException(status_code=404, detail="Repository not found")
|
||||
known = {value.casefold() for value in (repository.last_scan_revision, repository.latest_revision) if value}
|
||||
revision = rev if rev and SAFE_ICON_REVISION.fullmatch(rev) and rev.casefold() in known else repository.last_scan_revision or repository.latest_revision
|
||||
icon = project_icons.resolve(repository_acquirer.mirror_path(repository), revision) if revision else None
|
||||
if icon is None:
|
||||
return Response(status_code=status.HTTP_404_NOT_FOUND, headers={"Cache-Control": "public, max-age=3600"})
|
||||
return Response(icon.content, media_type=icon.media_type, headers=ICON_HEADERS)
|
||||
|
||||
|
||||
@app.get("/api/v1/repositories/{repository_id}/scans", response_model=list[ScanSummary])
|
||||
def list_repository_scans(
|
||||
repository_id: str,
|
||||
|
||||
Reference in new issue
Block a user