You've already forked top-wallpaper
Refactor caching logic and add support for a new feature
This commit is contained in:
@@ -54,9 +54,14 @@ type redditResponse struct {
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func GetLatestImage(httpGet func(url string) (*http.Response, error)) (string, error) {
|
||||
const (
|
||||
wallpaperURL = "https://www.reddit.com/r/wallpaper/.json"
|
||||
nsfwWallpaperURL = "https://www.reddit.com/r/NSFW_Wallpapers/.json"
|
||||
)
|
||||
|
||||
response, err := httpGet("https://www.reddit.com/r/wallpaper/.json")
|
||||
func GetLatestImage(httpGet func() (*http.Response, error)) (string, error) {
|
||||
|
||||
response, err := httpGet()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user