forked from tslocum/twins
1
0
Fork 0

Add configuration option ShowImages

When enabled, clients accessing gemini pages via HTTPS will see links to
images as inline images.

Resolves #13.
This commit is contained in:
Trevor Slocum 2021-07-22 20:00:50 -07:00
parent 0c4c7e8ecb
commit 24f3196a61
2 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,11 @@ Address to listen for connections on in the format of `interface:port`.
Content types may be defined by file extension. When a type is not defined for
the requested file extension, content type is detected automatically.
## ShowImages
When enabled, clients accessing gemini pages via HTTPS will see links to images
as inline images.
## Hosts
Hosts are defined by their hostname followed by one or more paths to serve.

View File

@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"code.rocketnine.space/tslocum/gmitohtml/pkg/gmitohtml"
"github.com/kballard/go-shellquote"
"github.com/yookoala/gofast"
"gopkg.in/yaml.v2"
@ -76,6 +77,7 @@ type hostConfig struct {
type serverConfig struct {
Listen string
Types map[string]string
ShowImages bool
Hosts map[string]*hostConfig
DisableHTTPS bool
DisableSize bool
@ -151,6 +153,8 @@ func readconfig(configPath string) error {
config.Types[".gemini"] = geminiType
}
gmitohtml.Config.ConvertImages = config.ShowImages
defaultHost := config.Hosts["default"]
delete(config.Hosts, "default")