Browse Source

Add hostname option

Resolves #1.
master
Trevor Slocum 9 months ago
parent
commit
cfaca6678d
  1. 3
      CHANGELOG
  2. 2
      go.mod
  3. 4
      go.sum
  4. 14
      main.go
  5. 5
      pkg/gmitohtml/daemon.go

3
CHANGELOG

@ -1,3 +1,6 @@
1.0.4:
- Add hostname option
1.0.3:
- Set address bar width to screen width

2
go.mod

@ -2,4 +2,4 @@ module gitlab.com/tslocum/gmitohtml
go 1.15
require gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
require gopkg.in/yaml.v3 v3.0.0-20210105161348-2e78108cf5f8

4
go.sum

@ -1,4 +1,4 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210105161348-2e78108cf5f8 h1:tH9C0MON9YI3/KuD+u5+tQrQQ8px0MrcJ/avzeALw7o=
gopkg.in/yaml.v3 v3.0.0-20210105161348-2e78108cf5f8/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

14
main.go

@ -31,13 +31,17 @@ func openBrowser(url string) {
}
func main() {
var view bool
var allowFile bool
var daemon string
var configFile string
var (
view bool
allowFile bool
daemon string
hostname string
configFile string
)
flag.BoolVar(&view, "view", false, "open web browser")
flag.BoolVar(&allowFile, "allow-file", false, "allow local file access via file://")
flag.StringVar(&daemon, "daemon", "", "start daemon on specified address")
flag.StringVar(&hostname, "hostname", "", "server hostname (e.g. rocketnine.space) (defaults to daemon address)")
flag.StringVar(&configFile, "config", "", "path to configuration file")
// TODO option to include response header in page
flag.Parse()
@ -92,7 +96,7 @@ func main() {
}
})
err := gmitohtml.StartDaemon(daemon, allowFile)
err := gmitohtml.StartDaemon(daemon, hostname, allowFile)
if err != nil {
log.Fatal(err)
}

5
pkg/gmitohtml/daemon.go

@ -345,8 +345,11 @@ func SetOnBookmarksChanged(f func()) {
}
// StartDaemon starts the page conversion daemon.
func StartDaemon(address string, allowFile bool) error {
func StartDaemon(address string, hostname string, allowFile bool) error {
daemonAddress = address
if hostname != "" {
daemonAddress = hostname
}
allowFileAccess = allowFile
loadAssets()

Loading…
Cancel
Save