Allow restricting file download
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"golang.org/x/term"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func ActionClientGet(c *cli.Context) error {
|
||||
@@ -97,6 +98,13 @@ func ActionClientUpload(c *cli.Context) error {
|
||||
}
|
||||
|
||||
req := &pb.UploadFileRequest{Data: data, OriginalFilename: filepath.Base(arg)}
|
||||
req.WithPasscode = c.Bool("with-passcode")
|
||||
req.MaxViews = c.Int64("max-views")
|
||||
if c.IsSet("ttl") {
|
||||
duration := c.Duration("ttl")
|
||||
expiresOn := time.Now().Add(duration)
|
||||
req.ExpiresOn = timestamppb.New(expiresOn)
|
||||
}
|
||||
|
||||
resp, err := client.UploadFile(c.Context, req)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user