Moving args to querystring

This commit is contained in:
Mike Bentzen 2022-08-12 23:00:46 +10:00
parent bfed9b4320
commit 2013f7ea1b
2 changed files with 5 additions and 5 deletions

View File

@ -13,8 +13,8 @@ if (elem !== null) {
term = new OurXterm(elem);
const httpsEnabled = window.location.protocol == "https:";
const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';
const args = window.location.search;
const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws' + args;
const factory = new ConnectionFactory(url, protocols);
const wt = new WebTTY(term, factory, args, gotty_auth_token);
const closer = wt.open();

View File

@ -72,7 +72,7 @@ func (server *Server) generateHandleWS(ctx context.Context, cancel context.Cance
}
defer conn.Close()
err = server.processWSConn(ctx, conn)
err = server.processWSConn(ctx, conn, r.URL.RawQuery)
switch err {
case ctx.Err():
@ -87,7 +87,7 @@ func (server *Server) generateHandleWS(ctx context.Context, cancel context.Cance
}
}
func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn) error {
func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn, rawquery string) error {
typ, initLine, err := conn.ReadMessage()
if err != nil {
return errors.Wrapf(err, "failed to authenticate websocket connection")
@ -106,8 +106,8 @@ func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn) e
}
queryPath := "?"
if server.options.PermitArguments && init.Arguments != "" {
queryPath = init.Arguments
if server.options.PermitArguments && rawquery != "" {
queryPath += rawquery
}
query, err := url.Parse(queryPath)