From 7929584ec5385f9010eb402aeb06cc7056983c40 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 1 Nov 2020 06:31:35 +1100 Subject: [PATCH 1/4] 542 use supplied html (#547) * Fix custom HTML * Update HTML escaping * Added more docs around config --- config.go | 54 +++++++++++++++++++++++++++++-------- lib/interfaces/appconfig.go | 4 +-- lib/renderer/webview.go | 2 +- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/config.go b/config.go index 57f274610..c520aced1 100644 --- a/config.go +++ b/config.go @@ -1,20 +1,39 @@ package wails import ( + "fmt" + "net/url" + "strings" + "github.com/leaanthony/mewn" "github.com/wailsapp/wails/runtime" ) // AppConfig is the configuration structure used when creating a Wails App object type AppConfig struct { - Width, Height int - Title string - defaultHTML string - HTML string - JS string - CSS string - Colour string - Resizable bool + // The width and height of your application in pixels + Width, Height int + + // The title to put in the title bar + Title string + + // The HTML your app should use. If you leave it blank, a default will be used: + //
+ HTML string + + // The Javascript your app should use. Normally this should be generated by a bundler. + JS string + + // The CSS your app should use. Normally this should be generated by a bundler. + CSS string + + // The colour of your window. Can take "#fff", "rgb(255,255,255)", "rgba(255,255,255,1)" formats + Colour string + + // Indicates whether your app should be resizable + Resizable bool + + // Indicated if the devtools should be disabled DisableInspector bool } @@ -33,9 +52,14 @@ func (a *AppConfig) GetTitle() string { return a.Title } -// GetDefaultHTML returns the default HTML -func (a *AppConfig) GetDefaultHTML() string { - return a.defaultHTML +// GetHTML returns the default HTML +func (a *AppConfig) GetHTML() string { + if len(a.HTML) > 0 { + a.HTML = url.QueryEscape(a.HTML) + a.HTML = "data:text/html," + strings.ReplaceAll(a.HTML, "+", "%20") + a.HTML = strings.ReplaceAll(a.HTML, "%3D", "=") + } + return a.HTML } // GetResizable returns true if the window should be resizable @@ -79,6 +103,10 @@ func (a *AppConfig) merge(in *AppConfig) error { a.JS = in.JS } + if in.HTML != "" { + a.HTML = in.HTML + } + if in.Width != 0 { a.Width = in.Width } @@ -109,5 +137,9 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) { } } + println("****************************************************") + fmt.Printf("%+v\n", result) + println("****************************************************") + return result, nil } diff --git a/lib/interfaces/appconfig.go b/lib/interfaces/appconfig.go index 6946c9186..6e063b4d4 100644 --- a/lib/interfaces/appconfig.go +++ b/lib/interfaces/appconfig.go @@ -6,9 +6,9 @@ type AppConfig interface { GetHeight() int GetTitle() string GetResizable() bool - GetDefaultHTML() string + GetHTML() string GetDisableInspector() bool GetColour() string GetCSS() string GetJS() string -} \ No newline at end of file +} diff --git a/lib/renderer/webview.go b/lib/renderer/webview.go index 0b19ac552..c51e76bc1 100644 --- a/lib/renderer/webview.go +++ b/lib/renderer/webview.go @@ -58,7 +58,7 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana Height: config.GetHeight(), Title: config.GetTitle(), Resizable: config.GetResizable(), - URL: config.GetDefaultHTML(), + URL: config.GetHTML(), Debug: !config.GetDisableInspector(), ExternalInvokeCallback: func(_ wv.WebView, message string) { w.ipc.Dispatch(message, w.callback) From 25d8a8763af771c73d2d3a0daca0718bcb479f50 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 1 Nov 2020 06:32:42 +1100 Subject: [PATCH 2/4] v1.10.0-pre1 --- cmd/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/version.go b/cmd/version.go index 9594ecc74..846458987 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,4 +1,4 @@ package cmd // Version - Wails version -const Version = "v1.9.1" +const Version = "v1.10.0-pre1" From 7e67562e19dbcbc29d554164ee31f1abe77c5b88 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 26 Nov 2020 20:44:42 +1100 Subject: [PATCH 3/4] Support EndeavourOS (#565) --- cmd/linux.go | 6 +++++- cmd/linuxdb.yaml | 11 ++++++++++- cmd/system.go | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cmd/linux.go b/cmd/linux.go index 3354ba4e0..4d5b91ca0 100644 --- a/cmd/linux.go +++ b/cmd/linux.go @@ -65,6 +65,8 @@ const ( Solus // Ctlos Linux distribution Ctlos + // EndeavourOS linux distribution + EndeavourOS ) // DistroInfo contains all the information relating to a linux distribution @@ -132,7 +134,7 @@ func parseOsRelease(osRelease string) *DistroInfo { case "archlabs": result.Distribution = ArchLabs case "ctlos": - result.Distribution = Ctlos + result.Distribution = Ctlos case "debian": result.Distribution = Debian case "ubuntu": @@ -171,6 +173,8 @@ func parseOsRelease(osRelease string) *DistroInfo { result.Distribution = PopOS case "solus": result.Distribution = Solus + case "endeavouros": + result.Distribution = EndeavourOS default: result.Distribution = Unknown } diff --git a/cmd/linuxdb.yaml b/cmd/linuxdb.yaml index ed314f545..616ccd0f6 100644 --- a/cmd/linuxdb.yaml +++ b/cmd/linuxdb.yaml @@ -202,7 +202,16 @@ distributions: name: Ctlos Linux gccversioncommand: *gccdumpversion programs: *archdefaultprograms - libraries: *archdefaultlibraries + libraries: *archdefaultlibraries + endeavouros: + id: endeavouros + releases: + default: + version: default + name: EndeavourOS + gccversioncommand: *gccdumpversion + programs: *archdefaultprograms + libraries: *archdefaultlibraries manjaro: id: manjaro releases: diff --git a/cmd/system.go b/cmd/system.go index 798f1230f..ab3c9e5dd 100644 --- a/cmd/system.go +++ b/cmd/system.go @@ -276,7 +276,7 @@ func CheckDependencies(logger *Logger) (bool, error) { switch distroInfo.Distribution { case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS: libraryChecker = DpkgInstalled - case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM: + case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS: libraryChecker = PacmanInstalled case CentOS, Fedora, Tumbleweed, Leap: libraryChecker = RpmInstalled From 8a768cce7718fc7b79b780789afbed5eebb0e31e Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 8 Dec 2020 20:40:37 +1100 Subject: [PATCH 4/4] v1.10.0 --- cmd/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/version.go b/cmd/version.go index 846458987..7391ce453 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,4 +1,4 @@ package cmd // Version - Wails version -const Version = "v1.10.0-pre1" +const Version = "v1.10.0"