Merge branch 'remove-mailcap' of sloum/bombadillo into develop

This commit is contained in:
Sloom Sloum Sluom IV 2019-10-28 00:41:22 -04:00 committed by Gitea
commit 86265454d3
6 changed files with 12 additions and 68 deletions

View File

@ -9,9 +9,11 @@ These instructions will get a copy of the project up and running on your local m
### Prerequisites
If building from source, you will need to have [Go](https://golang.org/) version >= 1.12.
If building from source, you will need to have [Go](https://golang.org/) version >= 1.11.
While Bombadillo has one external dependency of [Mailcap](https://tildegit.org/sloum/mailcap), no action is typically required to download this, as it is handled automatically during the build process.
#### Optional
[Lynx](https://lynx.invisible-island.net/), the text based web browser, can be used as a parsing engine for http/https. This is a totally optional item and Lynx is in no way required in order to compile or run Bombadillo. Having it available on the system can help create a richer experience by allowing users to navigate directly to web content in Bombadillo. Many users may wish to avoid this entirely, and the default configuration does not have this behavior turned on. To turn it on from within Bombadillo enter the command `set lynxmode true`.
### Installing

View File

@ -1,4 +1,4 @@
.TH "bombadillo" 1 "12 OCT 2019" "" "General Operation Manual"
.TH "bombadillo" 1 "27 OCT 2019" "" "General Operation Manual"
.SH NAME
\fBbombadillo \fP- a non-web client
.SH SYNOPSIS
@ -28,7 +28,7 @@ Gopher is the default protocol for \fBbombadillo\fP. Any textual item types will
.TP
.B
gemini
Gemini is supported, but as a new protocol with an incomplete specification, features may change over time. At present Bombadillo supports TLS with a trust on first use certificate pinning system (similar to SSH). Client certificates are also supported via option configuration. Gemini maps and other text types are rendered in the client and non-text types will trigger a prompt to the user to download or open in an appropriate program.
Gemini is supported, but as a new protocol with an incomplete specification, features may change over time. At present Bombadillo supports TLS with a trust on first use certificate pinning system (similar to SSH). Client certificates are also supported via option configuration. Gemini maps and other text types are rendered in the client and non-text types will be downloaded.
.TP
.B
finger

View File

@ -936,62 +936,14 @@ func (c *client) handleGemini(u Url) {
c.SetHeaderUrl()
c.Draw()
} else {
c.SetMessage("The file is non-text: (o)pen or (w)rite to disk", false)
c.SetMessage("The file is non-text: writing to disk...", false)
c.DrawMessage()
var ch rune
for {
ch = cui.Getch()
if ch == 'o' || ch == 'w' {
break
}
}
switch ch {
case 'o':
mime := fmt.Sprintf("%s/%s", capsule.MimeMaj, capsule.MimeMin)
var term bool
if c.Options["terminalonly"] == "true" {
term = true
} else {
term = false
}
mcEntry, err := mc.FindMatch(mime, "view", term)
if err != nil {
c.SetMessage(err.Error(), true)
c.DrawMessage()
return
}
file, err := ioutil.TempFile("/tmp/", "bombadillo-*.tmp")
if err != nil {
c.SetMessage("Unable to create temporary file for opening, aborting file open", true)
c.DrawMessage()
return
}
// defer os.Remove(file.Name())
file.Write([]byte(capsule.Content))
com, e := mcEntry.Command(file.Name())
if e != nil {
c.SetMessage(e.Error(), true)
c.DrawMessage()
return
}
com.Stdin = os.Stdin
com.Stdout = os.Stdout
com.Stderr = os.Stderr
if c.Options["terminalonly"] == "true" {
cui.Clear("screen")
}
com.Run()
c.SetMessage("File opened by an appropriate program", true)
c.DrawMessage()
c.Draw()
case 'w':
nameSplit := strings.Split(u.Resource, "/")
filename := nameSplit[len(nameSplit)-1]
c.saveFileFromData(capsule.Content, filename)
}
nameSplit := strings.Split(u.Resource, "/")
filename := nameSplit[len(nameSplit)-1]
c.saveFileFromData(capsule.Content, filename)
}
case 3:
c.SetMessage("[3] Redirect. Follow redirect? y or any other key for no", false)
c.SetMessage(fmt.Sprintf("Follow redirect (y/n): %s?", capsule.Content), false)
c.DrawMessage()
ch := cui.Getch()
if ch == 'y' || ch == 'Y' {

4
go.mod
View File

@ -1,5 +1,3 @@
module tildegit.org/sloum/bombadillo
go 1.12
require tildegit.org/sloum/mailcap v0.0.0-20190706214029-b787a49e9db2
go 1.11

2
go.sum
View File

@ -1,2 +0,0 @@
tildegit.org/sloum/mailcap v0.0.0-20190706214029-b787a49e9db2 h1:tAPIFBpXwOq1Ytxk8aGsDjCutnwUC01BVkK77QS1bdU=
tildegit.org/sloum/mailcap v0.0.0-20190706214029-b787a49e9db2/go.mod h1:m4etAw9DbXsdanDUNS8oERhL+7y4II82ZLHWzw2yibg=

View File

@ -30,7 +30,6 @@ import (
"tildegit.org/sloum/bombadillo/config"
"tildegit.org/sloum/bombadillo/cui"
_ "tildegit.org/sloum/bombadillo/gemini"
"tildegit.org/sloum/mailcap"
)
var version string
@ -39,7 +38,6 @@ var build string
var bombadillo *client
var helplocation string = "gopher://bombadillo.colorfield.space:70/1/user-guide.map"
var settings config.Config
var mc *mailcap.Mailcap
func saveConfig() error {
var opts strings.Builder
@ -194,10 +192,6 @@ func main() {
}
args := flag.Args()
// Build the mailcap db
// So that we can open files from gemini
mc = mailcap.NewMailcap()
cui.InitTerm()
defer cui.Exit()
err := initClient()