You've already forked top-wallpaper
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
14999e412a
|
@@ -63,13 +63,16 @@ func Fetch(ctx context.Context) {
|
||||
|
||||
func doFetch(rc *redis.Redis, l echo.Logger, nsfw bool, size int) {
|
||||
val, err := rc.Get(rc.GetCacheKey(nsfw))
|
||||
|
||||
l.Info("Checking cache for Reddit image...", " nsfw=", nsfw)
|
||||
|
||||
if err != nil {
|
||||
l.Error("Error fetching from Redis: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
if val != "" {
|
||||
l.Info("Reddit image fetched from cache...")
|
||||
l.Info("Reddit image is in cache... skipping...")
|
||||
|
||||
return
|
||||
}
|
||||
@@ -79,8 +82,7 @@ func doFetch(rc *redis.Redis, l echo.Logger, nsfw bool, size int) {
|
||||
latestImageVal, err := GetLatestImage(func() (*http.Response, error) {
|
||||
|
||||
jsonUrl := wallpaperURL
|
||||
nsfwMode := os.Getenv("NSFW_MODE")
|
||||
if nsfwMode == "true" {
|
||||
if nsfw {
|
||||
jsonUrl = nsfwWallpaperURL
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user