From b8cf50ab179f8f25afb721c1088669e87209eb3e Mon Sep 17 00:00:00 2001 From: "alex.dou" Date: Thu, 5 Dec 2024 10:52:41 +0800 Subject: [PATCH 1/2] chrome args override: custome_args can be override the default_args --- ui.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui.go b/ui.go index 6849d9d..5ce0cd9 100644 --- a/ui.go +++ b/ui.go @@ -79,6 +79,8 @@ func New(url, dir string, width, height int, customArgs ...string) (UI, error) { args = append(args, customArgs...) args = append(args, "--remote-debugging-port=0") + args = handleArgs(args) + chrome, err := newChromeWithArgs(ChromeExecutable(), args...) done := make(chan struct{}) if err != nil { @@ -92,6 +94,17 @@ func New(url, dir string, width, height int, customArgs ...string) (UI, error) { return &ui{chrome: chrome, done: done, tmpDir: tmpDir}, nil } +func handleArgs(src []string) (dest []string) { + m := make(map[string]bool) + for _, s := range src { + m[s] = true + } + for s, _ := range m { + dest = append(dest, s) + } + return +} + func (u *ui) Done() <-chan struct{} { return u.done } From df85760f4d6e0e2f95cc6893fee5cc1bd68d1784 Mon Sep 17 00:00:00 2001 From: "alex.dou" Date: Tue, 10 Dec 2024 18:18:37 +0800 Subject: [PATCH 2/2] c --- examples/counter/main.go | 2 +- examples/hello/main.go | 2 +- examples/stopwatch/main.go | 2 +- go.mod | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/counter/main.go b/examples/counter/main.go index 8aa272d..e6c9268 100644 --- a/examples/counter/main.go +++ b/examples/counter/main.go @@ -11,7 +11,7 @@ import ( "runtime" "sync" - "github.com/zserge/lorca" + "github.com/lishimeng/lorca" ) //go:embed www diff --git a/examples/hello/main.go b/examples/hello/main.go index 07589db..15c9453 100644 --- a/examples/hello/main.go +++ b/examples/hello/main.go @@ -4,7 +4,7 @@ import ( "log" "net/url" - "github.com/zserge/lorca" + "github.com/lishimeng/lorca" ) func main() { diff --git a/examples/stopwatch/main.go b/examples/stopwatch/main.go index a87b823..40669f9 100644 --- a/examples/stopwatch/main.go +++ b/examples/stopwatch/main.go @@ -7,7 +7,7 @@ import ( "sync/atomic" "time" - "github.com/zserge/lorca" + "github.com/lishimeng/lorca" ) func main() { diff --git a/go.mod b/go.mod index 56f9a04..e02f5ec 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/zserge/lorca +module github.com/lishimeng/lorca go 1.16