From 6cd3c7238bc69a69d669e3e735fca1e891d3132e Mon Sep 17 00:00:00 2001 From: DrMelone <27028174+Classic298@users.noreply.github.com> Date: Mon, 13 Apr 2026 00:40:36 +0200 Subject: [PATCH] fix: flush child form before modal save, guard localStorage parse, explicit dialect check - InterfaceDefaultsModal submitHandler now requestSubmits the embedded tab-interface form and awaits a Svelte tick before POSTing. That flushes submit-scoped writes in the InterfaceSettings component (updateInterfaceHandler -> saveSettings({ models, imageCompressionSize })) through the saveAdminSettings callback so they land in adminDefaults instead of being silently dropped on save. - +layout.svelte only reads localStorage.settings when the server didn't return user UI, and wraps the JSON.parse in try/catch with a {} fallback. A stale or hand-edited localStorage value would otherwise throw and abort the whole authenticated-load path even when valid userSettings came back from the backend. - users.py reset_all_users_interface_settings branches explicitly on postgresql and sqlite; any other dialect now responds 501 with a clear message naming the unsupported dialect. The previous "everything that isn't postgres runs SQLite-specific SQL" assumption would fail on MySQL/MariaDB with an opaque syntax error. --- backend/open_webui/routers/users.py | 20 +++++++++++++---- .../Interface/InterfaceDefaultsModal.svelte | 15 ++++++++++++- src/routes/+layout.svelte | 22 ++++++++++++++++++- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/backend/open_webui/routers/users.py b/backend/open_webui/routers/users.py index d07cdf745d..b3dc5a9991 100644 --- a/backend/open_webui/routers/users.py +++ b/backend/open_webui/routers/users.py @@ -701,6 +701,10 @@ async def reset_all_users_interface_settings( Clears the 'ui' key in all users' settings. Admin only. """ try: + # Match dialects explicitly. Falling through to SQLite-specific SQL + # (json_set / json_extract) for every non-postgres backend would + # silently fail on MySQL / MariaDB / other engines with an opaque + # syntax error instead of a clear "unsupported dialect" response. dialect = db.bind.dialect.name if dialect == 'postgresql': @@ -723,10 +727,10 @@ async def reset_all_users_interface_settings( ) result = await db.execute(stmt) reset_count = result.rowcount - else: - # SQLite: use native json_set (available since SQLite 3.9+). - # rowcount on the UPDATE result reflects the rows actually - # changed, so no follow-up SELECT changes() round-trip is needed. + elif dialect == 'sqlite': + # Native json_set is available since SQLite 3.9+. rowcount on the + # UPDATE result reflects the rows actually changed, so no + # follow-up SELECT changes() round-trip is needed. result = await db.execute( text( """ @@ -738,6 +742,14 @@ async def reset_all_users_interface_settings( ) ) reset_count = result.rowcount + else: + raise HTTPException( + status_code=status.HTTP_501_NOT_IMPLEMENTED, + detail=( + f"Resetting interface settings is not implemented for the '{dialect}' " + 'database dialect; supported dialects are postgresql and sqlite.' + ), + ) await db.commit() diff --git a/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte b/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte index 8c9f1dbf81..c853065bb4 100644 --- a/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte +++ b/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte @@ -1,6 +1,6 @@