webview2

package
v0.0.0-...-6a5c706 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Package webview abstracts Edge WebView 2 updates for a Wineprefix.

Index

Constants

View Source
const VersionPath = `HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView`

VersionPath is the registry path to open and check against the DisplayVersion key for retreiving the current installed version of Edge WebView2.

Variables

View Source
var Client = &http.Client{}

Client is the http.Client used for requests. http.DefaultTransport will be used to append Microsoft's certificate.

Functions

func Current

func Current(pfx *wine.Prefix) string

Current returns the current installed WebView2 version in the given Wineprefix, by invoking the registry file. If an error occured, an empty string will be returned.

It is reccomended to store the registry from [Prefix.Registry] and perform the check manually, see VersionPath.

func Install

func Install(pfx *wine.Prefix, name string) error

Install runs the downloaded executable with arguments for installing WebView it onto the Wineprefix. The given executable is assumed to be the executable from a WebView download URL. InstallerPath can be used as a download path.

It is the callers responsibility to ensure no downgrades have been made - see Current.

To ensure WebView2 runs correctly within the Wineprefix, a windows version override is installed by default if the Wineprefix is not Proton, since the override is installed in Proton by default.

The override will also be checked if it isn't set, in that case, the override will not be installed.

func Installed

func Installed(pfx *wine.Prefix, version string) bool

Installed determines if the given WebView Runtime version is installed.

func InstallerPath

func InstallerPath(pfx *wine.Prefix, version, arch string) string

InstallerPath returns a convenient path of a WebView Runtime download URL. For a Edge download, it's version must be appended with an underscore following the Edge version.

It is the user's responsibility to ensure this exists if using [Download.Install], by fetching the [Download.URL] to the path returned here.

func Uninstall

func Uninstall(pfx *wine.Prefix, version string) error

Uninstall runs the named version's uninstaller on the given Wineprefix.

Types

type Channel

type Channel string

Channel respresents a list of known download channels for Edge WebView2.

const (
	Stable       Channel = "msedge-stable-win"
	StableLegacy Channel = "msedge-stable-win7and8"
	Beta         Channel = "msedge-beta-win"
	Dev          Channel = "msedge-dev-win"
	Canary       Channel = "msedge-canary-win"
)

func (Channel) Downloads

func (c Channel) Downloads(version, arch string) ([]Download, error)

Download fetches the downloads for the given WebView download channel and version. The downloads that are returned consist of Edge versions and a single Runtime.

arch should be one of "x86", "x64", "ARM64".

func (Channel) Latest

func (c Channel) Latest(arch string) (string, error)

Latest returns the latest version of the given WebView download channel.

arch should be one of "x86", "x64", "ARM64".

func (Channel) Runtime

func (c Channel) Runtime(version, arch string) (*Download, error)

Runtime fetches the download of the Edge WebView2 Runtime for the given WebView download channel and version. If it could not be found, an error will be returned.

Runtime wraps around [Channel.Download].

arch should be one of "x86", "x64", "ARM64".

type Download

type Download struct {
	URL    string `json:"Url"`
	File   string `json:"FileId"`
	Size   int64  `json:"SizeInBytes"`
	Hashes struct {
		Sha1   string `json:"Sha1"`
		Sha256 string `json:"Sha256"`
	} `json:"Hashes"`
	Delivery struct {
		CatalogID  string `json:"CatalogId"`
		Properties struct {
			IntegrityCheckInfo struct {
				PiecesHashFileURL string `json:"PiecesHashFileUrl"`
				HashOfHashes      string `json:"HashOfHashes"`
			} `json:"IntegrityCheckInfo"`
		} `json:"Properties"`
	} `json:"DeliveryOptimization"`
}

Download represents a version's available download.

func (*Download) Version

func (d *Download) Version() (string, string)

Version returns the DownloadInfo's runtime and Edge version. If the returned Edge version is empty, this DownloadInfo is a Runtime.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL