From 59e06295972227e0d29646396341162b054f2a1e Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 1 Aug 2023 16:50:39 +0400 Subject: [PATCH] On index page only available storage is shown. --- internal/http/handlers.go | 4 +--- web/assets/css/main.css | 11 ----------- web/templates/index.jade | 14 +++++--------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/internal/http/handlers.go b/internal/http/handlers.go index 1134521..7b35bbf 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -48,12 +48,10 @@ func (h *UploadHandlers) Index(w http.ResponseWriter, r *http.Request) { var storCapacity int64 = h.limitStorage << 20 var fMaxSize int64 = h.limitFileSize << 20 - _, _, capStr := utils.ConvertFileSize(storCapacity) - _, _, usedStr := utils.ConvertFileSize(*h.uploadDirSize) _, _, availStr := utils.ConvertFileSize(storCapacity - *h.uploadDirSize) _, _, 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) { diff --git a/web/assets/css/main.css b/web/assets/css/main.css index 1ff74c3..c0f0df7 100644 --- a/web/assets/css/main.css +++ b/web/assets/css/main.css @@ -91,15 +91,6 @@ h2 { 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; } html { margin-left: calc(100vw - 100%); } @@ -147,8 +138,6 @@ nav h1 { section { margin-top: 1rem; } -#occupied-space div span { margin: 0 .2rem; } - footer { font-size: .8rem; text-align: center; diff --git a/web/templates/index.jade b/web/templates/index.jade index 77382b6..bd18556 100644 --- a/web/templates/index.jade +++ b/web/templates/index.jade @@ -4,27 +4,23 @@ block header h1 Upload 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 h2 Rules 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. - section#occupied-space.center - h2 Occupied space - div - span #{storageUsedStr} - progress(value=storageUsed max=storageCapacity) - span #{storageCapacityStr} - div - | #{storageAvailableStr} section#upload.center h2 Upload form(action="/" method="POST" enctype="multipart/form-data") input(type="file" name="file" multiple=false) button(type="submit") Upload + section.center + h2 Space left + p #{storageAvailableStr} section.center 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 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]. section.center h2 Delete