From 5310ae7b8b9866812355147b06256b54cf5941b3 Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Tue, 7 Oct 2025 20:57:13 +0100 Subject: [PATCH] chore: adapt for raw exposed json messages of webview fork --- src/ModMan/main.cpp | 2 +- src/ModManUi/src/native.ts | 5 +++-- thirdparty/webview | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ModMan/main.cpp b/src/ModMan/main.cpp index 76baa46b..01a1a5d4 100644 --- a/src/ModMan/main.cpp +++ b/src/ModMan/main.cpp @@ -68,7 +68,7 @@ namespace [&](const std::string& req) -> std::string { const auto name = req.substr(2, req.size() - 4); - return std::format("\"Hello from C++ {}!\"", name); + return webview::json_escape(std::format("Hello from C++ {}!", name)); }); // A binding that creates a new thread and returns the result at a later time. diff --git a/src/ModManUi/src/native.ts b/src/ModManUi/src/native.ts index f2531ffc..a0a0d25a 100644 --- a/src/ModManUi/src/native.ts +++ b/src/ModManUi/src/native.ts @@ -2,5 +2,6 @@ export interface NativeMethods { greet: (name: string) => Promise; } -// @ts-expect-error Typescript expects this to be an error, it is not here though -export const nativeMethods: NativeMethods = window as NativeMethods; +const windowWithWebViewExtensions = window as typeof window & {webview_binds: NativeMethods}; + +export const nativeMethods: NativeMethods = windowWithWebViewExtensions.webview_binds; diff --git a/thirdparty/webview b/thirdparty/webview index 1dfdba9f..ef12fdb8 160000 --- a/thirdparty/webview +++ b/thirdparty/webview @@ -1 +1 @@ -Subproject commit 1dfdba9f2be93616668b622c493276e724728386 +Subproject commit ef12fdb8a1ab068607cac191ff6a588f6a8e2161