mirror of
https://code.rocketnine.space/tslocum/gmitohtml.git
synced 2024-05-06 18:05:25 +02:00
parent
2a1abe8efe
commit
cfaca6678d
|
@ -1,3 +1,6 @@
|
||||||
|
1.0.4:
|
||||||
|
- Add hostname option
|
||||||
|
|
||||||
1.0.3:
|
1.0.3:
|
||||||
- Set address bar width to screen width
|
- Set address bar width to screen width
|
||||||
|
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -2,4 +2,4 @@ module gitlab.com/tslocum/gmitohtml
|
||||||
|
|
||||||
go 1.15
|
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
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 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
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-20210105161348-2e78108cf5f8 h1:tH9C0MON9YI3/KuD+u5+tQrQQ8px0MrcJ/avzeALw7o=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210105161348-2e78108cf5f8/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
14
main.go
14
main.go
|
@ -31,13 +31,17 @@ func openBrowser(url string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var view bool
|
var (
|
||||||
var allowFile bool
|
view bool
|
||||||
var daemon string
|
allowFile bool
|
||||||
var configFile string
|
daemon string
|
||||||
|
hostname string
|
||||||
|
configFile string
|
||||||
|
)
|
||||||
flag.BoolVar(&view, "view", false, "open web browser")
|
flag.BoolVar(&view, "view", false, "open web browser")
|
||||||
flag.BoolVar(&allowFile, "allow-file", false, "allow local file access via file://")
|
flag.BoolVar(&allowFile, "allow-file", false, "allow local file access via file://")
|
||||||
flag.StringVar(&daemon, "daemon", "", "start daemon on specified address")
|
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")
|
flag.StringVar(&configFile, "config", "", "path to configuration file")
|
||||||
// TODO option to include response header in page
|
// TODO option to include response header in page
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -92,7 +96,7 @@ func main() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
err := gmitohtml.StartDaemon(daemon, allowFile)
|
err := gmitohtml.StartDaemon(daemon, hostname, allowFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,8 +345,11 @@ func SetOnBookmarksChanged(f func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartDaemon starts the page conversion daemon.
|
// StartDaemon starts the page conversion daemon.
|
||||||
func StartDaemon(address string, allowFile bool) error {
|
func StartDaemon(address string, hostname string, allowFile bool) error {
|
||||||
daemonAddress = address
|
daemonAddress = address
|
||||||
|
if hostname != "" {
|
||||||
|
daemonAddress = hostname
|
||||||
|
}
|
||||||
allowFileAccess = allowFile
|
allowFileAccess = allowFile
|
||||||
|
|
||||||
loadAssets()
|
loadAssets()
|
||||||
|
|
Loading…
Reference in a new issue