feat(webui): add cached image proxy with configurable dir
Add disk-backed image proxy support to the web UI and expose it via `/api/image`. The proxy validates image URLs, fetches remote images with a timeout, stores image bytes + metadata in a local cache, and serves cached responses with proper content type and cache headers. Also add `SCRAPPR_IMAGE_CACHE` (default `.cache/webui-images`) and pass it through `cmd/outward-web` into `webui.Run`, with startup logging updated to include the cache location. This reduces repeated remote fetches and makes image delivery more reliable for the UI.feat(webui): add cached image proxy with configurable dir Add disk-backed image proxy support to the web UI and expose it via `/api/image`. The proxy validates image URLs, fetches remote images with a timeout, stores image bytes + metadata in a local cache, and serves cached responses with proper content type and cache headers. Also add `SCRAPPR_IMAGE_CACHE` (default `.cache/webui-images`) and pass it through `cmd/outward-web` into `webui.Run`, with startup logging updated to include the cache location. This reduces repeated remote fetches and makes image delivery more reliable for the UI.
This commit is contained in:
@@ -10,8 +10,9 @@ import (
|
||||
func main() {
|
||||
addr := envOrDefault("SCRAPPR_ADDR", ":8080")
|
||||
dataPath := envOrDefault("SCRAPPR_DATA", "outward_data.json")
|
||||
imageCacheDir := envOrDefault("SCRAPPR_IMAGE_CACHE", ".cache/webui-images")
|
||||
|
||||
if err := webui.Run(addr, dataPath); err != nil {
|
||||
if err := webui.Run(addr, dataPath, imageCacheDir); err != nil {
|
||||
logx.Eventf("error", "fatal: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user