improve dnd; prevent large files early on upload
This commit is contained in:
+13
-9
@@ -22,11 +22,13 @@ type Pages struct {
|
||||
}
|
||||
|
||||
type HomePageData struct {
|
||||
Expiries []config.Expiry
|
||||
Qt string
|
||||
PastePlaceholder string
|
||||
FileMaxSize string
|
||||
PasteMaxSize string
|
||||
Expiries []config.Expiry
|
||||
Qt string
|
||||
PastePlaceholder string
|
||||
FileMaxSize string
|
||||
FileMaxSizeBytes int64
|
||||
PasteMaxSize string
|
||||
PasteMaxSizeBytes int64
|
||||
}
|
||||
|
||||
func (pages *Pages) Render(w http.ResponseWriter, name string, data any) {
|
||||
@@ -108,10 +110,12 @@ func LoadPages() (*Pages, error) {
|
||||
func HomeHandler(pages *Pages, cfg config.Config) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data := HomePageData{
|
||||
Expiries: cfg.Expiries,
|
||||
FileMaxSize: humanize.Bytes(uint64(cfg.MaxFileBytes)),
|
||||
PasteMaxSize: humanize.Bytes(uint64(cfg.MaxPasteBytes)),
|
||||
Qt: GetRandomQt(pages.Qts),
|
||||
Expiries: cfg.Expiries,
|
||||
FileMaxSize: humanize.Bytes(uint64(cfg.MaxFileBytes)),
|
||||
FileMaxSizeBytes: cfg.MaxFileBytes,
|
||||
PasteMaxSize: humanize.Bytes(uint64(cfg.MaxPasteBytes)),
|
||||
PasteMaxSizeBytes: cfg.MaxPasteBytes,
|
||||
Qt: GetRandomQt(pages.Qts),
|
||||
}
|
||||
|
||||
if len(pages.Placeholders) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user