mirror of
https://github.com/sorenisanerd/gotty.git
synced 2025-04-02 17:10:29 +00:00
Moving args to querystring
This commit is contained in:
parent
bfed9b4320
commit
2013f7ea1b
@ -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();
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user