From 08ca3b4525bfb9f3771441cc60c0486e61a58234 Mon Sep 17 00:00:00 2001 From: chengyongru <61816729+chengyongru@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:34:54 +0800 Subject: [PATCH] refactor(webui): use native link actions and remove website previews (#6391) * refactor(webui): remove website previews and custom link menus * docs(webui): focus guide on product-specific usage --- docs/webui.md | 170 ++++--------- webui/COMPONENTS.md | 2 +- webui/src/components/MessageBubble.tsx | 8 +- webui/src/components/MessageLinksMenu.tsx | 94 ------- webui/src/components/PreviewPane.tsx | 13 +- webui/src/components/WebLink.tsx | 111 +------- webui/src/components/WebPreviewPanel.tsx | 24 -- webui/src/components/WebPreviewPanelView.tsx | 41 --- .../src/components/thread/ThreadMessages.tsx | 15 +- webui/src/components/thread/ThreadShell.tsx | 36 +-- webui/src/dev/gallery/content.tsx | 24 -- .../src/dev/gallery/locales/previews/en.json | 18 -- .../src/dev/gallery/locales/previews/es.json | 18 -- .../src/dev/gallery/locales/previews/fr.json | 18 -- .../src/dev/gallery/locales/previews/id.json | 18 -- .../src/dev/gallery/locales/previews/ja.json | 18 -- .../src/dev/gallery/locales/previews/ko.json | 18 -- .../dev/gallery/locales/previews/pt-BR.json | 18 -- .../src/dev/gallery/locales/previews/vi.json | 18 -- .../dev/gallery/locales/previews/zh-CN.json | 18 -- .../dev/gallery/locales/previews/zh-TW.json | 18 -- webui/src/dev/gallery/shell.tsx | 29 +-- webui/src/hooks/useFilePreviewState.ts | 17 +- webui/src/i18n/locales/en/common.json | 27 +- webui/src/i18n/locales/es/common.json | 27 +- webui/src/i18n/locales/fr/common.json | 27 +- webui/src/i18n/locales/id/common.json | 27 +- webui/src/i18n/locales/ja/common.json | 27 +- webui/src/i18n/locales/ko/common.json | 27 +- webui/src/i18n/locales/pt-BR/common.json | 27 +- webui/src/i18n/locales/vi/common.json | 27 +- webui/src/i18n/locales/zh-CN/common.json | 27 +- webui/src/i18n/locales/zh-TW/common.json | 27 +- webui/src/lib/web-preview.ts | 32 --- webui/src/tests/file-preview-panel.test.tsx | 2 +- webui/src/tests/file-reference-icon.test.tsx | 2 +- webui/src/tests/message-links-menu.test.tsx | 209 --------------- webui/src/tests/preview-pane.test.tsx | 32 +-- .../tests/temporary-chat-navigation.test.tsx | 53 +--- webui/src/tests/thread-messages.test.tsx | 13 + webui/src/tests/web-link.test.tsx | 56 ++++ webui/src/tests/web-preview.test.tsx | 239 ------------------ 42 files changed, 179 insertions(+), 1493 deletions(-) delete mode 100644 webui/src/components/MessageLinksMenu.tsx delete mode 100644 webui/src/components/WebPreviewPanel.tsx delete mode 100644 webui/src/components/WebPreviewPanelView.tsx delete mode 100644 webui/src/lib/web-preview.ts delete mode 100644 webui/src/tests/message-links-menu.test.tsx create mode 100644 webui/src/tests/web-link.test.tsx delete mode 100644 webui/src/tests/web-preview.test.tsx diff --git a/docs/webui.md b/docs/webui.md index f9c8942ad..6e261e734 100644 --- a/docs/webui.md +++ b/docs/webui.md @@ -2,42 +2,34 @@ -The WebUI is nanobot's browser workbench for persistent topics, grouped conversation panes, temporary chats, visible agent activity, workspace controls, Apps, skill discovery, settings, and Automations in one place. It shares the gateway and saved sessions with the native terminal client. +The WebUI shares its gateway and saved sessions with the native terminal client and is included with `nanobot-ai`. For a visual tour, see the [README feature gallery](../README.md#-webui). This guide follows the current source tree; some features are newer than the published release. -The published `nanobot-ai` wheel already includes the WebUI bundle. You only need the `webui/` source directory when you are changing the frontend itself. - ## Open the WebUI -Use the launcher: - ```bash nanobot webui ``` -`nanobot webui` asks for one confirmation on a new installation, creates the config/workspace, enables the local WebSocket channel, and generates a WebUI bootstrap secret when one is missing. It starts or joins the same gateway used by the native TUI and opens the browser. Fresh official-installer environments start it persistently and return control to the terminal; other installations keep the attached on-demand launch. With a fresh config, it can open before a model is configured so you can finish setup in **Settings → Models**. The first-run path binds the WebUI to `127.0.0.1` by default, so it is not available from other devices on your LAN. The startup summary groups the login link, model setup guidance, config, and exit controls with blank lines. While attached, the launcher displays new gateway warnings and errors; use the printed logs command for full output. +On a new installation, the launcher asks for confirmation to create the config and workspace, enables the local WebUI, and opens a signed-in browser. Configure a provider and model in **Settings → Models** before sending your first message; see [Configure Your Model](./quick-start.md#2-configure-your-model). The default address is `http://127.0.0.1:8765`, accessible only from the same machine. -Outside an installer-managed environment, use `nanobot webui --detach` to open the browser and keep the gateway running after the terminal closes. Alternatively, start or promote the same shared gateway explicitly: +Official-installer environments start a persistent gateway by default. Other installations keep it attached to the launchers: closing the last WebUI or TUI launcher stops an on-demand gateway. Use `nanobot webui --detach` to keep it running after the terminal closes, or start it explicitly: ```bash nanobot gateway --background ``` -`nanobot webui --background` remains deprecated and prints migration guidance. All launch routes use the same gateway lifecycle owner and state. +Manage a persistent gateway with `nanobot gateway status`, `nanobot gateway logs`, `nanobot gateway restart`, and `nanobot gateway stop`. Use the printed instance-specific commands for a custom config or workspace. The old `nanobot webui --background` flag is deprecated; `--detach` cannot be combined with `--dev`. -Each foreground WebUI or TUI launcher releases only its own client. The last interactive launcher stops an on-demand gateway, but not a persistent one. Manage the persistent gateway with `nanobot gateway status`, `nanobot gateway logs`, `nanobot gateway restart`, and `nanobot gateway stop`. Use the printed instance-specific commands when you selected a custom config or workspace. `--detach --dev` is unsupported; development remains attached. +To sign in another browser, use the complete printed login link, including the fragment after `#`. Treat it as a credential. `nanobot webui --no-open` prints the link without opening a browser. In WSL, the launcher uses the Windows default browser unless `BROWSER` is set; if automatic opening fails, use the printed link. -The browser signs in automatically using the generated credential in the launch URL. The terminal also prints the complete login link: if automatic opening fails, copy that link into your browser, including the fragment after `#`. In WSL, the launcher opens your Windows default browser through Windows PowerShell; an explicit `BROWSER` setting takes precedence. If Windows integration is unavailable, open the printed link in your Windows browser. The plain page address does not sign in a new browser. Treat the login link as a credential and do not share it. - -`nanobot webui --no-open` prints the same login link without opening a browser. Development mode uses the Vite address, normally `http://127.0.0.1:5173`, with the same gateway authentication. - -If no provider is configured, follow the **Next step** prompt to open **Settings → Models**. Errors for a configured provider appear with that prompt. +The launcher displays gateway warnings and errors; use the printed logs command for full output.
Manual configuration for the local WebUI -Manual config still works. Same-machine localhost WebUI access can run without a browser password. Set `tokenIssueSecret` when you intentionally expose the WebUI beyond localhost or want a browser password. These listener and authentication fields have no graphical editor: +Listener and authentication fields are configured in `config.json`. Localhost access can run without a browser password; set `tokenIssueSecret` for access beyond localhost or to require a password: ```json { @@ -54,40 +46,24 @@ Manual config still works. Same-machine localhost WebUI access can run without a
-The WebUI is served by the WebSocket channel on port `8765` by default. The gateway health endpoint, `18790` by default, is not the browser UI. - ### macOS Dock icon -In a local macOS desktop session, `nanobot webui` shows the nanobot cat in the Dock. Click it to open the current local WebUI in your default browser. `--no-open` keeps the icon but does not open a page automatically. SSH, headless, Windows and Linux launches keep their existing behavior. A one-shot connection to an unmanaged gateway does not leave an icon behind. +On a local macOS desktop, `nanobot webui` provides a Dock shortcut to the running WebUI. `--no-open` keeps the shortcut without opening a page; `--no-dock` disables it. It is unavailable in SSH/headless sessions or for non-loopback browser addresses. -Ordinary foreground launchers for the same instance, browser address and installation share an icon. The last WebUI launcher removes it when it exits, including after a terminal crash. For `--detach` and official-installer automatic background launch, the gateway owns the icon instead: closing the terminal does not remove it. An ordinary restart, successful update or supported automatic restoration shows it again once that gateway is activated. The icon can disappear while the service is stopped for an update; it is not an update-progress indicator. `nanobot gateway stop` removes it without changing configuration or chats. +Attached launchers share the shortcut until the last matching WebUI launcher exits. With `--detach` or official-installer background launch, it remains until the gateway stops and returns after restart or update. It is a shortcut to a running instance, not a standalone app. -Use `--no-dock` to disable the icon for a launcher. In detached mode this also remembers the choice for that instance's later restarts; running `nanobot webui` without it enables the background icon again. The request is stored beside the runtime state as a small `.dock` file, without a URL or credentials. Choosing **Hide Dock Icon** or quitting the icon hides only this shortcut, not the gateway or its tasks. It stays hidden until another explicit launch or service restart. The icon is not a standalone launcher to keep pinned when nanobot is stopped. - -The helper uses the installed Python and macOS frameworks, with no Xcode, extra Python dependency, executable download or separate updater. Its temporary application wrapper is private to the OS user. The login URL stays in memory and a private socket, never in process arguments or a file. The helper holds no installation or data lease, and protected restart does not start it until activation. A missing image or unavailable desktop does not prevent WebUI startup, updates or independent recovery. Non-loopback browser addresses continue to use the normal browser launcher. +**Hide Dock Icon** or quitting the icon hides the shortcut without stopping the gateway or its tasks, until the next explicit launch or service restart. In detached mode, `--no-dock` also disables it for later restarts; launching without that flag enables it again. ## Navigate a long conversation -On wide screens, use the message rail on the left to browse saved prompts; click one to jump to it. You can also search prompt summaries from the header. The WebUI loads messages near the selected prompt rather than the entire conversation. Scroll backward or forward to browse, or use the bottom arrow to return to the latest messages. If loading fails, your current content stays visible and you can retry. Older compatible hosts may only support navigation among messages that are already loaded. +The message rail on wide screens and prompt-summary search in the header jump to saved prompts, loading the surrounding messages as needed. Loading errors leave the current content available for retry. Older compatible hosts may only support navigation among already-loaded messages. ## Sharing access -The WebUI is an administration interface for one nanobot instance. Signed-in WebUI users can work with its saved topics and manage models, channels, Apps, automations, and settings within the gateway's supported capabilities. There are no per-user roles or private topic ownership boundaries. Remote package installation has an additional restriction described under [LAN Access](#lan-access); that restriction does not turn other WebUI users into read-only users. +The WebUI administers one nanobot instance. Signed-in users share saved topics and administrative controls; there are no per-user roles or private topic ownership boundaries. The [remote installation restriction](#lan-access) limits package installation, not other administrative access. Share WebUI access only with people you trust to administer the same agent. To give someone chat access without the administration interface, connect a [chat platform](./chat-apps.md) and configure its access policy. Channel approval still does not create a separate agent or memory store. For separate clients or users whose data must not mix, use [separate instances](./multiple-instances.md). -## First 10 Minutes - -Use the WebUI as the primary setup surface: - -1. Open **Settings → Models** and configure a provider, credential, and active model preset. -2. Send `Hello!` in a new topic to prove the selected model works. -3. Start a separate topic before project work, then choose the intended workspace and access mode. -4. Add only one capability next: a chat channel in **Channels**, a web/voice/image provider in **Settings**, or an App/MCP integration in **Apps**. -5. Restart when the WebUI shows a restart requirement, then test that capability with the smallest possible request. - -This path avoids hand-editing `config.json` for normal setup. Use the reference docs when you need an option the WebUI does not expose or when you manage config as code. - ## What It Is For | Area | Use it for | @@ -105,23 +81,17 @@ This path avoids hand-editing `config.json` for normal setup. Use the reference | Automations | Review, search, run, pause, edit, and delete scheduled and local-trigger agent turns | | Settings | Adjust models, providers, image generation, voice, web tools, runtime, and safety options | -### Optional GitHub invitation - -Returning users may see an illustrated invitation to star nanobot on GitHub. It follows the WebUI language and theme; the button's star animation also supports keyboard focus and respects reduced-motion preferences. **Maybe later**, the close button, or Escape dismisses it for now. **Don't ask again** or opening GitHub from the invitation stops future reminders for the gateway instance, including in other browsers. Starring is optional and never required to use nanobot. - ## Topic Workspace The sidebar is the topic switcher. Each topic keeps its own history, title, workspace selection, and linked automations. Use a new topic when you want a separate context; use fork when you want to continue from an existing point without changing the original thread. -On touch devices, sidebar action buttons stay visible with larger touch areas for topics, conversation groups, panes, and projects. Tap a title to select it or the adjacent action button for its menu. Desktop actions still appear on hover or keyboard focus. Press Escape in an action menu to return focus to its button and continue with Tab, including from the **Move to** submenu. ArrowLeft leaves the submenu and returns to **Move to** without closing the parent menu. Choosing **Rename** for a topic moves focus into its sidebar title. Edit the name in place, then press Enter or choose the checkmark to save; press Escape or choose × to cancel. A failed save keeps the draft and an error beside it so you can retry. Project and conversation-group names still use dialogs. Clicking outside a menu keeps focus at the clicked destination. - -Drag a topic within its current sidebar group to keep frequently used work in your preferred order. Drag a topic from the sidebar into the composer when you want to reference it in the next message instead of switching to it. +Drag topics within a sidebar group to reorder them. **Rename** edits a topic title in place; a failed save keeps the draft for retry. ### Conversation groups and panes Open a topic's sidebar action menu and choose **Create group** to turn it into a conversation group. Use **Add pane** in the workbench header to start another topic alongside it. A group holds up to four panes. To bring in an existing topic, drag it onto the group or use **Move to** in its action menu. -Use **Pane layout** to choose columns, rows, a grid, BSP, or a main pane with a stack. Drag a divider to resize panes. Each pane has its own conversation; select one to direct the shared composer to that topic. Group membership and layout persist across refreshes. Grouping topics does not merge their histories. +**Pane layout** controls the arrangement of resizable panes. Selecting a pane directs the shared composer to that topic. Group membership and layout persist across refreshes; grouping does not merge topic histories. To use work from another topic, mention it with `@` and tell nanobot what you need. See [Composer](#composer) for how to add a topic reference. @@ -129,42 +99,32 @@ To use work from another topic, mention it with `@` and tell nanobot what you ne The message timeline shows replies and agent activity. Expand the **Worked for** section to inspect the reasoning and tool activity for a completed turn. -To load earlier messages, scroll past the oldest loaded message, or pull down far enough and release on touch devices. The muted loading indicator settles into view while the request runs. When loading succeeds, the indicator and its temporary space disappear and normal message spacing returns. If loading fails, the blocks turn red; hover for error details, then pull again or select the red blocks to retry. If there are no earlier messages, pulling at the real history boundary briefly shows **No earlier messages**. +Scroll past the oldest loaded message, or pull down and release on touch devices, to load earlier history. A red indicator offers error details and retry; **No earlier messages** marks the history boundary. -If the connection drops, the host control shows **Reconnecting**. Tasks in persistent topics can continue during the interruption. After reconnecting, task indicators and completed replies update automatically, including topics you have switched away from. Some text generated while disconnected may appear only after the task finishes. [Temporary chats](#temporary-chats) end when their connection is lost. +Tasks in persistent topics can continue while the connection is lost. Status and completed replies update after reconnecting; some missed text may appear only when the task finishes. [Temporary chats](#temporary-chats) end on connection loss. -When the agent writes or edits files, the activity item shows the target path, status, and changed line counts. Choose **Settings → Appearance → File edit display** to control the detail: **Summary** shows the change summary, **Diff** shows available unified patches inline, and **Collapsed diff** lets you expand them with **View diff**. Large diffs may hide unchanged lines or truncate the inline preview. Select the filename in the activity row to open the read-only file preview panel. +The context indicator beside the model badge shows context-window usage. **Recent rounds** includes token usage, generation time and KV cache hits when reported. Provider figures may be estimated or unavailable and are not a billing statement. -Files open as tabs in one preview pane. Select another file to add or switch a tab without reopening the pane; close a tab with its **×**, or close the pane with **Escape**. Tabs and width follow each session while the WebUI remains open. They are kept only in memory and cleared when that session is deleted or the connection ends. The pane overlays the conversation on narrow screens. +During compaction, the model switches to a summary plus subsequent messages; the original messages remain in chat history. Use `/compact` to compact the current topic manually. See [Memory](./memory.md) for compaction and Dream consolidation. -Markdown files open in **Preview**, with formatted headings, lists, tables and code blocks. Select **Source** to see the original Markdown with line numbers, then **Preview** to return. The control changes only the display; it does not edit or read the file again. Each newly opened or selected file starts in Preview. Images in Markdown appear as links and do not load automatically. Local links open through the same file access checks; relative paths start from the document's folder. Section-only links remain text. HTML and MDX components do not execute. +### File and diagram previews -Text previews include up to 384 KiB, with a notice when the file is truncated. Large source previews show readable text before adding syntax colors; very large or minified source stays plain text. All previewed text remains available for selection and browser search, and the source pane scrolls in both directions. +File activity shows the path, status and changed line counts. **Settings → Appearance → File edit display** offers **Summary**, inline **Diff**, or **Collapsed diff** with **View diff**. Large patches may omit unchanged lines or be truncated. Select a filename to open its read-only preview. -PNG, JPEG, GIF and WebP files up to 8 MiB can be previewed as images. Hover or focus an image file reference for a compact quick look, or select it to open the pane. Select the preview image for the full-size viewer, which supports zoom controls, pinch-to-zoom and panning. HTML and SVG files remain read-only source previews rather than executable pages. +Files share a tabbed preview pane. Tabs and pane width are remembered per topic until the session is deleted or the WebUI connection ends. -A plain image file link does not automatically insert a large image into the reply. Explicit Markdown images appear inline; image attachments use a compact gallery, showing at most four thumbnails before a count of the remaining images. An image already displayed inline is not duplicated in the attachment gallery. +Selecting a Markdown file opens **Preview**; **Source** shows the original text. Relative file links resolve from the document's folder and follow the same access checks. Images are not loaded automatically, section-only links remain text, and HTML/MDX components do not execute. -Mermaid code fences show their source while a reply is being generated, then render a diagram when the reply finishes. Choose **Source** or **Diagram** to switch views, or **Copy source** to copy the original code. **Enlarge diagram** opens a viewer with zoom buttons, pinch-to-zoom and drag-to-pan. With the viewport focused, use **+**, **−** and **0** to zoom or reset, and arrow keys to pan; **Escape** closes the viewer. +Text previews are limited to 384 KiB and indicate truncation. Very large or minified source may remain plain text. Image previews support PNG, JPEG, GIF and WebP up to 8 MiB. HTML and SVG files display as read-only source. -If a diagram cannot be rendered, its source stays available with an error message. Links, external images and executable HTML inside diagrams are disabled. +Explicit Markdown images appear inline; image attachments use a gallery. Ordinary image file links open the preview instead. -Select a file reference to preview it. Right-click the reference or its preview tab to copy its absolute or project-relative path. Keyboard users can focus a reference and press **Shift+F10**. Paths are resolved on the gateway machine, which may not be the computer running your browser. Files outside the project do not have a project-relative path. If a reference cannot be resolved, you can still copy the original reference; the menu does not invent an absolute path. Finder, external editor and terminal launching are not available from this browser menu. +Mermaid diagrams render after the reply finishes. The source remains available if rendering fails. Links, external images and executable HTML inside diagrams are disabled. + +Right-click a file reference or preview tab to copy its absolute or project-relative path on the connected host. Files outside the project have no project-relative path; unresolved references can only be copied as written. File previews follow the active topic's access mode. Restricted workspace access previews only files under the selected workspace. Full Access can preview files outside the workspace when that access mode is allowed by the gateway. -Website links normally open in a new browser tab. Right-click a link (or press **Shift+F10** while it is focused) for link actions. On mobile, use the reply's **Message actions → View links** menu. **Preview website** appears only when the current browser and URL allow credential-isolated embedding; otherwise the menu explains the restriction and keeps **Open in browser** and **Copy link** available. Sites can still refuse embedding through their own security headers. nanobot does not proxy pages or bypass those restrictions; use **Open in browser** instead. - -On touch devices with Visual Viewport support, the app follows the visible area when the on-screen keyboard opens or pans the page. Navigation and the composer stay in view while messages scroll independently. Session search also follows the visible area: the search field stays above the keyboard and results scroll inside the dialog. In short landscape viewports, its input and results sit side by side so a result remains reachable. Taller dialogs scroll from their top instead of centering content outside the visible area. The `@` mention and `/` command menus use the visible app area above or below the composer, including when the keyboard pans the page. Scroll within a menu to reach more results. Mention rows use the app's larger touch targets on phones while retaining desktop density. In very short, wide viewports (such as landscape with the keyboard open), menus sit beside the input instead of overflowing the scrollable composer. Scroll the menu for more candidates and the input area for its controls. If the browser bars and keyboard leave no usable page area, dismiss the keyboard or return to portrait. Pinch zoom keeps the existing layout instead of resizing it to the magnified area; normal fitting resumes when you return to the default zoom. Non-touch desktop and native-host layout remain unchanged. - -On touch devices, compact text fields use a readable 16px minimum baseline to avoid Safari automatically zooming the page on focus. Desktop field density and manual page zoom remain unchanged. - -On touch devices, preview tab controls and the full-screen image viewer's close button use larger touch areas without enlarging the icons. Preview tabs remain horizontally scrollable when space is limited. - -Open the context indicator beside the composer model badge to see how much of the model's context window is in use. The **Recent rounds** chart shows input tokens for each logical model round, including tool-call rounds. Hover or focus a bar for input tokens, output tokens, generation time, and the KV cache hit rate when reported. Provider usage may be estimated or unavailable; these figures are not a billing statement. - -When nanobot compacts context, the timeline shows its progress and outcome. The model continues with a summary and any messages after it; messages covered by the summary remain in your chat history but are no longer sent to the model verbatim. Use `/compact` to compact the current topic's context manually. See [Memory](./memory.md) for compaction and Dream consolidation. - ### Model failures After a model request fails and automatic retries stop, the WebUI shows the failure category. Use **Continue** to resume from the saved conversation, or open model settings to change the model or correct its authorization. Review completed work before continuing: saved tool results are retained, but the model can choose to call tools again. Continuing does not resend the original message. Sending a new message or dismissing the notice clears the pending decision. Saved recovery decisions remain available after a refresh or gateway restart; temporary chats still follow their normal lifetime. @@ -175,17 +135,13 @@ When nanobot delegates work to subagents, a work group appears under the request Work groups follow the browser's **Activity details** preference: **Auto** opens running work and folds it when all tasks finish; **Expanded** keeps it open by default. You can also expand or fold a group manually to check individual outcomes, including failures and partial results. -Select a task to open its read-only conversation on the right, or across the screen on mobile. Read its messages, tool activity, file edits, and results, including formatted Markdown. Closing the details leaves the task running; its stop button cancels only that task. Give follow-up instructions to nanobot in the main conversation. +Select a task for its read-only conversation and tool activity. Closing the details leaves it running; its stop button cancels only that task. Give follow-up instructions to nanobot in the main conversation. These controls appear when the connected host supports subagent tasks. See [Subagents](./concepts.md#subagents) for cancellation, saved history, and gateway restart behavior. ## Temporary Chats -Use a temporary chat for a conversation that should not be added to nanobot's topic history or long-term memory: - -1. Select **New topic**. -2. Select the **Temporary chat** control in the page header. -3. Send the first message. +Start **New topic → Temporary chat** for a conversation that should not be added to topic history or long-term memory. You can keep more than one temporary chat open and switch between them under **Temporary chats** in the sidebar while the current WebUI connection remains open. Reloading or closing the page, restarting the gateway, or losing the WebSocket connection ends all of them. They cannot be recovered afterward. @@ -197,9 +153,9 @@ Temporary does not mean consequence-free. Requests still go to the configured mo Use the workspace picker to browse folders on the connected nanobot host, enter an absolute path, or return to recent and starred projects; favorites persist across gateway restarts. The host name appears above saved locations. Project paths refer to that machine, not the browser's filesystem. -Use the breadcrumb nodes or Back and Forward controls to navigate. **Last visited folder** returns directly to the folder you most recently left, restoring its directory columns, selected rows, filter, and scroll positions. **Filter this folder** only filters the current directory. Click the empty area in the path bar or press **Cmd/Ctrl+Shift+G** to enter a host path; Tab completes it and Enter opens it. Click outside the input or press Escape to cancel path editing; **Confirm** confirms the edited path. Browsing does not change the workspace until you choose **Confirm**. **Cancel** leaves the current workspace unchanged. Desktop uses directory columns with Shift+wheel horizontal scrolling; narrow screens show one folder at a time, with favorites and recent projects under **Saved locations**. Directory columns settle on complete rows after scrolling. +Browsing does not change the topic's workspace until you choose **Confirm**. **Filter this folder** searches only the current directory. **Cmd/Ctrl+Shift+G** opens host-path entry, with Tab completion; **Last visited folder** returns to the previous location. -On a compatible host without the optional directory-browser capabilities, manual path entry remains available. Browse and favorite requests are not sent to that host. The gateway still validates the selected workspace and owns its access policy. +Manual path entry remains available when the connected host does not support directory browsing. The host validates the selected path and access policy. Selecting a project does not replace the configured agent workspace. The two paths have different responsibilities: @@ -219,9 +175,7 @@ In Restricted mode, ordinary file and shell work stays inside the selected proje ## Composer -With voice transcription configured, the idle composer uses one button for voice input when empty and Send when text or attachments are present; speech is transcribed into the draft before sending. - -The composer supports plain messages, image attachments, voice input when transcription is configured, slash commands, and `@` mentions for installed Apps, MCP presets, or saved topics. +The composer supports text, image attachments, slash commands and `@` mentions. With voice transcription configured, the empty composer offers voice input; transcription is added to the draft before sending. To reference another topic, type or paste its complete handle (such as `@luma`), choose it from the `@` menu, or drag it from the sidebar into the composer. Recognized handles are highlighted; unknown handles remain plain text. You can reference up to eight different topics in one message. @@ -229,21 +183,13 @@ Ask nanobot to find, read, or send messages to other saved topics, including tho On touch-primary phones and tablets, **Enter** inserts a newline; tap the send arrow to submit. This also applies when a coarse-pointer tablet has a hardware keyboard attached. On desktop, **Enter** sends and **Shift+Enter** adds a newline. An open slash-command or mention menu takes precedence: Enter selects its item. -While a response is running, desktop Enter adds your input to one waiting message. Further inputs append in order, separated by newlines, with their attachments and references retained. The complete message is sent once the current response finishes. Press Enter again with an empty input or choose **Send now** to insert it immediately as guidance for the active turn. The send arrow also includes any waiting content when submitting a new draft. Use **Edit message** to revise the complete message or **Delete message** to discard it. If an addition would exceed the message limits, it stays in the input so you can revise it. The primary button shows **Stop** when there is no sendable draft; stopping or a failed send keeps the waiting message for manual sending. - -The model badge shows the current model or preset and links to model settings when setup is incomplete. +During a response, desktop Enter appends input to one waiting message, preserving order, attachments and references. It sends when the response finishes. **Send now** or Enter on an empty input sends it immediately as guidance; the send arrow submits the waiting content together with any draft. **Edit message** and **Delete message** act on the whole waiting message. Additions that exceed limits stay in the input. Stopping a turn or a failed send preserves the waiting message for manual sending. For image generation, configure an image provider first and then use the WebUI image mode from the composer. See [`image-generation.md`](./image-generation.md) for provider setup and output behavior. ## Channels -Open **Channels** to connect chat apps without assembling JSON by hand. Search for a platform, open its setup panel, and follow the fields or QR flow shown for that channel. The guided setup can: - -- install missing optional channel support when the WebUI is running locally; -- collect platform credentials while preserving previously saved values; -- handle supported QR-based login flows; -- validate the connection and show actionable setup errors; -- tell you when the gateway needs to restart. +**Channels** provides credential or QR-based setup, connection validation, and restart guidance. Missing channel support can be installed from a local WebUI. The platform itself may still require you to create a bot, enable event permissions, copy a token, or configure a webhook. Use [`chat-apps.md`](./chat-apps.md) for those platform-side prerequisites and for manual JSON/reference options. @@ -251,19 +197,17 @@ Test a new channel with a private DM. When a supported channel sends a pairing c ## Apps -Open Apps from the sidebar to review and manage installable capabilities. The default **Ready** view shows only capabilities that can be used immediately: +**Apps → Ready** lists capabilities available for use: - **Agent Plugins** are local packages that can bundle skills, MCP servers, or both. A package under `/plugins/` is installed but remains inactive until you enable it in Apps. -- **CLI Apps** are local command-line adapters that nanobot runs on your machine. Their installer manages the executable and exposes its adapter through the same plugin activation model. Installing an adapter does not modify the native desktop or web app it connects to. +- **CLI Apps** are command-line tool adapters on the nanobot host. Install and enable an adapter before attaching it to a turn. - **MCP** lists Model Context Protocol servers. Presets provide known configurations, and the **Add MCP server** panel accepts stdio, HTTP, and SSE servers. Custom HTTP/SSE servers can use no authentication, OAuth, or request headers. After saving an OAuth server, choose **Connect** to open its sign-in page. Presets such as Xmind, Notion, and Linear already use OAuth. HTTPS and localhost WebUIs return automatically; a remote plain-HTTP WebUI shows one field for pasting the complete localhost callback URL. CLI Apps run with a limited environment that excludes provider API keys. On Unix, they inherit `XDG_RUNTIME_DIR` when it is set in the gateway's environment, so desktop CLIs such as Obsidian can locate the running application. Start the gateway in the same desktop session as the app to inherit that runtime directory. -Apps intentionally does not list nanobot runtime support packages such as `api` or `bedrock`. Those packages enable providers, servers, or channels; they are not tools that can be attached to a turn with `@`. Manage them from **System**, **Models**, or **Web**. PDF and common Office document readers are included in nanobot and activate automatically when a file is attached. The equivalent CLI for optional integrations remains `nanobot plugins`. See [`cli-reference.md`](./cli-reference.md#optional-features). That command manages nanobot runtime extras, not Agent Plugin packages. +Manage optional runtime support from **System**, **Models**, or **Web**, or use [`nanobot plugins`](./cli-reference.md#optional-features). That command manages runtime extras, not Agent Plugin packages. PDF and common Office attachment readers require no setup. -Some MCP presets connect to hosted keyless endpoints. For example, the Firecrawl preset uses Firecrawl's hosted MCP endpoint for search, scrape, crawl, and extraction tools without requiring an API key. This does not replace nanobot's built-in web search provider; mention the Firecrawl MCP preset with `@` when a turn needs Firecrawl's richer web data tools. - -The Parallel Search preset connects to the free, anonymous Parallel Search MCP endpoint and exposes `web_search` and `web_fetch` without requiring an API key. It is an optional integration and does not replace nanobot's built-in web search provider; mention `@parallel-search` when a turn should use it. +Keyless hosted presets include **Firecrawl** for search, scraping, crawling and extraction, and **Parallel Search** for `web_search` and `web_fetch`. They are optional MCP tools and do not change the built-in web search provider. After a CLI App or MCP server is available, mention it from the composer with `@` to attach that tool to the next message. Plugin-provided skills participate in normal skill discovery and can be invoked with `$skill-name`. @@ -288,15 +232,7 @@ There are two user-facing automation types: For recurring background checks that should stay quiet unless there is something useful to report, use the protected heartbeat job by editing `HEARTBEAT.md` instead of creating a chat automation. -Use the Automations view to: - -- Filter by all, active, paused, needs-attention, or system jobs. -- Search by task name, message, trigger command, linked topic, schedule, or status. -- Sort by next run, last run, updated time, or name. -- Run scheduled automations now. -- Pause or resume, rename, or delete user-created automations. -- Copy the CLI command for local triggers. -- Inspect protected system automations without changing them. +The Automations view manages user-created jobs and can run scheduled jobs immediately. Protected system jobs are read-only. Search accepts plain text and field filters such as `name:backup`, `chat:WeChat`, `schedule:09:30`, `cron:"0 23 * * *"`, `trigger`, and `status:paused`. @@ -306,13 +242,9 @@ Local triggers do not have a WebUI "Run now" action because each run needs a mes ## Settings -Settings is the control surface for browser-local and gateway-backed runtime configuration. Use it to review or adjust model presets, providers, image generation, voice transcription, web tools, chat channels, Apps, Automations, Skills, runtime identity, and advanced safety controls. +Runtime settings may require a gateway restart; the WebUI marks those controls. -Some settings take effect immediately. Runtime settings that affect the gateway or agent process may require a restart; the WebUI shows that requirement next to the relevant control. - -Browser-only display preferences take effect immediately and persist in the current browser. In **Appearance → Local preferences**, **Reading text size** offers three A buttons: small, standard (default), and large. They adjust conversation text, Markdown and code, with a coordinated message input size; navigation and toolbars keep their interface size. Browser zoom remains available. These preferences, including file edit display mode, do not change gateway configuration. - -To add a model, follow [Configure Your Model](./quick-start.md#2-configure-your-model). +**Appearance → Local preferences** applies immediately to the current browser without changing gateway configuration. **Reading text size** adjusts conversation text, Markdown, code and the input, but not navigation or toolbars; standard is the default. ## LAN Access @@ -349,26 +281,12 @@ Remote WebUI clients with a valid token can view and use Apps and installed skil -Use this only for a private deployment where every authenticated WebUI user is trusted to change nanobot's Python environment and install workspace skill instructions or scripts. If you publish the WebUI through Nginx, Caddy, Cloudflare Tunnel, or a similar service, treat it as remote access and leave package and skill installs disabled unless that is intentional. +Enable remote installation only for a private deployment whose users are trusted to change the Python environment and install skill instructions or scripts. Reverse-proxy and tunnel deployments count as remote access. Optional feature installs use pip's configured package index, including `PIP_INDEX_URL`. skills.sh marketplace installs use `npx` instead. -Leave remote package installs disabled when the WebUI is exposed beyond a private, trusted network. - ## Troubleshooting -### Links and website previews - -HTTP(S) links in replies have a **Link actions** menu: right-click the link or press Shift+F10 while it is focused. Touch and hold keeps the browser's native link menu. For in-app actions on touch devices, open the message's existing **Message actions → View links** entry. It lists only the web links rendered in that message, not URLs inside code blocks or file references. Choose a link to copy it, open it externally, or preview it beside the current conversation. On phone-sized screens, Copy and Message actions sit below the message, leaving the full text width available. Message actions opens a bottom sheet; close it with its close button, by tapping outside, or with Escape. Desktop keeps the hover-triggered message popover. On desktop, hovering or focusing a message also reveals a short timestamp below its actions: a 24-hour clock for today, or month/day for every other date. Hover or focus that label for the full local date and time, including the year. Replies use their completion timestamp when available, otherwise their creation timestamp. There is no persistent action button beside each link and no custom long-press gesture to interfere with scrolling or text selection. Ordinary clicks still open links in a browser tab. File and session links keep their own behavior. - -The sidebar shares space with file previews and has refresh, external-open and close controls. Escape closes it when focus is in the nanobot page, unless a menu or dialog handles Escape first. Once focus is inside a third-party page, use the sidebar's close button. The opened address and width are remembered per session for this app connection, not written to browser storage. Returning to a session reloads the original address; it does not preserve the website's DOM, navigation history or forms. The header shows the **original link**, not a live address bar for navigation inside the embedded page. - -This is a restricted preview, not a full browser. It requires browser support for credentialless iframes and is disabled in the native host until a separate untrusted-content boundary is available. Unsupported browsers can still copy links and open new tabs. Previews use an opaque-origin sandbox with scripts but without same-origin access, forms, popups, downloads or top navigation. No gateway token, host bridge or parent storage is passed into the frame. - -Sites may refuse embedding via CSP or X-Frame-Options, and sign-in or some interactive features may not work. Use **Open in browser** if the frame is blank or reports a failure. The browser does not reliably expose an embedding failure to nanobot, so a frame load event is not presented as a success signal. Nanobot does not proxy pages or bypass their headers. Same-origin nanobot URLs and HTTP pages embedded from an HTTPS WebUI are not previewed. - -`localhost` and loopback addresses refer to the device running your browser, not a remote nanobot gateway. This feature does not forward remote ports. - ### Connection checks If the page does not open, check these in order: @@ -376,9 +294,7 @@ If the page does not open, check these in order: 1. `nanobot agent -m "Hello!"` works in the same Python environment. 2. `~/.nanobot/config.json` does not explicitly set `channels.websocket.enabled` to `false`. 3. `nanobot gateway` is still running. -4. You are opening port `8765`, not the gateway health port. +4. You are using the WebUI port (`8765` by default), not the health port (`18790` by default). 5. LAN access uses `host: "0.0.0.0"` and a token or token issue secret. -If voice input asks for a secure connection, use HTTPS with a certificate the device trusts. Browsers do not expose microphone capture to `http://` origins. - For detailed diagnostics, see [`troubleshooting.md#webui-problems`](./troubleshooting.md#webui-problems). For frontend development, see [`../webui/README.md`](../webui/README.md). diff --git a/webui/COMPONENTS.md b/webui/COMPONENTS.md index b9f3f3a13..ce2ab7790 100644 --- a/webui/COMPONENTS.md +++ b/webui/COMPONENTS.md @@ -23,7 +23,7 @@ Change state selectors to inspect streaming, completion, disabled, missing-media Feature screens that own gateway requests, session state, or host connections are indexed with their source and callers. Exercise their complete workflows in the running WebUI. The gallery does not emulate those services. -Runtime adapters and presentation views have separate responsibilities. Adapters subscribe to clients, load data, enforce browser restrictions, and perform service actions. Their views receive display data and operation callbacks. Production screens and gallery examples mount the same views, including host menus, pairing, file/web previews, session tasks, automation results, version information, and notification preferences. Connected source entries link to the corresponding view examples. +Runtime adapters and presentation views have separate responsibilities. Adapters subscribe to clients, load data, enforce browser restrictions, and perform service actions. Their views receive display data and operation callbacks. Production screens and gallery examples mount the same views, including host menus, pairing, file previews, session tasks, automation results, version information, and notification preferences. Connected source entries link to the corresponding view examples. Every channel registration has a preview. Channels with shared configuration forms use their production setup view; Linear, Feishu, Weixin, and WhatsApp use their channel-owned views, including authorization, verification, assistant management, and connection reset. The source inventory includes channel `webui/index.ts` registrations as well as `.tsx` components. Connected adapters link to the views they own. diff --git a/webui/src/components/MessageBubble.tsx b/webui/src/components/MessageBubble.tsx index 9315bb77e..bfb768578 100644 --- a/webui/src/components/MessageBubble.tsx +++ b/webui/src/components/MessageBubble.tsx @@ -7,7 +7,7 @@ import { useState, type ReactNode, } from "react"; -import { Activity, Check, ChevronRight, CircleAlert, Clock3, Copy, Link2, Quote, Wrench } from "lucide-react"; +import { Activity, Check, ChevronRight, CircleAlert, Clock3, Copy, Quote, Wrench } from "lucide-react"; import { useTranslation } from "react-i18next"; import { DisclosureContent } from "@/components/ui/disclosure"; @@ -145,7 +145,6 @@ interface MessageBlockMenuActionsProps { isTurnStreaming?: boolean; onForkFromHere?: () => void; activity?: MessageBlockMenuActivity; - onViewLinks?: () => void; sheet?: boolean; } @@ -155,7 +154,6 @@ export function MessageBlockMenuActions({ isTurnStreaming = false, onForkFromHere, activity, - onViewLinks, sheet = false, }: MessageBlockMenuActionsProps) { const { t } = useTranslation(); @@ -248,10 +246,6 @@ export function MessageBlockMenuActions({ ) : null} ) : null} - {onViewLinks ? : null} , open: boolean) { - const [links, setLinks] = useState([]); - useLayoutEffect(() => { - const element = root.current; - if (!open || !element) return; - const collect = () => { - const unique = new Map(); - element.querySelectorAll("[data-assistant-selectable] a[data-web-link]").forEach((anchor) => { - const href = anchor.getAttribute("href") ?? ""; - const url = parseWebLink(href); - if (url && !unique.has(url.href)) { - unique.set(url.href, { href, title: anchor.textContent?.trim() || href }); - } - }); - setLinks(Array.from(unique.values())); - }; - collect(); - // Markdown is lazy-loaded; collect again when its real links appear/change. - const observer = new MutationObserver(collect); - observer.observe(element, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ["href"] }); - return () => observer.disconnect(); - }, [root, open]); - return links; -} - -const itemClassName = `${floatingItemClassName} ${floatingItemFocusClassName} w-full min-h-11 text-start hover:bg-muted/70`; - -/** A drill-in inside the message's action surface, not another floating layer. */ -export function MessageLinksMenu({ links, onBack, onClose, expanded = false }: { - links: MessageWebLink[]; - onBack: () => void; - onClose: () => void; - expanded?: boolean; -}) { - const { t } = useTranslation(); - const openPreview = useContext(WebPreviewContext); - const [selected, setSelected] = useState(links.length === 1 ? links[0].href : null); - const active = links.find((link) => link.href === selected); - const backRef = useRef(null); - useLayoutEffect(() => { backRef.current?.focus({ preventScroll: true }); }, [selected]); - return
- - {active ? { onClose(); openPreview(active.href); } : undefined} /> - :
- {links.map((link) => )} -
} -
; -} - -function MessageLinkActions({ link, onClose, onPreview }: { - link: MessageWebLink; - onClose: () => void; - onPreview?: () => void; -}) { - const { t } = useTranslation(); - const restriction = onPreview ? currentWebPreviewRestriction(parseWebLink(link.href)) : null; - const [feedback, setFeedback] = useState<"copied" | "copyFailed" | null>(null); - const mounted = useRef(false); - useLayoutEffect(() => { - mounted.current = true; - return () => { mounted.current = false; }; - }, []); - const copy = async () => { - const success = await copyTextToClipboard(link.href); - if (mounted.current) setFeedback(success ? "copied" : "copyFailed"); - }; - return
-

{link.href}

- {onPreview && !restriction ? : null} - {t("webPreview.external")} - - {restriction ?

{t(`webPreview.${restriction}`)}

: null} - {feedback ?

{t(`webPreview.${feedback}`)}

: null} -
; -} diff --git a/webui/src/components/PreviewPane.tsx b/webui/src/components/PreviewPane.tsx index 4dc3459eb..add566d98 100644 --- a/webui/src/components/PreviewPane.tsx +++ b/webui/src/components/PreviewPane.tsx @@ -1,5 +1,5 @@ import { useEffect, useId, useRef, useState, type CSSProperties, type PointerEvent, type ReactNode } from "react"; -import { Globe2, PanelRightClose, X } from "lucide-react"; +import { PanelRightClose, X } from "lucide-react"; import { useTranslation } from "react-i18next"; import { FileReferenceIcon, fileKindForPath, splitFilePath } from "@/components/FileReferenceChip"; import { FileActions } from "@/components/FileActions"; @@ -7,10 +7,6 @@ import { SidebarSelectionHighlight, SIDEBAR_SELECTION_ITEM_CLASS } from "@/compo import type { PreviewTab } from "@/hooks/useFilePreviewState"; import { cn } from "@/lib/utils"; -function tabName(tab: PreviewTab) { - return tab.kind === "web" ? new URL(tab.value).host : splitFilePath(tab.value).name; -} - /** One stable sidebar shell: switching targets never replays its opening animation. */ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onCloseTab, onClose, onResizeStart, children }: { tabs: PreviewTab[]; @@ -72,7 +68,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos highlightClassName="rounded-compact"> {tabs.map((tab, index) => { const selected = tab.id === activeId; - const name = tabName(tab); + const name = splitFilePath(tab.value).name; const item =
@@ -104,7 +99,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
; - return tab.kind === "file" ? {item} : item; + return {item}; })} diff --git a/webui/src/components/WebLink.tsx b/webui/src/components/WebLink.tsx index d1389bb8e..fdb802ade 100644 --- a/webui/src/components/WebLink.tsx +++ b/webui/src/components/WebLink.tsx @@ -1,108 +1,21 @@ -import { createContext, useContext, useEffect, useRef, useState, type ComponentPropsWithoutRef } from "react"; -import * as Menu from "@radix-ui/react-menu"; -import { useTranslation } from "react-i18next"; +import type { ComponentPropsWithoutRef } from "react"; -import { floatingItemClassName, floatingItemFocusClassName, floatingSurfaceClassName, floatingSurfaceMotionClassName } from "@/components/ui/floating-surface"; -import { useFloatingPortal } from "@/components/ui/floating-portal"; -import { copyTextToClipboard } from "@/lib/clipboard"; -import { currentWebPreviewRestriction, parseWebLink } from "@/lib/web-preview"; -import { cn } from "@/lib/utils"; - -export const WebPreviewContext = createContext<((url: string) => void) | undefined>(undefined); - -const itemClassName = `${floatingItemClassName} ${floatingItemFocusClassName} cursor-default`; +function parseWebLink(value: string): URL | null { + if (value.length > 8192 || value.includes("\\") + || Array.from(value).some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127)) return null; + try { + const url = new URL(value); + return /^https?:$/.test(url.protocol) && !url.username && !url.password ? url : null; + } catch { + return null; + } +} export function WebLink({ href = "", children, ...props }: ComponentPropsWithoutRef<"a">) { const url = parseWebLink(href); - if (url) return {children}; // Keep the renderer's relative media/document and mail links unchanged. const relative = !/^[a-z][a-z\d+.-]*:/i.test(href) && !href.includes("\\") && !Array.from(href).some((char) => char.charCodeAt(0) < 32); - return relative || /^(mailto:|tel:|#)/i.test(href) + return url || relative || /^(mailto:|tel:|#)/i.test(href) ? {children} : <>{children}; } - -/** Keep links as links; secondary actions share the compact file-reference surface. */ -function WebsiteLink({ href, children, className, ...props }: ComponentPropsWithoutRef<"a"> & { href: string }) { - const { t } = useTranslation(); - const openPreview = useContext(WebPreviewContext); - const portal = useFloatingPortal(); - const [open, setOpen] = useState(false); - const restriction = open && openPreview ? currentWebPreviewRestriction(parseWebLink(href)) : null; - const [feedback, setFeedback] = useState<"copied" | "copyFailed" | null>(null); - const link = useRef(null); - const point = useRef({ x: 0, y: 0 }); - const anchor = useRef({ getBoundingClientRect: () => new DOMRect(point.current.x, point.current.y, 0, 0) }); - const interactedOutside = useRef(false); - const generation = useRef(0); - const pointerType = useRef(""); - - useEffect(() => () => { - generation.current += 1; - }, []); - - const changeOpen = (next: boolean) => { - generation.current += 1; - setOpen(next); - }; - const openAt = (x: number, y: number) => { - point.current = { x, y }; - interactedOutside.current = false; - setFeedback(null); - changeOpen(true); - }; - const copy = async () => { - const current = generation.current; - const copied = await copyTextToClipboard(href); - // Late clipboard results must not dismiss a new menu or report another URL. - if (current !== generation.current) return; - setFeedback(copied ? "copied" : "copyFailed"); - if (copied) changeOpen(false); - }; - - return - - { - event.stopPropagation(); - // Touch keeps the browser's native link preview/copy/share menu. Older - // WebKit exposes contextmenu as a MouseEvent, so remember the last pointer. - const type = (event.nativeEvent as PointerEvent).pointerType || pointerType.current; - if (type === "touch" || (!type && window.matchMedia("(pointer: coarse)").matches)) return; - event.preventDefault(); - openAt(event.clientX, event.clientY); - }} - onKeyDown={(event) => { - if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return; - event.preventDefault(); event.stopPropagation(); - const bounds = link.current!.getBoundingClientRect(); - openAt(bounds.left, bounds.bottom); - }} - onPointerDown={(event) => { - pointerType.current = event.pointerType; - }}> - {children} - - {feedback === "copied" ? {t("webPreview.copied")} : null} - - { event.preventDefault(); event.stopPropagation(); }} - onClick={(event) => event.stopPropagation()} - onInteractOutside={() => { interactedOutside.current = true; }} - onCloseAutoFocus={(event) => { - event.preventDefault(); - if (!interactedOutside.current) link.current?.focus(); - }}> - {openPreview && !restriction ? openPreview(href)}>{t("webPreview.open")} : null} - - {t("webPreview.external")} - - { event.preventDefault(); void copy(); }}>{t("webPreview.copy")} - {restriction ?

{t(`webPreview.${restriction}`)}

: null} - {feedback === "copyFailed" ?
{t("webPreview.copyFailed")}
: null} -
-
-
; -} diff --git a/webui/src/components/WebPreviewPanel.tsx b/webui/src/components/WebPreviewPanel.tsx deleted file mode 100644 index 50a0e8feb..000000000 --- a/webui/src/components/WebPreviewPanel.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - -import { WebPreviewPanelView } from "@/components/WebPreviewPanelView"; -import { isLoopbackHost } from "@/lib/network"; -import { currentWebPreviewRestriction, parseWebLink } from "@/lib/web-preview"; - -interface WebPreviewPanelProps { - url: string; -} - -export function WebPreviewPanel({ url: value }: WebPreviewPanelProps) { - const { t } = useTranslation(); - const [revision, setRevision] = useState(0); - const url = parseWebLink(value); - const restriction = currentWebPreviewRestriction(url); - return setRevision((n) => n + 1)}> - {!restriction ?