From 03cb98423b6bb3f4cbde638f222e24b6eb22f473 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Wed, 7 Oct 2026 16:24:30 +0200 Subject: [PATCH] Document and pin installed OpenWebUI Theme Designer Pro event function --- .../openwebui-theme-designer/INSTALLATION.md | 31 + integrations/openwebui-theme-designer/LICENSE | 21 + .../openwebui-theme-designer/README.md | 889 + .../openwebui-theme-designer/install.py | 64 + .../openwebui-theme-designer/manifest.json | 21 + .../theme_designer_pro_event.py | 15218 ++++++++++++++++ integrations/openwebui/README.md | 3 + 7 files changed, 16247 insertions(+) create mode 100644 integrations/openwebui-theme-designer/INSTALLATION.md create mode 100644 integrations/openwebui-theme-designer/LICENSE create mode 100644 integrations/openwebui-theme-designer/README.md create mode 100644 integrations/openwebui-theme-designer/install.py create mode 100644 integrations/openwebui-theme-designer/manifest.json create mode 100644 integrations/openwebui-theme-designer/theme_designer_pro_event.py diff --git a/integrations/openwebui-theme-designer/INSTALLATION.md b/integrations/openwebui-theme-designer/INSTALLATION.md new file mode 100644 index 0000000..6089435 --- /dev/null +++ b/integrations/openwebui-theme-designer/INSTALLATION.md @@ -0,0 +1,31 @@ +# Theme Designer Pro + +Installed on 2026-10-07 in the existing Unraid OpenWebUI container, version 0.11.4. + +- Upstream: https://github.com/silentoplayz/theme-designer-pro-presets +- Original Event Function version: 1.8.5; revision and SHA-256 checksums in `manifest.json`. +- Function ID: `theme_designer_pro`; type `event`; enabled centrally. +- Designer: http://192.168.1.2:8095/api/v1/theme-designer (administrator login required). +- `draft_mode_default=true`: preview changes before applying them. +- `enable_canvas_api_access=false`: no authentication-token access for canvas effects. +- Existing appearance retained; no preset applied during installation. + +No extra container, frontend rebuild, or custom frontend patch. The upstream function composes theme CSS and its loader through runtime routes. The frontend index hash remained unchanged during installation. + +## Persistence and restore + +Function source and valves are stored in `/app/backend/data/webui.db`. Theme files live under `/app/backend/data/theme/`. Both are in the existing persistent Unraid appdata volume `/mnt/user/appdata/open-webui`; include this directory in the OpenWebUI backup. This is an optional OpenWebUI integration, not a dependency of the native Athena Deck installation. + +Pre-install database backup: `/mnt/user/appdata/open-webui/plugin-backups/theme-20261007T142341Z/webui.db`. The backup also records the frontend index hash and copies an existing theme directory if present. Keep this database private: it contains application data and credentials. + +For a fresh OpenWebUI installation >=0.11.0, import the pinned `theme_designer_pro_event.py` as a Function, set the two valves above, then enable it. Alternatively run `install.py` inside OpenWebUI with this directory available and `PYTHONPATH=/app/backend`. It creates a database backup first and refuses to overwrite an existing function with this ID. No secrets are stored in this repository. + +Disable the Event Function in Administrator → Functions to turn off its theme integration. No Athena Deck restart is required. + +## Validation + +- Installed via normal authenticated Functions API; returned type `event`, active true. +- Authenticated designer request: HTTP 200, HTML response. +- Unauthenticated designer request: HTTP 401. +- Frontend `/app/build/index.html` SHA-256 unchanged. +- Browser rendering and applying a chosen theme remain user checks; no theme was selected automatically. diff --git a/integrations/openwebui-theme-designer/LICENSE b/integrations/openwebui-theme-designer/LICENSE new file mode 100644 index 0000000..79bee9c --- /dev/null +++ b/integrations/openwebui-theme-designer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 silentoplayz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/integrations/openwebui-theme-designer/README.md b/integrations/openwebui-theme-designer/README.md new file mode 100644 index 0000000..d91519a --- /dev/null +++ b/integrations/openwebui-theme-designer/README.md @@ -0,0 +1,889 @@ +# ⚡ Theme Designer Pro (Event Function) + +> Instance-wide theme designer for Open WebUI — standalone admin page with server-side persistence, SSE live push, draft mode, and real-time theme enforcement across all users. + +![Version](https://img.shields.io/badge/version-1.8.5-blue) +![License](https://img.shields.io/badge/license-MIT-green) +![Open WebUI](https://img.shields.io/badge/Open_WebUI-≥0.11.0-orange) +![Type](https://img.shields.io/badge/type-Event_Function-teal) + +--- + +> [!IMPORTANT] +> **Event Function vs. Tool — Which should you use?** +> +> Theme Designer Pro is available in two forms that target different audiences: +> +> | | **Event Function** (this file) | **Tool** | +> |---|---|---| +> | **Target audience** | Server administrators | Individual users | +> | **Storage** | Server-side file persistence (instance-wide) | Browser `localStorage` (per-user, per-browser) | +> | **Theme scope** | Global — applies to all users on the instance | Personal — only affects your own browser | +> | **Requires admin** | Yes | No | +> | **SSE live push** | Yes — all connected clients update in real-time | No | +> | **Draft mode** | Yes — preview before publishing | No | +> | **Community Themes browser** | Yes — curated themes with one-click install | No | +> | **Sidebar / overlay transparency** | Yes — admin-controlled visual style valves | No | +> | **Multi-worker support** | Yes — automatic Redis pub/sub for multi-worker SSE | No | +> | **AI-driven theming** | No | Yes (`apply_theme()` tool method) | +> | **Development status** | Actively developed | Maintenance mode | +> +> **Both versions share the same core functionality** — OKLCH palette engine, Canvas FX, gradient builder, custom CSS, and snapshot library. +> +> If you're an **admin** looking for instance-wide theming, this Event Function is for you. Add the optional **[Launcher Tool](../tools/theme_designer_pro_launcher.py)** companion to open the designer directly from chat. +> +> If you're a **regular user** who wants personal theme customization without admin access, use the **[Tool variant](../tools/)**. + +--- + +Theme Designer Pro (Event Function) is a professional-grade theming engine for Open WebUI. It registers a standalone admin page at a configurable URL (default: `/api/v1/theme-designer`), persists themes server-side, and pushes changes to all connected clients in real-time via Server-Sent Events. Powered by the modern OKLCH color space, it generates perceptually uniform color palettes across Dark, OLED, Light, and Her modes simultaneously. + +Unlike the [Tool variant](../tools/) which runs inside an AI chat iframe, this variant runs as a native ASGI route — no iframe sandbox flags needed, no "Same Origin" configuration required. + +--- + +## ✨ Key Features + +- ⚡ **Server-Side Persistence:** Themes are saved to `DATA_DIR/theme/` on the server and served through Open WebUI's shared static assets (`/static/loader.js` + `/static/custom.css`) — every user sees the same theme instantly, across all browsers and devices. Nothing is written to the frontend build. +- 📡 **Real-Time SSE Push:** When you save a theme, all connected Open WebUI clients receive the update in real-time via Server-Sent Events. No page refresh required. Multi-worker deployments are supported via automatic Redis pub/sub broadcasting. +- 📝 **Draft Mode:** Preview theme changes locally in your browser before publishing to all users. Draft mode isolates changes in `sessionStorage` — other users see nothing until you publish. The designer communicates with the bootloader via a `owui-theme-updated` CustomEvent for live preview without touching `localStorage`. Click **Publish** to push to all users, or discard to revert. +- 🌈 **OKLCH Color Engine:** Harness Tailwind v4's OKLCH color spaces. Adjust Hue, Chroma, and Lightness to generate mathematically perfect, accessible tonal ramps. Hit **✦ Randomize** to generate random base colors instantly, or **◎ Extract** to upload/paste an image and calculate dominant colors using hue-histogram analysis. Locked variables are protected from both. _(Pro-Tip: Double-click any slider label to instantly reset it to its default value)._ +- 🖥️☀️🌌🌙❤️ **Multi-Mode Design Engine:** Switch between System, Dark, OLED, Light, and the elusive Her mode design views using the segmented toggle. A unified OKLCH foundation ensures your colors look mathematically perfect across all environments. _(Note: The 'Her' tab dynamically reveals itself by syncing with your Open WebUI administrator's `enable_easter_eggs` configuration via the `/api/config` endpoint)._ +- 🌓 **True OS Integration & System Mode:** The System mode acts as a proxy, automatically swapping between your Light and Dark designs based on Operating System preference. The engine generates CSS utilizing native `@media (prefers-color-scheme)` blocks, guaranteeing custom styles, variables, and Canvas FX seamlessly adapt even if browser class management is delayed. +- 🔄 **Selective Cross-Mode Synchronization:** Instantly duplicate your setup from one mode to another using the "Sync" button. A powerful selective sync modal allows you to copy exactly what you need — OKLCH Palette, Variable Overrides, Custom CSS, Canvas FX, Gradient Background, or Auth Visibility — to any combination of target modes simultaneously. Colored delta badges show which settings differ between modes. +- 🔄 **Live Cross-UI Detection:** If you change the Open WebUI theme natively (via OS settings or keyboard shortcuts) while the designer is open, the designer instantly switches its internal tab to match your live environment. +- 🔑 **Auth Page Theming:** Selectively opt-in your custom theme components (Foundation Colors, Custom CSS, Canvas FX, and Gradient Background) to display on the Open WebUI Login and Signup screens. Each component has an independent "Show on Auth Pages" toggle. +- 🎇 **Canvas FX Animations (Web Worker Powered):** Inject interactive JavaScript animations directly into the background of Open WebUI. Animations run on a Background Web Worker via `OffscreenCanvas` for zero-lag performance, with an automatic main-thread fallback for browsers that don't support `OffscreenCanvas`. The structural transparency layer makes native UI panels see-through so animations show behind the interface. Drag & drop `.js` files anywhere on the UI to import animations instantly. +- 🔊 **Context-Aware Animations:** Canvas FX scripts can react to conversation data in real-time. A DOM observer scans chat messages for DOM-based token estimation (~2s debounce), while a Socket.IO WebSocket interceptor extracts exact token counts from `chat:completion` responses — both feed a `context` message to the animation for data-driven visual effects. External scripts can also dispatch custom context data via the `owui-canvas-context` CustomEvent API. +- 🎭 **Community Themes Browser:** Browse and install curated community themes directly from the Themes tab. The community themes grid fetches from the [preset gallery manifest](https://github.com/silentoplayz/theme-designer-pro-presets) and supports one-click install, install-all, and search. Controlled by the `enable_community_themes` valve. +- 🪟 **Sidebar & Overlay Transparency:** Admin-configurable transparency for the sidebar and overlay UI (settings modals, dropdowns). Choose between opaque (solid), translucent (frosted glass with backdrop-blur), or transparent modes via the `sidebar_transparency` and `overlay_transparency` valves. +- 👩‍💻 **IDE-Grade Custom CSS Editor:** Write raw CSS directly within the tool. The editor features Tab trapping (2-space indent), smart auto-indentation, auto-closing pairs (brackets, quotes, parentheses), and a synced line number gutter. Save your favorite tweaks to the built-in Custom CSS Preset Gallery. A bundled "Tactical HUD" CSS preset — designed to pair with the "Tactical Liquid Grid" Canvas FX animation — ships with every fresh install as a starter example. Includes a smart parser that safely extracts and hoists `@keyframes`! +- 🛡️ **Auto-Scoped CSS Injection:** Write Custom CSS without fear of breaking other modes. The Auto-Scope toggle automatically wraps your code in the correct CSS selectors (e.g., `.dark` or `[data-theme='light']`) to ensure tweaks only apply when they should. User CSS is automatically sanitized to prevent spoofing of internal `OWUI_*` marker comments used for auth-page stripping. +- 🎯 **Variable Overrides & Manual CSS Variables:** Hand-pick and override color variables with a native color picker — each swatch features an `Aa` contrast preview badge. Click directly on any variable name to instantly copy its CSS declaration (e.g., `--color-gray-800: #1a1a2e;`). The Manual Variable Overrides code editor lets you write raw CSS custom property declarations injected _after_ the generated palette for maximum priority. +- 🔒 **Smart Locking / Pinning:** Lock specific color variables using the 🔒 icon (or bulk "Lock All" / "Unlock All" buttons). Locked colors are pinned and protected from sliders, randomization, or image extraction. +- 📋 **Smart Clipboard Parsing & Image Extraction:** Upload an image or press `Ctrl+V` to paste one from your clipboard to calculate dominant colors. The tool also features a Smart JSON paste listener — paste a Theme Designer JSON configuration, and the tool will parse and prompt you to apply it (with a security warning if untrusted Canvas FX scripts are detected). +- 🎨 **Gradient Background Builder:** Design rich CSS gradient backgrounds using the dedicated Gradient tab. Choose between linear, radial, and mesh gradient types, add and position color stops visually, control direction and intensity, and enable smooth gradient animation with configurable speed. Ships with 12 built-in gradient presets — Midnight, Emerald, Amethyst, Sapphire, Aurora (animated), Sunset, Ocean, Neon, Nebula (mesh), Lagoon (mesh), Ember (mesh), and Arctic (mesh). Save, import, and export custom gradient presets. The gradient layer applies the same structural transparency rules as Canvas FX. + +- 📋 **Theme Metadata & Versioning:** Attach rich metadata when saving — Name, Description, Author, Theme Version, Target WebUI Version, Repository URL, and Theme Update URL. Metadata is embedded in exported `.json` files and preserved through imports. +- 🔄 **OTA Theme Update Checking:** Themes with a Theme Update URL can be checked for updates against a remote JSON endpoint. Use the per-snapshot ⟳ button or the global "Updates" header button to check all themes at once. Shows a detailed update modal with version comparison. +- 🌐 **Community Theme Import via URL:** Import themes directly from the web. The Import button opens a dual-mode dialog where you can paste a URL to a remote `theme.json` file, or use the classic file picker. Theme Designer Pro auto-converts `github.com` URLs to raw content. +- 📦 **JSON Viewer:** Inspect your current theme state at any time. The JSON Viewer modal displays your full configuration in a read-only, formatted code block with Copy, Collapse, and validity badge indicators. +- 📚 **Theme Library & Snapshots:** Save multiple "Snapshots" of your designs. Each snapshot captures your entire configuration (all modes, overrides, locks, manual variables, custom CSS, Canvas FX, and gradient background). Manage your library with inline Save, Import, Export, and Search buttons. +- 🔍 **Library Search, Filter & Sort:** Find saved themes using search, filter by feature tags (Custom CSS, Canvas FX, Overrides, Linked/URL themes), and sort alphabetically or by creation order. The same search and filter functionality is available in the CSS Snippet and Canvas Script galleries. Rich tooltips show name, version, author, description, and feature tags. +- 📦 **Mass Import, Export & Wipe Portability:** Download your entire snapshot library (or individual items) as smart backups. Mass-import via file picker, or drag & drop `.json`, `.js`, and `.css` files directly anywhere onto the designer window — files are automatically routed to the correct gallery (themes, canvas scripts, CSS snippets, or gradient presets). Each gallery has a "Trash" icon to wipe specific collections. Individual CSS files can also be imported and exported. +- ⏪ **Undo & Redo History:** Step backward and forward through changes using the built-in Undo/Redo footer buttons or `Ctrl+Z` / `Ctrl+Y` / `Ctrl+Shift+Z` keyboard shortcuts. Press `Escape` to close any open modal, or `Enter` to confirm the primary action. +- 📋 **CSS / Tailwind v4 Export:** The CSS Output tab provides Raw CSS and Tailwind v4 `@theme` block views, each with Minify toggle, Copy to Clipboard, and Download as `.css` file. +- 👁️‍🗨️ **Self-Adapting UI & Contrast Protection:** The designer interface dynamically themes _itself_ based on the colors you pick. Built-in contrast protection shifts text and border colors to remain legible with ultra-washed-out palettes. +- 🪄 **Native Open WebUI Aesthetic:** Meticulously designed to feel like a native part of Open WebUI, complete with custom-built, dependency-free tooltips and styled code blocks. +- 📱 **Fully Responsive:** The designer adapts to mobile screens with three responsive breakpoints (≤768px tablets, ≤480px phones, ≤390px iPhone SE) including icon-only mode for narrow header buttons. +- 💾 **Session Persistence:** The designer remembers which tab you were on via `sessionStorage`, so refreshing the page returns you to exactly where you left off. +- ⏪ **Legacy Data Migration:** Automatically detects legacy data structures and gracefully migrates saved snapshots and active themes to the latest format without data loss. +- 🔌 **Function Lifecycle Integration:** Toggling the function OFF in the admin panel triggers a clean `function.disable_started` lifecycle event that withdraws the theme CSS from the shared `custom.css`, broadcasts `theme-disable` to all connected clients, and clears `localStorage` — no page refresh needed. The loader fragment stays published in an inactive state so its SSE connection survives. Toggling back ON triggers `function.enable_started`, which republishes and broadcasts the theme to all clients immediately. Requires Open WebUI v0.11.0 or newer (pre-toggle lifecycle events). +- ☢️ **Safe Nuclear & Factory Resets:** "Reset Mode" and "Global Reset" buttons safely clear all custom styling and restore Open WebUI to its original look. Confirmation dialogs offer pre-wipe backups. Factory Reset under the Documentation tab's Danger Zone permanently wipes all data. + +--- + +## 🎭 Preset Gallery + +A curated community collection of ready-to-import presets is available at: + +**🔗 [github.com/silentoplayz/theme-designer-pro-presets](https://github.com/silentoplayz/theme-designer-pro-presets)** + +### Quick Import + +**Import everything at once** — paste this URL into any Import modal and click **Load URL**: + +``` +https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/everything.json +``` + +Or import individual categories: + +| Bundle | URL | +|---|---| +| All Canvas FX | `https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/canvas-fx-all.json` | +| All CSS Presets | `https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/css-presets-all.json` | +| All Themes | `https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/themes-all.json` | +| All Gradients | `https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/gradients-all.json` | + +You can also import individual presets by pasting any file's GitHub URL directly — Theme Designer Pro auto-converts `github.com` URLs to raw content. + +--- + +## 🚀 Installation + +1. Open your Open WebUI **Admin Panel** +2. Go to **Functions** +3. Click **Create New Function** +4. Set the Type to **Event** (not Tool, not Filter) +5. Copy the contents of [`theme_designer_pro_event.py`](theme_designer_pro_event.py) and paste it in +6. Save — the designer is now available at `/api/v1/theme-designer` + +> **No sandbox flags required.** Unlike the Tool variant, this event function serves a native page via ASGI routes — no iframe, no "Same Origin" configuration needed. + +> [!WARNING] +> **Running behind nginx or another reverse proxy?** You **must** add `proxy_buffering off;` to your nginx location block (or the equivalent for your proxy). Without this, SSE live push events are silently buffered and themes will only appear on the admin's browser — other users and devices will see no changes. This is the **#1 deployment issue**. See the in-app documentation (📖 Docs → Section 17: Reverse Proxy Configuration) for nginx, Caddy, Apache, and Traefik examples. + +### Optional: Launcher Companion Tool + +The [Launcher Tool](../tools/theme_designer_pro_launcher.py) is a lightweight companion that opens the designer page directly inside an Open WebUI chat via iframe — no need to navigate to the URL manually. + +1. Go to **Workspace** > **Tools** > **Create New Tool** +2. Copy the contents of [`theme_designer_pro_launcher.py`](../tools/theme_designer_pro_launcher.py) and paste it in +3. Save — now you can ask your AI: _"Open Theme Designer Pro"_ and it renders inside the chat + +> **Note:** The Launcher Tool requires the Event Function to be installed and running. It has its own `designer_url` valve that must match the Event Function's `designer_url` valve. + +--- + +## 🛠️ Usage Instructions + +1. **Navigate to the Designer:** Open your browser and go to your Open WebUI instance's designer URL (default: `/api/v1/theme-designer`) +2. **Design your Theme:** + - Use the **Segmented Toggle** to switch between System, Dark, OLED, Light, and Her mode design views + - Use the **Themes** tab to browse, install, and manage community themes and saved snapshots + - Use the sliders on the **Core Palette** tab to adjust your foundation colors, override individual color variables, and lock specific shades + - Hover and click over the **Tonal Ramp** to quickly copy mathematically generated HEX values + - Switch to the **Style Overrides** tab to write raw CSS tweaks + - Switch to the **Canvas FX** tab to inject interactive JavaScript background animations + - Switch to the **Gradient** tab to design gradient backgrounds using the visual builder + - Use the **JSON** header button to inspect or copy your full theme state + - Use the **Updates** header button to check all your themes for available updates +3. **Draft vs. Live:** Toggle the **Draft** button in the header to preview changes locally before publishing. While in Draft mode, only your browser sees the changes. Click **Publish** to push to all users. +4. **All changes auto-save.** Every change is debounced (250ms) and automatically persisted server-side via `syncToServer()`, then broadcast to all connected clients. In Draft mode, `syncToServer()` is gated off — changes are previewed locally only. + +**Pro-Tip for Custom CSS:** Not sure what to target? Press `F12` (or right-click > Inspect) to open your browser's Developer Tools. Use the element picker to find the exact class names used by Open WebUI (e.g., `.chat-bubble` or `#sidebar`). + +--- + +## 🎨 Custom CSS: Changing Fonts + +You can change the global font family for your entire Open WebUI instance by pasting a CSS rule into the **Style Overrides** tab. + +Set the font on the document root and the form controls, then let it **inherit** down — form elements (`input`, `textarea`, `button`, `select`) are listed explicitly because they don't inherit `font-family` by default. Avoid painting the font onto the universal selector `*`: it clobbers icon fonts and code/math spans. + +**1. The "Native OS" Vibe** (Uses San Francisco on Mac, Segoe on Windows) + +```css +html, +body, +input, +textarea, +button, +select { + font-family: + -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, sans-serif !important; + letter-spacing: -0.01em !important; +} +``` + +**2. The "Hacker Terminal" Vibe** (Forces monospace coding fonts) + +```css +html, +body, +input, +textarea, +button, +select { + font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace !important; +} +``` + +**3. The "Editorial" Vibe** (Clean, highly readable Serif font) + +```css +html, +body, +input, +textarea, +button, +select { + font-family: 'Georgia', 'Cambria', 'Times New Roman', serif !important; + line-height: 1.65 !important; +} +``` + +_Paste one of these into the Style Overrides editor for your desired mode, ensure "Enabled" is checked, and watch the UI font transform instantly!_ + +--- + +## 🔧 Valve Configuration + +Valves are configured in the Admin Panel under **Functions → Theme Designer Pro → ⚙️**. + +#### 🎛️ Feature Toggles + +| Valve | Type | Default | Description | +|---|---|---|---| +| **Enable Canvas FX** | `bool` | `true` | Allow Canvas FX (JavaScript background animations). When disabled, the Canvas FX tab is hidden and running animations are suppressed — canvas data is stripped from the saved state and a canvas-stripped update is broadcast. | +| **Enable Custom CSS** | `bool` | `true` | Allow the Style Overrides (custom CSS) editor. When disabled, the Style Overrides tab is hidden in the designer UI. | +| **Enable Gradient Builder** | `bool` | `true` | Allow the Gradient Background builder. When disabled, the Gradient tab is hidden in the designer UI. | +| **Enable Community Themes** | `bool` | `true` | Show the Community Themes browser in the Themes tab. When disabled, the community themes grid is hidden and no manifest is fetched. | + +#### 🖌️ UX Policy + +| Valve | Type | Default | Description | +|---|---|---|---| +| **Enable Auth Page Theming** | `bool` | `true` | Allow theming the login/signup pages. When disabled, all "Show on Auth Pages" toggles are hidden and forced off. | +| **Draft Mode Default** | `bool` | `false` | Open the designer in Draft mode by default. When enabled, the designer starts in Draft mode on every fresh page load, preventing accidental live changes. | +| **Auto Sync** | `bool` | `false` | Skip the Selective Sync modal when loading presets or syncing. When enabled, a "Sync All" toggle appears in the designer footer — turn it on to propagate changes to all modes, or leave it off to apply only to the active mode. | + +#### 🎨 Visual Style + +| Valve | Type | Default | Description | +|---|---|---|---| +| **Sidebar Transparency** | `Literal` | `"opaque"` | Controls sidebar background style. `"opaque"` (default) — solid background for best readability. `"translucent"` — frosted glass effect (backdrop-blur) that lets backgrounds show through. `"transparent"` — fully see-through sidebar with no blur (automatically uses translucent on mobile for readability). | +| **Overlay Transparency** | `Literal` | `"opaque"` | Controls overlay UI (settings modal, dropdowns, integration menus) background style. `"opaque"` (default) — solid background for best readability. `"translucent"` — frosted glass effect (backdrop-blur) that lets backgrounds show through. | + +#### 🔒 Security + +| Valve | Type | Default | Description | +|---|---|---|---| +| **Enable Canvas API Access** | `bool` | `false` | ⚠️ Gives every Canvas FX script **each viewer's own auth token**, not just yours. Canvas FX scripts run on every user's page, so a script can call the API as whoever is viewing. Scripts referencing `document` run on the main thread, outside a Worker's isolation, and an installed theme can replace its script later via its update URL — enabling this trusts every theme author on an ongoing basis. Only enable if you wrote or audited every installed script. When disabled (default), `env.authToken` is an empty string and everything else works. | +| **Enable URL Import** | `bool` | `true` | Allow importing themes, CSS snippets, and canvas scripts from remote URLs. When disabled, all URL import buttons are hidden. | +| **Allowed Import Domains** | `str` | `""` | Comma-separated allowlist of domains for URL imports (e.g., `raw.githubusercontent.com, openwebui.com`). Empty = allow all. Only applies when Enable URL Import is `true`. | + +#### 🛠️ Advanced + +| Valve | Type | Default | Description | +|---|---|---|---| +| **Designer URL** | `str` | `/api/v1/theme-designer` | URL path where the designer and all its sub-routes are served. Must start with `/api/v1/` — paths outside this prefix are auto-corrected to prevent the SPA catch-all from intercepting the route (a warning is logged). Changing this value triggers a route re-registration; the loader fragment picks up the new URL on its next compose. | + +> **Note:** All Valves default to their most permissive values — the event function behaves identically to an un-valved installation out of the box. Admins only need to configure Valves if they want to restrict specific features. + +> [!IMPORTANT] +> Most valve changes take effect on the **next `event()` call** (i.e., any chat message or function event). Saving valve values alone doesn't trigger re-injection — it happens the next time the event function runs. The exception is the function **ON/OFF toggle** in the admin panel, which triggers `function.disable_started`/`function.enable_started` lifecycle events that take effect immediately (on Open WebUI v0.11.0 or newer). + +--- + +## 📖 In-App Documentation + +The designer includes **22 comprehensive documentation sections** accessible via the **📖 Docs** button in the header. These cover: + +1. Getting Started & Architecture +2. OKLCH Foundation & Modes +3. System Theme & OS Integration +4. Draft Mode & Publishing +5. Variable Overrides & Locks +6. Custom CSS & Auto-Scoping +7. Canvas FX Animations (incl. Worker Protocol & API contract) +8. Advanced Tools & Image Extraction +9. Libraries & Data Management +10. Theme Updates (OTA) +11. Reference: Available Variables +12. Gradient Backgrounds (incl. preset table) +13. Structural Transparency & Layer Stack +14. Keyboard Shortcuts & Editor Tips +15. Compliance & Legal Disclaimer +16. Community Presets (with import URLs) +17. Reverse Proxy Configuration +17b. Multi-Worker Deployments +18. Troubleshooting & FAQ +19. Uninstallation & Complete Removal +20. Portability & Backups +21. Danger Zone (Factory Reset) + +--- + +## 🚀 How It Works (Under the Hood) + +Theme Designer Pro persists themes on the server and pushes changes to every connected client. Unlike the Tool variant, which operates through an iframe and browser `localStorage`, the Event Function publishes into Open WebUI's two admin-extensible static assets and composes them per request. + +> **Changed in 1.7.0.** Earlier versions wrote a bootloader and a `'), + (''), + ] + for start_marker, end_marker in markers: + while start_marker in content: + start = content.find(start_marker) + end = content.find(end_marker, start) + if end == -1: + break + end += len(end_marker) + if end < len(content) and content[end] == "\n": + end += 1 + content = content[:start] + content[end:] + return content + + # Cached result of _find_index_file() — index.html path never changes at runtime + _cached_index_path = None + + def _find_index_file(self): + """Find the frontend index.html served by SPAStaticFiles.""" + if Event._cached_index_path is not None: + return Event._cached_index_path + + try: + from open_webui.env import FRONTEND_BUILD_DIR + + idx = Path(FRONTEND_BUILD_DIR) / "index.html" + if idx.exists(): + Event._cached_index_path = str(idx) + return Event._cached_index_path + except ImportError: + pass + + # Fallback: guess common paths + fallbacks = [ + "/app/backend/open_webui/frontend/index.html", + "/app/build/index.html", + "../build/index.html", + "./build/index.html", + ] + for path in fallbacks: + if os.path.exists(path): + Event._cached_index_path = path + return Event._cached_index_path + return None + + # File-based lock to serialize all index.html read-modify-write operations + # across processes/workers. threading.Lock only protects within a single process, + # but Open WebUI fires event() from multiple concurrent contexts during startup. + _index_lock_path = None # Set lazily on first use + + @classmethod + def _get_index_lock(cls): + """Return a context manager that acquires an exclusive file lock.""" + import fcntl + from contextlib import contextmanager + + @contextmanager + def _flock(): + if cls._index_lock_path is None: + try: + from open_webui.env import DATA_DIR + cls._index_lock_path = Path(DATA_DIR) / "theme" / ".index.lock" + except ImportError: + cls._index_lock_path = Path("/tmp/.owui_index.lock") + cls._index_lock_path.parent.mkdir(parents=True, exist_ok=True) + fd = open(cls._index_lock_path, "w") + try: + fcntl.flock(fd, fcntl.LOCK_EX) + yield + finally: + fcntl.flock(fd, fcntl.LOCK_UN) + fd.close() + + return _flock() + + @staticmethod + def _atomic_write(path, content): + """Atomically write content to path via tempfile + os.replace.""" + import tempfile as _tmpf + _fd, _tmp = _tmpf.mkstemp(dir=os.path.dirname(path), suffix='.tmp') + try: + with os.fdopen(_fd, 'w', encoding='utf-8') as f: + f.write(content) + os.replace(_tmp, path) + except BaseException: + try: os.unlink(_tmp) + except OSError: pass + raise + + # -- shared static-asset fragments --------------------------------------- + + # Marker pairs wrapping this plugin's block inside each composed asset, so + # asset_compose can strip a previous build's block before re-appending. + LOADER_BLOCK_START = "// owui-theme-designer-pro:start" + LOADER_BLOCK_END = "// owui-theme-designer-pro:end" + CSS_BLOCK_START = "/* owui-theme-designer-pro:start */" + CSS_BLOCK_END = "/* owui-theme-designer-pro:end */" + + # Fixed literal, never derived from a build/function id — the shared-asset + # contract requires a stable key, because a key that changes per re-exec + # registers a SECOND entry and the output is emitted twice. + ASSET_KEY = "theme-designer-pro" + + # asset_compose sorts fragments by (order, key); higher composes last. On + # custom.css that is the CSS cascade between plugins, and this plugin's + # custom-CSS section is documented as last = highest priority (Section 13), + # so it claims a high order explicitly rather than relying on where + # "theme-designer-pro" happens to fall alphabetically. On loader.js the + # same value makes this bootloader the outermost wrapper. + ASSET_ORDER = 100 + + @staticmethod + def _strip_canvas_scripts(state_str: str) -> str: + """Drop only the canvasScript bodies from a delivered state JSON string. + + Measured on the largest Canvas FX script in the presets repo across four + modes, the scripts are 93% of the inlined state (129 KB of 139 KB) and + would make the loader fragment ~205 KB. asset_compose rebuilds and + md5-hashes the entire composed body on EVERY request — the ETag is + compared only after the producer has already run, so a 304 revalidation + costs almost exactly as much server CPU as a 200 (measured: 3.87 ms vs + 4.08 ms per request). Inlining the scripts would therefore charge every + page load of every user for a background animation that nobody can + perceive starting one round trip later. + + Nothing flash-sensitive is lost. enforceTheme() reads CSS, not state, + and that CSS arrives via the render-blocking /static/custom.css. + _cssSections stays inlined (9 KB) because the auth page assembles its + CSS from it before the fetch lands. initCanvas() simply finds no script + on its first pass and starts the canvas when /state.json arrives. + """ + try: + data = _json.loads(state_str) + if not isinstance(data, dict): + return state_str + stripped = False + for config in data.values(): + # _cssSections is a sibling of the mode dicts and has no + # canvasScript, so it falls through untouched. + if isinstance(config, dict) and config.get("canvasScript"): + config.pop("canvasScript", None) + stripped = True + if not stripped: + return state_str + return _json.dumps(data, separators=(",", ":")) + except Exception: + return state_str # Unparseable state is served as-is by design + + _bootloader_body_cache = None + + @classmethod + def _bootloader_body(cls) -> str: + """BOOTLOADER_SCRIPT with its HTML comment + \s*$", + "", + cls.BOOTLOADER_SCRIPT.strip(), + flags=_re.DOTALL, + ) + return cls._bootloader_body_cache + + def _loader_fragment(self, active: bool) -> str: + """Producer for the /static/loader.js fragment. + + Runs inside the request handler on every page load, so the whole result + is memoised and the steady state is a tuple compare. The two stat()s + behind _get_state_delivery are the only syscalls; its ETag stands in for + the state and sections mtimes plus the valves that affect delivery. + + Stays published while the function is disabled, with __THEME_ACTIVE__ + false: the bootloader strips the theme from a fresh load but keeps the + SSE connection, which is how a later re-enable reaches open tabs. The + CSS fragment is what goes empty on disable. + """ + delivery = self._get_state_delivery() if active else None + cache_key = ( + active, + self._get_route_base(), + self.valves.enable_canvas_api_access, + delivery[1] if delivery else None, # state delivery ETag + ) + cached = Event._loader_fragment_cache + if cached and cached[0] == cache_key: + return cached[1] + + js = self._bootloader_body().replace( + "__THEME_ROUTE__", cache_key[1] + ).replace( + "__CANVAS_API_ACCESS__", + "true" if self.valves.enable_canvas_api_access else "false", + ).replace( + "__THEME_ACTIVE__", + "true" if active else "false", + ) + + # State inlined as a JS string literal, minus the canvas scripts. Was a + # + + + +""" + + # Same substitutions as _loader_fragment, minus the embedded state: + # the designer page manages its own state directly (the bootloader's + # fetch/state path is gated on !window.__THEME_DESIGNER__), so the + # placeholder resolves to null rather than shipping a second copy. + route_base = self._get_route_base() + bootloader_js = self._bootloader_body().replace( + "__THEME_ROUTE__", route_base + ).replace( + "__CANVAS_API_ACCESS__", + "true" if self.valves.enable_canvas_api_access else "false", + ).replace( + "__THEME_ACTIVE__", + "true", + ).replace( + "__EMBEDDED_STATE__", + "null", + ) + + valve_config = { + "enableCanvasFx": self.valves.enable_canvas_fx, + "enableCanvasApiAccess": self.valves.enable_canvas_api_access, + "enableUrlImport": self.valves.enable_url_import, + "allowedImportDomains": [ + d.strip() + for d in self.valves.allowed_import_domains.split(",") + if d.strip() + ], + "enableCustomCss": self.valves.enable_custom_css, + "enableAuthPageTheming": self.valves.enable_auth_page_theming, + "enableGradientBuilder": self.valves.enable_gradient_builder, + "enableCommunityThemes": self.valves.enable_community_themes, + "draftModeDefault": self.valves.draft_mode_default, + "autoSync": self.valves.auto_sync, + "sidebarTransparency": self.valves.sidebar_transparency, + "overlayTransparency": self.valves.overlay_transparency, + } + safe_config = _json.dumps(valve_config).replace("' + f"window.__THEME_PRO_CONFIG__={safe_config};" + f"window.__THEME_PRO_SAVED_STATE__={safe_saved_state};" + "" + ) + + + + # --- Generate templated HTML fragments --- + def _metadata_grid(prefix, fields): + """Generate a metadata-grid with the given ID prefix.""" + html = '
\n' + for fid, label, placeholder, full_width in fields: + style = ' style="grid-column: 1 / -1;"' if full_width else '' + html += f'
\n' + html += f' \n' + html += f' \n' + html += '
\n' + html += '
' + return html + + # Shared field definitions (fid_suffix, label, placeholder, full_width) + _shared_meta = [ + ('desc-input', 'Description', 'A short description', False), + ('author-input', 'Author', 'Your name', False), + ('version-input', 'Theme Version', '1.0.0', False), + ('target-input', 'Target WebUI Version', '0.9.0', False), + ('repo-input', 'Repository URL', 'https://github.com/...', False), + ('update-input', 'Theme Update URL', 'https://...', True), + ] + save_meta = _metadata_grid('theme', [ + ('name-input', 'Name', 'My Custom Theme', False), + ] + _shared_meta) + rename_meta = _metadata_grid('rename', [ + ('input', 'Name', 'Theme Name', False), + ] + _shared_meta) + + # Sync option blocks + _sync_opts = [ + ('palette', 'OKLCH Palette', 'L, C, H base color values'), + ('overrides', 'Variable Overrides', 'Manual 50-950 ramp steps & locks'), + ('css', 'Custom CSS Snippet', 'All raw styles from Custom CSS tab'), + ('canvas', 'Canvas FX Script', 'Background animation code & state'), + ('gradient', 'Gradient Background', 'Color stops, direction, type & animation'), + ('auth', 'Auth Page Visibility', "'Show on Auth Pages' toggles for all tabs"), + ] + sync_html = '\n\n'.join( + f'
\n' + f' \n' + f' \n' + f' \n' + f'
\n' + f' ' + for key, label, desc in _sync_opts + ) + + # JSON editor modals + def _json_modal(modal_id, lang_label, textarea_id, readonly, badge_id, + collapse_id, close_id, close_tooltip, buttons=None): + ro = ' readonly' if readonly else '' + html = ( + f' ' + return html + + json_modals = '\n\n'.join([ + _json_modal('json-view-modal', 'json', 'json-view-textarea', True, + 'json-valid-badge', 'json-collapse-btn', 'json-close-btn', 'Close JSON Viewer'), + _json_modal('snapshot-json-edit-modal', 'json \u2014 Manual Snapshot Editor', 'snapshot-json-edit-textarea', False, + 'snapshot-json-valid-badge', 'snapshot-json-collapse-btn', 'snapshot-json-cancel-btn', 'Close without saving', + [('snapshot-json-discard-btn', 'Cancel', 'btn'), ('snapshot-json-save-btn', 'Save Changes', 'btn btn-primary')]), + _json_modal('save-json-edit-modal', 'json \u2014 New Theme Editor', 'save-json-edit-textarea', False, + 'save-json-valid-badge', 'save-json-collapse-btn', 'save-json-cancel-btn', 'Close without saving', + [('save-json-discard-btn', 'Cancel', 'btn'), ('save-json-save-btn', 'Save as New Theme', 'btn btn-primary')]), + ]) + + final_html = ( + html_content.replace("{VERSION}", VERSION) + .replace("{BOOTLOADER_SRC}", bootloader_js) + .replace("{ROUTE_BASE}", route_base) + .replace("{SAVE_METADATA_GRID}", save_meta) + .replace("{RENAME_METADATA_GRID}", rename_meta) + .replace("{SYNC_OPTIONS}", sync_html) + .replace("{JSON_EDITOR_MODALS}", json_modals) + .replace("", config_tag + "") + .strip() + ) + + return final_html + + # -- entry point --------------------------------------------------------- + + _published = False # Set once the shared-asset fragments are published in this process + # Delivery caches for /theme.css and /state.json: (cache_key, body, etag). + # Keyed on source-file mtimes + valve settings, so saves and valve changes + # invalidate naturally; per-process (each worker warms its own copy). + _css_delivery_cache = None + _state_delivery_cache = None + _safe_css_cache = None # (cache_key, css) for the first-paint-safe subset + _loader_fragment_cache = None # (cache_key, fragment) for the composed loader.js block + _reenabling = False # Set by function.enable_started; triggers SSE broadcast on next inject + _routes_registered_url = None # Route base the routes were registered under + _last_designer_url = None # Track URL changes to re-register routes + _last_enable_canvas_fx = None # Track Canvas FX valve to broadcast changes + _last_sidebar_transparency = None # Track sidebar transparency valve to broadcast changes + _last_overlay_transparency = None # Track overlay transparency valve to broadcast changes + # Cross-worker valve convergence (multi-container / Redis only). + instance = None # Live instance the producers and peer valve sync read + _last_valves_snapshot = None # All valve values at the last event(), to detect ANY change + _sse_clients: set = ( + set() + ) # Active SSE connections — aliased to app.state in _register_route() + # Per-worker ceiling on concurrent SSE connections. The endpoint is + # unauthenticated, so this bounds worst-case memory/FD usage; over-cap + # clients degrade gracefully to reconnect-later + refetch-on-focus. + _SSE_MAX_CLIENTS = 8192 + # Tags this process's own Redis messages so its subscriber skips them. The + # PID alone repeats across containers, where the server is often PID 1. + _WORKER_ID = f"{socket.gethostname()}:{os.getpid()}" + + @staticmethod + def _strip_canvas_from_state(state_str: str) -> str: + """Strip canvasEnabled/canvasScript/canvasShowAuth from state JSON. + + Used to enforce the Enable Canvas FX valve at the delivery layer + without modifying the saved state on disk (preserves user presets). + """ + try: + data = _json.loads(state_str) + for mode in ("dark", "oled", "light", "her"): + if isinstance(data.get(mode), dict): + data[mode]["canvasEnabled"] = False + data[mode].pop("canvasScript", None) + data[mode].pop("canvasShowAuth", None) + return _json.dumps(data, separators=(",", ":")) + except Exception: + return state_str + + @classmethod + def _apply_sidebar_transparency(cls, css: str, mode: str) -> str: + """Post-process flat CSS for the sidebar transparency valve. + + Composition of the per-rule rewrite (safe to run on individual + sections) and the appended mobile-upgrade block (must be added + exactly once, at the end of the delivered CSS). + """ + css = cls._rewrite_sidebar_fx(css, mode) + if mode == "transparent": + css += cls._sidebar_mobile_css() + return css + + @staticmethod + def _rewrite_sidebar_fx(css: str, mode: str) -> str: + """Rewrite opaque /*[FX]*/ sidebar rules for the transparency valve. + + mode='translucent': tinted glass (semi-transparent bg + backdrop-blur) + mode='transparent': fully see-through (transparent bg, no blur) + + Only affects sidebar rules marked with /*[FX]*/ (canvas/gradient blocks). + Plain-mode sidebar rules (no marker) are left untouched. Operates on + individual rules, so it can be applied to the flat CSS or to the + structural/gradient sections independently. + """ + if mode == 'translucent': + blur_val = 'blur(20px) saturate(1.3)' + else: + blur_val = 'none' + + # Replace structural opaque sidebar (marked with /*[FX]*/): var-based bg + # Pattern groups: (1: prefix) (2: var ref) (3: !important;) — closing } matched but not captured + if mode == 'translucent': + css = _re.sub( + r'(#sidebar\s*\{\s*/\*\[FX\]\*/\s*background-color:\s*)(var\(--[^)]+\))(\s*!important\s*;)\s*\}', + rf'\1color-mix(in srgb, \2 20%, transparent)\3 backdrop-filter: {blur_val} !important; -webkit-backdrop-filter: {blur_val} !important; }}', + css, + ) + else: + css = _re.sub( + r'(#sidebar\s*\{\s*/\*\[FX\]\*/\s*background-color:\s*)var\(--[^)]+\)(\s*!important\s*;)\s*\}', + rf'\1transparent\2 backdrop-filter: {blur_val} !important; -webkit-backdrop-filter: {blur_val} !important; }}', + css, + ) + + # Replace gradient sidebar (marked with /*[FX]*/): rgba-based bg + existing blur + if mode == 'translucent': + css = _re.sub( + r'(#sidebar\s*\{\s*/\*\[FX\]\*/[^}]*background-color:\s*)rgba\(([^,]+,[^,]+,[^,]+),\s*[\d.]+\)(\s*!important\s*;[^}]*backdrop-filter:\s*)blur\([^)]+\)', + rf'\1rgba(\2, 0.25)\3{blur_val}', + css, + ) + else: + css = _re.sub( + r'(#sidebar\s*\{\s*/\*\[FX\]\*/[^}]*background-color:\s*)rgba\([^)]+\)(\s*!important\s*;[^}]*backdrop-filter:\s*)blur\([^)]+\)', + rf'\1transparent\2{blur_val}', + css, + ) + + # Remove the revert-layer rule (marked with /*[FX]*/) + css = _re.sub( + r'[^\n]*#sidebar[^{]*\{\s*/\*\[FX\]\*/\s*background-color:\s*revert-layer\s*;?\s*\}[^\n]*\n?', + '', + css, + ) + + return css + + @staticmethod + def _sidebar_mobile_css() -> str: + """Mobile override: auto-upgrade transparent sidebar → translucent. + + Uses #sidebar#sidebar for specificity to override the transparent rules. + Appended once at the end of the delivered CSS (the 'extra' section when + assembling from structured sections). + """ + return ( + "\n/* Mobile: auto-upgrade transparent sidebar to translucent */\n" + "@media (max-width: 768px) {\n" + " .dark #sidebar#sidebar,\n" + ' [data-theme="dark"] #sidebar#sidebar,\n' + ' [data-theme="oled-dark"] #sidebar#sidebar {\n' + " background-color: color-mix(in srgb, var(--color-gray-950) 20%, transparent) !important;\n" + " backdrop-filter: blur(20px) saturate(1.3) !important;\n" + " -webkit-backdrop-filter: blur(20px) saturate(1.3) !important;\n" + " }\n" + ' :root:not(.dark):not([data-theme="dark"]):not([data-theme="oled-dark"]) #sidebar#sidebar {\n' + " background-color: color-mix(in srgb, var(--color-gray-50) 20%, transparent) !important;\n" + " backdrop-filter: blur(20px) saturate(1.3) !important;\n" + " -webkit-backdrop-filter: blur(20px) saturate(1.3) !important;\n" + " }\n" + "}\n" + ) + + @classmethod + def _apply_overlay_transparency(cls, css: str) -> str: + """Append translucent glass CSS for portaled overlay UI elements.""" + return css + cls._overlay_css() + + @staticmethod + def _overlay_css() -> str: + """Return the translucent glass CSS block for portaled overlay UI. + + Targets settings modal, dropdown menus, user menus, integration menus, + and other UI elements portaled outside .app directly on . + Uses descendant selectors to handle varying portal DOM depths. + Appended at the end of the delivered CSS (the 'extra' section when + assembling from structured sections). + """ + blur = 'blur(20px) saturate(1.3)' + + # Selector fragment: portal wrappers (direct children of body that aren't part of the app/theme system) + pex = ':not(.app):not(#theme-designer-container):not([id^="owui-"]):not(#svelte):not(script):not(style)' + # Selector fragment: background-bearing elements inside portals (exclude interactive widgets + app internals) + iex = ':not(button):not(a):not(input):not(select):not(label):not(span):not(svg):not(img):not(.app *):not(#theme-designer-container *)' + + def _where(util): + toks = [f'div[class^="{util}"]', f'div[class*=" {util}"]', + f'div[class^="dark:{util}"]', f'div[class*=" dark:{util}"]'] + return ':where(' + ', '.join(t + iex for t in toks) + ')' + + wgray = _where('bg-gray-') + wwhite = _where('bg-white') + + def _decl(color_var): + return ( + f' background-color: color-mix(in srgb, var({color_var}) 25%, transparent) !important;\n' + f' backdrop-filter: {blur} !important;\n' + f' -webkit-backdrop-filter: {blur} !important;\n' + ) + + rules = [ + ([f'.dark body > div{pex} {wgray}', + f'[data-theme="dark"] body > div{pex} {wgray}', + f'[data-theme="oled-dark"] body > div{pex} {wgray}'], + '--color-gray-950'), + ([f':root:not(.dark):not([data-theme="dark"]):not([data-theme="oled-dark"]):not([data-theme="her"]) body > div{pex} {wwhite}', + f':root:not(.dark):not([data-theme="dark"]):not([data-theme="oled-dark"]):not([data-theme="her"]) body > div{pex} {wgray}'], + '--color-gray-50'), + ([f'.her body > div{pex} {wwhite}', + f'[data-theme="her"] body > div{pex} {wwhite}', + f'.her body > div{pex} {wgray}', + f'[data-theme="her"] body > div{pex} {wgray}'], + '--color-gray-50'), + ] + + css = '\n/* --- Overlay Translucency (valve-injected) --- */\n' + for sels, color_var in rules: + css += ',\n'.join(sels) + ' {\n' + _decl(color_var) + '}\n' + + # System mode media queries + for scheme, color_var in [('dark', '--color-gray-950'), ('light', '--color-gray-50')]: + media_sels = [f' [data-theme="system"] body > div{pex} {wgray}'] + if scheme == 'light': + media_sels.insert(0, f' [data-theme="system"] body > div{pex} {wwhite}') + css += f'@media (prefers-color-scheme: {scheme}) {{\n' + css += ',\n'.join(media_sels) + ' {\n' + _decl(color_var) + ' }\n}\n' + return css + + def _postprocess_css(self, css): + """Apply valve-based CSS post-processing (sidebar + overlay transparency).""" + if self.valves.sidebar_transparency != "opaque": + css = self._apply_sidebar_transparency(css, self.valves.sidebar_transparency) + if self.valves.overlay_transparency != "opaque": + css = self._apply_overlay_transparency(css) + return css + + def _postprocess_sections(self, sections: dict) -> dict: + """Per-section mirror of _postprocess_css. + + The sidebar valve rewrites /*[FX]*/ rules, which live only in the + structural and gradient sections. Valve-APPENDED rules (mobile sidebar + upgrade, overlay glass) go into a synthetic 'extra' section so + consumers assembling from sections deliver the same CSS as /theme.css. + 'extra' is never auth-gated by the bootloader. + """ + out = dict(sections) + extra = "" + sidebar_mode = self.valves.sidebar_transparency + if sidebar_mode != "opaque": + out["structural"] = self._rewrite_sidebar_fx(out["structural"], sidebar_mode) + out["gradient"] = self._rewrite_sidebar_fx(out["gradient"], sidebar_mode) + if sidebar_mode == "transparent": + extra += self._sidebar_mobile_css() + if self.valves.overlay_transparency != "opaque": + extra += self._overlay_css() + out["extra"] = extra + return out + + def _state_with_sections(self, state: str) -> str: + """Merge valve-postprocessed CSS sections into a state JSON string. + + Injected at delivery time under the reserved '_cssSections' key so the + bootloader can assemble auth-page CSS from structured sections instead + of regex-slicing the flat blob. No-op when the sections file is missing + (legacy flat-CSS saves — bootloader falls back to marker regexes) or + the state isn't parseable JSON (served as-is by design). + """ + sections = self._load_sections() + if not sections: + return state + try: + data = _json.loads(state) + if not isinstance(data, dict): + return state + except Exception: + return state + data["_cssSections"] = self._postprocess_sections(sections) + return _json.dumps(data, separators=(",", ":")) + + def _postprocess_state(self, state): + """Apply valve-based state post-processing (strip canvas if disabled).""" + if state and not self.valves.enable_canvas_fx: + state = self._strip_canvas_from_state(state) + return state + + @classmethod + def _redis_publish(cls, msg: str): + """Publish a message to the Redis theme_pro_sse channel (best-effort). + + The blocking publish is dispatched to the default thread-pool executor + when an event loop is running — a stalled Redis connection must never + freeze the server's event loop (broadcasts fire from async handlers). + """ + if not os.environ.get("REDIS_URL", ""): + return + try: + loop = asyncio.get_running_loop() + except RuntimeError: + loop = None + if loop is not None: + loop.run_in_executor(None, cls._redis_publish_sync, msg) + else: + cls._redis_publish_sync(msg) + + @classmethod + def _redis_publish_sync(cls, msg: str): + """Blocking Redis publish — call via _redis_publish, not directly.""" + redis_url = os.environ.get("REDIS_URL", "") + if not redis_url: + return + try: + import redis as _sync_redis + import inspect as _insp + _extra = {} + try: + if 'maint_notifications' in _insp.signature(_sync_redis.Redis.from_url).parameters: + _extra['maint_notifications'] = False + except Exception: + pass + # Bounded timeouts: even off-loop, a dead route shouldn't pin a + # thread-pool worker for minutes waiting on TCP defaults. + r = _sync_redis.Redis.from_url( + redis_url, + socket_connect_timeout=2, + socket_timeout=2, + **_extra, + ) + r.publish("theme_pro_sse", f"wid:{cls._WORKER_ID}\n{msg}") + r.close() + except Exception: + pass # Redis unavailable — local broadcast still runs below + + @classmethod + def _broadcast_update(cls, etags: dict | None = None, local_only: bool = False): + """Push a theme-update notification to all connected SSE clients. + + The payload carries a version token — clients refetch /theme.css and + /state.json, which apply valve post-processing at delivery time. This + keeps SSE frames tiny instead of shipping the full CSS + state + (including the entire canvas script) to every client on every + debounced save. When etags (from _prime_delivery_caches) are provided + they ride along, letting clients that already applied that exact + version skip the refetch entirely. + + local_only skips the Redis re-publish: set when this broadcast is + itself the result of receiving a peer's message, so it reaches this + worker's own clients without echoing back onto the channel. + """ + import time + + data = {"v": int(time.time() * 1000)} + if etags: + if etags.get("cssTag"): + data["cssTag"] = etags["cssTag"] + if etags.get("stateTag"): + data["stateTag"] = etags["stateTag"] + payload = _json.dumps(data, separators=(",", ":")) + msg = f"event: theme-update\ndata: {payload}\n\n" + if not local_only: + cls._redis_publish(msg) + for q in list(cls._sse_clients): + try: + q.put_nowait(msg) + except asyncio.QueueFull: + pass # Drop if client is backed up + + @classmethod + def _broadcast_disable(cls, reason="disabled"): + """Push a theme-disable event to all SSE clients (strip theme + reload). + + reason distinguishes a function toggle ("disabled") from a Global Reset + ("reset"). Clients strip the theme identically in both cases, but the + designer's save-hold must only latch on a real disable: after a reset + the function is still running and saves must keep working — latching + would hold every save while no theme-update can ever arrive to release + them, deadlocking the designer until a page reload. + """ + msg = f'event: theme-disable\ndata: {{"reason":"{reason}"}}\n\n' + cls._redis_publish(msg) + for q in list(cls._sse_clients): + try: + q.put_nowait(msg) + except asyncio.QueueFull: + pass + + # --- Cross-worker valve convergence ------------------------------------- + # An admin changes a valve on ONE worker; Open WebUI reloads the function + # there, but every other worker keeps its cached instance with the old + # values until its own next dispatched event. All valves alter rendered + # output (the loader.js fragment embeds the whole config), so peers can + # serve a stale theme for that window. The worker that saw the change tells + # the others to re-read from the DB. Redis-only: a single-worker install + # already holds the fresh valves, so _redis_publish is a no-op there. + # + # Framed as an SSE comment (":") so a peer still on an older build, whose + # subscriber forwards raw channel traffic straight to browsers, delivers an + # ignored keep-alive rather than a malformed event. Our own subscriber + # intercepts it before any client sees it. + _CTRL_PREFIX = ":owui-theme-ctrl " + + @classmethod + def _broadcast_valve_sync(cls): + """Signal peer workers that a valve changed and they should re-read it.""" + cls._redis_publish(f"{cls._CTRL_PREFIX}valvesync\n\n") + + @staticmethod + async def _read_valves_from_db(inst, function_id): + """Read + validate this function's stored valves; None on any failure. + + Fail-safe by construction: a missing Open WebUI API, an unreadable row, + or data that no longer validates all resolve to None, and the caller + then leaves the current valves untouched — behaviour identical to + pre-1.7.9, where the worker converges on its own next event. No stored + valves means the defaults, as in Open WebUI's own dispatch. + """ + try: + from open_webui.models.functions import Functions + + stored = await Functions.get_function_valves_by_id(function_id) or {} + except Exception: + return None + if not isinstance(stored, dict): + return None + try: + return inst.Valves(**stored) + except Exception: + return None + + @classmethod + async def _handle_peer_valve_sync(cls, app): + """Apply a peer's valve change to this worker's live instance. + + Also runs after live_reload executes this code on a worker that no + event reaches, which is how that worker gets its valves and routes. + + Cache priming runs off-loop; the app-state mutations (route + re-registration, fragment republish) run on-loop, the same order + event() uses, so they interleave cooperatively with event() instead of + racing it in a thread. + """ + inst = cls.instance + if inst is None or (app is not None and not reload_active(app)): + return + new_valves = await cls._read_valves_from_db(inst, RELOAD_FUNCTION_ID) + if new_valves is None: + return + inst.valves = new_valves + snap = inst._valves_snapshot() + if snap == cls._last_valves_snapshot: + return # already holding this value — nothing to converge + cls._last_valves_snapshot = snap + if app is not None: + route = inst._get_route_base() + if route != cls._routes_registered_url: + inst._register_route(app) + cls._routes_registered_url = route + inst._publish_fragments(app) + etags = await asyncio.to_thread(inst._prime_delivery_caches) + # local_only: this refetch nudge is the downstream of a peer's message; + # echoing it back to Redis would ripple across the cluster. + cls._broadcast_update(etags, local_only=True) + log.info( + "[Theme Pro] Applied peer valve change — refreshed valves, re-primed, notified local clients" + ) + + @classmethod + async def _shutdown_cleanup(cls, app): + """Cancel background tasks and end SSE streams before the loop closes. + + Called from event() on system.shutdown.* (primary path — Open WebUI + publishes those from its lifespan exit while the event loop is still + fully alive) and from the legacy router.on_shutdown hook on old + stacks where that still fires. + + Idempotent via app.state._theme_shutting_down. That flag also gates + the subscriber/heartbeat creation paths: shutdown events are + dispatched as fire-and-forget tasks, so a straggler event() can run + mid-teardown — if it respawned the Redis subscriber, the new task + would miss the runner's cancellation sweep and be destroyed pending + at loop close ("Task was destroyed but it is pending!", + "RuntimeError: no running event loop", un-awaited redis disconnect + coroutines in the GC phase of interpreter shutdown). + """ + app.state._theme_shutting_down = True + for attr in ("_theme_redis_task", "_theme_sse_heartbeat"): + task = getattr(app.state, attr, None) + if task is not None: + task.cancel() + try: + await task + except BaseException: + pass # CancelledError (expected) or teardown noise + setattr(app.state, attr, None) + # Wake every SSE stream with a None sentinel so the generators + # return. This lets uvicorn's graceful wait for in-flight responses + # finish instead of stalling on open EventSource connections until + # the container runtime SIGKILLs the process (~10s restart penalty). + for q in list(cls._sse_clients): + try: + q.put_nowait(None) + except asyncio.QueueFull: + try: + q.get_nowait() # Drop one queued frame to make room + q.put_nowait(None) + except (asyncio.QueueEmpty, asyncio.QueueFull): + pass + + def _ensure_redis_subscriber(self, app): + """Start the Redis pub/sub subscriber for multi-worker SSE broadcasting. + + Called from event() and register() (async context) rather than + _register_route (sync) to avoid 'Task was destroyed' errors from + transient startup event loops. The _sub_alive guard ensures the task + is only created once, or recreated if the previous one died or was + started by an older exec of this code. + """ + redis_url = os.environ.get("REDIS_URL", "") + _existing_task = getattr(app.state, "_theme_redis_task", None) + _sub_alive = _existing_task is not None and not _existing_task.done() + # A subscriber started by an older exec of this code would hand peer + # valve syncs to that exec's dead class, so a new exec replaces it. + if _sub_alive and getattr(app.state, "_theme_redis_exec", None) != RELOAD_EXEC_ID: + _existing_task.cancel() + _sub_alive = False + # Never (re)spawn once shutdown cleanup ran: shutdown events are + # dispatched fire-and-forget, so this code can execute mid-teardown + # after the old subscriber was cancelled (_sub_alive False again) — + # a respawned task would be orphaned at loop close. + _shutting_down = getattr(app.state, "_theme_shutting_down", False) + if redis_url and not _sub_alive and not _shutting_down: + try: + import redis.asyncio as aioredis + import inspect as _insp + + # Detect if redis-py supports maint_notifications (v7+) + _redis_extra = {} + try: + if 'maint_notifications' in _insp.signature(aioredis.from_url).parameters: + _redis_extra['maint_notifications'] = False + else: + import logging as _logging + _logging.getLogger('redis.connection').setLevel(_logging.WARNING) + except Exception: + pass + + async def _redis_subscriber(): + """Listen on Redis channel and forward messages to local SSE clients. + Reconnects automatically on timeout or connection loss.""" + while True: + r = None + pubsub = None + # Set when the loop/interpreter is dying: skip every + # remaining await (logging included) so finalization + # stays silent instead of raising into the GC. + _teardown = False + try: + r = aioredis.from_url( + redis_url, + socket_timeout=None, + socket_connect_timeout=10, + **_redis_extra, + ) + pubsub = r.pubsub() + await pubsub.subscribe("theme_pro_sse") + log.info("[Theme Pro] Redis subscriber connected on channel 'theme_pro_sse'") + async for message in pubsub.listen(): + if message["type"] != "message": + continue + raw = message["data"] + if isinstance(raw, bytes): + raw = raw.decode("utf-8") + if raw.startswith("wid:"): + newline = raw.index("\n") + sender_id = raw[4:newline] + if sender_id == Event._WORKER_ID: + continue + raw = raw[newline + 1:] + # Internal control messages never reach browsers. + if raw.startswith(Event._CTRL_PREFIX): + if raw[len(Event._CTRL_PREFIX):].strip() == "valvesync": + try: + await Event._handle_peer_valve_sync(app) + except Exception: + log.warning( + "[Theme Pro] Peer valve sync failed", + exc_info=True, + ) + continue + for q in list(Event._sse_clients): + try: + q.put_nowait(raw) + except asyncio.QueueFull: + pass + except asyncio.CancelledError: + break + except GeneratorExit: + # GC is finalizing this coroutine after the loop + # already closed (shutdown cleanup never ran — + # e.g. hard kill). Any await here raises straight + # into the finalizer; bail out silently. + _teardown = True + raise + except Exception as exc: + # During finalization redis-py can convert the + # thrown GeneratorExit into an ordinary + # ConnectionError, landing here with no loop to + # sleep on. Only log + retry on a live loop. + try: + asyncio.get_running_loop() + except RuntimeError: + _teardown = True + return + log.warning("[Theme Pro] Redis subscriber lost connection: %s — reconnecting in 5s", exc) + await asyncio.sleep(5) + finally: + # Close connections to prevent FD/connection leaks on + # reconnect. redis-py >= 5 renamed close() to aclose() + # and deprecated close() — feature-detect to stay quiet + # on new versions and compatible with old ones. + # BaseException: a re-delivered CancelledError during + # shutdown must not skip closing the second connection. + if not _teardown: + if pubsub: + try: + await (pubsub.aclose() if hasattr(pubsub, "aclose") else pubsub.close()) + except BaseException: pass + if r: + try: + await (r.aclose() if hasattr(r, "aclose") else r.close()) + except BaseException: pass + + app.state._theme_redis_task = asyncio.get_running_loop().create_task(_redis_subscriber()) + app.state._theme_redis_exec = RELOAD_EXEC_ID + except Exception as exc: + log.warning("[Theme Pro] Could not start Redis subscriber: %s", exc) + + async def event( + self, + event: dict, + __event_name__: str = None, + __id__: str = None, + __app__=None, + **kwargs, + ) -> None: + # --- Server shutdown cleanup --- + # Open WebUI publishes system.shutdown.* from its lifespan exit while + # the event loop is still running — the only reliable shutdown hook + # (router.on_shutdown never fires on lifespan-based apps). Cancel the + # Redis subscriber + SSE heartbeat and end SSE streams NOW; once the + # loop closes, an un-cancelled subscriber surfaces at interpreter + # exit as "Task was destroyed but it is pending!" / "RuntimeError: + # no running event loop" GC noise. Runs even when the function is + # disabled: a subscriber started before a disable is still alive. + if __event_name__ in ( + "system.shutdown.started", + "system.shutdown.completed", + ): + if __app__ is not None and not getattr( + __app__.state, "_theme_shutting_down", False + ): + log.info( + "[Theme Pro] Server shutdown — cancelling background tasks and closing SSE streams" + ) + await Event._shutdown_cleanup(__app__) + return # No injection/broadcast work during shutdown + + if __app__ is None: + return + + # On/off, code saves and valve saves reach every worker through + # live_reload, which also flips reload_active() for the producers and + # route handlers. + await reload_on_event(__app__, event, __event_name__) + is_own = ((event or {}).get("subject") or {}).get("id") == RELOAD_FUNCTION_ID + + # --- Pre-disable cleanup --- + # When the admin toggles this function OFF, Open WebUI dispatches + # 'function.disable_started' synchronously BEFORE committing + # is_active=False (Open WebUI v0.11.0+; earlier builds never + # dispatch pre-toggle lifecycle events). + # + # live_reload has already switched the function off on every worker, + # so the next request composes a custom.css without our block and a + # loader.js with __THEME_ACTIVE__=false. The loader fragment stays + # published deliberately: an inactive bootloader still holds its SSE + # connection, which is how the theme-update broadcast on re-enable + # reaches all connected clients. What is left is to broadcast + # theme-disable, which strips the theme from all open tabs. + if is_own and __event_name__ == "function.disable_started": + log.info( + "[Theme Pro] Function is being disabled — CSS fragment withdrawn, SSE kept alive" + ) + Event._broadcast_disable() + Event._published = False + log.info( + "[Theme Pro] Cleanup complete — CSS withdrawn, bootloader set inactive, clients notified" + ) + return # Nothing else to do on this event + + # --- Pre-enable re-injection --- + # When the admin toggles this function back ON, Open WebUI dispatches + # 'function.enable_started' synchronously BEFORE committing + # is_active=True (the not-yet-active function is included via + # extra_function_ids). Ensure _published is False so the main logic + # below republishes the fragments and rebroadcasts to open tabs + # immediately. + if is_own and __event_name__ == "function.enable_started": + log.info("[Theme Pro] Function is being re-enabled — triggering re-injection") + Event._published = False # Forces the republish + broadcast below + Event._reenabling = True # Triggers broadcast to connected clients + + if not reload_active(__app__): + return + + url_changed = ( + Event._last_designer_url is not None + and Event._last_designer_url != self.valves.designer_url + ) + + # Register routes on first call or when the designer URL valve changes. + # Guarded because _register_route rewrites app.routes; the fragment + # publish below is cheap enough to run unguarded. + _current_route = self._get_route_base() + if ( + Event._routes_registered_url is None + or _current_route != Event._routes_registered_url + ): + self._register_route(__app__) + Event._routes_registered_url = _current_route + # A URL change rewrites __THEME_ROUTE__ inside the loader fragment. + # The producer picks that up on its own at the next compose, but + # clearing the flag also rebroadcasts so already-loaded tabs move + # their SSE connection to the new route instead of retrying a 404. + if url_changed: + Event._published = False + + self._ensure_redis_subscriber(__app__) + + canvas_valve_changed = ( + Event._last_enable_canvas_fx is not None + and Event._last_enable_canvas_fx != self.valves.enable_canvas_fx + ) + + sidebar_valve_changed = ( + Event._last_sidebar_transparency is not None + and Event._last_sidebar_transparency != self.valves.sidebar_transparency + ) + + overlay_valve_changed = ( + Event._last_overlay_transparency is not None + and Event._last_overlay_transparency != self.valves.overlay_transparency + ) + + # Any valve change (not just the three that drive a live broadcast) tells + # peer workers to re-read from the DB — they hold a cached instance that + # Open WebUI only reloads on the worker where the change was made. First + # event of the process is skipped (snapshot is None): startup is not a + # change, and peers load their own valves on their own startup. + _valves_now = self._valves_snapshot() + if ( + Event._last_valves_snapshot is not None + and _valves_now != Event._last_valves_snapshot + ): + Event._broadcast_valve_sync() + + # One-shot: remove blocks an older, index.html-writing build left behind. + # Threaded — the flock can wait on another process and must not stall + # the loop. Self-guarded, so this is a no-op after the first call. + if not Event._legacy_index_cleaned: + await asyncio.to_thread(self._clean_legacy_index_injection) + + # Capture whether fragments have been published in this process yet + # (first event after startup, a disable, or a class reload). Used below + # to trigger an SSE broadcast so connected clients receive the theme + # immediately without needing a page refresh. + _was_not_published = not Event._published + + # Publish unconditionally. This replaced a read-modify-write of + # index.html under a cross-process flock, which had to be guarded on + # "did anything actually change?"; re-pointing the two fragments is two + # dict writes plus a route scan, so the guard is not worth its own bugs. + # Re-pointing on every event is also what makes a hot reload converge: + # the registry ends up holding the NEW instance's producer. + # No valve branches either — the producers read self.valves at compose + # time, so a valve change is already reflected on the next request. + _published_ok = ( + self._publish_fragments(__app__) if __app__ is not None else False + ) + + if _published_ok: + # Broadcast theme state to connected clients when: + # - First publish cycle after disable/startup (_was_not_published) + # - Function was just re-enabled (_reenabling from function.enable_started) + # - A valve changed (admin toggled a setting) + _reenabling = Event._reenabling + Event._reenabling = False + if _was_not_published or _reenabling or canvas_valve_changed or sidebar_valve_changed or overlay_valve_changed: + # Token + ETag broadcast — clients refetch /theme.css + /state.json + # (valve post-processing applies at delivery), unless the tags show + # they already hold this exact version. Priming runs off-loop. + _etags = await asyncio.to_thread(self._prime_delivery_caches) + Event._broadcast_update(_etags) + _reasons = [] + if _was_not_published: _reasons.append("first publish cycle") + if _reenabling: _reasons.append("function re-enabled") + if canvas_valve_changed: _reasons.append(f"Canvas FX → {self.valves.enable_canvas_fx}") + if sidebar_valve_changed: _reasons.append(f"sidebar → {self.valves.sidebar_transparency}") + if overlay_valve_changed: _reasons.append(f"overlay → {self.valves.overlay_transparency}") + log.info("[Theme Pro] Valve change (%s) — pushed to SSE clients", ", ".join(_reasons)) + if _was_not_published: + log.info( + "[Theme Pro] Published loader.js + custom.css fragments to the shared static-asset registry" + ) + Event._published = True + elif __app__ is not None: + # Only latch on success — a transient failure leaves the flag unset + # so the next event retries instead of silently serving an unthemed + # instance until something else happens to republish. + log.warning( + "[Theme Pro] Fragment publish failed — will retry on next event" + ) + + # Always track the current valve state for next comparison + Event._last_designer_url = self.valves.designer_url + Event._last_enable_canvas_fx = self.valves.enable_canvas_fx + Event._last_sidebar_transparency = self.valves.sidebar_transparency + Event._last_overlay_transparency = self.valves.overlay_transparency + Event._last_valves_snapshot = _valves_now + + +def register(app: Any) -> None: + inst = Event.instance + inst._publish_fragments(app) + + # live_reload can execute this code on a worker that no event reaches, so + # load its valves, routes and Redis subscriber the way a peer valve sync + # does. Runs as a task: the valves are read from the database. + async def load(): + inst._ensure_redis_subscriber(app) + await Event._handle_peer_valve_sync(app) + + task = asyncio.get_running_loop().create_task(load()) + reload_tasks.add(task) + task.add_done_callback(reload_tasks.discard) diff --git a/integrations/openwebui/README.md b/integrations/openwebui/README.md index f9dda82..072dd1e 100644 --- a/integrations/openwebui/README.md +++ b/integrations/openwebui/README.md @@ -1,5 +1,8 @@ # Athena Audio-Trennung in OpenWebUI +Theme Designer Pro ist als zentrale Event Function installiert. Zugriff, Sicherung +und Wiederherstellung: [Theme-Designer-Installation](../openwebui-theme-designer/INSTALLATION.md). + Das Workspace-Werkzeug `athena_audio` verwendet die vorhandenen Deck-Laufzeiten und Trennprofile. Es braucht keinen zusätzlichen Container. Originaldateien verbleiben im OpenWebUI-Dateispeicher; temporäre konvertierte Eingaben werden gelöscht.