From cc99dcce80098e5f2546d3b256b80a510b0635db Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 7 May 2020 06:30:53 +1000 Subject: [PATCH 1/7] Update contributors --- CONTRIBUTORS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d5bae0edb..fd8e28600 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -25,4 +25,5 @@ Wails is what it is because of the time and effort given by these great people. * [Travis McLane](https://github.com/tmclane) * [Reuben Thomas-Davis](https://github.com/Rested) * [Jarek](https://github.com/Jarek-SRT) - * [Konez2k](https://github.com/konez2k) \ No newline at end of file + * [Konez2k](https://github.com/konez2k) + * [msms](https://github.com/sayuthisobri) \ No newline at end of file From f1d16a03eccd806af9a5898796e20e07e25493f5 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 9 May 2020 05:46:40 +1000 Subject: [PATCH 2/7] Disable F5 key on windows --- lib/renderer/webview/webview.h | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/lib/renderer/webview/webview.h b/lib/renderer/webview/webview.h index 3d308af38..f549d52b1 100644 --- a/lib/renderer/webview/webview.h +++ b/lib/renderer/webview/webview.h @@ -139,7 +139,7 @@ struct webview_priv #define DEFAULT_URL \ "data:text/" \ "html,%3C%21DOCTYPE%20html%3E%0A%3Chtml%20lang=%22en%22%3E%0A%3Chead%3E%" \ - "3Cmeta%20charset=%22utf-8%22%3E%3Cmeta%20http-equiv=%22IE=edge%22%" \ + "3Cmeta%20charset=%22utf-8%22%3E%3Cmeta%20http-equiv=%22IE=edge%22%" \ "20content=%22IE=edge%22%3E%3C%2Fhead%3E%0A%3Cbody%3E%3Cdiv%20id=%22app%22%" \ "3E%3C%2Fdiv%3E%3Cscript%20type=%22text%2Fjavascript%22%3E%3C%2Fscript%3E%" \ "3C%2Fbody%3E%0A%3C%2Fhtml%3E" @@ -1227,7 +1227,7 @@ struct webview_priv } VariantInit(&myURL); myURL.vt = VT_BSTR; -// #ifndef UNICODE + // #ifndef UNICODE { wchar_t *buffer = webview_to_utf16(webPageName); if (buffer == NULL) @@ -1237,9 +1237,9 @@ struct webview_priv myURL.bstrVal = SysAllocString(buffer); GlobalFree(buffer); } -// #else -// myURL.bstrVal = SysAllocString(webPageName); -// #endif + // #else + // myURL.bstrVal = SysAllocString(webPageName); + // #endif if (!myURL.bstrVal) { badalloc: @@ -1277,7 +1277,7 @@ struct webview_priv if (!SafeArrayAccessData(sfArray, (void **)&pVar)) { pVar->vt = VT_BSTR; -// #ifndef UNICODE + // #ifndef UNICODE { wchar_t *buffer = webview_to_utf16(url); if (buffer == NULL) @@ -1287,9 +1287,9 @@ struct webview_priv bstr = SysAllocString(buffer); GlobalFree(buffer); } -// #else -// bstr = SysAllocString(url); -// #endif + // #else + // bstr = SysAllocString(url); + // #endif if ((pVar->bstrVal = bstr)) { htmlDoc2->lpVtbl->write(htmlDoc2, sfArray); @@ -1444,12 +1444,12 @@ struct webview_priv rect.right - rect.left, rect.bottom - rect.top, HWND_DESKTOP, NULL, hInstance, (void *)w); #else - w->priv.hwnd = + w->priv.hwnd = CreateWindowEx(0, classname, w->title, style, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, HWND_DESKTOP, NULL, hInstance, (void *)w); #endif - + if (w->priv.hwnd == 0) { OleUninitialize(); @@ -1466,8 +1466,7 @@ struct webview_priv #else SetWindowText(w->priv.hwnd, w->title); #endif - - + ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT); UpdateWindow(w->priv.hwnd); SetFocus(w->priv.hwnd); @@ -1494,6 +1493,11 @@ struct webview_priv case WM_KEYDOWN: case WM_KEYUP: { + // Disable refresh when pressing F5 on windows + if (msg.wParam == VK_F5) + { + break; + } HRESULT r = S_OK; IWebBrowser2 *webBrowser2; IOleObject *browser = *w->priv.browser; @@ -1603,7 +1607,7 @@ struct webview_priv WEBVIEW_API void webview_set_title(struct webview *w, const char *title) { - #ifdef UNICODE +#ifdef UNICODE wchar_t *u16title = webview_to_utf16(title); if (u16title == NULL) { @@ -1611,12 +1615,11 @@ struct webview_priv } SetWindowText(w->priv.hwnd, u16title); GlobalFree(u16title); - #else +#else SetWindowText(w->priv.hwnd, title); - #endif +#endif } - WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen) { if (w->priv.is_fullscreen == !!fullscreen) @@ -1927,22 +1930,25 @@ struct webview_priv [script setValue:self forKey:@"external"]; } -static void webview_run_input_open_panel(id self, SEL cmd, id webview, - id listener, BOOL allowMultiple) { + static void webview_run_input_open_panel(id self, SEL cmd, id webview, + id listener, BOOL allowMultiple) + { char filename[256] = ""; struct webview *w = (struct webview *)objc_getAssociatedObject(self, "webview"); webview_dialog(w, WEBVIEW_DIALOG_TYPE_OPEN, WEBVIEW_DIALOG_FLAG_FILE, "", "", filename, 255); - if (strlen(filename)) { + if (strlen(filename)) + { [listener chooseFilename:[NSString stringWithUTF8String:filename]]; - } else { + } + else + { [listener cancel]; } } - static void webview_external_invoke(id self, SEL cmd, id arg) { struct webview *w = @@ -1955,7 +1961,7 @@ static void webview_run_input_open_panel(id self, SEL cmd, id webview, { return; } - w->external_invoke_cb(w, [(NSString *)(arg)UTF8String]); + w->external_invoke_cb(w, [(NSString *)(arg) UTF8String]); } WEBVIEW_API int webview_init(struct webview *w) From 131fd973cd6e363c7a6589a542587be33e868fb4 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 9 May 2020 05:55:54 +1000 Subject: [PATCH 3/7] lint fix --- lib/renderer/webview/webview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/renderer/webview/webview.h b/lib/renderer/webview/webview.h index f549d52b1..e2de89c37 100644 --- a/lib/renderer/webview/webview.h +++ b/lib/renderer/webview/webview.h @@ -1939,7 +1939,7 @@ struct webview_priv webview_dialog(w, WEBVIEW_DIALOG_TYPE_OPEN, WEBVIEW_DIALOG_FLAG_FILE, "", "", filename, 255); - if (strlen(filename)) + if (strlen(filename) > 0) { [listener chooseFilename:[NSString stringWithUTF8String:filename]]; } From 6339f230f9450f83df89ab3f3f6f04f7662d8bd4 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 9 May 2020 06:04:55 +1000 Subject: [PATCH 4/7] Fix CWE-126 --- lib/renderer/webview/webview.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/renderer/webview/webview.h b/lib/renderer/webview/webview.h index e2de89c37..7666dc4f1 100644 --- a/lib/renderer/webview/webview.h +++ b/lib/renderer/webview/webview.h @@ -1939,6 +1939,7 @@ struct webview_priv webview_dialog(w, WEBVIEW_DIALOG_TYPE_OPEN, WEBVIEW_DIALOG_FLAG_FILE, "", "", filename, 255); + filename[255] = '\0'; if (strlen(filename) > 0) { [listener chooseFilename:[NSString stringWithUTF8String:filename]]; From bcecd854bcd5f3e6ce16c45527c8a26bc2213969 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 16 May 2020 07:21:26 +1000 Subject: [PATCH 5/7] v1.6.0-pre1 --- cmd/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/version.go b/cmd/version.go index 0fb77957e..691b302b1 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,4 +1,4 @@ package cmd // Version - Wails version -const Version = "v1.5.0" +const Version = "v1.6.0-pre1" From 7cd78df1cdf6ef718d8f1cbfcc8d110ba817eee4 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 17 May 2020 20:17:00 +1000 Subject: [PATCH 6/7] Support ArchLabs --- README.md | 2 +- cmd/linux.go | 10 +++++++--- cmd/linuxdb.yaml | 9 +++++++++ cmd/system.go | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 290ed1bb8..0d3791716 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ _Ubuntu: 16.04, 18.04, 19.04_ _Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_ -#### Arch Linux +#### Arch Linux / ArchLabs `sudo pacman -S webkit2gtk gtk3` diff --git a/cmd/linux.go b/cmd/linux.go index 448c3c2b6..42af81a08 100644 --- a/cmd/linux.go +++ b/cmd/linux.go @@ -53,10 +53,12 @@ const ( Deepin // Raspbian distribution Raspbian - // openSUSE Tumbleweed distribution + // Tumbleweed (OpenSUSE) distribution Tumbleweed - // openSUSE Leap distribution + // Leap (OpenSUSE) distribution Leap + // ArchLabs distribution + ArchLabs ) // DistroInfo contains all the information relating to a linux distribution @@ -114,13 +116,15 @@ func parseOsRelease(osRelease string) *DistroInfo { } // Check distro name against list of distros - switch osID { + switch strings.ToLower(osID) { case "fedora": result.Distribution = Fedora case "centos": result.Distribution = CentOS case "arch": result.Distribution = Arch + case "archlabs": + result.Distribution = ArchLabs case "debian": result.Distribution = Debian case "ubuntu": diff --git a/cmd/linuxdb.yaml b/cmd/linuxdb.yaml index 4d6904943..a46c85cfe 100644 --- a/cmd/linuxdb.yaml +++ b/cmd/linuxdb.yaml @@ -176,6 +176,15 @@ distributions: gccversioncommand: *gccdumpversion programs: *archdefaultprograms libraries: *archdefaultlibraries + archlabs: + id: archlabs + releases: + default: + version: default + name: ArchLabs + gccversioncommand: *gccdumpversion + programs: *archdefaultprograms + libraries: *archdefaultlibraries manjaro: id: manjaro releases: diff --git a/cmd/system.go b/cmd/system.go index fea6aaef6..d9fb3d8f9 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: libraryChecker = DpkgInstalled - case Arch, ArcoLinux, Manjaro, ManjaroARM: + case Arch, ArcoLinux, ArchLabs, Manjaro, ManjaroARM: libraryChecker = PacmanInstalled case CentOS, Fedora, Tumbleweed, Leap: libraryChecker = RpmInstalled From 6da02e6b446481ad2333c55b5acf040d6a13b60e Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 17 May 2020 20:17:36 +1000 Subject: [PATCH 7/7] v1.6.0-pre2 --- cmd/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/version.go b/cmd/version.go index 691b302b1..a614fbf25 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,4 +1,4 @@ package cmd // Version - Wails version -const Version = "v1.6.0-pre1" +const Version = "v1.6.0-pre2"