Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Apr 29, 2021
1 parent afb3ebf commit 68e4724
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/stealth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

schedule:
- cron: "0 0 * * *"
- cron: "0 0 * * 6"

jobs:
build:
Expand All @@ -25,6 +25,5 @@ jobs:

- name: test
run: |
go install github.com/ysmood/golangci-lint@latest && golangci-lint
go generate
go test
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

run:
skip-dirs-use-default: false

linters:
enable:
- gofmt
- golint
- gocyclo
- misspell

gocyclo:
min-complexity: 15

issues:
exclude-use-default: false

5 changes: 4 additions & 1 deletion assets.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions examples_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package stealth_test

import (
"crypto/md5"
"fmt"
"strings"
"time"
Expand All @@ -19,7 +20,7 @@ func Example_main() {
defer browser.MustClose()

// You can also use stealth.JS directly without rod
fmt.Printf("js file size: %d\n\n", len(stealth.JS))
fmt.Printf("js: %x\n\n", md5.Sum([]byte(stealth.JS)))

page := stealth.MustPage(browser)

Expand All @@ -30,7 +31,7 @@ func Example_main() {
/*
Output:
js file size: 161797
js: 65ba02c7954c8248bd12239c38ad61e7
User Agent (Old): true
Expand Down
14 changes: 14 additions & 0 deletions generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"os/exec"
"path/filepath"
"regexp"
"strings"
Expand All @@ -17,13 +18,20 @@ func main() {
package stealth
// JSVersion for stealth
const JSVersion = "v{{.ver}}"
// JS for stealth
const JS = {{.js}}
`,
"ver", version(),
"js", encode(fetchJS()),
)

utils.E(utils.OutputFile(slash("assets.go"), build))

utils.Exec("go", "install", "github.com/ysmood/golangci-lint@latest")
utils.Exec("golangci-lint")
}

func fetchJS() string {
Expand All @@ -38,6 +46,12 @@ func fetchJS() string {
return fmt.Sprintf(";(() => {\n%s\n})();", code)
}

func version() string {
b, err := exec.Command("npx", "extract-stealth-evasions@latest", "--version").CombinedOutput()
utils.E(err)
return strings.TrimSpace(string(b))
}

// not using encoding like base64 or gzip because of they will make git diff every large for small change
func encode(s string) string {
return "`" + strings.ReplaceAll(s, "`", "` + \"`\" + `") + "`"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/go-rod/stealth

go 1.15

require github.com/go-rod/rod v0.96.0
require github.com/go-rod/rod v0.97.10
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
github.com/go-rod/rod v0.96.0 h1:XCeDDxiRFuCvDgU7yHuKnZf0AE6Kh6a3LrRHMUAq2xE=
github.com/go-rod/rod v0.96.0/go.mod h1:cIR84WFrMAwShOkmIJcuJZDyKLjQq3yiZSMEhawHktc=
github.com/go-rod/rod v0.97.10 h1:UQbnt9j6xbGwc73jepZTQ0LduPOTNjKyNqCT8akOhzY=
github.com/go-rod/rod v0.97.10/go.mod h1:vq9iVDwO9deS0fDvdfC08jEntzk5JfVJHN3KGFe+KS4=
github.com/ysmood/goob v0.3.0 h1:XZ51cZJ4W3WCoCiUktixzMIQF86W7G5VFL4QQ/Q2uS0=
github.com/ysmood/goob v0.3.0/go.mod h1:S3lq113Y91y1UBf1wj1pFOxeahvfKkCk6mTWTWbDdWs=
github.com/ysmood/got v0.9.3 h1:qx51X49jL/WAiqZzPTkPZ0zp5pTmrWJa4zYFTYo0gHI=
github.com/ysmood/got v0.9.3/go.mod h1:pE1l4LOwOBhQg6A/8IAatkGp7uZjnalzrZolnlhhMgY=
github.com/ysmood/gotrace v0.2.0 h1:IkTC6rJREwXSaG8yWK+NFwIJGIsxA1DjC6/gxYyQttE=
github.com/ysmood/gotrace v0.2.0/go.mod h1:TzhIG7nHDry5//eYZDYcTzuJLYQIkykJzCRIo4/dzQM=
github.com/ysmood/got v0.12.0 h1:Ol4cpy6Xdq1KCjPlWSA+tvekrnt9cV6LIw+Jvx0dj4M=
github.com/ysmood/got v0.12.0/go.mod h1:pE1l4LOwOBhQg6A/8IAatkGp7uZjnalzrZolnlhhMgY=
github.com/ysmood/gotrace v0.2.2 h1:006KHGRThSRf8lwh4EyhNmuuq/l+Ygs+JqojkhEG1/E=
github.com/ysmood/gotrace v0.2.2/go.mod h1:TzhIG7nHDry5//eYZDYcTzuJLYQIkykJzCRIo4/dzQM=
github.com/ysmood/gson v0.6.3 h1:4cU+5oOdsyundXHy00t99H0rLXLthuseD3x6W+xmCiU=
github.com/ysmood/gson v0.6.3/go.mod h1:3Kzs5zDl21g5F/BlLTNcuAGAYLKt2lV5G8D1zF3RNmg=
github.com/ysmood/leakless v0.6.14 h1:+RKbekKP9+WzVSylTlhwp2x9+zSojKOiGUYewgZyO8g=
github.com/ysmood/leakless v0.6.14/go.mod h1:R8iAXPRaG97QJwqxs74RdwzcRHT1SWCGTNqY8q0JvMQ=
github.com/ysmood/leakless v0.6.16 h1:PVS0EY7eFLzkUTqVJbST7cLz9V+58L+4TIlgxmCLi3k=
github.com/ysmood/leakless v0.6.16/go.mod h1:R8iAXPRaG97QJwqxs74RdwzcRHT1SWCGTNqY8q0JvMQ=

0 comments on commit 68e4724

Please sign in to comment.