From 4d78a943cd8904bd2246d3c1e5e538a5f65dcede Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Sat, 25 Nov 2023 01:42:33 +0530 Subject: [PATCH] Update webview lib, drop launcher wrapper \o/ --- .github/workflows/go.yml | 12 +-------- go.mod | 2 +- go.sum | 4 +-- launcher_windows.go | 53 ---------------------------------------- main.go | 2 +- package.json | 7 ++---- 6 files changed, 7 insertions(+), 73 deletions(-) delete mode 100644 launcher_windows.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 739fca8..5a4fe3c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,12 +31,6 @@ jobs: go-version: ^1.21 id: go - - name: Download DLLs for Windows - run: > - C:\msys64\usr\bin\wget.exe https://github.com/webview/webview_csharp/raw/master/libs/webview.dll - https://github.com/webview/webview_csharp/raw/master/libs/WebView2Loader.dll - if: ${{ success() && matrix.os == 'windows-latest' }} - - name: Install dependencies on Ubuntu run: | sudo apt-get update @@ -58,8 +52,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: writer-${{ runner.os }} - path: | - writer* - launcher.exe - webview.dll - WebView2Loader.dll + path: writer* diff --git a/go.mod b/go.mod index 3b82b40..9e224cd 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/sqweek/dialog v0.0.0-20200911184034-8a3d98e8211d - github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 + github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070 ) require github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect diff --git a/go.sum b/go.sum index ddb0287..79a19f3 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf h1:FPsprx82rdrX2j github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I= github.com/sqweek/dialog v0.0.0-20200911184034-8a3d98e8211d h1:Chay1rwJnXxI27H+pzu7P81BKf647un9GOoRPTdXN18= github.com/sqweek/dialog v0.0.0-20200911184034-8a3d98e8211d/go.mod h1:/qNPSY91qTz/8TgHEMioAUc6q7+3SOybeKczHMXFcXw= -github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 h1:e0+/fQY5l9NdCwPsEg9S8AgE5lFhZ/6UX+b2KkpIBFg= -github.com/webview/webview v0.0.0-20200724072439-e0c01595b361/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y= +github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070 h1:imZLWyo1ondeQjqfb/eHuYgFiOAYg6ugSMCnGfPTPmg= +github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070/go.mod h1:yE65LFCeWf4kyWD5re+h4XNvOHJEXOCOuJZ4v8l5sgk= diff --git a/launcher_windows.go b/launcher_windows.go deleted file mode 100644 index d73cdb4..0000000 --- a/launcher_windows.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build launcher - -package main - -import ( - "os" - "os/exec" - "path/filepath" - - _ "embed" -) - -//go:embed writer.exe -var writerExe []byte - -//go:embed webview.dll -var webviewDll []byte - -//go:embed WebView2Loader.dll -var webview2LoaderDll []byte - -func main() { - // Extract writer.exe to %LocalAppData%. - folder, err := os.UserCacheDir() - if err != nil { - panic(err) - } - err = os.MkdirAll(filepath.Join(folder, "writer"), os.ModePerm) - if err != nil { - panic(err) - } - err = os.WriteFile(filepath.Join(folder, "writer", "writer.exe"), writerExe, os.ModePerm) - if err != nil { - panic(err) - } - err = os.WriteFile(filepath.Join(folder, "writer", "webview.dll"), webviewDll, os.ModePerm) - if err != nil { - panic(err) - } - err = os.WriteFile(filepath.Join(folder, "writer", "WebView2Loader.dll"), webview2LoaderDll, os.ModePerm) - if err != nil { - panic(err) - } - cmd := exec.Command(filepath.Join(folder, "writer", "writer.exe")) - err = cmd.Start() - if err != nil { - panic(err) - } - cmd.Process.Release() - if err != nil { - panic(err) - } -} diff --git a/main.go b/main.go index 101f721..bb0156c 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( "github.com/retrixe/writer/utils" "github.com/sqweek/dialog" - "github.com/webview/webview" + webview "github.com/webview/webview_go" ) // TODO: Design UI (with live warnings/errors). diff --git a/package.json b/package.json index 68ef28b..8db7ce4 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,10 @@ "lint": "eslint . && tsc --noEmit", "dev": "parcel renderer/index.html & go run -ldflags=\"-s -w -X main.overrideUrl=http://localhost:1234/\" . & echo Starting...", "start": "parcel build renderer/index.tsx && go run .", - "build": "run-script-os", - "build:default": "parcel build renderer/index.tsx --no-source-maps && yarn build:go", - "build:windows": "yarn build:default && yarn build:launcher", + "build": "parcel build renderer/index.tsx --no-source-maps && yarn build:go", "build:go": "run-script-os", "build:go:default": "go build -ldflags=\"-s -w\" -o writer -v", - "build:go:windows": "go build -ldflags=\"-s -w -H windowsgui\" -o writer.exe -v", - "build:launcher": "go build -tags launcher -ldflags=\"-s -w\" -o launcher.exe -v launcher_windows.go" + "build:go:windows": "go build -ldflags=\"-s -w -H windowsgui\" -o writer.exe -v" }, "packageManager": "yarn@4.0.2", "dependencies": {