Refactor caching logic and add support for a new feature
Some checks failed
🚨 Test Code Base / 🧹 Lint (push) Failing after 5m24s
🚨 Test Code Base / 🔍 🐹 Go Tests (push) Failing after 5m45s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Failing after 6m14s

This commit is contained in:
2026-01-21 21:08:26 -05:00
parent 838051c880
commit d321d96fef
6 changed files with 128 additions and 94 deletions

View File

@@ -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
}