diff options
author | Tormod Alf Try Tufteland <moddad@gmail.com> | 2022-06-27 18:54:50 +0200 |
---|---|---|
committer | Thomas Buckley-Houston <tom@tombh.co.uk> | 2022-06-29 12:59:27 -0300 |
commit | b4bfd1af6d6cae258384e650ea29c371495e69d2 (patch) | |
tree | 85303e19c8285e449e86117f93f33b840c8200b4 | |
parent | 64c68a916c0f83ab1bf090ad2c9e60a73ca618d2 (diff) |
fix: build, and go 1.18
-rw-r--r-- | .github/workflows/build.yml | 24 | ||||
-rwxr-xr-x | interfacer/contrib/build_browsh.sh | 4 | ||||
-rw-r--r-- | interfacer/go.mod | 4 | ||||
-rw-r--r-- | interfacer/go.sum | 2 | ||||
-rw-r--r-- | interfacer/src/browsh/firefox.go | 15 |
5 files changed, 44 insertions, 5 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e7397b0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build browsh +on: [push] +jobs: + build: + runs-on: ubuntu-latest + env: + GOPATH: ${{ github.workspace }} + GOBIN: ${{ github.workspace }}/bin + steps: + - name: Checkout + uses: actions/checkout@main + with: + fetch-depth: 0 + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + - name: Install go-bindata + run: go install github.com/kevinburke/go-bindata/go-bindata@latest + - name: Build + run: ./interfacer/contrib/build_browsh.sh + - name: Test + run: ./interfacer/browsh --version + diff --git a/interfacer/contrib/build_browsh.sh b/interfacer/contrib/build_browsh.sh index 387a602..55fb159 100755 --- a/interfacer/contrib/build_browsh.sh +++ b/interfacer/contrib/build_browsh.sh @@ -14,7 +14,7 @@ INTERFACER_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && cd ../ & cd $INTERFACER_ROOT # Install the tool to convert the web extenstion file into a Go-compatible binary -go get -u gopkg.in/shuLhan/go-bindata.v3/... +go install github.com/kevinburke/go-bindata/go-bindata@latest # Get the current Browsh version, in order to find the corresponding web extension release version_file=$INTERFACER_ROOT/src/browsh/version.go @@ -25,7 +25,7 @@ version=$(echo $line | grep -o '".*"' | sed 's/"//g') base='https://github.com/browsh-org/browsh/releases/download' release_url="$base/v$version/browsh-${version}-an.fx.xpi" -xpi_file=$INTERFACER_ROOT/browsh.xpi +xpi_file=$INTERFACER_ROOT/src/browsh/browsh.xpi destination=$INTERFACER_ROOT/src/browsh/webextension.go # Download the web extension diff --git a/interfacer/go.mod b/interfacer/go.mod index 0c92241..4b74884 100644 --- a/interfacer/go.mod +++ b/interfacer/go.mod @@ -1,6 +1,6 @@ module github.com/browsh-org/browsh/interfacer -go 1.14 +go 1.18 require ( github.com/NYTimes/gziphandler v1.1.1 @@ -27,7 +27,7 @@ require ( github.com/spf13/viper v1.4.0 github.com/ulule/limiter v2.2.2+incompatible golang.org/x/net v0.0.0-20190607181551-461777fb6f67 - golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae + golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c golang.org/x/text v0.3.2 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 gopkg.in/yaml.v2 v2.2.2 diff --git a/interfacer/go.sum b/interfacer/go.sum index b1fe86f..7fc19c2 100644 --- a/interfacer/go.sum +++ b/interfacer/go.sum @@ -149,6 +149,8 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4= golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/interfacer/src/browsh/firefox.go b/interfacer/src/browsh/firefox.go index 2620522..e36012a 100644 --- a/interfacer/src/browsh/firefox.go +++ b/interfacer/src/browsh/firefox.go @@ -2,16 +2,19 @@ package browsh import ( "bufio" + "embed" "encoding/json" "fmt" "io/ioutil" "net" "os" "os/exec" + "os/signal" "path" "regexp" "runtime" "strings" + "syscall" "time" "github.com/gdamore/tcell" @@ -19,6 +22,9 @@ import ( "github.com/spf13/viper" ) +//go:embed browsh.xpi +var browshXpi embed.FS + var ( marionette net.Conn ffCommandCount = 0 @@ -227,7 +233,7 @@ func firefoxMarionette() { // Install the Browsh extension that was bundled with `go-bindata` under // `webextension.go`. func installWebextension() { - data, err := Asset("browsh.xpi") + data, err := browshXpi.ReadFile("browsh.xpi") if err != nil { Shutdown(err) } @@ -300,6 +306,13 @@ func setupFirefox() { if *timeLimit > 0 { go beginTimeLimit() } + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-sigs + quitBrowsh() + }() + firefoxMarionette() installWebextension() } |