mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
[PR #1013] [MERGED] feat(cloud): support China region for token-based login #1151
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#1151
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/maziggy/bambuddy/pull/1013
Author: @Minidoracat
Created: 4/17/2026
Status: ✅ Merged
Merged: 4/18/2026
Merged by: @maziggy
Base:
dev← Head:feature/token-login-region-selector📝 Commits (4)
adfee88feat(cloud): support China region for token-based login97b6c6bMerge branch 'dev' into feature/token-login-region-selector40a70fefeat(cloud): persist region, drop singleton, fix login/verify parityeebda84feat(cloud): route-level region tests, status payload, shared http pool📊 Changes
12 files changed (+558 additions, -193 deletions)
View changed files
📝
backend/app/api/routes/cloud.py(+128 -102)📝
backend/app/api/routes/inventory.py(+34 -29)📝
backend/app/core/database.py(+1 -0)📝
backend/app/main.py(+17 -0)📝
backend/app/models/user.py(+2 -0)📝
backend/app/schemas/cloud.py(+8 -1)📝
backend/app/services/bambu_cloud.py(+41 -16)📝
backend/app/services/github_backup.py(+11 -11)📝
backend/tests/integration/test_cloud_auth.py(+222 -16)📝
backend/tests/unit/services/test_bambu_cloud.py(+55 -0)📝
frontend/src/api/client.ts(+5 -4)📝
frontend/src/pages/ProfilesPage.tsx(+34 -14)📄 Description
Description
The
/cloud/tokenendpoint previously always used the global Bambu APIendpoint, so users with China-region access tokens could not validate
their token. The password-login flow already exposes a region selector;
this brings the token-login flow to parity.
Related Issue
N/A — small enhancement mirroring the existing password-login region
option. Happy to open a tracking issue first if preferred.
Documentation
Companion docs PRs: not opened (see reason below)
Pick one:
the existing password-login control. No new concepts, config keys,
or endpoints. Happy to add a wiki note if maintainers prefer.
Type of Change
Changes Made
CloudTokenRequestgains aregionfield (default"global")bambu_cloudexposesreset_cloud_service(region)so thesingleton can be rebuilt against the requested region
/cloud/tokencallsreset_cloud_servicebeforeset_tokenso the China endpoint is used when selected
cloudSetTokenaccepts aregionargumentProfilesPagetoken-auth step now shows the sameGlobal / China region dropdown as the password-auth step
Screenshots
Testing
flow with Global and China regions)
Checklist
ruff check+ruff formatpass)tsc --noEmit+eslintpass)Additional Notes
Follow-up observation (out of scope for this PR, happy to file separately):
the
/cloud/loginhandler already acceptsCloudLoginRequest.regionfrom the schema and the frontend sends it, but the handler doesn't read
request.region— it just callsget_cloud_service(). So thepassword-login region selector is currently a UI-only affordance.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.