20 lines
377 B
Go
20 lines
377 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.sr.ht/~cwpearson/replicate-jump-server/store"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func ImageGet(c echo.Context) error {
|
|
id := c.Param("id")
|
|
|
|
image, exists := store.Get(id)
|
|
if !exists {
|
|
return echo.NewHTTPError(http.StatusNotFound, "Image not found or expired")
|
|
}
|
|
|
|
return c.Blob(http.StatusOK, image.ContentType, image.Data)
|
|
}
|