Skip to content
Extraits de code Groupes Projets
Valider 804014f3 rédigé par Tulir Asokan's avatar Tulir Asokan
Parcourir les fichiers

Add cats to giphy proxy

parent 5da539ad
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"os" "os"
"regexp" "regexp"
"time"
"go.mau.fi/util/exerrors" "go.mau.fi/util/exerrors"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
...@@ -53,6 +54,13 @@ func main() { ...@@ -53,6 +54,13 @@ func main() {
} }
func getMedia(_ context.Context, id string) (response mediaproxy.GetMediaResponse, err error) { 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) { if !giphyIDRegex.MatchString(id) {
return nil, mediaproxy.ErrInvalidMediaIDSyntax return nil, mediaproxy.ErrInvalidMediaIDSyntax
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter