Solves merge conflicts with target
This commit is contained in:
commit
99fb1ce20b
|
@ -257,6 +257,8 @@ theme
|
||||||
Can toggle between visual modes. Valid values are \fInormal\fP, \fIcolor\fP, and \fIinverse\fP. When set to inverse, the normal mode colors are inverted. Both normal and inverse modes filter out terminal escape sequences. When set to color, Bombadillo will render terminal escape sequences representing colors when it finds them in documents.
|
Can toggle between visual modes. Valid values are \fInormal\fP, \fIcolor\fP, and \fIinverse\fP. When set to inverse, the normal mode colors are inverted. Both normal and inverse modes filter out terminal escape sequences. When set to color, Bombadillo will render terminal escape sequences representing colors when it finds them in documents.
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
|
timeout
|
||||||
|
The number of seconds after which connections to gopher or gemini servers should time out if the server has not responded.
|
||||||
webmode
|
webmode
|
||||||
Controls behavior when following web links. The following values are valid: \fInone\fP will disable following web links, \fIgui\fP will have the browser attempt to open web links in a user's default graphical web browser; \fIlynx\fP, \fIw3m\fP, and \fIelinks\fP will have the browser attempt to use the selected terminal web browser to handle the rendering of web pages and will display the pages directly in Bombadillo.
|
Controls behavior when following web links. The following values are valid: \fInone\fP will disable following web links, \fIgui\fP will have the browser attempt to open web links in a user's default graphical web browser; \fIlynx\fP, \fIw3m\fP, and \fIelinks\fP will have the browser attempt to use the selected terminal web browser to handle the rendering of web pages and will display the pages directly in Bombadillo.
|
||||||
|
|
||||||
|
|
22
client.go
22
client.go
|
@ -453,6 +453,8 @@ func (c *client) doCommandAs(action string, values []string) {
|
||||||
c.Options[values[0]] = lowerCaseOpt(values[0], val)
|
c.Options[values[0]] = lowerCaseOpt(values[0], val)
|
||||||
if values[0] == "geminiblocks" {
|
if values[0] == "geminiblocks" {
|
||||||
gemini.BlockBehavior = c.Options[values[0]]
|
gemini.BlockBehavior = c.Options[values[0]]
|
||||||
|
} else if values[0] == "timeout" {
|
||||||
|
updateTimeouts(c.Options[values[0]])
|
||||||
} else if values[0] == "configlocation" {
|
} else if values[0] == "configlocation" {
|
||||||
c.SetMessage("Cannot set READ ONLY setting 'configlocation'", true)
|
c.SetMessage("Cannot set READ ONLY setting 'configlocation'", true)
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
|
@ -997,6 +999,13 @@ func (c *client) handleGemini(u Url) {
|
||||||
if strings.Replace(lowerRedirect, lowerOriginal, "", 1) == "/" {
|
if strings.Replace(lowerRedirect, lowerOriginal, "", 1) == "/" {
|
||||||
c.Visit(capsule.Content)
|
c.Visit(capsule.Content)
|
||||||
} else {
|
} else {
|
||||||
|
if !strings.Contains(capsule.Content, "://") {
|
||||||
|
lnk, lnkErr := gemini.HandleRelativeUrl(capsule.Content, u.Full)
|
||||||
|
if lnkErr == nil {
|
||||||
|
capsule.Content = lnk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.SetMessage(fmt.Sprintf("Follow redirect (y/n): %s?", capsule.Content), false)
|
c.SetMessage(fmt.Sprintf("Follow redirect (y/n): %s?", capsule.Content), false)
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
ch := cui.Getch()
|
ch := cui.Getch()
|
||||||
|
@ -1193,3 +1202,16 @@ func findAvailableFileName(fpath, fname string) (string, error) {
|
||||||
|
|
||||||
return savePath, nil
|
return savePath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateTimeouts(timeoutString string) error {
|
||||||
|
sec, err := strconv.Atoi(timeoutString)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
timeout := time.Duration(sec) * time.Second
|
||||||
|
|
||||||
|
gopher.Timeout = timeout
|
||||||
|
gemini.TlsTimeout = timeout
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ var defaultOptions = map[string]string{
|
||||||
"showimages": "true",
|
"showimages": "true",
|
||||||
"telnetcommand": "telnet",
|
"telnetcommand": "telnet",
|
||||||
"theme": "normal", // "normal", "inverted", "color"
|
"theme": "normal", // "normal", "inverted", "color"
|
||||||
"webmode": "none", // "none", "gui", "lynx", "w3m", "elinks"
|
"timeout": "15", // connection timeout for gopher/gemini in seconds
|
||||||
|
"webmode": "none", // "none", "gui", "lynx", "w3m", "elinks"
|
||||||
}
|
}
|
||||||
|
|
||||||
// homePath will return the path to your home directory as a string
|
// homePath will return the path to your home directory as a string
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -24,7 +25,8 @@ type TofuDigest struct {
|
||||||
certs map[string]string
|
certs map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
var BlockBehavior = "block"
|
var BlockBehavior string = "block"
|
||||||
|
var TlsTimeout time.Duration = time.Duration(15) * time.Second
|
||||||
|
|
||||||
//------------------------------------------------\\
|
//------------------------------------------------\\
|
||||||
// + + + R E C E I V E R S + + + \\
|
// + + + R E C E I V E R S + + + \\
|
||||||
|
@ -175,7 +177,7 @@ func Retrieve(host, port, resource string, td *TofuDigest) (string, error) {
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := tls.Dial("tcp", addr, conf)
|
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: TlsTimeout}, "tcp", addr, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("TLS Dial Error: %s", err.Error())
|
return "", fmt.Errorf("TLS Dial Error: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -388,7 +390,7 @@ func parseGemini(b, currentUrl string) (string, []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Index(link, "://") < 0 {
|
if strings.Index(link, "://") < 0 {
|
||||||
link, _ = handleRelativeUrl(link, currentUrl)
|
link, _ = HandleRelativeUrl(link, currentUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
links = append(links, link)
|
links = append(links, link)
|
||||||
|
@ -407,7 +409,7 @@ func parseGemini(b, currentUrl string) (string, []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleRelativeUrl provides link completion
|
// handleRelativeUrl provides link completion
|
||||||
func handleRelativeUrl(relLink, current string) (string, error) {
|
func HandleRelativeUrl(relLink, current string) (string, error) {
|
||||||
base, err := url.Parse(current)
|
base, err := url.Parse(current)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return relLink, err
|
return relLink, err
|
||||||
|
|
|
@ -38,6 +38,8 @@ var types = map[string]string{
|
||||||
"T": "TEL",
|
"T": "TEL",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var Timeout time.Duration = time.Duration(15) * time.Second
|
||||||
|
|
||||||
//------------------------------------------------\\
|
//------------------------------------------------\\
|
||||||
// + + + F U N C T I O N S + + + \\
|
// + + + F U N C T I O N S + + + \\
|
||||||
//--------------------------------------------------\\
|
//--------------------------------------------------\\
|
||||||
|
@ -49,7 +51,6 @@ var types = map[string]string{
|
||||||
// be better.
|
// be better.
|
||||||
func Retrieve(host, port, resource string) ([]byte, error) {
|
func Retrieve(host, port, resource string) ([]byte, error) {
|
||||||
nullRes := make([]byte, 0)
|
nullRes := make([]byte, 0)
|
||||||
timeOut := time.Duration(5) * time.Second
|
|
||||||
|
|
||||||
if host == "" || port == "" {
|
if host == "" || port == "" {
|
||||||
return nullRes, errors.New("Incomplete request url")
|
return nullRes, errors.New("Incomplete request url")
|
||||||
|
@ -57,7 +58,7 @@ func Retrieve(host, port, resource string) ([]byte, error) {
|
||||||
|
|
||||||
addr := host + ":" + port
|
addr := host + ":" + port
|
||||||
|
|
||||||
conn, err := net.DialTimeout("tcp", addr, timeOut)
|
conn, err := net.DialTimeout("tcp", addr, Timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nullRes, err
|
return nullRes, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build darwin
|
// This will build for osx without a build tag based on the filename
|
||||||
|
|
||||||
package http
|
package http
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package http
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
)
|
|
||||||
|
|
||||||
// OpenInBrowser checks for the presence of a display server
|
|
||||||
// and environment variables indicating a gui is present. If found
|
|
||||||
// then xdg-open is called on a url to open said url in the default
|
|
||||||
// gui web browser for the system
|
|
||||||
func OpenInBrowser(url string) (string, error) {
|
|
||||||
disp := os.Getenv("DISPLAY")
|
|
||||||
wayland := os.Getenv("WAYLAND_DISPLAY")
|
|
||||||
_, err := exec.LookPath("Xorg")
|
|
||||||
if disp == "" && wayland == "" && err != nil {
|
|
||||||
return "", fmt.Errorf("No gui is available, check 'webmode' setting")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use start rather than run or output in order
|
|
||||||
// to release the process and not block
|
|
||||||
err = exec.Command("xdg-open", url).Start()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return "Opened in system default web browser", nil
|
|
||||||
}
|
|
|
@ -1,11 +1,30 @@
|
||||||
// +build !linux
|
// +build !darwin,!windows
|
||||||
// +build !darwin
|
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package http
|
package http
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OpenInBrowser checks for the presence of a display server
|
||||||
|
// and environment variables indicating a gui is present. If found
|
||||||
|
// then xdg-open is called on a url to open said url in the default
|
||||||
|
// gui web browser for the system
|
||||||
func OpenInBrowser(url string) (string, error) {
|
func OpenInBrowser(url string) (string, error) {
|
||||||
return "", fmt.Errorf("Unsupported os for 'webmode' 'gui' setting")
|
disp := os.Getenv("DISPLAY")
|
||||||
|
wayland := os.Getenv("WAYLAND_DISPLAY")
|
||||||
|
_, err := exec.LookPath("Xorg")
|
||||||
|
if disp == "" && wayland == "" && err != nil {
|
||||||
|
return "", fmt.Errorf("No gui is available, check 'webmode' setting")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use start rather than run or output in order
|
||||||
|
// to release the process and not block
|
||||||
|
err = exec.Command("xdg-open", url).Start()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return "Opened in system default web browser", nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// +build windows
|
// This will only build for windows based on the filename
|
||||||
|
// no build tag required
|
||||||
package http
|
package http
|
||||||
|
|
||||||
import "os/exec"
|
import "os/exec"
|
||||||
|
|
10
main.go
10
main.go
|
@ -82,6 +82,14 @@ func validateOpt(opt, val string) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opt == "timeout" {
|
||||||
|
_, err := strconv.Atoi(val)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +134,8 @@ func loadConfig() {
|
||||||
bombadillo.Options[lowerkey] = v.Value
|
bombadillo.Options[lowerkey] = v.Value
|
||||||
if lowerkey == "geminiblocks" {
|
if lowerkey == "geminiblocks" {
|
||||||
gemini.BlockBehavior = v.Value
|
gemini.BlockBehavior = v.Value
|
||||||
|
} else if lowerkey == "timeout" {
|
||||||
|
updateTimeouts(v.Value)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bombadillo.Options[lowerkey] = defaultOptions[lowerkey]
|
bombadillo.Options[lowerkey] = defaultOptions[lowerkey]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user