Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
4c219ee
initial commit
esimkowitz Jan 3, 2025
1003187
save
esimkowitz Jan 3, 2025
f652ad0
Merge branch 'main' into evan/remote-s3
esimkowitz Jan 6, 2025
39aae45
save
esimkowitz Jan 6, 2025
4d20ebb
use fsclient in fileservice
esimkowitz Jan 7, 2025
7b9fc52
remove listentries
esimkowitz Jan 7, 2025
ac8a08b
fix name
esimkowitz Jan 7, 2025
6a34b0b
save
esimkowitz Jan 7, 2025
721653e
Merge branch 'main' into evan/remote-s3
esimkowitz Jan 7, 2025
acebeaa
add parseprofiles
esimkowitz Jan 8, 2025
58be97d
add connparse
esimkowitz Jan 8, 2025
cffd151
Merge branch 'main' into evan/remote-s3
esimkowitz Jan 8, 2025
5596aa7
switch import order
esimkowitz Jan 8, 2025
a6581d4
add boilerplate wavefs impl
esimkowitz Jan 8, 2025
9f23437
Merge branch 'main' into evan/remote-s3
esimkowitz Jan 10, 2025
dfc0ea3
save
esimkowitz Jan 11, 2025
ccdcf4e
connparse impl
esimkowitz Jan 13, 2025
d59497a
add back parseprofiles, make more modular
esimkowitz Jan 13, 2025
1191597
generate
esimkowitz Jan 13, 2025
1d2f1fe
save
esimkowitz Jan 13, 2025
3dd5070
save
esimkowitz Jan 14, 2025
0753a7b
got listentries implemented
esimkowitz Jan 14, 2025
d491ffa
save
esimkowitz Jan 14, 2025
d7f3a18
comment
esimkowitz Jan 14, 2025
6219bb7
add supportsmkdir
esimkowitz Jan 14, 2025
6414fba
move getfullconfig to wshrpc
esimkowitz Jan 14, 2025
cf77583
fix wsh errors
esimkowitz Jan 14, 2025
1deeb16
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 14, 2025
4022182
more plumbing
esimkowitz Jan 14, 2025
098730c
save
esimkowitz Jan 15, 2025
8f863db
fixed conn issue
esimkowitz Jan 15, 2025
9de524f
cat is working!
esimkowitz Jan 15, 2025
96e6725
formatting info
esimkowitz Jan 15, 2025
57deb43
add updated help text
esimkowitz Jan 15, 2025
041720a
update text
esimkowitz Jan 15, 2025
1ad2372
update text
esimkowitz Jan 15, 2025
294ae81
update text
esimkowitz Jan 15, 2025
e265cca
fix indents
esimkowitz Jan 15, 2025
75b5bf7
remove newline
esimkowitz Jan 15, 2025
aca09f2
more formatting
esimkowitz Jan 15, 2025
ca281d6
more improvements
esimkowitz Jan 15, 2025
579a6e8
fix wavefile scheme
esimkowitz Jan 15, 2025
fba2550
move wavefile below others
esimkowitz Jan 15, 2025
3bb25cb
more doc updates
esimkowitz Jan 15, 2025
58785c8
got ls working
esimkowitz Jan 15, 2025
489c81e
add default . to ls
esimkowitz Jan 15, 2025
106d9c7
move fixRelativePaths to wshcmd-file-util
esimkowitz Jan 15, 2025
44f48d6
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 15, 2025
281220a
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 15, 2025
778337c
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 15, 2025
66e2461
it's working!!!!
esimkowitz Jan 15, 2025
b2b16ed
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 15, 2025
1410f31
add readstream
esimkowitz Jan 16, 2025
f71a04f
save
esimkowitz Jan 16, 2025
1a2c6b0
got ui working
esimkowitz Jan 16, 2025
65b50bd
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 16, 2025
2e00cac
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 16, 2025
714c60d
fix merge error
esimkowitz Jan 16, 2025
149126a
update comment
esimkowitz Jan 16, 2025
2c525b8
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 16, 2025
47df22f
add tar stream command
esimkowitz Jan 16, 2025
81c7b47
add iochan test
esimkowitz Jan 16, 2025
2311577
tar seems to be working, can't write files to os
esimkowitz Jan 17, 2025
d992edc
save work
esimkowitz Jan 17, 2025
43a3f29
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 17, 2025
3b3b167
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 17, 2025
09f4239
fix merge error
esimkowitz Jan 17, 2025
d7e65a4
save
esimkowitz Jan 17, 2025
91c6525
add listbuckets
esimkowitz Jan 17, 2025
280e454
move listbuckets to awsconn
esimkowitz Jan 17, 2025
bc76164
save
esimkowitz Jan 17, 2025
29419fa
it works! timing out but still
esimkowitz Jan 18, 2025
e44ea1c
working, getting copy file error read/write on closed pipe, need to i…
esimkowitz Jan 18, 2025
fa94263
don't allow unregister to block the main sending loop
sawka Jan 18, 2025
d707995
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 21, 2025
1fe895f
it's working!
esimkowitz Jan 21, 2025
5f42b97
save
esimkowitz Jan 21, 2025
c0e25d6
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 21, 2025
367044e
add panichandler to runServer
sawka Jan 21, 2025
570885b
timeout
esimkowitz Jan 21, 2025
c76ca37
Merge branch 'main' into evan/combine-wsh-file-commands
esimkowitz Jan 21, 2025
3283314
Disable S3, add fileappend
esimkowitz Jan 21, 2025
e043a7b
clean up opts, fix append for wavefile
esimkowitz Jan 22, 2025
0fb579c
fix race condition around ctx.Done() and unregisterRpc() that can hap…
sawka Jan 22, 2025
d37e7de
update filestore to use ints for size
esimkowitz Jan 22, 2025
91e80b3
Potential fix for code scanning alert no. 72: Arbitrary file access d…
esimkowitz Jan 22, 2025
d9c1013
Update pkg/remote/awsconn/awsconn.go
esimkowitz Jan 22, 2025
20e393c
Update pkg/remote/awsconn/awsconn.go
esimkowitz Jan 22, 2025
74e8f60
Update pkg/remote/awsconn/awsconn.go
esimkowitz Jan 22, 2025
8541f72
Update pkg/util/iochan/iochan.go
esimkowitz Jan 22, 2025
d7e8b47
Update pkg/util/iochan/iochan.go
esimkowitz Jan 22, 2025
9355950
Update pkg/remote/fileshare/s3fs/s3fs.go
esimkowitz Jan 22, 2025
27d26c2
Update pkg/wshrpc/wshrpctypes.go
esimkowitz Jan 22, 2025
d38c3aa
use time.Duration for timeouts
esimkowitz Jan 22, 2025
3a31a0e
Update pkg/remote/fileshare/wavefs/wavefs.go
esimkowitz Jan 22, 2025
a940146
fix readstream for loops
esimkowitz Jan 22, 2025
895596a
apply suggestion
esimkowitz Jan 22, 2025
0ef6481
save
esimkowitz Jan 22, 2025
a468bc6
add back mkdir
esimkowitz Jan 22, 2025
d3afa06
undo time.Duration change. undo int64->int change in blockstore
sawka Jan 22, 2025
e2a68ba
make timeout int64
esimkowitz Jan 22, 2025
8d525c3
remove logs, drain channel
esimkowitz Jan 22, 2025
6715923
fix dir preview for empty dir
esimkowitz Jan 22, 2025
34cbb5f
implement native append, reintroduce mv and copy
esimkowitz Jan 22, 2025
d5242e1
add mv command
esimkowitz Jan 22, 2025
9ad5cf1
fix potential nil opts
esimkowitz Jan 22, 2025
b186963
fix potential nil opts
esimkowitz Jan 22, 2025
57d804a
fix suggestion
esimkowitz Jan 22, 2025
1e441cb
fix big log
esimkowitz Jan 22, 2025
0ce2651
Merge branch 'main' into evan/file-rpc
esimkowitz Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/generatego/main-generatego.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func GenerateWshClient() error {
gogen.GenerateBoilerplate(&buf, "wshclient", []string{
"github.com/wavetermdev/waveterm/pkg/wshutil",
"github.com/wavetermdev/waveterm/pkg/wshrpc",
"github.com/wavetermdev/waveterm/pkg/wconfig",
"github.com/wavetermdev/waveterm/pkg/waveobj",
"github.com/wavetermdev/waveterm/pkg/wps",
"github.com/wavetermdev/waveterm/pkg/vdom",
Expand Down
2 changes: 2 additions & 0 deletions cmd/server/main-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/wavetermdev/waveterm/pkg/filestore"
"github.com/wavetermdev/waveterm/pkg/panichandler"
"github.com/wavetermdev/waveterm/pkg/remote/conncontroller"
"github.com/wavetermdev/waveterm/pkg/remote/fileshare/wshfs"
"github.com/wavetermdev/waveterm/pkg/service"
"github.com/wavetermdev/waveterm/pkg/telemetry"
"github.com/wavetermdev/waveterm/pkg/util/shellutil"
Expand Down Expand Up @@ -175,6 +176,7 @@ func shutdownActivityUpdate() {

func createMainWshClient() {
rpc := wshserver.GetMainRpcClient()
wshfs.RpcClient = rpc
wshutil.DefaultRouter.RegisterRoute(wshutil.DefaultRoute, rpc, true)
wps.Broker.SetClient(wshutil.DefaultRouter)
localConnWsh := wshutil.MakeWshRpc(nil, nil, wshrpc.RpcContext{Conn: wshrpc.LocalConnName}, &wshremote.ServerImpl{})
Expand Down
3 changes: 3 additions & 0 deletions cmd/wsh/cmd/wshcmd-connserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/spf13/cobra"
"github.com/wavetermdev/waveterm/pkg/panichandler"
"github.com/wavetermdev/waveterm/pkg/remote/fileshare/wshfs"
"github.com/wavetermdev/waveterm/pkg/util/packetparser"
"github.com/wavetermdev/waveterm/pkg/wavebase"
"github.com/wavetermdev/waveterm/pkg/wshrpc"
Expand Down Expand Up @@ -180,6 +181,7 @@ func serverRunRouter(jwtToken string) error {
if err != nil {
return fmt.Errorf("error setting up connserver rpc client: %v", err)
}
wshfs.RpcClient = client
go runListener(unixListener, router)
// run the sysinfo loop
wshremote.RunSysInfoLoop(client, client.GetRpcContext().Conn)
Expand Down Expand Up @@ -224,6 +226,7 @@ func serverRunNormal(jwtToken string) error {
if err != nil {
return err
}
wshfs.RpcClient = RpcClient
WriteStdout("running wsh connserver (%s)\n", RpcContext.Conn)
go wshremote.RunSysInfoLoop(RpcClient, RpcContext.Conn)
select {} // run forever
Expand Down
67 changes: 43 additions & 24 deletions cmd/wsh/cmd/wshcmd-file-util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
"io/fs"
"strings"

"github.com/wavetermdev/waveterm/pkg/remote/connparse"
"github.com/wavetermdev/waveterm/pkg/util/fileutil"
"github.com/wavetermdev/waveterm/pkg/util/wavefileutil"
"github.com/wavetermdev/waveterm/pkg/wshrpc"
"github.com/wavetermdev/waveterm/pkg/wshrpc/wshclient"
)
Expand All @@ -24,15 +27,11 @@ func convertNotFoundErr(err error) error {
return err
}

func ensureWaveFile(origName string, fileData wshrpc.CommandFileData) (*wshrpc.WaveFileInfo, error) {
func ensureFile(origName string, fileData wshrpc.FileData) (*wshrpc.FileInfo, error) {
info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: DefaultFileTimeout})
err = convertNotFoundErr(err)
if err == fs.ErrNotExist {
createData := wshrpc.CommandFileCreateData{
ZoneId: fileData.ZoneId,
FileName: fileData.FileName,
}
err = wshclient.FileCreateCommand(RpcClient, createData, &wshrpc.RpcOpts{Timeout: DefaultFileTimeout})
err = wshclient.FileCreateCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: DefaultFileTimeout})
if err != nil {
return nil, fmt.Errorf("creating file: %w", err)
}
Expand All @@ -48,7 +47,7 @@ func ensureWaveFile(origName string, fileData wshrpc.CommandFileData) (*wshrpc.W
return info, nil
}

func streamWriteToWaveFile(fileData wshrpc.CommandFileData, reader io.Reader) error {
func streamWriteToFile(fileData wshrpc.FileData, reader io.Reader) error {
// First truncate the file with an empty write
emptyWrite := fileData
emptyWrite.Data64 = ""
Expand Down Expand Up @@ -81,7 +80,7 @@ func streamWriteToWaveFile(fileData wshrpc.CommandFileData, reader io.Reader) er
appendData := fileData
appendData.Data64 = base64.StdEncoding.EncodeToString(chunk)

err = wshclient.FileAppendCommand(RpcClient, appendData, &wshrpc.RpcOpts{Timeout: fileTimeout})
err = wshclient.FileAppendCommand(RpcClient, appendData, &wshrpc.RpcOpts{Timeout: int64(fileTimeout)})
if err != nil {
return fmt.Errorf("appending chunk to file: %w", err)
}
Expand All @@ -90,7 +89,7 @@ func streamWriteToWaveFile(fileData wshrpc.CommandFileData, reader io.Reader) er
return nil
}

func streamReadFromWaveFile(fileData wshrpc.CommandFileData, size int64, writer io.Writer) error {
func streamReadFromFile(fileData wshrpc.FileData, size int64, writer io.Writer) error {
const chunkSize = 32 * 1024 // 32KB chunks
for offset := int64(0); offset < size; offset += chunkSize {
// Calculate the length of this chunk
Expand All @@ -100,19 +99,19 @@ func streamReadFromWaveFile(fileData wshrpc.CommandFileData, size int64, writer
}

// Set up the ReadAt request
fileData.At = &wshrpc.CommandFileDataAt{
fileData.At = &wshrpc.FileDataAt{
Offset: offset,
Size: int64(length),
Size: length,
}

// Read the chunk
content64, err := wshclient.FileReadCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
data, err := wshclient.FileReadCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: int64(fileTimeout)})
if err != nil {
return fmt.Errorf("reading chunk at offset %d: %w", offset, err)
}

// Decode and write the chunk
chunk, err := base64.StdEncoding.DecodeString(content64)
chunk, err := base64.StdEncoding.DecodeString(data.Data64)
if err != nil {
return fmt.Errorf("decoding chunk at offset %d: %w", offset, err)
}
Expand All @@ -127,7 +126,7 @@ func streamReadFromWaveFile(fileData wshrpc.CommandFileData, size int64, writer
}

type fileListResult struct {
info *wshrpc.WaveFileInfo
info *wshrpc.FileInfo
err error
}

Expand All @@ -139,9 +138,9 @@ func streamFileList(zoneId string, path string, recursive bool, filesOnly bool)
go func() {
defer close(resultChan)

fileData := wshrpc.CommandFileData{
ZoneId: zoneId,
FileName: path,
fileData := wshrpc.FileData{
Info: &wshrpc.FileInfo{
Path: fmt.Sprintf(wavefileutil.WaveFilePathPattern, zoneId, path)},
}

info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: 2000})
Expand Down Expand Up @@ -169,13 +168,12 @@ func streamFileList(zoneId string, path string, recursive bool, filesOnly bool)
foundAny := false

for {
listData := wshrpc.CommandFileListData{
ZoneId: zoneId,
Prefix: prefix,
All: recursive,
Offset: offset,
Limit: 100,
}
listData := wshrpc.FileListData{
Path: fmt.Sprintf(wavefileutil.WaveFilePathPattern, zoneId, prefix),
Opts: &wshrpc.FileListOpts{
All: recursive,
Offset: offset,
Limit: 100}}

files, err := wshclient.FileListCommand(RpcClient, listData, &wshrpc.RpcOpts{Timeout: 2000})
if err != nil {
Expand Down Expand Up @@ -210,3 +208,24 @@ func streamFileList(zoneId string, path string, recursive bool, filesOnly bool)

return resultChan, nil
}

func fixRelativePaths(path string) (string, error) {
conn, err := connparse.ParseURI(path)
if err != nil {
return "", err
}
if conn.Scheme == connparse.ConnectionTypeWsh {
if conn.Host == connparse.ConnHostCurrent {
conn.Host = RpcContext.Conn
fixedPath, err := fileutil.FixPath(conn.Path)
if err != nil {
return "", err
}
conn.Path = fixedPath
}
if conn.Host == "" {
conn.Host = wshrpc.LocalConnName
}
}
return conn.GetFullURI(), nil
}
Loading
Loading