1
0

I removed repeats from them and changed extention to not suddenly overwrite them.

This commit is contained in:
Alexander Andreev 2022-06-14 18:47:11 +04:00
parent 52ab9a3167
commit a5ee7c2604
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
5 changed files with 63 additions and 59 deletions

View File

@ -3,25 +3,26 @@
package web package web
import ( import (
"html"
"io" "io"
) )
const ( const (
error404__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head></html><style type="text/css"> #error { error404__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/><style type="text/css"> #error {
font-size: 3.5rem; font-size: 3.5rem;
line-height: 5rem; line-height: 5rem;
text-align: center; text-align: center;
margin: 6rem 0; } margin: 6rem 0; }
#error h1 { font-size: 8rem; }</style><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="` #error h1 { font-size: 8rem; }
error404__1 = `" title="Arav&#39;s dwelling">Back to main website</a></nav></header></body><h1>404</h1><section id="error"><h1>404</h1>Nod Found xD</section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer>` </style></head><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="`
error404__1 = `" title="Arav&#39;s dwelling">Back to main website</a><h1>404</h1></nav></header><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer></body></html>`
) )
func Error404(mainSite string, wr io.Writer) { func Error404(mainSite string, wr io.Writer) {
buffer := &WriterAsBuffer{wr} buffer := &WriterAsBuffer{wr}
buffer.WriteString(error404__0) buffer.WriteString(error404__0)
WriteEscString(mainSite, buffer) buffer.WriteString(html.EscapeString(mainSite))
buffer.WriteString(error404__1) buffer.WriteString(error404__1)
} }

View File

@ -1,42 +0,0 @@
// Code generated by "jade.go"; DO NOT EDIT.
package web
import (
"io"
)
const (
index__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head></html><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="`
index__1 = `" title="Arav&#39;s dwelling">Back to main website</a></nav></header></body><h1>Upload</h1><section id="rules" class="center"><h2>Rules</h2><ul><li>Max. file size is `
index__2 = `.</li><li>It will be kept for `
index__3 = ` hours.</li><li>Anything you upload should comply with Russian Federation's law. Generally speaking, anything illegal, like CP, extremist literature etc., is forbidden.</li></ul></section><section id="used-space" class="center"><h2>Free space</h2><div><span>`
index__4 = `</span><progress value="`
index__5 = `" max="`
index__6 = `"></progress><span>`
index__7 = `</span></div><div>`
index__8 = `</div></section><section id="upload" class="center"><h2>Upload</h2><form action="/" method="POST" enctype="multipart/form-data"><input type="file" name="file"/><button type="submit">Upload</button></form></section><section><p class="center">You can use cURL to upload a file: <code>curl -F 'file=@somefile.ext' https://upload.arav.top</code></p><p class="center">Over I2P: <code>curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p</code></p><p class="center">A resulted link looks like this: <code>/f/base64rawURL(sha256)/filename.ext</code>.</p><p class="center">filename.ext is mandatory. It is a name the file will be retrieved with.</p></section><section><h2>Privacy statements</h2><p>I WILL cooperate with law enforcements and provide them with logs, guess I shouldn't clarify why. Abuses should be sent to <a href="mailto:admin@arav.top">admin@arav.top</a>.</p><p>Upload logs include: access time, IP-address, name of a file it was uploaded with, a SHA-256 hash of the file, download name*, size of the file in bytes, User-Agent.</p><p>Each download also being logged and include: access time, IP-address, name of a file it was requested with, download name*, User-Agent.</p><p>*Download name is a salted SHA-256 hash of the file encoded using base64 raw URL encoding. The hash is being salted to make useless any attempt of bruteforcing.</p></section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer>`
)
func Index(mainSite string, storageCapacity, storageUsed int64, keepForHours int, fileMaxSize, storageUsedStr, storageCapacityStr, storageAvailableStr string, wr io.Writer) {
buffer := &WriterAsBuffer{wr}
buffer.WriteString(index__0)
WriteEscString(mainSite, buffer)
buffer.WriteString(index__1)
WriteEscString(fileMaxSize, buffer)
buffer.WriteString(index__2)
WriteInt(int64(keepForHours), buffer)
buffer.WriteString(index__3)
WriteEscString(storageUsedStr, buffer)
buffer.WriteString(index__4)
WriteInt(storageUsed, buffer)
buffer.WriteString(index__5)
WriteInt(storageCapacity, buffer)
buffer.WriteString(index__6)
WriteEscString(storageCapacityStr, buffer)
buffer.WriteString(index__7)
WriteEscString(storageAvailableStr, buffer)
buffer.WriteString(index__8)
}

42
web/index.jade.mod.go Normal file
View File

@ -0,0 +1,42 @@
// Code generated by "jade.go"; DO NOT EDIT.
package web
import (
"html"
"io"
"strconv"
)
const (
index__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="`
index__1 = `" title="Arav&#39;s dwelling">Back to main website</a><h1>Upload</h1></nav></header><section id="rules" class="center"><h2>Rules</h2><ul><li>Max. file size is `
index__2 = `.</li><li>It will be kept for `
index__3 = ` hours.</li><li>Anything you upload should comply with Russian Federation's law. Generally speaking, anything illegal, like CP, extremist literature etc., is forbidden.</li></ul></section><section id="used-space" class="center"><h2>Free space</h2><div><span>`
index__4 = `</span><progress value="`
index__5 = `" max="`
index__6 = `"></progress><span>`
index__7 = `</span></div><div>`
index__8 = `</div></section><section id="upload" class="center"><h2>Upload</h2><form action="/" method="POST" enctype="multipart/form-data"><input type="file" name="file"/><button type="submit">Upload</button></form></section><section><p class="center">You can use cURL to upload a file: <code>curl -F 'file=@somefile.ext' https://upload.arav.top</code></p><p class="center">Over I2P: <code>curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p</code></p><p class="center">A resulted link looks like this: <code>/f/base64rawURL(sha256)/filename.ext</code>.</p><p class="center">filename.ext is mandatory. It is a name the file will be retrieved with.</p></section><section><h2>Privacy statements</h2><p>I WILL cooperate with law enforcements and provide them with logs, guess I shouldn't clarify why. Abuses should be sent to <a href="mailto:admin@arav.top">admin@arav.top</a>.</p><p>Upload logs include: access time, IP-address, name of a file it was uploaded with, a SHA-256 hash of the file, download name*, size of the file in bytes, User-Agent.</p><p>Each download also being logged and include: access time, IP-address, name of a file it was requested with, download name*, User-Agent.</p><p>*Download name is a salted SHA-256 hash of the file encoded using base64 raw URL encoding. The hash is being salted to make useless any attempt of bruteforcing.</p></section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer></body></html>`
)
func Index(mainSite string, storageCapacity, storageUsed int64, keepForHours int, fileMaxSize, storageUsedStr, storageCapacityStr, storageAvailableStr string, wr io.Writer) {
buffer := &WriterAsBuffer{wr}
buffer.WriteString(index__0)
buffer.WriteString(html.EscapeString(mainSite))
buffer.WriteString(index__1)
buffer.WriteString(html.EscapeString(fileMaxSize))
buffer.WriteString(index__2)
buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(keepForHours), 10)))
buffer.WriteString(index__3)
buffer.WriteString(html.EscapeString(storageUsedStr))
buffer.WriteString(index__4)
buffer.WriteString(html.EscapeString(strconv.FormatInt(storageUsed, 10)))
buffer.WriteString(index__5)
buffer.WriteString(html.EscapeString(strconv.FormatInt(storageCapacity, 10)))
buffer.WriteString(index__6)
buffer.WriteString(html.EscapeString(storageCapacityStr))
buffer.WriteString(index__7)
buffer.WriteString(html.EscapeString(storageAvailableStr))
}

View File

@ -3,25 +3,27 @@
package web package web
import ( import (
"html"
"io" "io"
) )
const ( const (
nospace__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head></html><style type="text/css"> #error { nospace__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/><style type="text/css"> #error {
font-size: 3.5rem; font-size: 3.5rem;
line-height: 5rem; line-height: 5rem;
text-align: center; text-align: center;
margin: 6rem 0; } margin: 6rem 0; }
#error h1 { font-size: 6rem; }</style><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="` #error h1 { font-size: 6rem; }
nospace__1 = `" title="Arav&#39;s dwelling">Back to main website</a></nav></header></body><h1>:(</h1><section id="error"><h1>Not enough space left</h1></section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer>` </style></head><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="`
nospace__1 = `" title="Arav&#39;s dwelling">Back to main website</a><h1>:(</h1></nav></header><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer></body></html>`
) )
func ErrorNoSpace(mainSite string, wr io.Writer) { func ErrorNoSpace(mainSite string, wr io.Writer) {
buffer := &WriterAsBuffer{wr} buffer := &WriterAsBuffer{wr}
buffer.WriteString(nospace__0) buffer.WriteString(nospace__0)
WriteEscString(mainSite, buffer) buffer.WriteString(html.EscapeString(mainSite))
buffer.WriteString(nospace__1) buffer.WriteString(nospace__1)
} }

View File

@ -3,28 +3,29 @@
package web package web
import ( import (
"html"
"io" "io"
"strconv"
) )
const ( const (
uploaded__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head></html><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="` uploaded__0 = `<!DOCTYPE html><html lang="en"><head><title>Arav's dwelling / Upload</title><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="theme-color" content="#cd2682"/><meta name="description" content="File upload service for ya."/><link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/><link href="/assets/css/main.css" rel="stylesheet"/></head><body><header><svg id="logo" viewBox="0 -25 216 40"><text class="logo">Arav's dwelling</text><text class="under" y="11">Welcome to my sacred place, wanderer</text></svg><nav><a href="`
uploaded__1 = `" title="Arav&#39;s dwelling">Back to main website</a></nav></header></body><h1>Upload</h1><section id="file"><h2>Your link</h2><center><a href="` uploaded__1 = `" title="Arav&#39;s dwelling">Back to main website</a><h1>Upload</h1></nav></header><section id="file"><h2>Your link</h2><center><a href="`
uploaded__2 = `">` uploaded__2 = `">`
uploaded__3 = `</a></center><center>It will be available for next ` uploaded__3 = `</a></center><center>It will be available for next `
uploaded__4 = ` hours.</center><center><a href="/">Back to index page</a></center></section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer>` uploaded__4 = ` hours.</center><center><a href="/">Back to index page</a></center></section><footer>2022 Arav &lt;<a href="mailto:me@arav.top">me@arav.top</a>&gt;</footer></body></html>`
) )
func Uploaded(mainSite, downloadLink string, keepForHours int, wr io.Writer) { func Uploaded(mainSite, downloadLink string, keepForHours int, wr io.Writer) {
buffer := &WriterAsBuffer{wr} buffer := &WriterAsBuffer{wr}
buffer.WriteString(uploaded__0) buffer.WriteString(uploaded__0)
WriteEscString(mainSite, buffer) buffer.WriteString(html.EscapeString(mainSite))
buffer.WriteString(uploaded__1) buffer.WriteString(uploaded__1)
WriteEscString(downloadLink, buffer) buffer.WriteString(html.EscapeString(downloadLink))
buffer.WriteString(uploaded__2) buffer.WriteString(uploaded__2)
WriteEscString(downloadLink, buffer) buffer.WriteString(html.EscapeString(downloadLink))
buffer.WriteString(uploaded__3) buffer.WriteString(uploaded__3)
WriteInt(int64(keepForHours), buffer) buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(keepForHours), 10)))
buffer.WriteString(uploaded__4) buffer.WriteString(uploaded__4)
} }