diff --git a/config.go b/config.go index 8cb8b3f..b89f78a 100644 --- a/config.go +++ b/config.go @@ -15,6 +15,7 @@ type TTYShareConfig struct { LogFileName string `json:"logFileName"` UseTLS bool `json:"useTLS"` Server string `json:"server"` + ReadOnly bool `json:"readonly"` configFileName string commandName string commandArgs string @@ -36,6 +37,7 @@ func (conf *TTYShareConfig) Load() { flag.StringVar(&config.LogFileName, "logfile", config.LogFileName, "The name of the file to log") flag.BoolVar(&config.UseTLS, "useTLS", config.UseTLS, "Use TLS to connect to the server") flag.StringVar(&config.Server, "server", config.Server, "tty-server address") + flag.BoolVar(&config.ReadOnly, "readOnly", config.ReadOnly, "Share as a read only") flag.Parse() if conf.versionFlag { diff --git a/main.go b/main.go index 2a88ea3..2bab6b7 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ var version string = "0.0.0" var config = TTYShareConfig{ // default configuration options LogFileName: "-", Server: "go.tty-share.com:7654", + ReadOnly: false, UseTLS: false, } @@ -108,7 +109,7 @@ func main() { break } - if msg.Type == MsgIDWrite { + if (msg.Type == MsgIDWrite) && !config.ReadOnly { var msgWrite MsgTTYWrite json.Unmarshal(msg.Data, &msgWrite) ptyMaster.Write(msgWrite.Data[:msgWrite.Size])