diff --git a/bombadillo.1 b/bombadillo.1 index 83a27c7..aa0296a 100644 --- a/bombadillo.1 +++ b/bombadillo.1 @@ -210,6 +210,10 @@ configlocation The path to the directory that the \fI.bombadillo.ini\fP configuration file is stored in. This is a \fBread only\fP setting and cannot be changed with the \fIset\fP command, but it can be read with the \fIcheck\fP command. .TP .B +defaultscheme +The scheme that should be used when no scheme is present in a given URL. \fIgopher\fP, \fIgemini\fP, \fIhttp\fP, and \fIhttps\fP are valid values. +.TP +.B homeurl The url that \fBbombadillo\fP navigates to when the program loads or when the \fIhome\fP or \fIh\fP LINE COMMAND is issued. This should be a valid url. If a scheme/protocol is not included, gopher will be assumed. .TP diff --git a/defaults.go b/defaults.go index a89e7f5..022435f 100644 --- a/defaults.go +++ b/defaults.go @@ -50,6 +50,7 @@ var defaultOptions = map[string]string{ "searchengine": "gopher://gopher.floodgap.com:70/7/v2/vs", "telnetcommand": "telnet", "configlocation": xdgConfigPath(), + "defaultscheme": "gopher", // "gopher", "gemini", "http", "https" "theme": "normal", // "normal", "inverted" "tlscertificate": "", "tlskey": "", diff --git a/main.go b/main.go index 3b6e8ba..5fb0596 100644 --- a/main.go +++ b/main.go @@ -66,8 +66,9 @@ func saveConfig() error { func validateOpt(opt, val string) bool { var validOpts = map[string][]string{ - "webmode": []string{"none", "gui", "lynx", "w3m", "elinks"}, - "theme": []string{"normal", "inverse"}, + "webmode": []string{"none", "gui", "lynx", "w3m", "elinks"}, + "theme": []string{"normal", "inverse"}, + "defaultscheme": []string{"gopher", "gemini", "http", "https"}, } opt = strings.ToLower(opt) @@ -86,7 +87,7 @@ func validateOpt(opt, val string) bool { func lowerCaseOpt(opt, val string) string { switch opt { - case "webmode", "theme": + case "webmode", "theme", "defaultscheme": return strings.ToLower(val) default: return val diff --git a/url.go b/url.go index bc1895a..a6823fa 100644 --- a/url.go +++ b/url.go @@ -44,6 +44,7 @@ func MakeUrl(u string) (Url, error) { if len(u) < 1 { return Url{}, fmt.Errorf("Invalid url, unable to parse") } + if strings.HasPrefix(u, "finger://") { return parseFinger(u) } @@ -103,7 +104,7 @@ func MakeUrl(u string) (Url, error) { out.Scheme = strings.ToLower(out.Scheme) if out.Scheme == "" { - out.Scheme = "gopher" + out.Scheme = bombadillo.Options["defaultscheme"] } if out.Scheme == "gopher" && out.Port == "" {