mirror of
https://github.com/tenox7/wrp.git
synced 2026-02-14 13:46:32 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71889effe7 | ||
|
|
6a7ffbb67b | ||
|
|
f93058fed3 | ||
|
|
67ed26b8f4 | ||
|
|
6aefcdacc5 | ||
|
|
de315fb95f | ||
|
|
b098b3632a | ||
|
|
5ec0266f75 |
@@ -1,5 +1,6 @@
|
||||
FROM chromedp/headless-shell
|
||||
ADD wrp /wrp
|
||||
ARG TARGETARCH
|
||||
ADD wrp-${TARGETARCH}-linux /wrp
|
||||
ENTRYPOINT ["/wrp"]
|
||||
ENV PATH="/headless-shell:${PATH}"
|
||||
LABEL maintainer="as@tenoware.com"
|
||||
|
||||
8
Makefile
8
Makefile
@@ -5,6 +5,7 @@ wrp: wrp.go
|
||||
|
||||
cross:
|
||||
GOOS=linux GOARCH=amd64 go build -a -o wrp-amd64-linux wrp.go
|
||||
GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go
|
||||
GOOS=freebsd GOARCH=amd64 go build -a -o wrp-amd64-freebsd wrp.go
|
||||
GOOS=openbsd GOARCH=amd64 go build -a -o wrp-amd64-openbsd wrp.go
|
||||
GOOS=darwin GOARCH=amd64 go build -a -o wrp-amd64-macos wrp.go
|
||||
@@ -14,10 +15,9 @@ cross:
|
||||
GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go
|
||||
|
||||
docker: wrp
|
||||
docker build -t tenox7/wrp:latest .
|
||||
|
||||
dockerhub:
|
||||
docker push tenox7/wrp:latest
|
||||
GOOS=linux GOARCH=amd64 go build -a -o wrp-amd64-linux wrp.go
|
||||
GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go
|
||||
docker buildx build --platform linux/amd64,linux/arm64 -t tenox7/wrp:latest --push .
|
||||
|
||||
gcrio:
|
||||
docker tag tenox7/wrp:latest gcr.io/tenox7/wrp
|
||||
|
||||
17
README.md
17
README.md
@@ -94,6 +94,7 @@ Fortunately ACI allows port 80 without encryption.
|
||||
-d chromedp debug logging (default false)
|
||||
-n do not free maps and images after use (default false)
|
||||
-ui html template file (default "wrp.html")
|
||||
-ua user agent, override the default "headless" agent
|
||||
-s delay/sleep after page is rendered before screenshot is taken (default 2s)
|
||||
```
|
||||
|
||||
@@ -106,12 +107,22 @@ Fortunately ACI allows port 80 without encryption.
|
||||
|
||||
### I can't get it to run
|
||||
|
||||
This program does not have a GUI and is run from the command line. You may need to enable executable bit on Unix systems, for example:
|
||||
This program does not have a GUI and is run from the command line. After downloading, you may need to enable executable bit on Unix systems, for example:
|
||||
|
||||
```shell
|
||||
$ cd ~/Downloads
|
||||
$ chmod +x wrp-amd64-macos
|
||||
$ ./wrp-amd64-macos -t png
|
||||
$ ./wrp-amd64-macos
|
||||
```
|
||||
|
||||
### Websites are blocking headless browsers
|
||||
|
||||
This is a well known issue. WRP has some provisions to work around it, but it's a cat and mouse game. The first and
|
||||
foremost recommendation is to change `User Agent`, so that it doesn't say "headless". Add `-ua="my agent"` to override the default one.
|
||||
Obtain your regular desktop browser user agent and specify it as the flag. For example
|
||||
|
||||
```shell
|
||||
$ wrp -ua="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
|
||||
```
|
||||
|
||||
## History
|
||||
@@ -138,4 +149,4 @@ $ ./wrp-amd64-macos -t png
|
||||
|
||||
License: Apache 2.0
|
||||
Copyright (c) 2013-2018 Antoni Sawicki
|
||||
Copyright (c) 2019-2022 Google LLC
|
||||
Copyright (c) 2019-2024 Google LLC
|
||||
|
||||
8
go.mod
8
go.mod
@@ -4,8 +4,8 @@ go 1.21.5
|
||||
|
||||
require (
|
||||
github.com/MaxHalford/halfgone v0.0.0-20171017091812-482157b86ccb
|
||||
github.com/chromedp/cdproto v0.0.0-20231205062650-00455a960d61
|
||||
github.com/chromedp/chromedp v0.9.3
|
||||
github.com/chromedp/cdproto v0.0.0-20240519224452-66462be74baa
|
||||
github.com/chromedp/chromedp v0.9.5
|
||||
github.com/soniakeys/quant v1.0.0
|
||||
)
|
||||
|
||||
@@ -13,8 +13,8 @@ require (
|
||||
github.com/chromedp/sysutil v1.0.0 // indirect
|
||||
github.com/gobwas/httphead v0.1.0 // indirect
|
||||
github.com/gobwas/pool v0.2.1 // indirect
|
||||
github.com/gobwas/ws v1.3.1 // indirect
|
||||
github.com/gobwas/ws v1.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
)
|
||||
|
||||
11
go.sum
11
go.sum
@@ -3,8 +3,13 @@ github.com/MaxHalford/halfgone v0.0.0-20171017091812-482157b86ccb/go.mod h1:J86X
|
||||
github.com/chromedp/cdproto v0.0.0-20231011050154-1d073bb38998/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
|
||||
github.com/chromedp/cdproto v0.0.0-20231205062650-00455a960d61 h1:XD280QPATe9jaz20dylKe3vBsNcH1w3mkssGY0lidn8=
|
||||
github.com/chromedp/cdproto v0.0.0-20231205062650-00455a960d61/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
|
||||
github.com/chromedp/cdproto v0.0.0-20240202021202-6d0b6a386732/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
|
||||
github.com/chromedp/cdproto v0.0.0-20240519224452-66462be74baa h1:T3Ho4BWIkoEoMPCj90W2HIPF/k56qk4JWzTs6JUBxVw=
|
||||
github.com/chromedp/cdproto v0.0.0-20240519224452-66462be74baa/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
|
||||
github.com/chromedp/chromedp v0.9.3 h1:Wq58e0dZOdHsxaj9Owmfcf+ibtpYN1N0FWVbaxa/esg=
|
||||
github.com/chromedp/chromedp v0.9.3/go.mod h1:NipeUkUcuzIdFbBP8eNNvl9upcceOfWzoJn6cRe4ksA=
|
||||
github.com/chromedp/chromedp v0.9.5 h1:viASzruPJOiThk7c5bueOUY91jGLJVximoEMGoH93rg=
|
||||
github.com/chromedp/chromedp v0.9.5/go.mod h1:D4I2qONslauw/C7INoCir1BJkSwBYMyZgx8X276z3+Y=
|
||||
github.com/chromedp/sysutil v1.0.0 h1:+ZxhTpfpZlmchB58ih/LBHX52ky7w2VhQVKQMucy3Ic=
|
||||
github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww=
|
||||
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
|
||||
@@ -14,6 +19,9 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm
|
||||
github.com/gobwas/ws v1.3.0/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
|
||||
github.com/gobwas/ws v1.3.1 h1:Qi34dfLMWJbiKaNbDVzM9x27nZBjmkaW6i4+Ku+pGVU=
|
||||
github.com/gobwas/ws v1.3.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
|
||||
github.com/gobwas/ws v1.3.2/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
|
||||
github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs=
|
||||
github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 h1:6Yzfa6GP0rIo/kULo2bwGEkFvCePZ3qHDDTC3/J9Swo=
|
||||
@@ -27,3 +35,6 @@ github.com/soniakeys/quant v1.0.0/go.mod h1:HI1k023QuVbD4H8i9YdfZP2munIHU4QpjsIm
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
|
||||
8
wrp.go
8
wrp.go
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// WRP - Web Rendering Proxy
|
||||
//
|
||||
// Copyright (c) 2013-2018 Antoni Sawicki
|
||||
// Copyright (c) 2013-2024 Antoni Sawicki
|
||||
// Copyright (c) 2019-2024 Google LLC
|
||||
//
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
@@ -42,7 +43,7 @@ import (
|
||||
"github.com/soniakeys/quant/median"
|
||||
)
|
||||
|
||||
const version = "4.6.0"
|
||||
const version = "4.6.3"
|
||||
|
||||
var (
|
||||
addr = flag.String("l", ":8080", "Listen address:port, default :8080")
|
||||
@@ -548,8 +549,9 @@ func printIPs(b string) {
|
||||
// Main
|
||||
func main() {
|
||||
var err error
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
flag.Parse()
|
||||
log.Printf("Web Rendering Proxy Version %s\n", version)
|
||||
log.Printf("Web Rendering Proxy Version %s (%v)\n", version, runtime.GOARCH)
|
||||
log.Printf("Args: %q", os.Args)
|
||||
if len(os.Getenv("PORT")) > 0 {
|
||||
*addr = ":" + os.Getenv(("PORT"))
|
||||
|
||||
Reference in New Issue
Block a user