added SetXtermHtml and GetXtermHtml to enable the caller to customize the ssh page
This commit is contained in:
parent
4016793327
commit
65cec65597
@ -29,7 +29,7 @@ var xterm_addon_fit_js []byte
|
||||
//go:embed xterm.css
|
||||
var xterm_css []byte
|
||||
//go:embed xterm.html
|
||||
var xterm_html []byte
|
||||
var xterm_html string
|
||||
|
||||
type server_proxy struct {
|
||||
s *Server
|
||||
@ -547,7 +547,11 @@ func (pxy *server_proxy_xterm_file) ServeHTTP(w http.ResponseWriter, req *http.R
|
||||
}
|
||||
|
||||
tmpl = template.New("")
|
||||
_, err = tmpl.Parse(string(xterm_html))
|
||||
if s.xterm_html != "" {
|
||||
_, err = tmpl.Parse(s.xterm_html)
|
||||
} else {
|
||||
_, err = tmpl.Parse(xterm_html)
|
||||
}
|
||||
if err != nil {
|
||||
status_code = http.StatusInternalServerError; w.WriteHeader(status_code)
|
||||
goto oops
|
||||
|
12
server.go
12
server.go
@ -59,7 +59,6 @@ type Server struct {
|
||||
wpx_addr []string
|
||||
wpx_mux *http.ServeMux
|
||||
wpx []*http.Server // proxy server than handles http/https only
|
||||
wpx_resp_tf ServerWpxResponseTransformer
|
||||
|
||||
ctl_addr []string
|
||||
ctl_prefix string
|
||||
@ -90,6 +89,9 @@ type Server struct {
|
||||
ssh_proxy_sessions atomic.Int64
|
||||
}
|
||||
|
||||
wpx_resp_tf ServerWpxResponseTransformer
|
||||
xterm_html string
|
||||
|
||||
UnimplementedHoduServer
|
||||
}
|
||||
|
||||
@ -1123,6 +1125,14 @@ func (s *Server) GetWpxResponseTransformer() ServerWpxResponseTransformer {
|
||||
return s.wpx_resp_tf
|
||||
}
|
||||
|
||||
func (s *Server) SetXtermHtml(html string) {
|
||||
s.xterm_html = html
|
||||
}
|
||||
|
||||
func (s *Server) GetXtermHtml() string {
|
||||
return s.xterm_html
|
||||
}
|
||||
|
||||
func (s *Server) run_grpc_server(idx int, wg *sync.WaitGroup) error {
|
||||
var l *net.TCPListener
|
||||
var err error
|
||||
|
Loading…
x
Reference in New Issue
Block a user