Inject nativeshell script at the profile level to fix first-load race

On startup the WebEngineView first shows the bundled qrc find-webclient
page and then navigates to the server web client. That cross-origin
navigation moves the view to a new renderer process, and a user script
registered on the view is not reliably delivered to it, so the first
load of the web client comes up without window.NativeShell. jellyfin-web
then falls back to its HTML video player: playback works, but the native
mpv player, MPRIS, and client settings are silently unavailable until
the page is reloaded.

Registering the script on the profile instead makes injection apply to
every load, including the first one. Verified on Linux (Qt 6.11.2,
Wayland): before the change window.jmpInfo was undefined on every cold
start until a reload; after it is present on the first load.
This commit is contained in:
Charlie Strauss committed 2026-08-31 01:09:43 -06:00
1 parent 4e1010b90f
commit cabddc6090
1 file changed
+1 -1
+1 -1
View File
@@ -275,7 +275,7 @@ Window
worldId: WebEngineScript.MainWorld
}
web.userScripts.collection = [ nativeshell ];
web.profile.userScripts.collection = [ nativeshell ];
}
onLoadingChanged: function(loadingInfo)