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