From c0c267f5a18f875fed769ad09f5a76ca5920857d Mon Sep 17 00:00:00 2001 From: Davide Pastore Date: Fri, 12 Jul 2019 12:49:05 +0200 Subject: [PATCH 01/24] "What's" instead of "Whats" --- README.md | 2 +- templates/view.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0a7d78..b6cd7d7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Just *kidding*! You don't need any of that crap. Just goto [hostyoself.com](http **Won't I have to reload my browser if I change a file?** Yep! Welcome to the joys of Javascript. -**Whats the largest file I can host using this?** `¯\_(ツ)_/¯` +**What's the largest file I can host using this?** `¯\_(ツ)_/¯` **Should I use this to host a website?** Dear god yes. diff --git a/templates/view.html b/templates/view.html index cad45f7..7e243e8 100644 --- a/templates/view.html +++ b/templates/view.html @@ -60,7 +60,7 @@ computer turns off then your site is down. Welcome to the joys of hosting a site on the internet.

Won't I have to reload my browser if I change a file? Yep! Welcome to the joys of Javascript.

-

Whats the largest file I can host using this? ¯\_(ツ)_/¯

+

What's the largest file I can host using this? ¯\_(ツ)_/¯

Should I use this to host a website? Dear god yes.

Does this use AI or blockchain? Sure, why not.

What inspired this? websocketd @@ -242,4 +242,4 @@ - \ No newline at end of file + From 79bf4213e485f80f55c6f621b816e00736df62c1 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 12:11:07 +0000 Subject: [PATCH 02/24] fix superflous response --- pkg/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index 9e20310..ffeea13 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -79,7 +79,7 @@ Disallow:`)) var b []byte b, err = Asset(r.URL.Path[1:]) if err != nil { - http.Error(w, "file not found", 404) + err = fmt.Errorf("resource '%s' not found",r.URL.Path[1:]) return } var contentType string From ae6121a085056b135cda16a5770988c70409b6c5 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 12:18:40 +0000 Subject: [PATCH 03/24] return nil from websocket error so no superfluos writes --- pkg/server/server.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index ffeea13..160b1cc 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -232,7 +232,8 @@ func (s *server) handleWebsocket(w http.ResponseWriter, r *http.Request) (err er // handle websockets on this page c, errUpgrade := wsupgrader.Upgrade(w, r, nil) if errUpgrade != nil { - return errUpgrade + log.Error(errUpgrade) + return nil } ws := wsconn.New(c) @@ -250,7 +251,7 @@ func (s *server) handleWebsocket(w http.ResponseWriter, r *http.Request) (err er err = fmt.Errorf("got wrong type/domain: %s/%s", p.Type, p.Message) log.Debug(err) ws.Close() - return + return nil } domain := strings.Replace(strings.ToLower(strings.TrimSpace(p.Message)), " ", "-", -1) @@ -276,7 +277,10 @@ func (s *server) handleWebsocket(w http.ResponseWriter, r *http.Request) (err er Message: domain, Success: true, }) - return + if err != nil { + log.Error(err) + } + return nil } func (s *server) isdomain(domain string) bool { From 6f31c5793fa89cff3ed99c2512aa0092d5117c54 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 13:54:19 +0000 Subject: [PATCH 04/24] debug -> debugf --- pkg/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index 160b1cc..c4eb521 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -179,7 +179,7 @@ Disallow:`)) data, err = s.get(domain, pathToFile, ipAddress) } if err != nil { - log.Debug("problem getting: %s", err.Error()) + log.Debugf("problem getting: %s", err.Error()) return } } From ef0758e07a07c8e3854b18aecd097522b8d15524 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 08:15:06 -0600 Subject: [PATCH 05/24] bump --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6cd7d7..22aecb1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
Version

A hosting service from the browser, because why not. Try it at hostyoself.com.

From 66d39b9503981be5e1587cb36e93b1ff88045216 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 08:52:07 -0600 Subject: [PATCH 06/24] bug fix: attempt to get files with no extension --- README.md | 2 ++ pkg/server/server.go | 15 ++++++++++++--- templates/view.html | 6 ++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 22aecb1..dbc605f 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ Just *kidding*! You don't need any of that crap. Just goto [hostyoself.com](http **Does this use AI or blockchain?** Sure, why not. +**Does it scale?** Horizontally, or vertically? Probably neither! + **What inspired this?** [beaker browser](https://beakerbrowser.com/), [ngrok](https://ngrok.com/), [localhost.run](http://localhost.run/), [inlets.dev](https://github.com/alexellis/inlets), Parks and Recreation. **What's the point of this?** You can host a website! You can share a file! Anything you want, directly from your browser! diff --git a/pkg/server/server.go b/pkg/server/server.go index c4eb521..aa99998 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -79,7 +79,7 @@ Disallow:`)) var b []byte b, err = Asset(r.URL.Path[1:]) if err != nil { - err = fmt.Errorf("resource '%s' not found",r.URL.Path[1:]) + err = fmt.Errorf("resource '%s' not found", r.URL.Path[1:]) return } var contentType string @@ -176,11 +176,20 @@ Disallow:`)) pathToFile += "/" } pathToFile += "index.html" + log.Debugf("trying 2nd try to get: %s", pathToFile) data, err = s.get(domain, pathToFile, ipAddress) } if err != nil { - log.Debugf("problem getting: %s", err.Error()) - return + // try one more time + if strings.HasSuffix(pathToFile, "/index.html") { + pathToFile = strings.TrimSuffix(pathToFile, "/index.html") + log.Debugf("trying 3rd try to get: %s", pathToFile) + data, err = s.get(domain, pathToFile, ipAddress) + } + if err != nil { + log.Debugf("problem getting: %s", err.Error()) + return + } } } diff --git a/templates/view.html b/templates/view.html index 7e243e8..f8eacf9 100644 --- a/templates/view.html +++ b/templates/view.html @@ -62,10 +62,8 @@ Javascript.

What's the largest file I can host using this? ¯\_(ツ)_/¯

Should I use this to host a website? Dear god yes.

-

Does this use AI or blockchain? Sure, why not.

-

What inspired this? websocketd - which shows the magic of websockets and beaker browser which - shows the magic of browser hosting.

+

Does it scale? Horizontally, or vertically? Probably neither!

+

What inspired this? beaker browser, ngrok, localhost.run, inlets.dev, Parks and Recreation.

What's the point of this? You can host a website! You can share a file! Anything you want, directly from your browser!

From 8ff76da85e93fe493dfd786f6512a79a2d62bf06 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 08:43:41 -0700 Subject: [PATCH 07/24] bug fix: browser reconnect after disconnect --- static/main.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/main.js b/static/main.js index 42132b1..72e2c00 100644 --- a/static/main.js +++ b/static/main.js @@ -164,6 +164,14 @@ const socketMessageListener = (event) => { }; const socketOpenListener = (event) => { consoleLog('[info] connected'); + if (isConnected == true) { + // reconnect if was connected and got disconnected + socketSend({ + type: "domain", + message: document.getElementById("inputDomain").value, + key: document.getElementById("inputKey").value, + }) + } }; const socketCloseListener = (event) => { From bd01535efadff669d46ada7055aa8cbd97aba6ba Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 08:50:37 -0700 Subject: [PATCH 08/24] make the host run forever --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 186fcb7..1b38373 100644 --- a/main.go +++ b/main.go @@ -92,7 +92,15 @@ func host(c *cli.Context) (err error) { if err != nil { return } - return cl.Run() + for { + log.Info("serving forever") + err = cl.Run() + if err != nil { + log.Debug(err) + } + log.Infof("server disconnected, retrying in 10 seconds") + time.Sleep(10 * time.Second) + } } func relay(c *cli.Context) (err error) { From 2670c964d12a7478cfd885d9efde69abbdf5a096 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 09:51:18 -0600 Subject: [PATCH 09/24] bump --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbc605f..f5629d5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
Version

A hosting service from the browser, because why not. Try it at hostyoself.com.

From 3520f36f721bba96bdb95b53f2b9ca4b6c473b48 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 14:33:10 -0700 Subject: [PATCH 10/24] use fullpath if no webkitRelativePath --- static/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/main.js b/static/main.js index 72e2c00..fbe91e3 100644 --- a/static/main.js +++ b/static/main.js @@ -125,8 +125,9 @@ const socketMessageListener = (event) => { var foundFile = false var iToSend = 0 for (i = 0; i < files.length; i++) { - if (files[i].webkitRelativePath == data.message || files[i].name == data.message || files[i] - .webkitRelativePath == relativeDirectory + "/" + data.message) { + if (files[i].webkitRelativePath == data.message || files[i].fullPath == data.message || files[i].name == data.message || files[i] + .webkitRelativePath == relativeDirectory + "/" + data.message || files[i] + .fullPath == relativeDirectory + "/" + data.message) { iToSend = i; var reader = new FileReader(); reader.onload = function(theFile) { From 78f06e76cad1e54cee8a6732ab5e00bfba6cf11a Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 15:15:51 -0700 Subject: [PATCH 11/24] add file listing if nothing is found --- pkg/server/server.go | 88 +++++++++++++++++++++++++++++++++++++++++++- static/main.js | 18 ++++++++- templates/files.html | 20 ++++++++++ 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 templates/files.html diff --git a/pkg/server/server.go b/pkg/server/server.go index aa99998..9756a24 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1,6 +1,7 @@ package server import ( + "encoding/json" "fmt" "html/template" "math/rand" @@ -168,6 +169,7 @@ Disallow:`)) // send GET request to websockets var data string + var fs []File data, err = s.get(domain, pathToFile, ipAddress) if err != nil { // try index.html if it doesn't exist @@ -188,7 +190,28 @@ Disallow:`)) } if err != nil { log.Debugf("problem getting: %s", err.Error()) - return + // just serve files + fs, err = s.getFiles(domain, ipAddress) + log.Debugf("fs: %+v", fs) + if err != nil { + log.Debug(err) + return + } + + b, _ := Asset("templates/files.html") + var t *template.Template + t, err = template.New("files").Parse(string(b)) + if err != nil { + log.Error(err) + return + } + return t.Execute(w, struct { + Files []File + Domain string + }{ + Domain: domain, + Files: fs, + }) } } } @@ -299,6 +322,69 @@ func (s *server) isdomain(domain string) bool { return ok } +type File struct { + FullPath string `json:"fullPath"` + Upload Upload `json:"upload"` +} +type Upload struct { + UUID string `json:"uuid"` + Total int `json:"total"` + Filename string `json:"filename"` +} + +func (s *server) getFiles(domain, ipAddress string) (fs []File, err error) { + var connections []*connection + s.Lock() + if _, ok := s.conn[domain]; ok { + connections = s.conn[domain] + } + s.Unlock() + if connections == nil || len(connections) == 0 { + err = fmt.Errorf("no connections available for domain %s", domain) + log.Debug(err) + return + } + log.Debugf("requesting files of %s from %d connections", domain, len(connections)) + + // any connection that initated with this key is viable + key := connections[0].Key + + // loop through connections randomly and try to get one to serve the file + for _, i := range rand.Perm(len(connections)) { + var p wsconn.Payload + p, err = func() (p wsconn.Payload, err error) { + err = connections[i].ws.Send(wsconn.Payload{ + Type: "files", + Message: "all", + IPAddress: ipAddress, + }) + if err != nil { + return + } + p, err = connections[i].ws.Receive() + return + }() + if err != nil { + log.Debug(err) + s.dumpConnection(domain, connections[i].ID) + continue + } + log.Tracef("recv: %+v", p) + if p.Type == "files" && p.Key == key { + if !p.Success { + err = fmt.Errorf(p.Message) + return + } + + err = json.Unmarshal([]byte(p.Message), &fs) + return + } + log.Debugf("no good data from %d", i) + } + err = fmt.Errorf("invalid response") + return +} + func (s *server) get(domain, filePath, ipAddress string) (payload string, err error) { var connections []*connection s.Lock() diff --git a/static/main.js b/static/main.js index fbe91e3..fb2c7b8 100644 --- a/static/main.js +++ b/static/main.js @@ -121,7 +121,23 @@ const socketMessageListener = (event) => { } console.log(data) consoleLog(`[debug] ${data.message}`) - if (data.type == "get") { + if (data.type == "files") { + if (files.length > 0) { + socketSend({ + type: "files", + message: JSON.stringify(files), + success: true, + key: document.getElementById("inputKey").value, + }); + } else { + socketSend({ + type: "files", + message: "none found", + success: false, + key: document.getElementById("inputKey").value, + }); + } + } else if (data.type == "get") { var foundFile = false var iToSend = 0 for (i = 0; i < files.length; i++) { diff --git a/templates/files.html b/templates/files.html new file mode 100644 index 0000000..237b285 --- /dev/null +++ b/templates/files.html @@ -0,0 +1,20 @@ + + + + + + + + + + \ No newline at end of file From 479838af2a2dedbbcb2aa90b17147fd0229e7e90 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 15:20:26 -0700 Subject: [PATCH 12/24] add file listing if nothing is found --- static/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/main.js b/static/main.js index fb2c7b8..810fab9 100644 --- a/static/main.js +++ b/static/main.js @@ -129,6 +129,9 @@ const socketMessageListener = (event) => { success: true, key: document.getElementById("inputKey").value, }); + consoleLog( + `${data.ip} [${(new Date()).toUTCString()}] sitemap 200` + ); } else { socketSend({ type: "files", @@ -136,6 +139,9 @@ const socketMessageListener = (event) => { success: false, key: document.getElementById("inputKey").value, }); + consoleLog( + `${data.ip} [${(new Date()).toUTCString()}] sitemap 404` + ); } } else if (data.type == "get") { var foundFile = false From d709d471bea4817ee8879a57d731106cc20fdee8 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 16:25:44 -0700 Subject: [PATCH 13/24] client servers file list Fixes #7 --- pkg/client/client.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index 1bab1b3..b94faca 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1,6 +1,7 @@ package client import ( + "encoding/json" "fmt" "io/ioutil" "os" @@ -10,6 +11,7 @@ import ( "sync" "github.com/schollz/hostyoself/pkg/namesgenerator" + "github.com/schollz/hostyoself/pkg/server" "github.com/schollz/hostyoself/pkg/utils" "github.com/schollz/hostyoself/pkg/wsconn" @@ -134,6 +136,30 @@ func (c *client) Run() (err error) { }) log.Infof("%s /%s 200", p.IPAddress, p.Message) } + } else if p.Type == "files" { + c.Lock() + fs := make([]server.File, len(c.fileList)) + i := 0 + for n := range c.fileList { + fs[i] = server.File{ + FullPath: n, + Upload: server.Upload{ + UUID: "", + Total: 0, + Filename: "", + }, + } + i++ + } + c.Unlock() + + b, _ := json.Marshal(fs) + err = ws.Send(wsconn.Payload{ + Type: "files", + Success: true, + Message: string(b), + Key: c.Key, + }) } if err != nil { log.Debug(err) @@ -195,6 +221,7 @@ func (c *client) watchFileSystem() (err error) { } else { ppath, _ = filepath.Abs(ppath) ppath = strings.TrimPrefix(filepath.ToSlash(ppath), c.Folder+"/") + log.Debugf("%s", ppath) c.Lock() c.fileList[ppath] = struct{}{} c.Unlock() From ef28306e6dc06e7eb8fb4bd62a9f83a2c7edb7ed Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 16:29:49 -0700 Subject: [PATCH 14/24] more logging --- pkg/client/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index b94faca..be03927 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -154,6 +154,7 @@ func (c *client) Run() (err error) { c.Unlock() b, _ := json.Marshal(fs) + log.Infof("%s sitemap", p.IPAddress) err = ws.Send(wsconn.Payload{ Type: "files", Success: true, From 2804887a562c49a5d305d7925ab230cf8a8f0407 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 16:37:55 -0700 Subject: [PATCH 15/24] only request all files when index.html is not found at root --- pkg/server/server.go | 45 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index 9756a24..9ecae83 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -189,29 +189,34 @@ Disallow:`)) data, err = s.get(domain, pathToFile, ipAddress) } if err != nil { - log.Debugf("problem getting: %s", err.Error()) - // just serve files - fs, err = s.getFiles(domain, ipAddress) - log.Debugf("fs: %+v", fs) - if err != nil { - log.Debug(err) - return - } + if pathToFile == "index.html" { + // just serve files + fs, err = s.getFiles(domain, ipAddress) + log.Debugf("fs: %+v", fs) + if err != nil { + log.Debug(err) + return + } - b, _ := Asset("templates/files.html") - var t *template.Template - t, err = template.New("files").Parse(string(b)) - if err != nil { - log.Error(err) + b, _ := Asset("templates/files.html") + var t *template.Template + t, err = template.New("files").Parse(string(b)) + if err != nil { + log.Error(err) + return + } + return t.Execute(w, struct { + Files []File + Domain string + }{ + Domain: domain, + Files: fs, + }) + } else { + log.Debugf("problem getting: %s", err.Error()) + err = fmt.Errorf("not found") return } - return t.Execute(w, struct { - Files []File - Domain string - }{ - Domain: domain, - Files: fs, - }) } } } From d74ce010237c3d98920f15d5ae96255f258d6ed5 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 12 Jul 2019 21:38:01 -0600 Subject: [PATCH 16/24] bump --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5629d5..85154ea 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
Version

A hosting service from the browser, because why not. Try it at hostyoself.com.

From b458bac63f59f0d3d412c517c819b882f08f6cf4 Mon Sep 17 00:00:00 2001 From: Douglas Muth Date: Sat, 13 Jul 2019 14:28:46 -0400 Subject: [PATCH 17/24] Added Homebrew installation instructions --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 85154ea..d78de1a 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,11 @@ https://hostyoself.com/confidentcat/ Now if you have a file in your folder `README.md` you can access it with the public URL `https://hostyoself.com/confidentcat/README.md`, directly from your computer! +If you're on a Mac, you can install with Homebrew: +``` +brew tap schollz/homebrew https://github.com/schollz/homebrew-tap.git +brew install hostyoself +``` ## Run your own relay From d34a5bca3f04fd1803de2e7c279f8755c8c7e3c5 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 14 Jul 2019 16:58:44 -0600 Subject: [PATCH 18/24] add Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..93c9b4c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +################################### +# 1. Build in a Go-based image # +################################### +FROM golang:1.12-alpine as builder +RUN apk add --no-cache git ca-certificates # add deps here (like make) if needed +WORKDIR /go/hostyoself +COPY . . +# any pre-requisities to building should be added here +# RUN go generate +RUN go build -v + +################################### +# 2. Copy into a clean image # +################################### +FROM alpine:latest +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /go/hostyoself/hostyoself /hostyoself +VOLUME /data +CMD ["sh","-c","/hostyoself host --folder /data"] + From 3a62f092f1e21231e4fe8772aa3bc71fc36ae50b Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 14 Jul 2019 17:02:32 -0600 Subject: [PATCH 19/24] add docker fixes #10 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d78de1a..0c1263e 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,18 @@ https://hostyoself.com/confidentcat/ Now if you have a file in your folder `README.md` you can access it with the public URL `https://hostyoself.com/confidentcat/README.md`, directly from your computer! If you're on a Mac, you can install with Homebrew: + ``` brew tap schollz/homebrew https://github.com/schollz/homebrew-tap.git brew install hostyoself ``` +Or you can host your current directory using Docker: + +``` +$ docker run -v `pwd`:/data schollz/hostyoself +``` + ## Run your own relay Want to run your own relay? Its easy. From ab215af53e61c501d86e3e14d422a16cae451ae3 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 14 Jul 2019 17:12:39 -0600 Subject: [PATCH 20/24] fix dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 93c9b4c..43d4a53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apk add --no-cache git ca-certificates # add deps here (like make) if needed WORKDIR /go/hostyoself COPY . . # any pre-requisities to building should be added here -# RUN go generate +RUN go generate -v RUN go build -v ################################### From e98f05e6dc2f5443bbd1629c838ee36dc0cf0c87 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 15 Jul 2019 08:50:23 -0700 Subject: [PATCH 21/24] check it webkitRelativePath exists --- static/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/static/main.js b/static/main.js index 810fab9..f47522e 100644 --- a/static/main.js +++ b/static/main.js @@ -50,12 +50,15 @@ var filesize = 0; // console.log(file); var domain = document.getElementById("inputDomain").value files.push(file); - if (files.length == 1) { - relativeDirectory = file.webkitRelativePath.split("/")[0]; - } else if (file.webkitRelativePath.split("/")[0] != relativeDirectory) { - relativeDirectory = ""; + if (file.hasOwnProperty("webkitRelativePath")) { + if (files.length == 1) { + relativeDirectory = file.webkitRelativePath.split("/")[0]; + } else if (file.webkitRelativePath.split("/")[0] != relativeDirectory) { + relativeDirectory = ""; + } } + if (!(isConnected)) { isConnected = true; socketSend({ From 47ef11549196402b97eea66eb03aabc5c98b3bd8 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 15 Jul 2019 08:58:40 -0700 Subject: [PATCH 22/24] fix handling of relative path --- static/main.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/static/main.js b/static/main.js index f47522e..8085ef5 100644 --- a/static/main.js +++ b/static/main.js @@ -48,15 +48,23 @@ var filesize = 0; drop.on('addedfile', function(file) { // console.log(file); - var domain = document.getElementById("inputDomain").value + var domain = document.getElementById("inputDomain").value; files.push(file); - if (file.hasOwnProperty("webkitRelativePath")) { - if (files.length == 1) { + if ("webkitRelativePath" in file) { + if (files.length == 1 && file.webkitRelativePath != "") { relativeDirectory = file.webkitRelativePath.split("/")[0]; } else if (file.webkitRelativePath.split("/")[0] != relativeDirectory) { relativeDirectory = ""; } } + if ("fullPath" in file) { + if (files.length == 1 && file.fullPath != "") { + relativeDirectory = file.fullPath.split("/")[0]; + } else if (file.fullPath.split("/")[0] != relativeDirectory) { + relativeDirectory = ""; + } + } + if (!(isConnected)) { From bdd053699874d72ebdbd6bd1799063d0ce474ed1 Mon Sep 17 00:00:00 2001 From: 0x333 <0x333@0x333s-MBP.lan> Date: Tue, 16 Jul 2019 00:34:36 -0700 Subject: [PATCH 23/24] Fix a typo. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 1b38373..9a83410 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func main() { app.Version = Version app.Compiled = time.Now() app.Usage = "host your files using websockets from the command line or a browser" - app.UsageText = "use to transfer files or host a impromptu website" + app.UsageText = "use to transfer files or host an impromptu website" app.Commands = []cli.Command{ { Name: "relay", From 04ad1997a612b36a11530f321060bd3e31b0b2c4 Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 13 May 2020 15:36:38 -0700 Subject: [PATCH 24/24] Create FUNDING.yml --- .github/FUNDING.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..91b9655 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: schollz