Initial commit
This commit is contained in:
19
handlers/image.go
Normal file
19
handlers/image.go
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user