kopia lustrzana https://github.com/browsh-org/browsh
fix: Don't load startup URL in HTTP Server mode
I think this is the source of a long-standing issue in the HTTP Server where it would just freeze after a certain period of time. Every successful page load, wether it was explicitly requested as a raw-text request or not, attempts to send a raw text payload on page load. So I think the automatic default home page startup loading was confusing things. Fixes #207pull/435/head
rodzic
1f20113bc0
commit
aaea254f0d
|
@ -38,6 +38,7 @@ var (
|
|||
***********************`
|
||||
// IsTesting is used in tests, so it needs to be exported
|
||||
IsTesting = false
|
||||
IsHTTPServerMode = false
|
||||
logfile string
|
||||
_ = pflag.Bool("version", false, "Output current Browsh version")
|
||||
)
|
||||
|
|
|
@ -158,7 +158,9 @@ func webSocketServer(w http.ResponseWriter, r *http.Request) {
|
|||
// work. So we do it here instead.
|
||||
validURL := viper.GetStringSlice("validURL")
|
||||
if len(validURL) == 0 {
|
||||
if !IsHTTPServerMode {
|
||||
sendMessageToWebExtension("/new_tab," + viper.GetString("startup-url"))
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < len(validURL); i++ {
|
||||
sendMessageToWebExtension("/new_tab," + validURL[i])
|
||||
|
|
|
@ -66,6 +66,7 @@ type rawTextResponse struct {
|
|||
// it will return:
|
||||
// `Something `
|
||||
func HTTPServerStart() {
|
||||
IsHTTPServerMode = true
|
||||
StartFirefox()
|
||||
go startWebSocketServer()
|
||||
Log("Starting Browsh HTTP server")
|
||||
|
|
|
@ -47,11 +47,16 @@ export default MixinBase =>
|
|||
}
|
||||
|
||||
_rawTextRequest(incoming) {
|
||||
// I think the only reason that a tab would send a raw text payload is the
|
||||
// automatic startup URL loading, which should now be disabled for HTTP Server
|
||||
// mode.
|
||||
if (this.request_id) {
|
||||
let payload = {
|
||||
json: JSON.stringify(incoming),
|
||||
request_id: this.request_id
|
||||
};
|
||||
this.sendToTerminal(`/raw_text,${JSON.stringify(payload)}`);
|
||||
}
|
||||
this._tabCount(count => {
|
||||
if (count > 1) {
|
||||
this.remove();
|
||||
|
|
Ładowanie…
Reference in New Issue