move vdomclient to waveapp (#1290)

This commit is contained in:
Mike Sawka 2024-11-14 13:32:58 -08:00 committed by GitHub
parent 2dfdf66169
commit 8b672211a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
// Copyright 2024, Command Line Inc. // Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
package vdomclient package waveapp
import ( import (
"bytes" "bytes"

View File

@ -1,7 +1,7 @@
// Copyright 2024, Command Line Inc. // Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
package vdomclient package waveapp
import ( import (
"context" "context"
@ -44,7 +44,7 @@ type Client struct {
RootElem *vdom.VDomElem RootElem *vdom.VDomElem
RpcClient *wshutil.WshRpc RpcClient *wshutil.WshRpc
RpcContext *wshrpc.RpcContext RpcContext *wshrpc.RpcContext
ServerImpl *VDomServerImpl ServerImpl *WaveAppServerImpl
IsDone bool IsDone bool
RouteId string RouteId string
VDomContextBlockId string VDomContextBlockId string
@ -171,7 +171,7 @@ func (client *Client) Connect() error {
if client.RpcContext == nil || client.RpcContext.BlockId == "" { if client.RpcContext == nil || client.RpcContext.BlockId == "" {
return fmt.Errorf("no block id in rpc context") return fmt.Errorf("no block id in rpc context")
} }
client.ServerImpl = &VDomServerImpl{BlockId: client.RpcContext.BlockId, Client: client} client.ServerImpl = &WaveAppServerImpl{BlockId: client.RpcContext.BlockId, Client: client}
sockName, err := wshutil.ExtractUnverifiedSocketName(jwtToken) sockName, err := wshutil.ExtractUnverifiedSocketName(jwtToken)
if err != nil { if err != nil {
return fmt.Errorf("error extracting socket name from %s: %v", wshutil.WaveJwtTokenVarName, err) return fmt.Errorf("error extracting socket name from %s: %v", wshutil.WaveJwtTokenVarName, err)

View File

@ -1,7 +1,7 @@
// Copyright 2024, Command Line Inc. // Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
package vdomclient package waveapp
import ( import (
"bytes" "bytes"
@ -14,14 +14,14 @@ import (
"github.com/wavetermdev/waveterm/pkg/wshrpc" "github.com/wavetermdev/waveterm/pkg/wshrpc"
) )
type VDomServerImpl struct { type WaveAppServerImpl struct {
Client *Client Client *Client
BlockId string BlockId string
} }
func (*VDomServerImpl) WshServerImpl() {} func (*WaveAppServerImpl) WshServerImpl() {}
func (impl *VDomServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate] { func (impl *WaveAppServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate] {
respChan := make(chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate], 5) respChan := make(chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate], 5)
defer func() { defer func() {
@ -99,7 +99,7 @@ func (impl *VDomServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom
return respChan return respChan
} }
func (impl *VDomServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse] { func (impl *WaveAppServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse] {
respChan := make(chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]) respChan := make(chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse])
writer := NewStreamingResponseWriter(respChan) writer := NewStreamingResponseWriter(respChan)