Skip to content

Commit 81f41b7

Browse files
committed
Fix for Viper's lowercasing of config keys :/
See spf13/viper#635
1 parent fc92642 commit 81f41b7

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

interfacer/src/browsh/config_sample.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ use-existing = false
4242
with-gui = false
4343
4444
# Config that you might usually set through Firefox's 'about:config' page
45-
[firefox-config]
46-
# "privacy.resistFingerprinting" = true
45+
# Note that string must be wrapped in quotes
46+
# preferences = [
47+
# "privacy.resistFingerprinting=true",
48+
# "network.proxy.http='localhost'",
49+
# "network.proxy.ssl='localhost'",
50+
# "network.proxy.http_port=8118",
51+
# "network.proxy.ssl_port=8118",
52+
# "network.proxy.type=1"
53+
# ]
4754
4855
[tty]
4956
# The time in milliseconds between requesting a new TTY-sized pixel frame.

interfacer/src/browsh/firefox.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func firefoxMarionette() {
219219
Shutdown(errors.New("Failed to connect to Firefox's Marionette within 30 seconds"))
220220
}
221221
marionette = conn
222-
readMarionette()
222+
go readMarionette()
223223
sendFirefoxCommand("WebDriver:NewSession", map[string]interface{}{})
224224
}
225225

@@ -258,7 +258,8 @@ func readMarionette() {
258258
buffer := make([]byte, 4096)
259259
count, err := marionette.Read(buffer)
260260
if err != nil {
261-
Shutdown(err)
261+
Log("Error reading from Marionette connection")
262+
return
262263
}
263264
Log("FF-MRNT: " + string(buffer[:count]))
264265
}
@@ -270,15 +271,16 @@ func sendFirefoxCommand(command string, args map[string]interface{}) {
270271
message := fmt.Sprintf("%d:%s", len(marshalled), marshalled)
271272
fmt.Fprintf(marionette, message)
272273
ffCommandCount++
273-
readMarionette()
274+
go readMarionette()
274275
}
275276

276277
func setDefaultFirefoxPreferences() {
277278
for key, value := range defaultFFPrefs {
278279
setFFPreference(key, value)
279280
}
280-
for key, value := range viper.GetStringMapString("firefox-config") {
281-
setFFPreference(key, value)
281+
for _, pref := range viper.GetStringSlice("firefox.preferences") {
282+
parts := strings.SplitN(pref, "=", 2)
283+
setFFPreference(parts[0], parts[1])
282284
}
283285
}
284286

interfacer/src/browsh/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package browsh
22

3-
var browshVersion = "1.6.0"
3+
var browshVersion = "1.6.1"

0 commit comments

Comments
 (0)