fix: grant clipboard-write permission to webview sessions (fixes #154)

The Copy button in the Open WebUI interface silently failed on
GNOME/Wayland/Flatpak because the webview session permission handlers
did not include 'clipboard-sanitized-write'. Electron denied the
navigator.clipboard.writeText() call, but the web app saw no error
and briefly showed 'Copied' without actually writing to the clipboard.

Added 'clipboard-sanitized-write' to both permission handler whitelists:
- Per-connection content window handler
- session-created handler for webview partition sessions
This commit is contained in:
Timothy Jaeryang Baek 2026-04-27 14:32:35 +09:00
parent 27a3075c3a
commit 61db9dc10f
3 changed files with 9 additions and 3 deletions

View file

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.0.13] - 2026-04-27
### Fixed
- **Copy Button on Linux (GNOME/Wayland/Flatpak).** Fixed the "Copy" button in the Open WebUI interface not actually writing to the system clipboard on Linux. The webview session was missing the `clipboard-sanitized-write` permission required by Electron for `navigator.clipboard.writeText()` to work.
## [0.0.12] - 2026-04-25 ## [0.0.12] - 2026-04-25
### Added ### Added

View file

@ -1,6 +1,6 @@
{ {
"name": "open-webui", "name": "open-webui",
"version": "0.0.12", "version": "0.0.13",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"description": "Open WebUI Desktop", "description": "Open WebUI Desktop",
"main": "./out/main/index.js", "main": "./out/main/index.js",

View file

@ -737,7 +737,7 @@ function createContentWindow(url: string, connectionId: string): BrowserWindow {
session session
.fromPartition(`persist:connection-${connectionId}`) .fromPartition(`persist:connection-${connectionId}`)
.setPermissionRequestHandler((_webContents, permission, callback) => { .setPermissionRequestHandler((_webContents, permission, callback) => {
const allowedPermissions = ['media', 'mediaKeySystem', 'notifications'] const allowedPermissions = ['media', 'mediaKeySystem', 'notifications', 'clipboard-sanitized-write']
callback(allowedPermissions.includes(permission)) callback(allowedPermissions.includes(permission))
}) })
@ -1213,7 +1213,7 @@ if (!gotTheLock) {
// Grant media / notification permissions for webview partition sessions // Grant media / notification permissions for webview partition sessions
// so that auth flows, media capture, and notifications work correctly. // so that auth flows, media capture, and notifications work correctly.
newSession.setPermissionRequestHandler((_webContents, permission, callback) => { newSession.setPermissionRequestHandler((_webContents, permission, callback) => {
const allowed = ['media', 'mediaKeySystem', 'notifications', 'clipboard-read'] const allowed = ['media', 'mediaKeySystem', 'notifications', 'clipboard-read', 'clipboard-sanitized-write']
callback(allowed.includes(permission)) callback(allowed.includes(permission))
}) })
}) })