mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-05 13:41:36 +02:00
Since #2562, a Bambu Cloud sign-in flipped to "expired" and forced constant re-logins even while cloud features worked. #2562 made a 401 durably record the stored token as dead, but treated *any* 401 from any cloud/MakerWorld call as expiry. Bambu 401s for benign reasons (endpoint/region/scope refusals, Cloudflare edge, transient blips), so one stray 401 -- including from a background poll -- signed the whole cloud integration out until manual re-login. The flag lives in the DB, so a setup with more than one instance against the same database signed the user out across all of them. Invalidate only on Bambu's documented expiry body {"code":4,"error":"Please login."}. A plain/unparseable 401 is treated as transient: the request fails but the session stays signed in. validate_token maps a signature-less 401 to None (unknown), never expired. A shared is_expiry_401() gates both the Bambu Cloud and MakerWorld services (same token). Genuine expiry is still detected and surfaced exactly as before.