fix: build, and go 1.18
This commit is contained in:
parent
64c68a916c
commit
b4bfd1af6d
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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=
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue