mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-18 21:22:15 +01:00
RPC error (#23)
This commit is contained in:
@@ -11,13 +11,15 @@ env:
|
|||||||
- secure: CmLh169xwt3OC7l19lDUwdZYfw+l/+XXKjTGxnuJiXHa9hAH+nc4mEUSmqHMHwjquyYE6LnSVGZ94LH8sCaGed/TMm0Lj3DZtZ0VsjYu3sKsNrVJn5WdYEah+GvNJ8i8uzvHnGk1L2fAagLpXFUB2K9UraA1CFiHs1fF5Fua7Ra0mE7lMz0MFvyvzcmc9u8nMz71K2YVsXqn+I/rv8onJCTtc/Ds0hVrBXwG5Fh0T3xHqjOhME9ZI2hRHnnQVdBojSY3USifQ//qAKowfBVc0pebEtgFpyXx/I17A6xCm0KVtnA2tNqu1+XFkjWaBzryaLE9ujhJcTRC/YK0JUZ+QxfYbD5C7jVy9Jlx1lOEjJ42B/ImNxPP+9p3wi2MWNbcbZJPxIe635fnT17lI7CLK2Qg1xjfTQ4WTEKW5IhnYMiyfRKiripFh4PCkDm8cJlTbpntsX1n0uheydbsgf/11vS7o1WGhVQ8+Jelc4DvIbBHCqienQEOLJDBwm7FiK5JbwZJ6ZAGeDM/IhGU1h9PNjVbHUyJhUxYoPYUE9QsZFT7ENCrRQpq49KOzXBRfffyJNJRh+Ep9X5YoW0dUp0MNu5B7z2+6w9X9n/C+loa11xF42bFzniCvvbSOQ37J+EngDinVxJkNPeyivR4fye2ENhIAjAEjouTJLOSXL9nAOU=
|
- secure: CmLh169xwt3OC7l19lDUwdZYfw+l/+XXKjTGxnuJiXHa9hAH+nc4mEUSmqHMHwjquyYE6LnSVGZ94LH8sCaGed/TMm0Lj3DZtZ0VsjYu3sKsNrVJn5WdYEah+GvNJ8i8uzvHnGk1L2fAagLpXFUB2K9UraA1CFiHs1fF5Fua7Ra0mE7lMz0MFvyvzcmc9u8nMz71K2YVsXqn+I/rv8onJCTtc/Ds0hVrBXwG5Fh0T3xHqjOhME9ZI2hRHnnQVdBojSY3USifQ//qAKowfBVc0pebEtgFpyXx/I17A6xCm0KVtnA2tNqu1+XFkjWaBzryaLE9ujhJcTRC/YK0JUZ+QxfYbD5C7jVy9Jlx1lOEjJ42B/ImNxPP+9p3wi2MWNbcbZJPxIe635fnT17lI7CLK2Qg1xjfTQ4WTEKW5IhnYMiyfRKiripFh4PCkDm8cJlTbpntsX1n0uheydbsgf/11vS7o1WGhVQ8+Jelc4DvIbBHCqienQEOLJDBwm7FiK5JbwZJ6ZAGeDM/IhGU1h9PNjVbHUyJhUxYoPYUE9QsZFT7ENCrRQpq49KOzXBRfffyJNJRh+Ep9X5YoW0dUp0MNu5B7z2+6w9X9n/C+loa11xF42bFzniCvvbSOQ37J+EngDinVxJkNPeyivR4fye2ENhIAjAEjouTJLOSXL9nAOU=
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- tests
|
||||||
- publish
|
- publish
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- stage: lint
|
- stage: tests
|
||||||
script: make lint
|
script: make lint
|
||||||
|
- stage: tests
|
||||||
|
script: make tests
|
||||||
- stage: publish
|
- stage: publish
|
||||||
if: tag IS present
|
if: tag IS present
|
||||||
script: ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
script: ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
||||||
@@ -54,8 +54,9 @@ func (c *Chrome) getFullname() string {
|
|||||||
|
|
||||||
func (c *Chrome) isViable() bool {
|
func (c *Chrome) isViable() bool {
|
||||||
// check if Chrome is correctly running.
|
// check if Chrome is correctly running.
|
||||||
devt := devtool.New("http://127.0.0.1:9222")
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
_, err := devt.Create(context.TODO())
|
defer cancel()
|
||||||
|
_, err := devtool.New("http://localhost:9222").Version(ctx)
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,15 @@ const defaultHeaderFooterHTML string = "<html><head></head><body></body></html>"
|
|||||||
// Print converts HTML to PDF.
|
// Print converts HTML to PDF.
|
||||||
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
||||||
func (html *HTML) Print(destination string) error {
|
func (html *HTML) Print(destination string) error {
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
||||||
devt := devtool.New("http://127.0.0.1:9222")
|
devt, err := devtool.New("http://localhost:9222").Version(ctx)
|
||||||
pt, err := devt.Create(html.Context)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating DevTools target: %v", err)
|
return fmt.Errorf("creating DevTools target: %v", err)
|
||||||
}
|
}
|
||||||
// open a new RPC connection to the Chrome Debugging Protocol target.
|
// open a new RPC connection to the Chrome Debugging Protocol target.
|
||||||
conn, err := rpcc.DialContext(html.Context, pt.WebSocketDebuggerURL)
|
conn, err := rpcc.DialContext(html.Context, devt.WebSocketDebuggerURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating RPC connection: %v", err)
|
return fmt.Errorf("creating RPC connection: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user