aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAnthony Wang2023-05-12 21:29:15 -0400
committerAnthony Wang2023-05-12 21:29:15 -0400
commitccd58080b6d6949ed10136efe8a2d953f42d90ac (patch)
treeed56724b8785309eb30e96281e95f2496d9e4271 /client
parent16952576144cda87c9e01e73b21f6a49d01af2a5 (diff)
parentf1a03b2082de8ed16c80ae5e030eda9c87c5e702 (diff)
Merge branch 'main' of git.exozy.me:a/Kela
Diffstat (limited to 'client')
-rw-r--r--client/main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/client/main.go b/client/main.go
index 150e160..d490d56 100644
--- a/client/main.go
+++ b/client/main.go
@@ -7,6 +7,7 @@ import (
"encoding/binary"
"flag"
"fmt"
+ "io"
"net/http"
"os"
"strings"
@@ -135,5 +136,19 @@ func main() {
if err != nil {
panic(err)
}
+ } else if flag.Arg(0) == "get" {
+ user := flag.Arg(1)
+ filename := flag.Arg(2)
+ response, _ := http.Get(servers[0] + "/storage/" + user + "/" + filename)
+ responseBodyBytes, _ := io.ReadAll(response.Body)
+ os.WriteFile(user + "/" + filename, responseBodyBytes, 0644)
+ } else if flag.Arg(0) == "post" {
+ filename := flag.Arg(1)
+ file, _ := os.Open(filename)
+ http.Post(
+ servers[0] + "/storage/" + id + "/" + filename,
+ "application/octet-stream",
+ file,
+ )
}
}