From 804014f3b490192e90bf1dc9a60431d2310fc450 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 19 Jun 2024 12:02:39 +0300 Subject: [PATCH] Add cats to giphy proxy --- giphyproxy/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/giphyproxy/main.go b/giphyproxy/main.go index 279afcb..8954a46 100644 --- a/giphyproxy/main.go +++ b/giphyproxy/main.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "regexp" + "time" "go.mau.fi/util/exerrors" "gopkg.in/yaml.v3" @@ -53,6 +54,13 @@ func main() { } func getMedia(_ context.Context, id string) (response mediaproxy.GetMediaResponse, err error) { + // This is not related to giphy, but random cats are always fun + if id == "cat" { + return &mediaproxy.GetMediaResponseURL{ + URL: "https://cataas.com/cat", + ExpiresAt: time.Now(), + }, nil + } if !giphyIDRegex.MatchString(id) { return nil, mediaproxy.ErrInvalidMediaIDSyntax }