kopia lustrzana https://github.com/browsh-org/browsh
rodzic
3b7ee79808
commit
c0e51e6413
|
@ -20,14 +20,14 @@
|
|||
revision = "aa4a75b1c20a2b03751b1a9f7e41d58bd6f71c43"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/shuLhan/go-bindata"
|
||||
branch = "master"
|
||||
name = "github.com/shibukawa/configdir"
|
||||
packages = ["."]
|
||||
revision = "13e7f547b03edacc82d8b69dcf1f404b7f1d97f7"
|
||||
version = "v3.2.0"
|
||||
revision = "e180dbdc8da04c4fa04272e875ce64949f38bd3e"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "2c892d289743dedad27a5cab0c6716e1949efe9aa7cee7b683ce50ad5c15e5d6"
|
||||
inputs-digest = "e1642a608af3337f43720099e44ef494d6d73b19c3c61f5422be19c8465df364"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -9,3 +9,7 @@
|
|||
[[constraint]]
|
||||
name = "github.com/shuLhan/go-bindata"
|
||||
version = "3.2.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/shibukawa/configdir"
|
||||
|
|
|
@ -21,6 +21,8 @@ import (
|
|||
"github.com/nsf/termbox-go"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/shibukawa/configdir"
|
||||
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -30,6 +32,7 @@ var (
|
|||
isFFGui = flag.Bool("with-gui", false, "Don't use headless Firefox")
|
||||
isUseExistingFirefox = flag.Bool("use-existing-ff", false, "Whether Browsh should launch Firefox or not")
|
||||
useFFProfile = flag.String("ff-profile", "default", "Firefox profile to use")
|
||||
isDebug = flag.Bool("debug", false, "Log to ./debug.log")
|
||||
upgrader = websocket.Upgrader{
|
||||
CheckOrigin: func(r *http.Request) bool { return true },
|
||||
ReadBufferSize: 1024,
|
||||
|
@ -85,6 +88,9 @@ func setupLogging() {
|
|||
}
|
||||
|
||||
func log(msg string) {
|
||||
if !*isDebug {
|
||||
return
|
||||
}
|
||||
f, oErr := os.OpenFile(logfile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if oErr != nil {
|
||||
shutdown(oErr.Error())
|
||||
|
@ -272,6 +278,14 @@ func webSocketServer(w http.ResponseWriter, r *http.Request) {
|
|||
sendTtySize()
|
||||
}
|
||||
|
||||
// Gets a cross-platform path to store Browsh config
|
||||
func getConfigFolder() string {
|
||||
configDirs := configdir.New("browsh", "firefox_profile")
|
||||
folders := configDirs.QueryFolders(configdir.Global)
|
||||
folders[0].MkdirAll()
|
||||
return folders[0].Path
|
||||
}
|
||||
|
||||
func startHeadlessFirefox() {
|
||||
println("Starting...")
|
||||
log("Starting Firefox in headless mode")
|
||||
|
@ -280,7 +294,12 @@ func startHeadlessFirefox() {
|
|||
args = append(args, "--headless")
|
||||
}
|
||||
if *useFFProfile != "default" {
|
||||
log("Using profile: " + *useFFProfile)
|
||||
args = append(args, "-P", *useFFProfile)
|
||||
} else {
|
||||
profilePath := getConfigFolder()
|
||||
log("Using default profile at: " + profilePath)
|
||||
args = append(args, "--profile", profilePath)
|
||||
}
|
||||
firefoxProcess := exec.Command(*firefoxBinary, args...)
|
||||
defer firefoxProcess.Process.Kill()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Browsh",
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.6",
|
||||
|
||||
"description": "Renders the browser as realtime, interactive, TTY-compatible text",
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Browsh",
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.6",
|
||||
|
||||
"description": "Renders the browser as realtime, interactive, TTY-compatible text",
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class Helper {
|
|||
env: process.env
|
||||
});
|
||||
this.browshPTY.write(`cd ${dir} \r`);
|
||||
this.browshPTY.write(`go run *.go -use-existing-ff \r`);
|
||||
this.browshPTY.write(`go run *.go -use-existing-ff -debug \r`);
|
||||
this.broadcastOutput();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue