Skip to content

Commit

Permalink
Fix for Viper's lowercasing of config keys :/
Browse files Browse the repository at this point in the history
  • Loading branch information
tombh committed Jun 19, 2019
1 parent fc92642 commit 81f41b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 9 additions & 2 deletions interfacer/src/browsh/config_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ use-existing = false
with-gui = false
# Config that you might usually set through Firefox's 'about:config' page
[firefox-config]
# "privacy.resistFingerprinting" = true
# Note that string must be wrapped in quotes
# preferences = [
# "privacy.resistFingerprinting=true",
# "network.proxy.http='localhost'",
# "network.proxy.ssl='localhost'",
# "network.proxy.http_port=8118",
# "network.proxy.ssl_port=8118",
# "network.proxy.type=1"
# ]
[tty]
# The time in milliseconds between requesting a new TTY-sized pixel frame.
Expand Down
12 changes: 7 additions & 5 deletions interfacer/src/browsh/firefox.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func firefoxMarionette() {
Shutdown(errors.New("Failed to connect to Firefox's Marionette within 30 seconds"))
}
marionette = conn
readMarionette()
go readMarionette()
sendFirefoxCommand("WebDriver:NewSession", map[string]interface{}{})
}

Expand Down Expand Up @@ -258,7 +258,8 @@ func readMarionette() {
buffer := make([]byte, 4096)
count, err := marionette.Read(buffer)
if err != nil {
Shutdown(err)
Log("Error reading from Marionette connection")
return
}
Log("FF-MRNT: " + string(buffer[:count]))
}
Expand All @@ -270,15 +271,16 @@ func sendFirefoxCommand(command string, args map[string]interface{}) {
message := fmt.Sprintf("%d:%s", len(marshalled), marshalled)
fmt.Fprintf(marionette, message)
ffCommandCount++
readMarionette()
go readMarionette()
}

func setDefaultFirefoxPreferences() {
for key, value := range defaultFFPrefs {
setFFPreference(key, value)
}
for key, value := range viper.GetStringMapString("firefox-config") {
setFFPreference(key, value)
for _, pref := range viper.GetStringSlice("firefox.preferences") {
parts := strings.SplitN(pref, "=", 2)
setFFPreference(parts[0], parts[1])
}
}

Expand Down
2 changes: 1 addition & 1 deletion interfacer/src/browsh/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package browsh

var browshVersion = "1.6.0"
var browshVersion = "1.6.1"

0 comments on commit 81f41b7

Please sign in to comment.