Support i.stack.imgur.com (#61)
This commit is contained in:
		
							parent
							
								
									b8d54dede6
								
							
						
					
					
						commit
						f1c058cbfc
					
				
							
								
								
									
										1
									
								
								main.go
								
								
								
								
							
							
						
						
									
										1
									
								
								main.go
								
								
								
								
							| 
						 | 
				
			
			@ -77,6 +77,7 @@ func main() {
 | 
			
		|||
	app.Get("/privacy", pages.HandlePrivacy)
 | 
			
		||||
	app.Get("/:postID.gifv", pages.HandleGifv)
 | 
			
		||||
	app.Get("/:baseName.:extension", pages.HandleMedia)
 | 
			
		||||
	app.Get("/stack/:baseName.:extension", pages.HandleMedia)
 | 
			
		||||
	app.Get("/:postID", pages.HandlePost)
 | 
			
		||||
	app.Get("/:postID/embed", pages.HandleEmbed)
 | 
			
		||||
	app.Get("/a/:postID", pages.HandlePost)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,8 +11,12 @@ import (
 | 
			
		|||
 | 
			
		||||
func HandleMedia(c *fiber.Ctx) error {
 | 
			
		||||
	c.Set("Cache-Control", "public,max-age=31557600")
 | 
			
		||||
	if strings.HasPrefix(c.Path(), "/stack") {
 | 
			
		||||
		return handleMedia(c, "https://i.stack.imgur.com/" + strings.ReplaceAll(c.Params("baseName"), "stack/", "") + "." + c.Params("extension"))
 | 
			
		||||
	} else {
 | 
			
		||||
		return handleMedia(c, "https://i.imgur.com/" + c.Params("baseName") + "." + c.Params("extension"))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func HandleUserCover(c *fiber.Ctx) error {
 | 
			
		||||
	c.Set("Cache-Control", "public,max-age=604800")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue