diff --git a/.gitignore b/.gitignore index 6ff0bb9..08cc3a5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ gotty bindata builds js/node_modules/* +.idea diff --git a/README.md b/README.md index 6a89233..e09c0db 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ By default, GoTTY starts a web server at port 8080. Open the URL on your web bro --credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] --random-url, -r Add a random string to the URL [$GOTTY_RANDOM_URL] --random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] +--custom-url, -u Add a customized string to the URL --tls, -t Enable TLS/SSL [$GOTTY_TLS] --tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] --tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] @@ -186,6 +187,10 @@ GoTTY uses [xterm.js](https://xtermjs.org/) and [hterm](https://groups.google.co * [termshare](https://termsha.re): Terminal-Terminal sharing through a HTTP server * [tmux](https://tmux.github.io/): Tmux itself also supports TTY sharing through SSH) +# Changelog for this fork + +* Merged in waiting PR for origin repo (https://github.com/yudai/gotty/pull/197), adding the `--custom-url` option + # License The MIT License diff --git a/backend/localcommand/factory.go b/backend/localcommand/factory.go index 11810ed..b27d487 100644 --- a/backend/localcommand/factory.go +++ b/backend/localcommand/factory.go @@ -4,7 +4,7 @@ import ( "syscall" "time" - "github.com/yudai/gotty/server" + "github.com/nimbix/gotty/server" ) type Options struct { diff --git a/main.go b/main.go index b6290be..7bb971a 100644 --- a/main.go +++ b/main.go @@ -11,10 +11,10 @@ import ( "github.com/codegangsta/cli" - "github.com/yudai/gotty/backend/localcommand" - "github.com/yudai/gotty/pkg/homedir" - "github.com/yudai/gotty/server" - "github.com/yudai/gotty/utils" + "github.com/nimbix/gotty/backend/localcommand" + "github.com/nimbix/gotty/pkg/homedir" + "github.com/nimbix/gotty/server" + "github.com/nimbix/gotty/utils" ) func main() { diff --git a/server/handlers.go b/server/handlers.go index f1a2f9b..ba9771d 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -13,7 +13,7 @@ import ( "github.com/gorilla/websocket" "github.com/pkg/errors" - "github.com/yudai/gotty/webtty" + "github.com/nimbix/gotty/webtty" ) func (server *Server) generateHandleWS(ctx context.Context, cancel context.CancelFunc, counter *counter) http.HandlerFunc { diff --git a/server/options.go b/server/options.go index 3d7f69c..91fd57e 100644 --- a/server/options.go +++ b/server/options.go @@ -12,6 +12,7 @@ type Options struct { Credential string `hcl:"credential" flagName:"credential" flagSName:"c" flagDescribe:"Credential for Basic Authentication (ex: user:pass, default disabled)" default:""` EnableRandomUrl bool `hcl:"enable_random_url" flagName:"random-url" flagSName:"r" flagDescribe:"Add a random string to the URL" default:"false"` RandomUrlLength int `hcl:"random_url_length" flagName:"random-url-length" flagDescribe:"Random URL length" default:"8"` + CustomUrl string `hcl:"custom_url" flagName:"custom-url" flagSName:"u" flagDescribe:"Custom URL" default:""` EnableTLS bool `hcl:"enable_tls" flagName:"tls" flagSName:"t" flagDescribe:"Enable TLS/SSL" default:"false"` TLSCrtFile string `hcl:"tls_crt_file" flagName:"tls-crt" flagDescribe:"TLS/SSL certificate file path" default:"~/.gotty.crt"` TLSKeyFile string `hcl:"tls_key_file" flagName:"tls-key" flagDescribe:"TLS/SSL key file path" default:"~/.gotty.key"` diff --git a/server/server.go b/server/server.go index 6411e71..30e4ee0 100644 --- a/server/server.go +++ b/server/server.go @@ -18,9 +18,9 @@ import ( "github.com/gorilla/websocket" "github.com/pkg/errors" - "github.com/yudai/gotty/pkg/homedir" - "github.com/yudai/gotty/pkg/randomstring" - "github.com/yudai/gotty/webtty" + "github.com/nimbix/gotty/pkg/homedir" + "github.com/nimbix/gotty/pkg/randomstring" + "github.com/nimbix/gotty/webtty" ) // Server provides a webtty HTTP endpoint. @@ -97,7 +97,10 @@ func (server *Server) Run(ctx context.Context, options ...RunOption) error { path := "/" if server.options.EnableRandomUrl { - path = "/" + randomstring.Generate(server.options.RandomUrlLength) + "/" + path += randomstring.Generate(server.options.RandomUrlLength) + "/" + } + if server.options.CustomUrl != "" { + path += server.options.CustomUrl + "/" } handlers := server.setupHandlers(cctx, cancel, path, counter) diff --git a/server/slave.go b/server/slave.go index 77d0973..41509b5 100644 --- a/server/slave.go +++ b/server/slave.go @@ -1,7 +1,7 @@ package server import ( - "github.com/yudai/gotty/webtty" + "github.com/nimbix/gotty/webtty" ) // Slave is webtty.Slave with some additional methods. diff --git a/utils/flags.go b/utils/flags.go index b5c66b9..e4b92d9 100644 --- a/utils/flags.go +++ b/utils/flags.go @@ -11,7 +11,7 @@ import ( "github.com/fatih/structs" "github.com/yudai/hcl" - "github.com/yudai/gotty/pkg/homedir" + "github.com/nimbix/gotty/pkg/homedir" ) func GenerateFlags(options ...interface{}) (flags []cli.Flag, mappings map[string]string, err error) {