feat(forge,core): fetch and decode authenticated images #65
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Inline images (#60) need the app to fetch images the forge serves behind a login, and to decode them safely. Nothing user-visible changes in this ticket.
Acceptance criteria
forge.AssetReader(optional capability,forge.ActAssets):OpenAsset(ctx, u *url.URL) (io.ReadCloser, error). The gitea adapter sendsAuthorization: tokenonly when scheme, host and port all match the session host; any other URL returnsforge.ErrUnsupportedbefore any I/O.forgetest.Fakeimplements it with an embedded demo PNG; the contract suite covers it.core.Service.Image(ctx, repo, raw)andPeekImage(repo, raw): resolverawagainst<host>/<owner>/<repo>/; refuse anything off-host with no I/O; 20s timeout; read at most 10 MiB; refuse over 40 MP viaimage.DecodeConfig; decode PNG, JPEG, GIF (first frame); downscale to at most 1600px on the longest side; share the existing concurrency semaphore.rrefresh clears it.docs/architecture.mdForge listing updated; ADR 0014 Consequences updated.Plan
Decided by Opus (design summary on #60). Files:
internal/forge/forge.go,internal/forge/gitea/,internal/forge/forgetest/,internal/core/(new image service file),docs/adr/0015-*.md.Context
/attachments/paths could not be tested live (no attachment on the host). Confirm against a recorded fixture; ForgejoSERVE_DIRECTredirects downloads to object storage, hence the redirect test.Out of scope
Terminal output (#66), markdown and details integration (later ticket), WebP, external hosts.
Refs #60
🤖 merged: #69