Skip to content

fix(wallpapers): fail gracefully when the osu! API is unreachable - #3599

Open
ksh2177 wants to merge 1 commit into
end-4:mainfrom
ksh2177:fix/osu-graceful-failure
Open

fix(wallpapers): fail gracefully when the osu! API is unreachable#3599
ksh2177 wants to merge 1 commit into
end-4:mainfrom
ksh2177:fix/osu-graceful-failure

Conversation

@ksh2177

@ksh2177 ksh2177 commented Aug 20, 2026

Copy link
Copy Markdown

Describe your changes

Related to #3590. The seasonal-backgrounds endpoint currently answers with a Cloudflare HTML challenge page instead of JSON. The random osu! script had no guards, so a failure cascaded into a mess: jq parse error → division by zero → curl invoked with an empty URL → matugen and switchwall erroring on a nonexistent image file, leaving the wallpaper state broken.

The wall itself cannot be fixed client-side — no script can solve a JS challenge (I verified that even a same-origin fetch from a logged-in browser session on osu.ppy.sh gets the challenge page for this endpoint). What can be fixed is the failure mode: this PR makes it one clear notification and a clean exit, both for the API call and for the image download. It also sends a User-Agent and Accept: application/json, which costs nothing and helps whenever the protection relaxes.

Tested on Arch + Hyprland: with the endpoint walled, one notification, exit 1, no cascade; the rest of the script is untouched for the day the API answers again.

Is it ready? Questions/feedback needed?

Ready. If you'd rather swap the source for another seasonal wallpaper API instead, happy to rework — but graceful failure seems worth having regardless of the source.

The seasonal-backgrounds endpoint sits behind Cloudflare, which currently
answers with an HTML challenge page instead of JSON (end-4#3590). The script
had no guards, so a failure cascaded: jq parse error, division by zero,
curl invoked with an empty URL, then matugen and switchwall erroring on a
nonexistent image file.

The wall itself cannot be fixed client-side (no script can solve a JS
challenge - even a same-origin fetch from a logged-in browser session
gets the challenge page). This makes the failure mode sane meanwhile:
one notification and a clean exit, both for the API call and for the
image download.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant