diff --git a/CHANGELOG b/CHANGELOG index 4539971..4423bf2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.0.4: +- Add hostname option + 1.0.3: - Set address bar width to screen width diff --git a/go.mod b/go.mod index 7638ace..b02318c 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index d1f72c7..94c3e6c 100644 --- a/go.sum +++ b/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= diff --git a/main.go b/main.go index 80fbf3f..1a6fc43 100644 --- a/main.go +++ b/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) } diff --git a/pkg/gmitohtml/daemon.go b/pkg/gmitohtml/daemon.go index 57eb3a4..fbdb09e 100644 --- a/pkg/gmitohtml/daemon.go +++ b/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()