diff --git a/Dockerfile b/Dockerfile index 1035e2b..1dc5eb6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ FROM scratch WORKDIR /app COPY --from=go /app/nixshare ./nixshare +COPY --from=go /app/html ./html EXPOSE 8000 diff --git a/Makefile b/Makefile index db4ded9..5621cdf 100644 --- a/Makefile +++ b/Makefile @@ -6,5 +6,6 @@ deploy: docker push gitrepo.ru/neonxp/nixshare:latest docker context use curie docker pull gitrepo.ru/neonxp/nixshare:latest - docker rm nixshare || true - docker run --name nixshare -d -p 8095:8000 -v nixshare:/app/storage gitrepo.ru/neonxp/nixshare \ No newline at end of file + docker rm -f nixshare || true + docker volume rm -f nixshare_html || true + docker run --name nixshare -d -p 8095:8000 -v nixshare:/app/storage -v nixshare_html:/app/html gitrepo.ru/neonxp/nixshare \ No newline at end of file diff --git a/go.mod b/go.mod index ad3e9c2..13d2043 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,8 @@ go 1.23.0 require ( github.com/google/uuid v1.6.0 + go.neonxp.ru/mux v0.0.0-20240729221623-376839b264c7 golang.org/x/sync v0.8.0 ) + +require go.neonxp.ru/objectid v0.0.2 // indirect diff --git a/go.sum b/go.sum index b1eeaf3..520d67f 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +go.neonxp.ru/mux v0.0.0-20240729221623-376839b264c7 h1:b/AgHRmzwI+FMNrf/HYEILmntTPSRDarOMTYEmL7AS8= +go.neonxp.ru/mux v0.0.0-20240729221623-376839b264c7/go.mod h1:5OlVmN/OgaWjghQMV8oOzUQC0lUqAoplpQsUiqL5Pgc= +go.neonxp.ru/objectid v0.0.2 h1:Z/G6zvBxmUq0NTq681oGH8pTbBWwi6VA22YOYludIPs= +go.neonxp.ru/objectid v0.0.2/go.mod h1:s0dRi//oe1liiKcor1KmWx09WzkD6Wtww8ZaIv+VLBs= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..3d3b20e --- /dev/null +++ b/html/index.html @@ -0,0 +1,39 @@ + + +
+ + ++ curl -d @FILENAME https://nixshare.ru/upload ++
X:
++ xclip -o | curl -d @- https://nixshare.ru/upload ++
Wayland (wl-clipboard
required):
+ wl-paste | curl -d @- https://nixshare.ru/upload ++
You can add shell aliases to .bashrc or .zshrc file:
+X:
++ alias nsh="xclip -o | curl -d @- https://nixshare.ru/upload 2>/dev/null | xclip" ++
Wayland (wl-clipboard
required):
+ alias nsh="wl-paste | curl -d @- https://nixshare.ru/upload 2>/dev/null | wl-copy" ++
Alexander NeonXP Kiryukhin <a.kiryukhin@mail.ru>
+- curl -d @FILENAME https://nixshare.ru/upload --
X:
-- xclip -o | curl -d @- https://nixshare.ru/upload --
Wayland (wl-clipboard
required):
- wl-paste | curl -d @- https://nixshare.ru/upload --
You can add shell aliases to .bashrc or .zshrc file:
-X:
-- alias nsh="xclip -o | curl -d @- https://nixshare.ru/upload 2>/dev/null | xclip" --
Wayland (wl-clipboard
required):
- alias nsh="wl-paste | curl -d @- https://nixshare.ru/upload 2>/dev/null | wl-copy" -- - \ No newline at end of file +nothing here \ No newline at end of file diff --git a/upload.go b/upload.go index 719e519..95a6913 100644 --- a/upload.go +++ b/upload.go @@ -36,7 +36,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) { h.Set("Content-Type", "text/plain; charset=utf-8") h.Set("X-Content-Type-Options", "nosniff") w.WriteHeader(http.StatusCreated) - u, err := url.JoinPath(host, section, uid) + u, err := url.JoinPath(host, "s", section, uid) if err != nil { log.Println(err) http.Error(w, "can't get file url", http.StatusInternalServerError)