[PR #23274] feat: adding open-terminal virtual desktop #27117

Open
opened 2026-04-20 06:53:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23274
Author: @volkermauel
Created: 3/31/2026
Status: 🔄 Open

Base: devHead: feature-desktop


📝 Commits (5)

  • 9d86ac8 Add remote desktop (noVNC) viewer to terminal server feature
  • 6ec66f5 Fix desktop feature detection on initial mount
  • 683f126 Fix: guard desktop stop state update on stopDesktop success
  • d16bd61 feat: integrate grounding model for computer use desktop with bbox coordinate scaling
  • c510045 Merge branch 'dev' into feature-desktop

📊 Changes

14 files changed (+1617 additions, -14 deletions)

View changed files

📝 backend/open_webui/config.py (+18 -0)
📝 backend/open_webui/main.py (+6 -0)
📝 backend/open_webui/routers/tasks.py (+12 -0)
📝 backend/open_webui/routers/terminals.py (+146 -0)
backend/open_webui/test/apps/webui/routers/test_terminals.py (+433 -0)
📝 backend/open_webui/utils/middleware.py (+230 -9)
src/lib/apis/terminal/desktop.test.ts (+135 -0)
📝 src/lib/apis/terminal/index.ts (+63 -0)
📝 src/lib/components/admin/Settings/Interface.svelte (+78 -0)
📝 src/lib/components/chat/Chat.svelte (+41 -0)
📝 src/lib/components/chat/FileNav.svelte (+90 -3)
src/lib/components/chat/FileNav/DesktopViewer.svelte (+333 -0)
📝 src/lib/components/chat/Messages/Markdown.svelte (+31 -1)
📝 src/lib/components/common/Image.svelte (+1 -1)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.

This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.

Before submitting, make sure you've checked the following:

  • Target branch: Verify that the pull request targets the dev branch. PRs targeting main will be immediately closed.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Add docs in Open WebUI Docs Repository. Document user-facing behavior, environment variables, public APIs/interfaces, or deployment steps.
  • Dependencies: Are there any new or upgraded dependencies? If so, explain why, update the changelog/docs, and include any compatibility notes. Actually run the code/function that uses updated library to ensure it doesn't crash.
  • Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Include reproducible steps to demonstrate the issue before the fix. Test edge cases (URL encoding, HTML entities, types). Take this as an opportunity to make screenshots of the feature/fix and include them in the PR description.
  • Agentic AI Code: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review AND manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Design & Architecture: Prefer smart defaults over adding new settings; use local state for ephemeral UI logic. Open a Discussion for major architectural or UX changes.
  • Git Hygiene: Keep PRs atomic (one logical change). Clean up commits and rebase on dev to ensure no unrelated commits (e.g. from main) are included. Push updates to the existing PR branch instead of closing and reopening.
  • Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • Adds a fully integrated remote desktop (noVNC) viewer to the existing terminal server infrastructure. Users can launch and interact with a virtual desktop via noVNC/websockify directly from the Open WebUI file navigation panel, alongside the existing terminal and file browser features. This PR works in conjunction with the companion terminal server changes in https://github.com/open-webui/open-terminal/pull/100.

Added

  • WebSocket proxy for noVNC (ws_desktop endpoint at /{server_id}/desktop/ws): Authenticates via JWT query parameter, discovers the websockify port from the terminal server, and performs a bidirectional binary RFB relay between the browser and the terminal server
  • _resolve_desktop_connection and _fetch_novnc_port helpers in backend/open_webui/routers/terminals.py for connection resolution and port discovery (falls back to port 6080 on failure)
  • DesktopStatus type, getDesktopStatus, startDesktop, stopDesktop, getDesktopViewerUrl frontend API helpers in src/lib/apis/terminal/index.ts
  • desktop flag added to the TerminalFeatures type
  • DesktopViewer.svelte component: Embeds noVNC in an iframe with a toolbar providing Start/Stop toggle, Refresh, Open in new tab, Fullscreen mode, and a status indicator (connected / starting / stopped). Auto-starts desktop on mount and polls status every 10 seconds
  • Desktop panel integration in FileNav.svelte: Collapsible panel with drag handle appears below the terminal when the terminal server reports features.desktop === true. Desktop state (enabled/expanded/height) is managed independently from the terminal
  • Backend unit tests (backend/open_webui/test/apps/webui/routers/test_terminals.py, 433 lines): Covers path sanitization, noVNC port discovery, HTTP proxy endpoints, desktop status/start, access control, and WebSocket route registration
  • Frontend unit tests (src/lib/apis/terminal/desktop.test.ts, 135 lines): Covers getDesktopStatus, startDesktop, stopDesktop, getDesktopViewerUrl, and getPortProxyUrl

Changed

  • src/lib/components/chat/FileNav.svelte: Added desktop feature detection in both the reactive block and the onMount block to ensure the Desktop panel appears correctly on first load and subsequent chat switches

Deprecated

  • (None)

Removed

  • (None)

Fixed

  • Desktop feature detection on initial mount: desktopEnabled was only set in the reactive block but not in onMount, causing the Desktop panel to not appear on first page load

Security

  • Desktop WebSocket endpoint authenticates users via JWT token passed as a query parameter (required because noVNC uses the binary RFB protocol and cannot send a JSON auth message)
  • Group-based access control is enforced through the existing _resolve_desktop_connection helper, consistent with the terminal WebSocket proxy

Breaking Changes

  • BREAKING CHANGE: (None)

Additional Information

  • Related terminal server PR: https://github.com/open-webui/open-terminal/pull/100
  • The terminal server must support GET /desktop, POST /desktop/start, POST /desktop/stop endpoints and run websockify for this feature to work
  • No new npm or pip dependencies were introduced — the feature uses the existing WebSocket proxy infrastructure and the noVNC client served by the terminal server
  • Integration tested via docker compose -f docker-compose.integration.yml up --build with both open-webui and open-terminal containers healthy

Architecture

Browser (noVNC iframe)
  │  WebSocket (binary RFB)
  ▼
Open WebUI Backend (ws_desktop proxy)
  │  Authenticates JWT from query param
  │  Discovers websockify port via GET /desktop
  ▼
Terminal Server (websockify on discovered port)
  │
  ▼
Virtual Desktop (X11 / VNC)

Files Changed

File Description
backend/open_webui/routers/terminals.py WebSocket proxy and desktop endpoint helpers (+146 lines)
src/lib/apis/terminal/index.ts Desktop API helpers and types (+63 lines)
src/lib/components/chat/FileNav.svelte Desktop panel integration (+158/-12 lines)
src/lib/components/chat/FileNav/DesktopViewer.svelte New noVNC viewer component (+331 lines)
backend/open_webui/test/apps/webui/routers/test_terminals.py Backend unit tests (+433 lines)
src/lib/apis/terminal/desktop.test.ts Frontend unit tests (+135 lines)

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23274 **Author:** [@volkermauel](https://github.com/volkermauel) **Created:** 3/31/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feature-desktop` --- ### 📝 Commits (5) - [`9d86ac8`](https://github.com/open-webui/open-webui/commit/9d86ac8186f4a84f724ccdeb889827c84f576111) Add remote desktop (noVNC) viewer to terminal server feature - [`6ec66f5`](https://github.com/open-webui/open-webui/commit/6ec66f57fde1f6429b45a2cd0c39662b4b7a6489) Fix desktop feature detection on initial mount - [`683f126`](https://github.com/open-webui/open-webui/commit/683f126dabcf42f1397eb6a613c59cb7c4a2ea5b) Fix: guard desktop stop state update on stopDesktop success - [`d16bd61`](https://github.com/open-webui/open-webui/commit/d16bd616d6638fdccf60c0d5c45437f1033fa9cc) feat: integrate grounding model for computer use desktop with bbox coordinate scaling - [`c510045`](https://github.com/open-webui/open-webui/commit/c510045137e4287b7895c97db2ae1b08379448ee) Merge branch 'dev' into feature-desktop ### 📊 Changes **14 files changed** (+1617 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+18 -0) 📝 `backend/open_webui/main.py` (+6 -0) 📝 `backend/open_webui/routers/tasks.py` (+12 -0) 📝 `backend/open_webui/routers/terminals.py` (+146 -0) ➕ `backend/open_webui/test/apps/webui/routers/test_terminals.py` (+433 -0) 📝 `backend/open_webui/utils/middleware.py` (+230 -9) ➕ `src/lib/apis/terminal/desktop.test.ts` (+135 -0) 📝 `src/lib/apis/terminal/index.ts` (+63 -0) 📝 `src/lib/components/admin/Settings/Interface.svelte` (+78 -0) 📝 `src/lib/components/chat/Chat.svelte` (+41 -0) 📝 `src/lib/components/chat/FileNav.svelte` (+90 -3) ➕ `src/lib/components/chat/FileNav/DesktopViewer.svelte` (+333 -0) 📝 `src/lib/components/chat/Messages/Markdown.svelte` (+31 -1) 📝 `src/lib/components/common/Image.svelte` (+1 -1) </details> ### 📄 Description <!-- ⚠️ CRITICAL CHECKS FOR CONTRIBUTORS (READ, DON'T DELETE) ⚠️ 1. Target the `dev` branch. PRs targeting `main` will be automatically closed. 2. Do NOT delete the CLA section at the bottom. It is required for the bot to accept your PR. --> # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request. This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Verify that the pull request targets the `dev` branch. **PRs targeting `main` will be immediately closed.** - [x] **Description:** Provide a concise description of the changes made in this pull request down below. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Documentation:** Add docs in [Open WebUI Docs Repository](https://github.com/open-webui/docs). Document user-facing behavior, environment variables, public APIs/interfaces, or deployment steps. - [x] **Dependencies:** Are there any new or upgraded dependencies? If so, explain why, update the changelog/docs, and include any compatibility notes. Actually run the code/function that uses updated library to ensure it doesn't crash. - [x] **Testing:** Perform manual tests to **verify the implemented fix/feature works as intended AND does not break any other functionality**. Include reproducible steps to demonstrate the issue before the fix. Test edge cases (URL encoding, HTML entities, types). Take this as an opportunity to **make screenshots of the feature/fix and include them in the PR description**. - [x] **Agentic AI Code:** Confirm this Pull Request is **not written by any AI Agent** or has at least **gone through additional human review AND manual testing**. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR. - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Design & Architecture:** Prefer smart defaults over adding new settings; use local state for ephemeral UI logic. Open a Discussion for major architectural or UX changes. - [x] **Git Hygiene:** Keep PRs atomic (one logical change). Clean up commits and rebase on `dev` to ensure no unrelated commits (e.g. from `main`) are included. Push updates to the existing PR branch instead of closing and reopening. - [x] **Title Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - Adds a fully integrated remote desktop (noVNC) viewer to the existing terminal server infrastructure. Users can launch and interact with a virtual desktop via noVNC/websockify directly from the Open WebUI file navigation panel, alongside the existing terminal and file browser features. This PR works in conjunction with the companion terminal server changes in https://github.com/open-webui/open-terminal/pull/100. ### Added - **WebSocket proxy for noVNC** (`ws_desktop` endpoint at `/{server_id}/desktop/ws`): Authenticates via JWT query parameter, discovers the websockify port from the terminal server, and performs a bidirectional binary RFB relay between the browser and the terminal server - **`_resolve_desktop_connection`** and **`_fetch_novnc_port`** helpers in `backend/open_webui/routers/terminals.py` for connection resolution and port discovery (falls back to port `6080` on failure) - **`DesktopStatus` type**, **`getDesktopStatus`**, **`startDesktop`**, **`stopDesktop`**, **`getDesktopViewerUrl`** frontend API helpers in `src/lib/apis/terminal/index.ts` - **`desktop` flag** added to the `TerminalFeatures` type - **`DesktopViewer.svelte`** component: Embeds noVNC in an iframe with a toolbar providing Start/Stop toggle, Refresh, Open in new tab, Fullscreen mode, and a status indicator (connected / starting / stopped). Auto-starts desktop on mount and polls status every 10 seconds - **Desktop panel integration** in `FileNav.svelte`: Collapsible panel with drag handle appears below the terminal when the terminal server reports `features.desktop === true`. Desktop state (enabled/expanded/height) is managed independently from the terminal - **Backend unit tests** (`backend/open_webui/test/apps/webui/routers/test_terminals.py`, 433 lines): Covers path sanitization, noVNC port discovery, HTTP proxy endpoints, desktop status/start, access control, and WebSocket route registration - **Frontend unit tests** (`src/lib/apis/terminal/desktop.test.ts`, 135 lines): Covers `getDesktopStatus`, `startDesktop`, `stopDesktop`, `getDesktopViewerUrl`, and `getPortProxyUrl` ### Changed - `src/lib/components/chat/FileNav.svelte`: Added desktop feature detection in both the reactive block and the `onMount` block to ensure the Desktop panel appears correctly on first load and subsequent chat switches ### Deprecated - _(None)_ ### Removed - _(None)_ ### Fixed - Desktop feature detection on initial mount: `desktopEnabled` was only set in the reactive block but not in `onMount`, causing the Desktop panel to not appear on first page load ### Security - Desktop WebSocket endpoint authenticates users via JWT token passed as a query parameter (required because noVNC uses the binary RFB protocol and cannot send a JSON auth message) - Group-based access control is enforced through the existing `_resolve_desktop_connection` helper, consistent with the terminal WebSocket proxy ### Breaking Changes - **BREAKING CHANGE**: _(None)_ --- ### Additional Information - **Related terminal server PR:** https://github.com/open-webui/open-terminal/pull/100 - The terminal server must support `GET /desktop`, `POST /desktop/start`, `POST /desktop/stop` endpoints and run websockify for this feature to work - No new npm or pip dependencies were introduced — the feature uses the existing WebSocket proxy infrastructure and the noVNC client served by the terminal server - Integration tested via `docker compose -f docker-compose.integration.yml up --build` with both open-webui and open-terminal containers healthy ### Architecture ``` Browser (noVNC iframe) │ WebSocket (binary RFB) ▼ Open WebUI Backend (ws_desktop proxy) │ Authenticates JWT from query param │ Discovers websockify port via GET /desktop ▼ Terminal Server (websockify on discovered port) │ ▼ Virtual Desktop (X11 / VNC) ``` ### Files Changed | File | Description | | -------------------------------------------------------------- | --------------------------------------------------------- | | `backend/open_webui/routers/terminals.py` | WebSocket proxy and desktop endpoint helpers (+146 lines) | | `src/lib/apis/terminal/index.ts` | Desktop API helpers and types (+63 lines) | | `src/lib/components/chat/FileNav.svelte` | Desktop panel integration (+158/-12 lines) | | `src/lib/components/chat/FileNav/DesktopViewer.svelte` | New noVNC viewer component (+331 lines) | | `backend/open_webui/test/apps/webui/routers/test_terminals.py` | Backend unit tests (+433 lines) | | `src/lib/apis/terminal/desktop.test.ts` | Frontend unit tests (+135 lines) | ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:53:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#27117