qtify other pages + fixed position on qts
working on showing the max upload size, just figuring out how to make it look good and where to position it. there's probably a better way to include qts in all of these pages without having to pass all of these variables
This commit is contained in:
+7
-3
@@ -27,6 +27,8 @@ type HomePageData struct {
|
||||
Expiries []Expiry
|
||||
Qt string
|
||||
PastePlaceholder string
|
||||
FileMaxSize string
|
||||
PasteMaxSize string
|
||||
}
|
||||
|
||||
func health(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -45,6 +47,7 @@ type UploadResponse struct {
|
||||
SHA256 string `json:"sha256"`
|
||||
DeleteToken string `json:"deleteToken"`
|
||||
FileExtension string `json:"extension"` // useful for things like sharex to append the extension
|
||||
Qt string `json:"-"`
|
||||
}
|
||||
type ContentInfoResponse struct {
|
||||
Upload
|
||||
@@ -59,13 +62,13 @@ func render(pages *template.Template, w http.ResponseWriter, name string, data a
|
||||
}
|
||||
}
|
||||
|
||||
func staticPage(pages *template.Template, name string) http.HandlerFunc {
|
||||
func staticPage(pages *template.Template, name string, qts []string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
render(pages, w, name, nil)
|
||||
render(pages, w, name, getRandomQt(qts))
|
||||
}
|
||||
}
|
||||
|
||||
func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template) http.HandlerFunc {
|
||||
func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template, qts []string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost && r.Method != http.MethodPut {
|
||||
w.Header().Set("Allow", "POST,PUT")
|
||||
@@ -273,6 +276,7 @@ func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template) http.Handl
|
||||
SHA256: hex.EncodeToString(upload.SHA256),
|
||||
DeleteToken: upload.DeleteToken,
|
||||
FileExtension: filepath.Ext(upload.Filename),
|
||||
Qt: getRandomQt(qts),
|
||||
}
|
||||
|
||||
switch returnType {
|
||||
|
||||
Reference in New Issue
Block a user