mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-06 16:10:06 +08:00
* fix(api): expose GET /api/v1/settings/ui without auth for pre-session language bootstrap The app shell bootstraps the interface language from GET /api/v1/settings/ui (added in #730), but auth pages (/register, /login) have no session, so the request hit the router-level _auth dependency and returned 401. The bootstrap silently bailed out and auth pages stayed English even with the persisted language set to zh (#760). Move the anonymous read to a public_router mounted before the gated settings router. The payload is non-sensitive UI preferences (theme/language) only; PUT /ui and every other settings endpoint remain auth/admin-gated. Adds regression tests: anonymous GET returns 200, and the gated router no longer carries GET /ui. Closes #760 * fix(api): narrow the public UI read to theme and language The endpoint was returning the whole saved `ui` blob to anonymous callers, which also carries sidebar_nav_order, enabled_optional_tools and chat_response_timeout — configuration that describes the deployment, not the visitor. Project it down to the two fields a page can actually need before it knows who is asking; the rest stays behind auth on GET /settings. Also fixes the gated-router assertion, which compared "GET" against a list of method *sets* and so would have passed even with GET /ui still mounted on the auth-gated router. --------- Co-authored-by: Huoran559 <huoran559@users.noreply.github.com> Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>