Option to share session as read only

pull/13/head
Faruk Kasumovic 4 years ago
parent 732233ccad
commit ccd15fa220

@ -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 {

@ -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])

Loading…
Cancel
Save