1
0

On index page only available storage is shown.

This commit is contained in:
Alexander Andreev 2023-08-01 16:50:39 +04:00
parent 6b8a7dffc7
commit 59e0629597
Signed by: Arav
GPG Key ID: D22A817D95815393
3 changed files with 6 additions and 23 deletions

View File

@ -48,12 +48,10 @@ func (h *UploadHandlers) Index(w http.ResponseWriter, r *http.Request) {
var storCapacity int64 = h.limitStorage << 20 var storCapacity int64 = h.limitStorage << 20
var fMaxSize int64 = h.limitFileSize << 20 var fMaxSize int64 = h.limitFileSize << 20
_, _, capStr := utils.ConvertFileSize(storCapacity)
_, _, usedStr := utils.ConvertFileSize(*h.uploadDirSize)
_, _, availStr := utils.ConvertFileSize(storCapacity - *h.uploadDirSize) _, _, availStr := utils.ConvertFileSize(storCapacity - *h.uploadDirSize)
_, _, fMaxSzStr := utils.ConvertFileSize(fMaxSize) _, _, fMaxSzStr := utils.ConvertFileSize(fMaxSize)
web.Index(utils.MainSite(r.Host), storCapacity, *h.uploadDirSize, h.keepForHours, fMaxSzStr, usedStr, capStr, availStr, w) web.Index(utils.MainSite(r.Host), h.keepForHours, fMaxSzStr, availStr, w)
} }
func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) { func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {

View File

@ -91,15 +91,6 @@ h2 {
small { font-size: .8rem; } small { font-size: .8rem; }
progress {
background-color: var(--secondary-color);
border: none;
color: var(--primary-color);
height: 1.1rem;
width: 30%; }
progress::-moz-progress-bar { background-color: var(--primary-color); }
.center { text-align: center; } .center { text-align: center; }
html { margin-left: calc(100vw - 100%); } html { margin-left: calc(100vw - 100%); }
@ -147,8 +138,6 @@ nav h1 {
section { margin-top: 1rem; } section { margin-top: 1rem; }
#occupied-space div span { margin: 0 .2rem; }
footer { footer {
font-size: .8rem; font-size: .8rem;
text-align: center; text-align: center;

View File

@ -4,27 +4,23 @@ block header
h1 Upload h1 Upload
block body block body
:go:func Index(mainSite string, storageCapacity, storageUsed int64, keepForHours int, fileMaxSize, storageUsedStr, storageCapacityStr, storageAvailableStr string) :go:func Index(mainSite string, keepForHours int, fileMaxSize, storageAvailableStr string)
section#rules.center section#rules.center
h2 Rules h2 Rules
p Maximum file size is #[b #{fileMaxSize}] and it will be kept for #[b #{keepForHours}] hours. p Maximum file size is #[b #{fileMaxSize}] and it will be kept for #[b #{keepForHours}] hours.
p Content you upload should comply with Russian Federation's law. Generally speaking, anything illegal, like CP, extremist literature, and so on is forbidden. p Content you upload should comply with Russian Federation's law. Generally speaking, anything illegal, like CP, extremist literature, and so on is forbidden.
section#occupied-space.center
h2 Occupied space
div
span #{storageUsedStr}
progress(value=storageUsed max=storageCapacity)
span #{storageCapacityStr}
div
| #{storageAvailableStr}
section#upload.center section#upload.center
h2 Upload h2 Upload
form(action="/" method="POST" enctype="multipart/form-data") form(action="/" method="POST" enctype="multipart/form-data")
input(type="file" name="file" multiple=false) input(type="file" name="file" multiple=false)
button(type="submit") Upload button(type="submit") Upload
section.center
h2 Space left
p #{storageAvailableStr}
section.center section.center
p You can use cURL to upload a file: #[code curl -F 'file=@somefile.ext' https://upload.arav.su] p You can use cURL to upload a file: #[code curl -F 'file=@somefile.ext' https://upload.arav.su]
p Over I2P: #[code curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p] p Over I2P: #[code curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p]
p Same for Tor, just set #[code --proxy] and replace a domain.
p A resulted link looks like this: #[code /base64rawURL(salted SHA-256)/filename.ext]. p A resulted link looks like this: #[code /base64rawURL(salted SHA-256)/filename.ext].
section.center section.center
h2 Delete h2 Delete