mirror of
				https://github.com/maunium/stickerpicker
				synced 2025-10-31 04:08:14 +00:00 
			
		
		
		
	Add cats to giphy proxy
This commit is contained in:
		
							parent
							
								
									5da539ad84
								
							
						
					
					
						commit
						804014f3b4
					
				| @ -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 | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user