Source code for dakweb.routers.information
# SPDX-License-Identifier: GPL-2.0-or-later
# © 2026, Ansgar 🙀 <ansgar@debian.org>
import datetime
from email.utils import format_datetime
from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException, Path, Response, status
from fastapi.responses import PlainTextResponse
from sqlalchemy import select
from sqlalchemy.orm import Session
from daklib.dbconn import Information
from dakweb.routers.deps import get_db
router = APIRouter()
[docs]
@router.get("/dinstall.status", response_class=PlainTextResponse)
def get_dinstall_status(response: Response, db: Session = Depends(get_db)) -> str:
return _get_information(response, db, Information.KEY_DINSTALL_STATUS)
[docs]
@router.get(
"/api/information/v1/mirrorstart/{archive}", response_class=PlainTextResponse
)
def get_mirrorstart(
archive: Annotated[str, Path(max_length=128, pattern=r"^[a-z0-9-]+$")],
response: Response,
db: Session = Depends(get_db),
) -> str:
return _get_information(response, db, f"mirrorstart.{archive}")
[docs]
@router.get("/api/information/v1/trace/{archive}", response_class=PlainTextResponse)
def get_trace(
archive: Annotated[str, Path(max_length=128, pattern=r"^[a-z0-9-]+$")],
response: Response,
db: Session = Depends(get_db),
) -> str:
return _get_information(response, db, f"trace.{archive}")