mirror of
https://github.com/yudai/gotty.git
synced 2026-02-24 17:04:07 +01:00
Add xterm itegration
* Move to TypeScript from legacy JavaScript * Add support of xterm.js * Hterm is still available for backward compatibility
This commit is contained in:
parent
d6c98866b9
commit
8803721f3d
40 changed files with 9051 additions and 124 deletions
109
server/asset.go
109
server/asset.go
File diff suppressed because one or more lines are too long
|
|
@ -218,6 +218,11 @@ func (server *Server) handleAuthToken(w http.ResponseWriter, r *http.Request) {
|
|||
w.Write([]byte("var gotty_auth_token = '" + server.options.Credential + "';"))
|
||||
}
|
||||
|
||||
func (server *Server) handleConfig(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/javascript")
|
||||
w.Write([]byte("var gotty_term = '" + server.options.Term + "';"))
|
||||
}
|
||||
|
||||
// titleVariables merges maps in a specified order.
|
||||
// varUnits are name-keyed maps, whose names will be iterated using order.
|
||||
func (server *Server) titleVariables(order []string, varUnits map[string]map[string]interface{}) map[string]interface{} {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ type Options struct {
|
|||
Width int `hcl:"width" flagName:"width" flagDescribe:"Static width of the screen, 0(default) means dynamically resize" default:"0"`
|
||||
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"`
|
||||
|
||||
TitleVariables map[string]interface{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,9 @@ func (server *Server) setupHandlers(ctx context.Context, cancel context.CancelFu
|
|||
siteMux.HandleFunc(url.Path, server.handleIndex)
|
||||
siteMux.Handle(url.Path+"js/", http.StripPrefix(url.Path, staticFileHandler))
|
||||
siteMux.Handle(url.Path+"favicon.png", http.StripPrefix(url.Path, staticFileHandler))
|
||||
siteMux.Handle(url.Path+"css/", http.StripPrefix(url.Path, staticFileHandler))
|
||||
siteMux.HandleFunc(url.Path+"auth_token.js", server.handleAuthToken)
|
||||
siteMux.HandleFunc(url.Path+"config.js", server.handleConfig)
|
||||
|
||||
siteHandler := http.Handler(siteMux)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue