mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Move webview2 options to application. Improve logging.
This commit is contained in:
parent
25e58edf28
commit
77ca8fe9e6
5 changed files with 23 additions and 16 deletions
|
|
@ -68,4 +68,4 @@ require (
|
|||
mvdan.cc/sh/v3 v3.7.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/wailsapp/wails/v3 => /Users/lea/GolandProjects/wails/v3
|
||||
replace github.com/wailsapp/wails/v3 => D:\GolandProjects\wails\v3
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package operatingsystem
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/wailsapp/wails/v3/pkg/w32"
|
||||
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package application
|
|||
import (
|
||||
"fmt"
|
||||
"github.com/wailsapp/go-webview2/webviewloader"
|
||||
"github.com/wailsapp/wails/v3/internal/operatingsystem"
|
||||
"golang.org/x/sys/windows"
|
||||
"os"
|
||||
"strconv"
|
||||
|
|
@ -320,10 +321,15 @@ func newPlatformApp(app *App) *windowsApp {
|
|||
func (a *App) logPlatformInfo() {
|
||||
var args []any
|
||||
args = append(args, "Go-WebView2Loader", webviewloader.UsingGoWebview2Loader)
|
||||
windowsVersion, err := w32.GetWindowsVersionInfo()
|
||||
if err == nil {
|
||||
args = append(args, "Version", windowsVersion)
|
||||
webviewVersion, err := webviewloader.GetAvailableCoreWebView2BrowserVersionString(a.options.Windows.WebviewBrowserPath)
|
||||
if err != nil {
|
||||
args = append(args, "WebView2", "Error: "+err.Error())
|
||||
} else {
|
||||
args = append(args, "WebView2", webviewVersion)
|
||||
}
|
||||
args = append(args, "Branding", w32.GetBranding())
|
||||
a.info("Windows Info:", args...)
|
||||
|
||||
osInfo, _ := operatingsystem.Info()
|
||||
args = append(args, osInfo.AsLogSlice()...)
|
||||
|
||||
a.info("Platform Info:", args...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,13 @@ type WindowsApplicationOptions struct {
|
|||
|
||||
// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
|
||||
DisableQuitOnLastWindowClosed bool
|
||||
|
||||
// Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used.
|
||||
// If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code.
|
||||
WebviewUserDataPath string
|
||||
|
||||
// Path to the directory with WebView2 executables. If empty WebView2 installed in the system will be used.
|
||||
WebviewBrowserPath string
|
||||
}
|
||||
|
||||
type BackdropType int32
|
||||
|
|
@ -41,13 +48,6 @@ type WindowsWindow struct {
|
|||
WindowMask []byte
|
||||
WindowMaskDraggable bool
|
||||
|
||||
// Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used.
|
||||
// If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code.
|
||||
WebviewUserDataPath string
|
||||
|
||||
// Path to the directory with WebView2 executables. If empty WebView2 installed in the system will be used.
|
||||
WebviewBrowserPath string
|
||||
|
||||
// WebviewGpuIsDisabled is used to enable / disable GPU acceleration for the webview
|
||||
WebviewGpuIsDisabled bool
|
||||
|
||||
|
|
|
|||
|
|
@ -1370,7 +1370,7 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
|
||||
opts := w.parent.options.Windows
|
||||
|
||||
webview2version, err := webviewloader.GetAvailableCoreWebView2BrowserVersionString(opts.WebviewBrowserPath)
|
||||
webview2version, err := webviewloader.GetAvailableCoreWebView2BrowserVersionString(globalApplication.options.Windows.WebviewBrowserPath)
|
||||
if err != nil {
|
||||
globalApplication.error("Error getting WebView2 version: " + err.Error())
|
||||
return
|
||||
|
|
@ -1383,8 +1383,8 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
disableFeatues = append(disableFeatues, "msSmartScreenProtection")
|
||||
}
|
||||
|
||||
chromium.DataPath = opts.WebviewUserDataPath
|
||||
chromium.BrowserPath = opts.WebviewBrowserPath
|
||||
chromium.DataPath = globalApplication.options.Windows.WebviewUserDataPath
|
||||
chromium.BrowserPath = globalApplication.options.Windows.WebviewBrowserPath
|
||||
|
||||
if opts.WebviewGpuIsDisabled {
|
||||
chromium.AdditionalBrowserArgs = append(chromium.AdditionalBrowserArgs, "--disable-gpu")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue