mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-12 15:17:16 +03:00
sshchat: Replace terminal echo hack with our forked terminal
This commit is contained in:
parent
1ba36b785c
commit
8653f0a730
2
go.mod
2
go.mod
@ -6,5 +6,5 @@ require (
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
github.com/shazow/rateio v0.0.0-20150116013248-e8e00881e5c1
|
||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313
|
||||
)
|
||||
|
8
host.go
8
host.go
@ -146,14 +146,6 @@ func (h *Host) Connect(term *sshd.Terminal) {
|
||||
break
|
||||
}
|
||||
|
||||
// Gross hack to override line echo in golang.org/x/crypto/ssh/terminal
|
||||
// It needs to live before we render any responses.
|
||||
term.Write([]byte{
|
||||
27, '[', 'A', // Up
|
||||
27, '[', '2', 'K', // Clear line
|
||||
})
|
||||
// May the gods have mercy on our souls.
|
||||
|
||||
err = ratelimit.Count(1)
|
||||
if err != nil {
|
||||
user.Send(message.NewSystemMsg("Message rejected: Rate limiting is in effect.", user))
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/shazow/ssh-chat/sshd/terminal"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
var keepaliveInterval = time.Second * 30
|
||||
@ -81,6 +81,7 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
|
||||
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
term.Terminal.ClearLine = true
|
||||
|
||||
go term.listen(requests)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user