here's one we made earlier
This commit is contained in:
parent
b881f56df2
commit
ba47a525b8
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="piss.sqlite" uuid="eb03e42c-49c9-4c1e-9a0d-af72e1ebd2b4">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:piss.sqlite</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/stream.iml" filepath="$PROJECT_DIR$/.idea/stream.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,9 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBSjCB8aADAgECAhBUgf+d/TRa+cjFBLRBzKLCMAoGCCqGSM49BAMCMBQxEjAQ
|
||||
BgNVBAMTCWxvY2FsaG9zdDAeFw0yMTEwMjIxMjI3MjRaFw0yNjEwMjIxMjI3MjRa
|
||||
MBQxEjAQBgNVBAMTCWxvY2FsaG9zdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
|
||||
BEKpcQImT7FyF1aBRB2BLpBmDZssHoaQt9lBFzC88XDGxOdEUa2jbwHIMvpiOubz
|
||||
KtyRs99HvQL+zC88yG0dk8qjJTAjMCEGA1UdEQQaMBiCCWxvY2FsaG9zdIILKi5s
|
||||
b2NhbGhvc3QwCgYIKoZIzj0EAwIDSAAwRQIgQCLUxavsJCLpqZLzlaPYjyQxq524
|
||||
YdNK1BWiYCkiOdoCIQCl6MRJA4ww1160q+sFrvilG7ZXB+nF6xmFM6B4LJfvEg==
|
||||
-----END CERTIFICATE-----
|
|
@ -0,0 +1,5 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgJ5v23tWXPuNILpkH
|
||||
Vpl5clAs4r2y7gerGHCrRVdKQ6ahRANCAARCqXECJk+xchdWgUQdgS6QZg2bLB6G
|
||||
kLfZQRcwvPFwxsTnRFGto28ByDL6Yjrm8yrckbPfR70C/swvPMhtHZPK
|
||||
-----END PRIVATE KEY-----
|
|
@ -0,0 +1,90 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
// "log"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
ID int
|
||||
Username string
|
||||
Created time.Time
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
gorm.Model
|
||||
ID int
|
||||
Location string
|
||||
Kind string
|
||||
Icon string
|
||||
Title string
|
||||
Description string
|
||||
Uploaded time.Time
|
||||
Duration time.Duration
|
||||
Upvotes int
|
||||
Downvotes int
|
||||
Owner User `gorm:"embedded"`
|
||||
}
|
||||
|
||||
func (i *Item) Date() string {
|
||||
return i.CreatedAt.Format("15:04, Mon Jan _2 2006")
|
||||
}
|
||||
|
||||
var db *gorm.DB
|
||||
|
||||
func OpenDB(dbloc string) (err error) {
|
||||
db, err = gorm.Open(sqlite.Open(dbloc), &gorm.Config{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// seed randy numbers
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
// migrate moment
|
||||
err = db.AutoMigrate(&Item{}, &User{})
|
||||
return err
|
||||
}
|
||||
|
||||
func GetItem(id int) (*Item, error) {
|
||||
var item Item
|
||||
// grab matching item from the database
|
||||
err := db.First(&item, "id = ?", id).Error
|
||||
return &item, err
|
||||
}
|
||||
|
||||
func NewItem(
|
||||
title string, kind string, icon string, desc string, owner User, loc string) (int, error) {
|
||||
|
||||
id := rand.Int()
|
||||
|
||||
i := &Item{
|
||||
ID: id,
|
||||
Title: title,
|
||||
Kind: kind,
|
||||
Icon: icon,
|
||||
Description: desc,
|
||||
Owner: owner,
|
||||
Location: loc,
|
||||
Upvotes: 0,
|
||||
Downvotes: 0,
|
||||
}
|
||||
|
||||
err := db.Create(i).Error
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func Latest() ([]Item, error) {
|
||||
var items []Item
|
||||
q := db.Table("items").Order("created_at").Limit(20).Find(&items)
|
||||
return items, q.Error
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
module tildegit.org/what/stream/db
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
gorm.io/driver/sqlite v1.1.6
|
||||
gorm.io/gorm v1.21.16
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.2 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.8 // indirect
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
|
||||
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
|
||||
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/sqlite v1.1.6 h1:p3U8WXkVFTOLPED4JjrZExfndjOtya3db8w9/vEMNyI=
|
||||
gorm.io/driver/sqlite v1.1.6/go.mod h1:W8LmC/6UvVbHKah0+QOC7Ja66EaZXHwUTjgXY8YNWX8=
|
||||
gorm.io/gorm v1.21.15/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
|
||||
gorm.io/gorm v1.21.16 h1:YBIQLtP5PLfZQz59qfrq7xbrK7KWQ+JsXXCH/THlMqs=
|
||||
gorm.io/gorm v1.21.16/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
|
|
@ -0,0 +1,21 @@
|
|||
module tildegit.org/what/stream
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/pitr/gig v0.9.8
|
||||
tildegit.org/what/stream/db v0.0.0-00010101000000-000000000000
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.2 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.1.0 // indirect
|
||||
gorm.io/driver/sqlite v1.1.6 // indirect
|
||||
gorm.io/gorm v1.21.16 // indirect
|
||||
)
|
||||
|
||||
replace tildegit.org/what/stream/db => ./db
|
||||
replace tildegit.org/what/stream/upload => ./upload
|
|
@ -0,0 +1,30 @@
|
|||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
|
||||
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/matryer/is v1.3.0 h1:9qiso3jaJrOe6qBRJRBt2Ldht05qDiFP9le0JOIhRSI=
|
||||
github.com/matryer/is v1.3.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
|
||||
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/pitr/gig v0.9.8 h1:N29T4spH/0MslqsIx8j+XU4IMI040xZJ2wJmoqA9UF4=
|
||||
github.com/pitr/gig v0.9.8/go.mod h1:YHUShtPtgG/zAsdlVG2HyzfGA1EKB+QBVFKxJ2qzxhU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.1.0 h1:RZqt0yGBsps8NGvLSGW804QQqCUYYLsaOjTVHy1Ocw4=
|
||||
github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/sqlite v1.1.6 h1:p3U8WXkVFTOLPED4JjrZExfndjOtya3db8w9/vEMNyI=
|
||||
gorm.io/driver/sqlite v1.1.6/go.mod h1:W8LmC/6UvVbHKah0+QOC7Ja66EaZXHwUTjgXY8YNWX8=
|
||||
gorm.io/gorm v1.21.15/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
|
||||
gorm.io/gorm v1.21.16 h1:YBIQLtP5PLfZQz59qfrq7xbrK7KWQ+JsXXCH/THlMqs=
|
||||
gorm.io/gorm v1.21.16/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
|
|
@ -0,0 +1,125 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"github.com/pitr/gig"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
_ "os"
|
||||
"text/template"
|
||||
"tildegit.org/what/stream/db"
|
||||
"tildegit.org/what/stream/upload"
|
||||
)
|
||||
|
||||
var tmpls embed.FS
|
||||
var names []string
|
||||
|
||||
type Template struct {
|
||||
t *template.Template
|
||||
}
|
||||
|
||||
func (t *Template) Render(w io.Writer, name string, data interface{}, _ gig.Context) error {
|
||||
return t.t.ExecuteTemplate(w, fmt.Sprintf("%s.gmi", name), data)
|
||||
}
|
||||
|
||||
func main() {
|
||||
var err error
|
||||
|
||||
names = upload.GetNames()
|
||||
|
||||
// crack open the db
|
||||
err = db.OpenDB("./piss.db")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
g := gig.Default()
|
||||
|
||||
g.Renderer = &Template{template.Must(template.ParseGlob("./templates/*.gmi"))}
|
||||
|
||||
go g.Handle("/", handleIndex)
|
||||
go g.Handle("/upload/", handleUpload)
|
||||
|
||||
g.Handle("/user", func(c gig.Context) error { // add a trailing slash automatically
|
||||
return c.NoContent(gig.StatusRedirectPermanent, "/user/")
|
||||
}) // TODO: there's got to be a tidier way to do this
|
||||
|
||||
g.Handle("/user/", func(c gig.Context) error {
|
||||
cert := c.Certificate()
|
||||
if cert == nil {
|
||||
// fail if no cert
|
||||
return c.NoContent(gig.StatusClientCertificateRequired, "A certificate is required")
|
||||
}
|
||||
// return content
|
||||
return c.Gemini("# %s's channel", cert.Subject.CommonName)
|
||||
})
|
||||
|
||||
// start server
|
||||
err = g.Run("cert.crt", "cert.key")
|
||||
// handle errors
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func handleIndex(c gig.Context) error {
|
||||
items, err := db.Latest()
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(gig.StatusServerUnavailable, "index broke.")
|
||||
}
|
||||
|
||||
var identified bool
|
||||
cert := c.Certificate()
|
||||
|
||||
if cert != nil {
|
||||
identified = true
|
||||
} else {
|
||||
identified = false
|
||||
}
|
||||
|
||||
return c.Render("index", struct {
|
||||
Items []db.Item
|
||||
Identified bool
|
||||
}{
|
||||
Items: items,
|
||||
Identified: identified,
|
||||
})
|
||||
}
|
||||
|
||||
func handleUpload(c gig.Context) error {
|
||||
// id, err := db.NewItem("Piss",
|
||||
// "Video",
|
||||
// "🎞️",
|
||||
// "Piss",
|
||||
// db.User{
|
||||
// ID: 12,
|
||||
// Username: "piss"},
|
||||
// "./files/small.mp4",
|
||||
// )
|
||||
//if err != nil {
|
||||
// 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")
|
||||
|
||||
return c.Render("upload", nil)
|
||||
}
|
||||
|
||||
func handleView(id int, c gig.Context) error {
|
||||
item, err := db.GetItem(id)
|
||||
if err != nil {
|
||||
log.Printf("view faled, error message follows: %s", err)
|
||||
return c.NoContent(gig.StatusTemporaryFailure, "sorry, something went wrong on our end. try again, and if this keeps happening please get in contact")
|
||||
}
|
||||
|
||||
return c.Render("view", item)
|
||||
}
|
||||
|
||||
func debugNewRow(c gig.Context) error {
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
harris
|
||||
michael
|
||||
benjamin
|
||||
kiwi
|
||||
jasmine
|
||||
alex
|
||||
towel
|
||||
spoon
|
||||
your_mum
|
||||
pasta
|
||||
lamp
|
||||
wind
|
||||
charles
|
||||
standard
|
||||
cat
|
||||
bread
|
||||
science
|
||||
yokel
|
||||
stocking
|
||||
sea
|
||||
river
|
||||
yarn
|
||||
chair
|
||||
rose
|
||||
lunch
|
||||
mars
|
||||
chilli
|
||||
what
|
||||
goodness
|
||||
reflect
|
||||
spoons
|
||||
rube
|
||||
flag
|
||||
jimothy
|
||||
mitchell
|
||||
neil
|
||||
work
|
||||
margaret_thatcher
|
||||
smith
|
||||
john
|
||||
thomas
|
||||
joe_rogan
|
||||
jack
|
||||
epic
|
||||
report
|
||||
eagle
|
||||
tit
|
||||
grass
|
||||
richard
|
||||
rock
|
||||
burn
|
||||
spend
|
||||
empty
|
||||
bee
|
||||
hum
|
||||
question
|
||||
sort
|
||||
mean
|
||||
even
|
||||
stride
|
||||
enter
|
||||
equal
|
||||
plus
|
||||
minus
|
||||
seven
|
||||
nine
|
||||
six
|
||||
five
|
||||
devon
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# welcome to stream!
|
||||
|
||||
stream is the friendly place where you can share your terrible video and audio with the world.
|
||||
|
||||
```
|
||||
████████████████████████████████████████████████████████████████
|
||||
██ ██
|
||||
██ IMPORTANT: stream is an alpha-quality service. ██
|
||||
██ I make no guarantees about its reliability or longevity. ██
|
||||
██ ██
|
||||
████████████████████████████████████████████████████████████████
|
||||
```
|
||||
|
||||
=> /subs/ 📰 Subscriptions
|
||||
=> /notifs/ 🔔 Notifications
|
||||
=> /user/ 👤 Your Profile
|
||||
=> /lists/ 📑 Playlists
|
||||
=> /search/ 🔎 Search
|
||||
|
||||
```divider
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
### The Latest on stream
|
||||
|
||||
=> /videos/349230748 🎞️ [1:13] OBJECTS THAT I HAVE SHOVED UP MY ARSE (A Bruno Powroznik Classic)
|
||||
A classic Bruno Powroznik video salvaged from his latest account.
|
||||
=> /videos/349230748 🗪 12 Comments · 124 Points · Uploaded by what
|
||||
|
||||
|
||||
=> /videos/349230748 🎞️ [16:56] The Bizarre And Surprising Coffee Of The Nespresso Vertuo
|
||||
I hadn't heard much discussion over this particular technology so this video takes a look at what is involved and what makes it unusual.
|
||||
=> /videos/349230748 🗪 1.2k Comments · 31k Points · Uploaded by what
|
|
@ -0,0 +1,36 @@
|
|||
# welcome to stream!
|
||||
|
||||
stream is the friendly place where you can share your terrible videos and audio with the world.
|
||||
|
||||
```
|
||||
████████████████████████████████████████████████████████████████████
|
||||
██ ██
|
||||
██ please note that i am neither a good developer nor a ██
|
||||
██ good sysadmin, this service may break/disappear at any time. ██
|
||||
██ ██
|
||||
████████████████████████████████████████████████████████████████████
|
||||
```
|
||||
{{if .Identified}}
|
||||
=> /upload/ ⏫ Upload
|
||||
=> /subs/ 📰 Subscriptions
|
||||
=> /notifs/ 🔔 Notifications
|
||||
=> /user/ 👤 Your Profile
|
||||
=> /lists/ 📑 Playlists
|
||||
=> /search/ 🔎 Search
|
||||
{{else}}
|
||||
You are not identified
|
||||
=> /register/ 📋 Register
|
||||
{{end}}
|
||||
```divider
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
### The Latest on stream
|
||||
{{range .Items}}
|
||||
=> ./stream/{{.ID}}/ {{.Icon}} [{{.Duration}}] {{.Title}}
|
||||
{{.Description}}
|
||||
=> /stream/{{.ID}} 🗪 No Comments · No Points · Uploaded by {{.Owner.Username}} on {{.Date}}
|
||||
{{else}}
|
||||
nothing to see here…
|
||||
{{end}}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
## ⏫ 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:
|
||||
|
||||
### ◆ Quick info for people in a hurry
|
||||
```connection information
|
||||
Connect To: harris@stream.smethwick.xyz
|
||||
Password: kdjfihsdfsdfoHASfjxz93
|
||||
```
|
||||
|
||||
=> /upload/picker ⏩ 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.
|
||||
|
||||
```
|
||||
|
||||
### 🄌 Prepare
|
||||
Change directory to where your content is stored:
|
||||
```example directory changing
|
||||
❯ cd Videos
|
||||
❯ ls
|
||||
my_video.mkv
|
||||
~/Videos ❯ at 00:21:54
|
||||
```
|
||||
|
||||
### ➊ 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>
|
||||
```
|
||||
|
||||
### ➋ 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
|
||||
```
|
||||
|
||||
### ➌ Finish up
|
||||
Click This Button.
|
||||
|
||||
=> /upload/picker ⏩ Continue
|
|
@ -0,0 +1,29 @@
|
|||
package upload
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func GetNames() []string {
|
||||
var names []string
|
||||
f, _ := os.Open("../misc/names.txt")
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
names = append(names, line)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
func CreateSession(username string, password string) error {
|
||||
log.Printf("new session created")
|
||||
script := exec.Command("../scripts/CreateSession.sh")
|
||||
log.Printf("waiting for script to finish up")
|
||||
|
||||
err := script.Run()
|
||||
|
||||
return err
|
||||
}
|
Loading…
Reference in New Issue