had a better idea

This commit is contained in:
what 2021-11-06 01:27:27 +00:00
parent ba47a525b8
commit 1553fbb975
2 changed files with 56 additions and 37 deletions

16
main.go
View File

@ -6,7 +6,6 @@ import (
"github.com/pitr/gig"
"io"
"log"
"math/rand"
_ "os"
"text/template"
"tildegit.org/what/stream/db"
@ -41,6 +40,7 @@ func main() {
go g.Handle("/", handleIndex)
go g.Handle("/upload/", handleUpload)
go g.Handle("/upload/receive", handleReceive)
g.Handle("/user", func(c gig.Context) error { // add a trailing slash automatically
return c.NoContent(gig.StatusRedirectPermanent, "/user/")
@ -103,9 +103,9 @@ func handleUpload(c gig.Context) error {
// log.Printf("upload failed, error message follows: %s", err)
// return c.NoContent(gig.StatusTemporaryFailure, "sorry, something went wrong there. please get in contact if this keeps happening")
//}
i := rand.Intn(len(names)-0) + 0
name := names[i]
upload.CreateSession(name, "fuck")
// i := rand.Intn(len(names)-0) + 0
// name := names[i]
// upload.CreateSession(name, "fuck")
return c.Render("upload", nil)
}
@ -122,4 +122,12 @@ func handleView(id int, c gig.Context) error {
func debugNewRow(c gig.Context) error {
return nil
}
func handleReceive(c gig.Context) error {
q := c.URL().RawQuery
if len(q) == 0 {
return c.NoContent(gig.StatusInput, "slap your wormhole code here please")
}
// todo: get sleep, finish this
}

View File

@ -1,57 +1,68 @@
## ⏫ Upload
Let's begin! To upload your content you'll need to transfer them using a tool called sftp. You can do this in a variety of ways, but here's the recommended method:
Let's get uploading! This requires you to have magic-wormhole installed, see below on how to install that if you don't have it already.
### ◆ Quick info for people in a hurry
```connection information
Connect To: harris@stream.smethwick.xyz
Password: kdjfihsdfsdfoHASfjxz93
```
### ◆ If you've done this before:
=> /upload/picker ⏩ Continue
=> /upload/receive ⏩ Continue
### ⚠️ Some warnings
```
▲ You have 5 minutes to connect before your session will expire.
▲ Your content may not exceed 50MB in size.
▲ You are forbidden from submitting third-party intellectual property
without permission from that third party.
▲ You must not submit content that violates out Code of Conduct.
▲ You must not submit content that violates our Code of Conduct.
```
### 🄌 Prepare
Change directory to where your content is stored:
```example directory changing
You'll need magic-wormhole installed for this guide. Install it if you haven't already:
```
sudo apt install magic-wormhole
[sudo] password for what:
...
0 to upgrade, 36 to newly install, 0 to remove and 1 not to upgrade.
Need to get 7,743 kB of archives.
After this operation, 37.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Setting up magic-wormhole (0.12.0-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.34-0ubuntu3) ...
  ~ took  1m 51s at  23:35:21
```
And now just navigate to the location of your content
```
cd Videos
ls
 my_video.mkv
  ~/Videos at  00:21:54
 my_video.mkv # this is what we're gonna upload
  ~/Videos at  23:41:47
```
### ➊ Connect
Now, we can connect to the server using sftp…
```example connection
sftp harris@stream.smethwick.xyz
harris@stream.smethwick.xyz's password:
Connected to stream.smethwick.xyz.
sftp>
### ➊ Send it
now we can send our content over to the server using the wormhole command:
```
wormhole send my_video.mkv
Sending 4.0 MB file named 'my_video.mkv'
Wormhole code is: 3-almighty-reward
On the other computer, please run:
wormhole receive 3-almighty-reward
```
### ➋ Upload
…and upload our content to it.
```example of a video upload
sftp> put my_video.mkv
Uploading my_video.mkv to /drop/harris/my_video.mkv
my_video.mkv 100% 3900KB 1.2MB/s 00:03
sftp>quit
  ~/Videos took  1m 27s at  00:31:30
### ➋ Receive it
Click the link below, and paste in the code returned by wormhole (with or without "wormhole receive")
```
In this example, I would put "3-almighty-reward" into the box
```
### ➌ Finish up
Click This Button.
=> /upload/picker ⏩ Continue
=> /upload/receive ⏩ Continue