Add WebGL and links addons for xterm.js

This commit is contained in:
Søren L. Hansen 2021-04-22 12:44:06 -07:00
parent 8d7358b3b3
commit 0dfc5aed76
9 changed files with 47 additions and 14 deletions

File diff suppressed because one or more lines are too long

View file

@ -154,9 +154,12 @@ func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn) e
if server.options.Height > 0 {
opts = append(opts, webtty.WithFixedRows(server.options.Height))
}
if server.options.Preferences != nil {
opts = append(opts, webtty.WithMasterPreferences(server.options.Preferences))
if server.options.Preferences == nil {
server.options.Preferences = &HtermPrefernces{}
}
// Awkward hack until HtermPreferences can be phased out
server.options.Preferences.EnableWebGL = server.options.EnableWebGL
opts = append(opts, webtty.WithMasterPreferences(server.options.Preferences))
tty, err := webtty.New(&wsWrapper{conn}, slave, opts...)
if err != nil {

View file

@ -31,6 +31,7 @@ type Options struct {
Height int `hcl:"height" flagName:"height" flagDescribe:"Static height of the screen, 0(default) means dynamically resize" default:"0"`
WSOrigin string `hcl:"ws_origin" flagName:"ws-origin" flagDescribe:"A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default" default:""`
Term string `hcl:"term" flagName:"term" flagDescribe:"Terminal name to use on the browser, one of xterm or hterm." default:"xterm"`
EnableWebGL bool `hcl:"enable_webgl" flagName:"enable-webgl" flagDescribe:"Enable WebGL renderer" default:"true"`
TitleVariables map[string]interface{}
}
@ -73,6 +74,7 @@ type HtermPrefernces struct {
EnableClipboardNotice bool `hcl:"enable_clipboard_notice" json:"enable-clipboard-notice,omitempty"`
EnableClipboardWrite bool `hcl:"enable_clipboard_write" json:"enable-clipboard-write,omitempty"`
EnableDec12 bool `hcl:"enable_dec12" json:"enable-dec12,omitempty"`
EnableWebGL bool `json:"EnableWebGL,omitempty"`
Environment map[string]string `hcl:"environment" json:"environment,omitempty"`
FontFamily string `hcl:"font_family" json:"font-family,omitempty"`
FontSize int `hcl:"font_size" json:"font-size,omitempty"`