Expand terminal to occupy the whole screen

This commit is contained in:
klizhentas 2015-07-13 10:53:55 -07:00
parent b6e8047c56
commit 9da00a86cc
6 changed files with 40 additions and 31 deletions

View file

@ -52,7 +52,6 @@ var SessionPage = React.createClass({
<LeftNavBar current="sessions"/>
<div id="page-wrapper" className="gray-bg">
<TopNavBar/>
<PageHeader title={"Session '"+session.id+"'"} url={"/sessions" + session.id}/>
<div className="wrapper wrapper-content animated fadeInRight">
<div className="row">
<div className="col-lg-9" style={{width: '920px'}}>

View file

@ -108,7 +108,6 @@ func newCPHandler(host string, auth []utils.NetAddr, assetsDir string) *cpHandle
func (s *cpHandler) ls(w http.ResponseWriter, r *http.Request, p httprouter.Params, c *ctx) {
root := r.URL.Query().Get("node")
log.Infof("!!!! LS: root: %v", root)
addr := p[0].Value

View file

@ -55,10 +55,16 @@ func (w *wsHandler) connectUpstream() (*sshutils.Upstream, error) {
}
up.GetSession().SendRequest(
sshutils.SetEnvReq, false,
ssh.Marshal(sshutils.EnvReq{
ssh.Marshal(sshutils.EnvReqParams{
Name: sshutils.SessionEnvVar,
Value: w.sid,
}))
up.GetSession().SendRequest(
sshutils.PTYReq, false,
ssh.Marshal(sshutils.PTYReqParams{
W: 120,
H: 32,
}))
return up, nil
}

View file

@ -92,7 +92,8 @@ func New(addr utils.NetAddr, signers []ssh.Signer,
s.elog = utils.NullEventLogger
}
srv, err := sshutils.NewServer(
addr, s, signers, sshutils.AuthMethods{PublicKey: s.keyAuth},
addr, s, signers,
sshutils.AuthMethods{PublicKey: s.keyAuth},
sshutils.SetRequestHandler(s))
if err != nil {
return nil, err
@ -373,7 +374,7 @@ func (s *Server) dispatch(sconn *ssh.ServerConn, ch ssh.Channel, req *ssh.Reques
case "exec":
// exec is a remote execution of a program, does not use PTY
return s.handleExec(ch, req, ctx)
case "pty-req":
case sshutils.PTYReq:
// SSH client asked to allocate PTY
return s.handlePTYReq(ch, req, ctx)
case "shell":
@ -386,7 +387,7 @@ func (s *Server) dispatch(sconn *ssh.ServerConn, ch ssh.Channel, req *ssh.Reques
// subsystems are SSH subsystems defined in http://tools.ietf.org/html/rfc4254 6.6
// they are in essence SSH session extensions, allowing to implement new SSH commands
return s.handleSubsystem(sconn, ch, req, ctx)
case "window-change":
case sshutils.WindowChangeReq:
return s.handleWinChange(ch, req, ctx)
case "auth-agent-req@openssh.com":
// This happens when SSH client has agent forwarding enabled, in this case
@ -453,7 +454,7 @@ func (s *Server) emit(eid lunk.EventID, e lunk.Event) {
}
func (s *Server) handleEnv(ch ssh.Channel, req *ssh.Request, ctx *ctx) error {
var e sshutils.EnvReq
var e sshutils.EnvReqParams
if err := ssh.Unmarshal(req.Payload, &e); err != nil {
log.Errorf("%v handleEnv(err=%v)", err)
return fmt.Errorf("failed to parse env request, error: %v", err)

View file

@ -6,6 +6,8 @@ import (
"syscall"
"unsafe"
"github.com/gravitational/teleport/sshutils"
"github.com/gravitational/teleport/Godeps/_workspace/src/github.com/kr/pty"
"github.com/gravitational/teleport/Godeps/_workspace/src/github.com/mailgun/log"
"github.com/gravitational/teleport/Godeps/_workspace/src/golang.org/x/crypto/ssh"
@ -20,25 +22,8 @@ type term struct {
done bool
}
type ptyReq struct {
Env string
W uint32
H uint32
Wpx uint32
Hpx uint32
Modes string
}
type winChangeReq struct {
W uint32
H uint32
Wpx uint32
Hpx uint32
Modes string
}
func parsePTYReq(req *ssh.Request) (*ptyReq, error) {
var r ptyReq
func parsePTYReq(req *ssh.Request) (*sshutils.PTYReqParams, error) {
var r sshutils.PTYReqParams
if err := ssh.Unmarshal(req.Payload, &r); err != nil {
log.Infof("failed to parse PTY request: %v", err)
return nil, err
@ -57,7 +42,7 @@ func newTerm() (*term, error) {
}
func reqPTY(req *ssh.Request) (*term, error) {
var r ptyReq
var r sshutils.PTYReqParams
if err := ssh.Unmarshal(req.Payload, &r); err != nil {
log.Infof("failed to parse PTY request: %v", err)
return nil, err
@ -73,7 +58,7 @@ func reqPTY(req *ssh.Request) (*term, error) {
}
func (t *term) reqWinChange(req *ssh.Request) error {
var r winChangeReq
var r sshutils.WinChangeReqParams
if err := ssh.Unmarshal(req.Payload, &r); err != nil {
log.Infof("failed to parse window change request: %v", err)
return err

View file

@ -1,11 +1,30 @@
package sshutils
type EnvReq struct {
type EnvReqParams struct {
Name string
Value string
}
type WinChangeReqParams struct {
W uint32
H uint32
Wpx uint32
Hpx uint32
Modes string
}
type PTYReqParams struct {
Env string
W uint32
H uint32
Wpx uint32
Hpx uint32
Modes string
}
const (
SessionEnvVar = "TELEPORT_SESSION"
SetEnvReq = "env"
SessionEnvVar = "TELEPORT_SESSION"
SetEnvReq = "env"
WindowChangeReq = "window-change"
PTYReq = "pty-req"
)