🐛 Fixes #81
This commit is contained in:
parent
eb10c26599
commit
b7efbdaeea
|
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- XDG user dir file is parsed instead of looking for XDG env vars (#97, #100)
|
- XDG user dir file is parsed instead of looking for XDG env vars (#97, #100)
|
||||||
- Support paths with spaces in HTTP browser config setting (#77)
|
- Support paths with spaces in HTTP browser config setting (#77)
|
||||||
- Clicking "Change" on an existing bookmark without changing the text no longer removes it (#91)
|
- Clicking "Change" on an existing bookmark without changing the text no longer removes it (#91)
|
||||||
|
- Display HTTP Error if "Open In Portal" fails (#81)
|
||||||
|
|
||||||
|
|
||||||
## [v1.5.0] - 2020-09-01
|
## [v1.5.0] - 2020-09-01
|
||||||
|
|
|
@ -117,10 +117,12 @@ func dlChoice(text, u string, resp *gemini.Response) {
|
||||||
portalURL = parsed.String() + "%3F" + query
|
portalURL = parsed.String() + "%3F" + query
|
||||||
}
|
}
|
||||||
portalURL = strings.TrimPrefix(portalURL, "gemini://") + "?raw=1"
|
portalURL = strings.TrimPrefix(portalURL, "gemini://") + "?raw=1"
|
||||||
handleHTTP("https://portal.mozz.us/gemini/"+portalURL, false)
|
ok := handleHTTP("https://portal.mozz.us/gemini/"+portalURL, false)
|
||||||
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
if ok {
|
||||||
App.SetFocus(tabs[curTab].view)
|
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
||||||
App.Draw()
|
App.SetFocus(tabs[curTab].view)
|
||||||
|
App.Draw()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
||||||
|
|
|
@ -145,35 +145,42 @@ func setPage(t *tab, p *structs.Page) {
|
||||||
|
|
||||||
// handleHTTP is used by handleURL.
|
// handleHTTP is used by handleURL.
|
||||||
// It opens HTTP links and displays Info and Error modals.
|
// It opens HTTP links and displays Info and Error modals.
|
||||||
func handleHTTP(u string, showInfo bool) {
|
// Returns false if there was an error.
|
||||||
|
func handleHTTP(u string, showInfo bool) bool {
|
||||||
if len(config.HTTPCommand) == 1 {
|
if len(config.HTTPCommand) == 1 {
|
||||||
// Possibly a non-command
|
// Possibly a non-command
|
||||||
|
|
||||||
switch strings.TrimSpace(config.HTTPCommand[0]) {
|
switch strings.TrimSpace(config.HTTPCommand[0]) {
|
||||||
case "", "off":
|
case "", "off":
|
||||||
Error("HTTP Error", "Opening HTTP URLs is turned off.")
|
Error("HTTP Error", "Opening HTTP URLs is turned off.")
|
||||||
|
return false
|
||||||
case "default":
|
case "default":
|
||||||
s, err := webbrowser.Open(u)
|
s, err := webbrowser.Open(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error("Webbrowser Error", err.Error())
|
Error("Webbrowser Error", err.Error())
|
||||||
} else if showInfo {
|
return false
|
||||||
|
}
|
||||||
|
if showInfo {
|
||||||
Info(s)
|
Info(s)
|
||||||
}
|
}
|
||||||
}
|
return true
|
||||||
} else {
|
|
||||||
// Custom command
|
|
||||||
var err error = nil
|
|
||||||
if len(config.HTTPCommand) > 1 {
|
|
||||||
err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start()
|
|
||||||
} else {
|
|
||||||
err = exec.Command(config.HTTPCommand[0], u).Start()
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
Error("HTTP Error", "Error executing custom browser command: "+err.Error())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom command
|
||||||
|
var err error = nil
|
||||||
|
if len(config.HTTPCommand) > 1 {
|
||||||
|
err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start()
|
||||||
|
} else {
|
||||||
|
err = exec.Command(config.HTTPCommand[0], u).Start()
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
Error("HTTP Error", "Error executing custom browser command: "+err.Error())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
App.Draw()
|
App.Draw()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleOther is used by handleURL.
|
// handleOther is used by handleURL.
|
||||||
|
|
Loading…
Reference in New Issue