Skip to content

Commit

Permalink
fix: build, and go 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
tormodatt authored and tombh committed Jun 29, 2022
1 parent 64c68a9 commit b4bfd1a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions interfacer/contrib/build_browsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions interfacer/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions interfacer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
15 changes: 14 additions & 1 deletion interfacer/src/browsh/firefox.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@ 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"
"github.com/go-errors/errors"
"github.com/spf13/viper"
)

//go:embed browsh.xpi
var browshXpi embed.FS

var (
marionette net.Conn
ffCommandCount = 0
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit b4bfd1a

Please sign in to comment.