mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(archives): add {archive}.sha256 and construct archives in tmpdir
This change brings some new additions to our archives: - SHA-256 .sha256 hexdigests - We construct our archives in a tmpdir now and move them to the archive destination when all are completed. This removes some corrupted downloading when archiving is in-process. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
828847cfcd
commit
40a0e866e7
6 changed files with 135 additions and 61 deletions
|
@ -213,6 +213,19 @@ async def index(request: Request):
|
|||
return render_template(request, "index.html", context)
|
||||
|
||||
|
||||
@router.get("/{archive}.sha256")
|
||||
async def archive_sha256(request: Request, archive: str):
|
||||
archivedir = aurweb.config.get("mkpkglists", "archivedir")
|
||||
hashfile = os.path.join(archivedir, f"{archive}.sha256")
|
||||
if not os.path.exists(hashfile):
|
||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||
|
||||
with open(hashfile) as f:
|
||||
hash_value = f.read()
|
||||
headers = {"Content-Type": "text/plain"}
|
||||
return Response(hash_value, headers=headers)
|
||||
|
||||
|
||||
@router.get("/metrics")
|
||||
async def metrics(request: Request):
|
||||
registry = CollectorRegistry()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue